diff options
author | Dave Airlie <airlied@redhat.com> | 2012-06-15 18:38:48 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2012-06-15 18:38:48 +0100 |
commit | 639061edb3ac35a24e4d6633c9b6384434dcac64 (patch) | |
tree | 56ae81e7eec85622c3bd09b444aee08478083660 /src | |
parent | 85711a0a6a553232b603dbbb2b2d234c35391578 (diff) |
radeon: move more functions into texture video
make more thing static.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/radeon.h | 1 | ||||
-rw-r--r-- | src/radeon_textured_video.c | 82 | ||||
-rw-r--r-- | src/radeon_video.c | 163 | ||||
-rw-r--r-- | src/radeon_video.h | 5 |
4 files changed, 82 insertions, 169 deletions
diff --git a/src/radeon.h b/src/radeon.h index 76af6416..c80aae93 100644 --- a/src/radeon.h +++ b/src/radeon.h @@ -494,7 +494,6 @@ typedef struct { struct radeon_surface_manager *surf_man; struct radeon_surface front_surface; - /* Xv bicubic filtering */ struct radeon_bo *bicubic_bo; diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c index 4544a08e..63631c99 100644 --- a/src/radeon_textured_video.c +++ b/src/radeon_textured_video.c @@ -733,6 +733,88 @@ static void radeon_unload_bicubic_texture(ScrnInfoPtr pScrn) } #endif +static void +RADEONQueryBestSize( + ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data +){ + RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; + + if (!pPriv->textured) { + if (vid_w > (drw_w << 4)) + drw_w = vid_w >> 4; + if (vid_h > (drw_h << 4)) + drw_h = vid_h >> 4; + } + + *p_w = drw_w; + *p_h = drw_h; +} + +#define FOURCC_RGB24 0x00000000 +#define FOURCC_RGBT16 0x54424752 +#define FOURCC_RGB16 0x32424752 +#define FOURCC_RGBA32 0x41424752 + +static int +RADEONQueryImageAttributes( + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets +){ + const RADEONInfoRec * const info = RADEONPTR(pScrn); + int size, tmp; + + if(*w > info->xv_max_width) *w = info->xv_max_width; + if(*h > info->xv_max_height) *h = info->xv_max_height; + + *w = RADEON_ALIGN(*w, 2); + if(offsets) offsets[0] = 0; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + *h = RADEON_ALIGN(*h, 2); + size = RADEON_ALIGN(*w, 4); + if(pitches) pitches[0] = size; + size *= *h; + if(offsets) offsets[1] = size; + tmp = RADEON_ALIGN(*w >> 1, 4); + if(pitches) pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) offsets[2] = size; + size += tmp; + break; + case FOURCC_RGBA32: + size = *w << 2; + if(pitches) pitches[0] = size; + size *= *h; + break; + case FOURCC_RGB24: + size = *w * 3; + if(pitches) pitches[0] = size; + size *= *h; + break; + case FOURCC_RGBT16: + case FOURCC_RGB16: + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if(pitches) pitches[0] = size; + size *= *h; + break; + } + + return size; +} + XF86VideoAdaptorPtr RADEONSetupImageTexturedVideo(ScreenPtr pScreen) { diff --git a/src/radeon_video.c b/src/radeon_video.c index 2422779e..e996cedf 100644 --- a/src/radeon_video.c +++ b/src/radeon_video.c @@ -250,113 +250,6 @@ void RADEONInitVideo(ScreenPtr pScreen) } -#define INCLUDE_RGB_FORMATS 1 - -#if INCLUDE_RGB_FORMATS - -#define NUM_IMAGES 8 - -/* Note: GUIDs are bogus... - but nothing uses them anyway */ - -#define FOURCC_RGBA32 0x41424752 - -#define XVIMAGE_RGBA32(byte_order) \ - { \ - FOURCC_RGBA32, \ - XvRGB, \ - byte_order, \ - { 'R', 'G', 'B', 'A', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 32, \ - XvPacked, \ - 1, \ - 32, 0x00FF0000, 0x0000FF00, 0x000000FF, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - {'A', 'R', 'G', 'B', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_RGB24 0x00000000 - -#define XVIMAGE_RGB24 \ - { \ - FOURCC_RGB24, \ - XvRGB, \ - LSBFirst, \ - { 'R', 'G', 'B', 0, \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 24, \ - XvPacked, \ - 1, \ - 24, 0x00FF0000, 0x0000FF00, 0x000000FF, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - { 'R', 'G', 'B', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_RGBT16 0x54424752 - -#define XVIMAGE_RGBT16(byte_order) \ - { \ - FOURCC_RGBT16, \ - XvRGB, \ - byte_order, \ - { 'R', 'G', 'B', 'T', \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 16, \ - XvPacked, \ - 1, \ - 16, 0x00007C00, 0x000003E0, 0x0000001F, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - {'A', 'R', 'G', 'B', \ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } - -#define FOURCC_RGB16 0x32424752 - -#define XVIMAGE_RGB16(byte_order) \ - { \ - FOURCC_RGB16, \ - XvRGB, \ - byte_order, \ - { 'R', 'G', 'B', 0x00, \ - 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, \ - 16, \ - XvPacked, \ - 1, \ - 16, 0x0000F800, 0x000007E0, 0x0000001F, \ - 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - {'R', 'G', 'B', \ - 0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, \ - XvTopToBottom \ - } -#endif - -void -RADEONQueryBestSize( - ScrnInfoPtr pScrn, - Bool motion, - short vid_w, short vid_h, - short drw_w, short drw_h, - unsigned int *p_w, unsigned int *p_h, - pointer data -){ - RADEONPortPrivPtr pPriv = (RADEONPortPrivPtr)data; - - if (!pPriv->textured) { - if (vid_w > (drw_w << 4)) - drw_w = vid_w >> 4; - if (vid_h > (drw_h << 4)) - drw_h = vid_h >> 4; - } - - *p_w = drw_w; - *p_h = drw_h; -} - void RADEONCopyData( ScrnInfoPtr pScrn, @@ -448,59 +341,3 @@ RADEONCopyMungedData( } } } - -int -RADEONQueryImageAttributes( - ScrnInfoPtr pScrn, - int id, - unsigned short *w, unsigned short *h, - int *pitches, int *offsets -){ - const RADEONInfoRec * const info = RADEONPTR(pScrn); - int size, tmp; - - if(*w > info->xv_max_width) *w = info->xv_max_width; - if(*h > info->xv_max_height) *h = info->xv_max_height; - - *w = RADEON_ALIGN(*w, 2); - if(offsets) offsets[0] = 0; - - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - *h = RADEON_ALIGN(*h, 2); - size = RADEON_ALIGN(*w, 4); - if(pitches) pitches[0] = size; - size *= *h; - if(offsets) offsets[1] = size; - tmp = RADEON_ALIGN(*w >> 1, 4); - if(pitches) pitches[1] = pitches[2] = tmp; - tmp *= (*h >> 1); - size += tmp; - if(offsets) offsets[2] = size; - size += tmp; - break; - case FOURCC_RGBA32: - size = *w << 2; - if(pitches) pitches[0] = size; - size *= *h; - break; - case FOURCC_RGB24: - size = *w * 3; - if(pitches) pitches[0] = size; - size *= *h; - break; - case FOURCC_RGBT16: - case FOURCC_RGB16: - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - size = *w << 1; - if(pitches) pitches[0] = size; - size *= *h; - break; - } - - return size; -} - diff --git a/src/radeon_video.h b/src/radeon_video.h index ea61ece0..f097f2f8 100644 --- a/src/radeon_video.h +++ b/src/radeon_video.h @@ -81,11 +81,6 @@ typedef struct tagREF_TRANSFORM #define RTFContrast(a) (1.0 + ((a)*1.0)/1000.0) #define RTFHue(a) (((a)*3.1416)/1000.0) -void RADEONQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, - unsigned int *, unsigned int *, pointer); -int RADEONQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, - unsigned short *, int *, int *); - XF86VideoAdaptorPtr RADEONSetupImageTexturedVideo(ScreenPtr pScreen); |