summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Crouse <jordan.crouse@amd.com>2007-01-10 17:51:23 -0700
committerJordan Crouse <jordan.crouse@amd.com>2007-01-10 17:52:09 -0700
commita212981da0147a5f277b43b801de6d2454005c17 (patch)
treee43fa64e0476031198d20d4618dbda303389e5a4
parentacc4421ac55d021ef917967ecd09b650e8dd9699 (diff)
Add Xv hardware support for a RGB565 source.
-rw-r--r--src/amd_fourcc.h22
-rw-r--r--src/amd_gx_video.c51
2 files changed, 53 insertions, 20 deletions
diff --git a/src/amd_fourcc.h b/src/amd_fourcc.h
index 2fe6f9e..f34c2fb 100644
--- a/src/amd_fourcc.h
+++ b/src/amd_fourcc.h
@@ -87,4 +87,26 @@
XvTopToBottom \
}
+/* Borrowed from Trident */
+
+#define FOURCC_RGB565 0x36315652
+#define XVIMAGE_RGB565 \
+ { \
+ FOURCC_RGB565, \
+ XvRGB,\
+ LSBFirst,\
+ {'R','V','1','6',\
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},\
+ 16,\
+ XvPacked,\
+ 1,\
+ 16, 0xF800, 0x07E0, 0x001F,\
+ 0, 0, 0,\
+ 0, 0, 0,\
+ 0, 0, 0,\
+ {'R','V','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
diff --git a/src/amd_gx_video.c b/src/amd_gx_video.c
index 869fbee..0ad259e 100644
--- a/src/amd_gx_video.c
+++ b/src/amd_gx_video.c
@@ -117,7 +117,7 @@ extern void GXAccelSync(ScrnInfoPtr pScrni);
int DeltaX, DeltaY;
unsigned long graphics_lut[256];
-unsigned long *lutptr = NULL;
+static int lutflag = 0;
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
@@ -236,7 +236,7 @@ static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = {
{XvSettable | XvGettable, 0, 1, "XV_COLORKEYMODE"}
};
-#define NUM_IMAGES 7
+#define NUM_IMAGES 8
static XF86ImageRec Images[NUM_IMAGES] = {
XVIMAGE_UYVY,
@@ -245,7 +245,8 @@ static XF86ImageRec Images[NUM_IMAGES] = {
XVIMAGE_YVYU,
XVIMAGE_Y800,
XVIMAGE_I420,
- XVIMAGE_YV12
+ XVIMAGE_YV12,
+ XVIMAGE_RGB565
};
typedef struct
@@ -471,13 +472,13 @@ GXStopVideo(ScrnInfoPtr pScrni, pointer data, Bool exit)
/* If we have saved graphics LUT data - restore it */
/* Otherwise, turn bypass on */
- if (lutptr != NULL)
- GFX(set_graphics_palette(lutptr));
- else
+ if (lutflag)
+ GFX(set_graphics_palette(graphics_lut));
+ else
GFX(set_video_palette_bypass(1));
- lutptr = NULL;
- }
+ lutflag = 0;
+ }
if (pPriv->area) {
#ifdef XF86EXA
@@ -921,17 +922,19 @@ GXDisplayVideo(ScrnInfoPtr pScrni,
* off
*/
- dcfg = gfx_read_vid32(DISPLAY_CONFIG);
- misc = gfx_read_vid32(MISC);
+
+ if (id != FOURCC_RGB565) {
+ dcfg = gfx_read_vid32(DISPLAY_CONFIG);
+ misc = gfx_read_vid32(MISC);
+
+ lutflag = ((!(misc & 1)) && (!(dcfg & (1 << 21))));
- if ((!(misc & 1)) && (!(dcfg & (1 << 21)))) {
- /* xf86DrvMsg(pScrni->scrnIndex, X_ERROR, "save graphics_lut\n"); */
+ if (lutflag)
get_gamma_ram(graphics_lut);
- lutptr = graphics_lut;
- }
- /* Set the video gamma ram */
- GFX(set_video_palette(NULL));
+ /* Set the video gamma ram */
+ GFX(set_video_palette(NULL));
+ }
GFX(set_video_enable(1));
@@ -959,6 +962,11 @@ GXDisplayVideo(ScrnInfoPtr pScrni,
GFX(set_video_format(VIDEO_FORMAT_YVYU));
GFX(set_video_size(width, height));
break;
+ case FOURCC_RGB565:
+ GFX(set_video_format(VIDEO_FORMAT_RGB));
+ GFX(set_video_size(width, height));
+ break;
+
}
if (pGeode->Panel) {
@@ -1122,6 +1130,7 @@ GXPutImage(ScrnInfoPtr pScrni,
case FOURCC_UYVY:
case FOURCC_YUY2:
case FOURCC_Y800:
+ case FOURCC_RGB565:
default:
dstPitch = ((width << 1) + 3) & ~3;
srcPitch = (width << 1);
@@ -1173,6 +1182,7 @@ GXPutImage(ScrnInfoPtr pScrni,
case FOURCC_UYVY:
case FOURCC_YUY2:
case FOURCC_Y800:
+ case FOURCC_RGB565:
default:
left <<= 1;
buf += (top * srcPitch) + left;
@@ -1214,6 +1224,7 @@ GXPutImage(ScrnInfoPtr pScrni,
break;
case FOURCC_UYVY:
case FOURCC_YUY2:
+ case FOURCC_RGB565:
default:
GXCopyData422(buf, dst_start, srcPitch, dstPitch, nlines, npixels);
break;
@@ -1341,12 +1352,12 @@ GXBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask)
/* If we have saved graphics LUT data - restore it */
/* Otherwise, turn bypass on */
- if (lutptr != NULL)
- GFX(set_graphics_palette(lutptr));
+ if (lutflag)
+ GFX(set_graphics_palette(graphics_lut));
else
- GFX(set_video_palette_bypass(1));
+ GFX(set_video_palette_bypass(1));
- lutptr = NULL;
+ lutflag = 0;
pPriv->videoStatus = FREE_TIMER;
pPriv->freeTime = currentTime.milliseconds + FREE_DELAY;