summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Verhaegen <libv@skynet.be>2009-10-17 11:42:25 +0200
committerLuc Verhaegen <libv@skynet.be>2009-11-04 15:13:02 +0100
commit7d414c59bfafd12896c511301a6af9f98e0d98b8 (patch)
treed05b19d112e690b2815f5432d20e5b05fdfcc9ab
parent8348ea2d89f81c54fcd17d242ae7788ce36cb3d7 (diff)
XvMC: Dump subpicture support.
There is little to no correlation between the subpicture support in this hardware and the API. Also, the xine module is very very badly implemented. So drop subpictures completely for now, when there is a winner in the new APIs, i will port my working hw level code to that. Add an xorg.conf option which enables us to fool the xine xxmc module to start by halfarsedly claiming subpictures.
-rw-r--r--lib/xvmc/xvmc_unichrome.c62
-rw-r--r--lib/xvmc/xvmce.c24
-rw-r--r--lib/xvmc/xvmce_proto.h13
-rw-r--r--src/via_mpeg.c294
-rw-r--r--src/via_mpeg.h38
-rw-r--r--src/via_video.c6
-rw-r--r--src/via_xvmc.c169
7 files changed, 109 insertions, 497 deletions
diff --git a/lib/xvmc/xvmc_unichrome.c b/lib/xvmc/xvmc_unichrome.c
index 8a717dc..6422e68 100644
--- a/lib/xvmc/xvmc_unichrome.c
+++ b/lib/xvmc/xvmc_unichrome.c
@@ -39,7 +39,8 @@
#define FOURCC_MPEG (('G' << 24) | ('E' << 16) | ('P' << 8) | 'M')
-/* Oh you must be kidding me. What a bunch of clueless idiots. */
+/* Oh you must be kidding me. What a bunch of clueless idiots.
+ Who splits such an API all over the place? */
extern Status _xvmc_create_context(Display *dpy, XvMCContext *context,
int *priv_count, CARD32 **priv_data);
@@ -583,13 +584,27 @@ XvMCGetAttribute(Display *display, XvMCContext *context,
/*
*
+ * During the bringup of subpicture support it was clear that there was little
+ * to no correlation with the subpicture APIs implemented on top of XvMC and
+ * the "simpler overlay" inside an overlay that is the subpicture support on
+ * unichrome hardware. Rather than mucking about, or rather than redesigning
+ * a working implementation, why not just claim not to support subpictures, and
+ * have media players overwrite the colorkey in the framebuffer directly.
+ *
+ * When a winner is chosen from VDPAU, VA-API and whatever, wake me up, i'll
+ * be happy to port the once working "XUMA" unichrome subpicture support to
+ * that.
+ */
+
+/*
+ *
*/
_X_EXPORT Status
XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture)
{
printf("%s\n", __func__);
- return Success;
+ return BadImplementation;
}
@@ -613,9 +628,7 @@ XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpicture, int *stat)
{
printf("%s\n", __func__);
- *stat = 0; /* placeholder */
-
- return Success;
+ return BadImplementation;
}
@@ -627,29 +640,9 @@ XvMCCreateSubpicture(Display *display, XvMCContext *context,
XvMCSubpicture *subpicture, unsigned short width,
unsigned short height, int xvimage_id)
{
- Status status = Success;
- int priv_count;
- CARD32 *priv_data = NULL;
-
- if (!display || !context || !subpicture)
- return XvMCBadContext;
-
- printf("%s: 0x%08X %dx%d\n", __func__, xvimage_id, width, height);
-
- subpicture->width = context->width;
- subpicture->height = context->height;
- subpicture->xvimage_id = xvimage_id;
-
- status = _xvmc_create_subpicture(display, context, subpicture, &priv_count, &priv_data);
-
- if (status != Success)
- fprintf(stderr, "%s: Error: _xvmc_create_subpicture failed: %d\n",
- status);
- else
- printf("%s: 0x%08X: %2d/%1d\n", __func__, subpicture->subpicture_id,
- subpicture->num_palette_entries, subpicture->entry_bytes);
+ printf("%s\n", __func__);
- return status;
+ return BadImplementation;
}
@@ -663,12 +656,7 @@ XvMCClearSubpicture(Display *display, XvMCSubpicture *subpicture,
{
printf("%s\n", __func__);
- /* WTF sort of API is this? */
- if (x || y || colour || (width != subpicture->width) ||
- (height != subpicture->height))
- printf("%s: Warning: nulling whole subpicture!\n", __func__);
-
- return XvMCESubPictureClear(display, XvMCPortID, subpicture->subpicture_id);
+ return BadImplementation;
}
@@ -693,9 +681,9 @@ XvMCCompositeSubpicture(Display *display, XvMCSubpicture *subpicture,
_X_EXPORT Status
XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture)
{
- printf("%s: 0x%08X\n", __func__, subpicture->subpicture_id);
+ printf("%s\n", __func__);
- return _xvmc_destroy_subpicture(display, subpicture);
+ return BadImplementation;
}
@@ -708,7 +696,7 @@ XvMCSetSubpicturePalette(Display *display, XvMCSubpicture *subpicture,
{
printf("%s\n", __func__);
- return Success;
+ return BadImplementation;
}
@@ -724,7 +712,7 @@ XvMCBlendSubpicture(Display *display, XvMCSurface *surface,
{
printf("%s\n", __func__);
- return Success;
+ return BadImplementation;
}
diff --git a/lib/xvmc/xvmce.c b/lib/xvmc/xvmce.c
index 8fbe8d3..562b593 100644
--- a/lib/xvmc/xvmce.c
+++ b/lib/xvmc/xvmce.c
@@ -270,27 +270,3 @@ XVMCEBufferSliceSend(Display *dpy, XvPortID port, XID Buffer,
return Success;
}
-
-/*
- *
- */
-Status
-XvMCESubPictureClear(Display *dpy, XvPortID port, XID SubPicture)
-{
- XExtDisplayInfo *info = XvMCEFindDisplay(dpy);
- xvmceSubPictureClearReq *req;
-
- XvMCECheckExtension(dpy, info, BadImplementation);
-
- LockDisplay(dpy);
-
- XvMCEGetReq(SubPictureClear, req);
-
- req->Port = port;
- req->SubPicture = SubPicture;
-
- UnlockDisplay(dpy);
- SyncHandle();
-
- return Success;
-}
diff --git a/lib/xvmc/xvmce_proto.h b/lib/xvmc/xvmce_proto.h
index 8dff60a..47777f1 100644
--- a/lib/xvmc/xvmce_proto.h
+++ b/lib/xvmc/xvmce_proto.h
@@ -37,7 +37,6 @@
#define xvmce_BufferStatus 2
#define xvmce_BufferSliceInit 3
#define xvmce_BufferSliceSend 4
-#define xvmce_SubPictureClear 5
/*
* Version, are we compatible?
@@ -181,16 +180,4 @@ typedef struct {
} xvmceBufferSliceSendReq;
#define sz_xvmceBufferSliceSendReq 20
-/*
- *
- */
-typedef struct {
- CARD8 reqType;
- CARD8 xvmceReqType; /* xvmce_SubPictureClear */
- CARD16 length B16;
- CARD32 Port B32;
- CARD32 SubPicture B32;
-} xvmceSubPictureClearReq;
-#define sz_xvmceSubPictureClearReq 12
-
#endif /* XVMCE_PROTO_H */
diff --git a/src/via_mpeg.c b/src/via_mpeg.c
index e747c45..dcebc62 100644
--- a/src/via_mpeg.c
+++ b/src/via_mpeg.c
@@ -35,299 +35,9 @@
/*
*
- * SubPicture support.
- *
- */
-/*
- *
- */
-int
-ViaSubPictureGrab(struct ViaSubPicture *SubPicture, XID ID,
- CARD16 Width, CARD16 Height, CARD8 Type)
-{
- int i;
-
- ViaDebug(SubPicture->scrnIndex, "%s: Grabbing 0x%08X\n", __func__, ID);
-
- /* We only track type and dimensions once. */
- if ((SubPicture->Width == Width) && (SubPicture->Height == Height) &&
- (SubPicture->Type == Type)) {
- for (i = 0; i < VIA_SUBPICTURE_COUNT; i++)
- if (!SubPicture->SubPictures[i].ID &&
- !SubPicture->SubPictures[i].Mem)
- break;
-
- if (i == VIA_SUBPICTURE_COUNT) {
- xf86DrvMsg(SubPicture->scrnIndex, X_ERROR, "%s: No more slots "
- "available for 0x%08X\n", __func__, ID);
- return BadAlloc;
- }
- } else {
- for (i = 0; i < VIA_SUBPICTURE_COUNT; i++)
- if (SubPicture->SubPictures[i].ID ||
- SubPicture->SubPictures[i].Mem) {
- xf86DrvMsg(SubPicture->scrnIndex, X_ERROR, "%s: Cannot change "
- "layout. Subpictures still in use.\n", __func__);
- return BadAccess;
- }
-
- SubPicture->Width = Width;
- SubPicture->Height = Height;
- SubPicture->Type = Type;
-
- i = 0;
- }
-
- SubPicture->SubPictures[i].Mem =
- ViaMemAlloc(xf86Screens[SubPicture->scrnIndex], Width * Height, 16);
- if (!SubPicture->SubPictures[i].Mem) {
- xf86DrvMsg(SubPicture->scrnIndex, X_ERROR, "%s: Memory allocation "
- "failed for 0x%08X\n", __func__, ID);
- return BadAlloc;
- }
-
- SubPicture->SubPictures[i].ID = ID;
-
- return Success;
-}
-
-/*
- *
- */
-void
-ViaSubPictureRelease(struct ViaSubPicture *SubPicture, XID ID)
-{
- int i;
-
- ViaDebug(SubPicture->scrnIndex, "%s: 0x%08X\n", __func__, ID);
-
- for (i = 0; i < VIA_SUBPICTURE_COUNT; i++)
- if (SubPicture->SubPictures[i].ID == ID)
- break;
-
- if (i == VIA_SUBPICTURE_COUNT) {
- xf86DrvMsg(SubPicture->scrnIndex, X_ERROR, "%s: Unknown ID: 0x%08X\n",
- __func__, ID);
- return;
- }
-
- SubPicture->SubPictures[i].ID = 0;
-
- if (SubPicture->SubPictures[i].Mem) {
- ViaMemFree(xf86Screens[SubPicture->scrnIndex],
- SubPicture->SubPictures[i].Mem);
- SubPicture->SubPictures[i].Mem = NULL;
- }
-}
-
-/*
- *
- */
-int
-ViaSubPictureClear(struct ViaSubPicture *SubPicture, XID ID)
-{
- int i;
-
- ViaDebug(SubPicture->scrnIndex, "%s: 0x%08X\n", __func__, ID);
-
- for (i = 0; i < VIA_SUBPICTURE_COUNT; i++)
- if (SubPicture->SubPictures[i].ID == ID)
- break;
-
- if (i == VIA_SUBPICTURE_COUNT) {
- xf86DrvMsg(SubPicture->scrnIndex, X_ERROR, "%s: Unknown ID: 0x%08X\n",
- __func__, ID);
- return BadAccess;
- }
-
- /* Quick and dirty, and most likely wrong, but will find out
- what this does for real later on. */
- memset(VIAPTR(xf86Screens[SubPicture->scrnIndex])->FBBase +
- SubPicture->SubPictures[i].Mem->Base,
- 0, SubPicture->SubPictures[i].Mem->Size);
-
- return Success;
-}
-
-#if 0
-/*
- *
- */
-static int
-ViaSubPicturePut(ScrnInfoPtr pScrn, CARD16 Width, CARD16 Height, CARD8 IA44,
- CARD32 *Palette, CARD8 *Buffer)
-{
- struct ViaSubPicture *SubPicture = VIAPTR(pScrn)->Swov->SubPicture;
- CARD32 Control;
- int i;
-
- if (!SubPicture->Mem ||
- (Width != SubPicture->Width) || (Height != SubPicture->Height)) {
- if (SubPicture->Mem)
- ViaMemFree(pScrn, SubPicture->Mem);
-
- SubPicture->Mem = ViaMemAlloc(pScrn, Width * Height, 16);
- if (!SubPicture->Mem)
- return BadAlloc;
-
- SubPicture->Width = Width;
- SubPicture->Height = Height;
- }
-
- if (!ViaSwovCopy(pScrn, SubPicture->Mem, Buffer))
- return BadAccess;
-
- SubPicture->Regs->Address = SubPicture->Mem->Base;
-
- for (i = 0; i < 16; i++)
- SubPicture->Regs->Palette = (Palette[i] & 0xFFFFFF00) | (i << 4) | 0x07;
-
- Control = SUBPICTURE_HQV_ENABLE;
- if (IA44)
- Control |= SUBPICTURE_IA44;
-
- Control |= Width & 0x1FFF;
-
- SubPicture->Regs->Control = Control;
-
- return Success;
-}
-#endif
-
-/*
- *
- */
-void
-ViaSubPictureStop(ScrnInfoPtr pScrn)
-{
- struct ViaSwov *Swov = VIAPTR(pScrn)->Swov;
- struct ViaSubPicture *SubPicture = Swov->SubPicture;
- int i;
-
- if (!SubPicture)
- return;
-
- SubPicture->Regs->Control = 0x00000000;
-
- for (i = 0; i < VIA_SUBPICTURE_COUNT; i++) {
- SubPicture->SubPictures[i].ID = 0;
-
- if (SubPicture->SubPictures[i].Mem) {
- ViaMemFree(xf86Screens[SubPicture->scrnIndex],
- SubPicture->SubPictures[i].Mem);
- SubPicture->SubPictures[i].Mem = NULL;
- }
- }
-
- SubPicture->Width = 0;
- SubPicture->Height = 0;
- SubPicture->Type = 0;
-}
-
-/*
- *
- */
-void
-ViaSubPictureInit(ScrnInfoPtr pScrn)
-{
- VIAPtr pVia = VIAPTR(pScrn);
- struct ViaSwov *Swov = pVia->Swov;
- struct ViaSubPicture *SubPicture;
-
- VIAFUNC(pScrn);
-
- SubPicture = xnfcalloc(sizeof(struct ViaSubPicture), 1);
-
- SubPicture->scrnIndex = pScrn->scrnIndex;
- SubPicture->Regs = (struct ViaSubPictureRegs *) (pVia->MapBase + 0x3C0);
-
- Swov->SubPicture = SubPicture;
-}
-
-/*
- *
- */
-void
-ViaSubPictureDestroy(ScrnInfoPtr pScrn)
-{
- struct ViaSwov *Swov = VIAPTR(pScrn)->Swov;
- struct ViaSubPicture *SubPicture = Swov->SubPicture;
-
- VIAFUNC(pScrn);
-
- if (!SubPicture)
- return;
-
- ViaSubPictureStop(pScrn);
-
- xfree(SubPicture);
- Swov->SubPicture = NULL;
-}
-
-/*
- *
* MPEG engine.
*
*/
-#if 0
-/*
- *
- */
-static void
-ViaMpegPrintRegs(struct ViaMpeg *Mpeg)
-{
- struct ViaMpegRegs *Regs = Mpeg->Regs;
-#if 0
- int i;
-#endif
-
- ViaDebug(Mpeg->scrnIndex, "%s: MPEG register Map.\n", __func__);
-
- ViaDebug(Mpeg->scrnIndex, " Picture: 0x%08lX\n", Regs->Picture);
- ViaDebug(Mpeg->scrnIndex, " Macroblock: 0x%08lX\n", Regs->Macroblock);
- ViaDebug(Mpeg->scrnIndex, " Null: 0x%08lX\n", Regs->Null);
- ViaDebug(Mpeg->scrnIndex, " Control: 0x%08lX\n", Regs->Control);
-
- /* Write-Only. */
-#if 0
- for (i = 0; i < 4; i++)
- ViaDebug(Mpeg->scrnIndex, " MV%1d: 0x%08lX\n", i, Regs->MV[i]);
-
- for (i = 0; i < 4; i++) {
- ViaDebug(Mpeg->scrnIndex, " Buffer[%1d]->Y: 0x%08lX\n", i, Regs->Buffer[i].Y);
- ViaDebug(Mpeg->scrnIndex, " Buffer[%1d]->Cb: 0x%08lX\n", i, Regs->Buffer[i].Cb);
- ViaDebug(Mpeg->scrnIndex, " Buffer[%1d]->Cr: 0x%08lX\n", i, Regs->Buffer[i].Cr);
- }
-#endif
-
- ViaDebug(Mpeg->scrnIndex, " LineOffset: 0x%08lX\n", Regs->LineOffset);
- ViaDebug(Mpeg->scrnIndex, " Status: 0x%08lX\n", Regs->Status);
- ViaDebug(Mpeg->scrnIndex, " IDCTBlock: 0x%08lX\n", Regs->IDCTBlock);
-#if 0
- ViaDebug(Mpeg->scrnIndex, " QMatrixSelect: 0x%08lX\n", Regs->QMatrixSelect);
- ViaDebug(Mpeg->scrnIndex, " QMatrixContent: 0x%08lX\n", Regs->QMatrixContent);
-#endif
- ViaDebug(Mpeg->scrnIndex, " SliceStreamOut: 0x%08lX\n", Regs->SliceStreamOut);
-
- /* Reserved */
-#if 0
- for (i = 0; i < 4; i++)
- ViaDebug(Mpeg->scrnIndex, " IDCTData%1d: 0x%08lX\n", i, Regs->IDCTData[i]);
-#endif
-
- ViaDebug(Mpeg->scrnIndex, " SliceControl1: 0x%08lX\n", Regs->SliceControl1);
- ViaDebug(Mpeg->scrnIndex, " SliceControl2: 0x%08lX\n", Regs->SliceControl2);
- ViaDebug(Mpeg->scrnIndex, " SliceControl3: 0x%08lX\n", Regs->SliceControl3);
- ViaDebug(Mpeg->scrnIndex, " SliceControl4: 0x%08lX\n", Regs->SliceControl4);
-
-#if 0
- for (i = 0; i < 4; i++)
- ViaDebug(Mpeg->scrnIndex, " SliceStream[%1d]: 0x%08lX\n", i, Regs->SliceStream[i]);
-#endif
-
- ViaDebug(Mpeg->scrnIndex, "%s: Done.\n", __func__);
-}
-#endif
/*
*
@@ -867,9 +577,5 @@ ViaMpegDestroy(ScrnInfoPtr pScrn)
xfree(Swov->Mpeg);
Swov->Mpeg = NULL;
-
- ViaSubPictureStop(pScrn);
- xfree(Swov->SubPicture);
- Swov->SubPicture = NULL;
}
diff --git a/src/via_mpeg.h b/src/via_mpeg.h
index f05fb00..a3c9fdd 100644
--- a/src/via_mpeg.h
+++ b/src/via_mpeg.h
@@ -57,42 +57,12 @@ struct ViaMpeg {
struct ViaMpegRegs *Regs;
};
-/*
- *
- */
-struct ViaSubPicture {
- int scrnIndex;
-
-#define VIA_SUBPICTURE_TYPE_AI44 0
-#define VIA_SUBPICTURE_TYPE_IA44 1
- int Type;
-
- CARD16 Width;
- CARD16 Height;
-
-#define VIA_SUBPICTURE_COUNT 4
- struct {
- XID ID;
- struct ViaMem *Mem;
- } SubPictures[VIA_SUBPICTURE_COUNT];
-
- struct ViaSubPictureRegs *Regs;
-};
-
/* from via_mpeg.c, to allow via_video.c to sync this engine */
void ViaMpegEngineIdle(struct ViaMpeg *Mpeg);
/* from via_video.c, to allow via_mpeg.c to sync this engine */
void ViaHQVIdle(struct ViaSwov *Swov);
-/* from via_video.c - to copy over the SubPicture */
-Bool ViaSwovCopy(ScrnInfoPtr pScrn, struct ViaMem *Mem, unsigned char *Buffer);
-
-/* Function prototypes for via_video.c */
-void ViaSubPictureInit(ScrnInfoPtr pScrn);
-void ViaSubPictureStop(ScrnInfoPtr pScrn);
-void ViaSubPictureDestroy(ScrnInfoPtr pScrn);
-
void ViaMpegInit(ScrnInfoPtr pScrn);
void ViaMpegStop(ScrnInfoPtr pScrn);
void ViaMpegDestroy(ScrnInfoPtr pScrn);
@@ -122,12 +92,4 @@ int ViaMpegSlicePut(struct ViaMpeg *Mpeg, XID BufferID, CARD8 SliceCode,
CARD32 SliceLength, CARD8 *Slice);
void ViaMpegQMatrix(struct ViaMpeg *Mpeg, CARD32 Type, CARD8 Matrix[64]);
-/*
- * Subpicture support for XvMC(E).
- */
-int ViaSubPictureGrab(struct ViaSubPicture *SubPicture, XID ID,
- CARD16 Width, CARD16 Height, CARD8 Type);
-void ViaSubPictureRelease(struct ViaSubPicture *SubPicture, XID ID);
-int ViaSubPictureClear(struct ViaSubPicture *SubPicture, XID ID);
-
#endif /* HAVE_VIA_MPEG_H */
diff --git a/src/via_video.c b/src/via_video.c
index f49f3c3..d2dff4b 100644
--- a/src/via_video.c
+++ b/src/via_video.c
@@ -2287,9 +2287,7 @@ viaQueryImageAttributes(ScrnInfoPtr pScrn, int FourCC, CARD16 *Width,
break;
case FOURCC_AI44:
- case FOURCC_IA44:
- /* Subpicture types, why are they mashed in here? */
-
+ /* Fool broken xine. */
/* Just match MPEG */
*Width = ALIGN_TO(*Width, 32);
*Height = ALIGN_TO(*Height, 16);
@@ -2620,7 +2618,6 @@ ViaVideoInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
case VT3122:
case VT3108:
ViaMpegInit(pScrn);
- ViaSubPictureInit(pScrn);
break;
default:
break;
@@ -2669,7 +2666,6 @@ ViaVideoDestroy(ScrnInfoPtr pScrn)
case VT3122:
case VT3108:
ViaMpegDestroy(pScrn);
- ViaSubPictureDestroy(pScrn);
break;
default:
break;
diff --git a/src/via_xvmc.c b/src/via_xvmc.c
index eef1842..3df7c64 100644
--- a/src/via_xvmc.c
+++ b/src/via_xvmc.c
@@ -332,45 +332,6 @@ XvMCEProcBufferSliceSend(ClientPtr client)
*
*/
static int
-XvMCEProcSubPictureClear(ClientPtr client)
-{
- ExtensionEntry *XvMCE_Ext;
- struct XvMCEPrivates *Private;
- ScrnInfoPtr pScrn;
- XvPortPtr Port;
- int ret;
-
- REQUEST(xvmceSubPictureClearReq);
- REQUEST_SIZE_MATCH(xvmceSubPictureClearReq);
-
- XvMCE_Ext = CheckExtension(XVMCE_EXT_NAME);
- if (!XvMCE_Ext || !XvMCE_Ext->extPrivate) {
- xf86Msg(X_WARNING, "%s: Extension not initialised.\n", __func__);
- return BadMatch;
- }
-
- Private = XvMCE_Ext->extPrivate;
- pScrn = xf86Screens[Private->scrnIndex];
-
- /* Does our client own this port? */
- Port = LookupIDByType(stuff->Port, XvGetRTPort());
- if (!Port) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "%s: Client doesn't own this Xv Port.\n", __func__);
- return BadAccess;
- }
-
- ret = ViaSubPictureClear(VIAPTR(pScrn)->Swov->SubPicture, stuff->SubPicture);
- if (ret != Success)
- return ret;
-
- return (client->noClientException);
-}
-
-/*
- *
- */
-static int
XvMCEHandler(ClientPtr client)
{
REQUEST(xReq);
@@ -386,8 +347,6 @@ XvMCEHandler(ClientPtr client)
return XvMCEProcBufferSliceInit(client);
case xvmce_BufferSliceSend:
return XvMCEProcBufferSliceSend(client);
- case xvmce_SubPictureClear:
- return XvMCEProcSubPictureClear(client);
default:
break;
}
@@ -449,25 +408,6 @@ XvMCEInit(ScrnInfoPtr pScrn)
* Now, use what is somewhat useable from XvMC.
*
*/
-static int ViaMCImageIDs[2] = {FOURCC_AI44, FOURCC_IA44};
-static XF86MCImageIDList ViaMCImageIDList = {2, ViaMCImageIDs};
-
-static XF86ImageRec ViaMCIA44 = XVIMAGE_IA44;
-static XF86ImageRec ViaMCAI44 = XVIMAGE_AI44;
-
-static XF86ImagePtr ViaMCSubPictures[2] = {&ViaMCIA44, &ViaMCAI44};
-
-static XF86MCSurfaceInfoRec ViaMCMpeg2Surface = {
- FOURCC_YV12,
- XVMC_CHROMA_FORMAT_420,
- 0,
- 1024, 1024, 1024, 1024,
- XVMC_MPEG_2 | XVMC_VLD,
- XVMC_OVERLAID_SURFACE | XVMC_BACKEND_SUBPICTURE,
- &ViaMCImageIDList
-};
-
-static XF86MCSurfaceInfoPtr ViaMCSurfaces[1] = {&ViaMCMpeg2Surface};
/*
*
@@ -546,52 +486,102 @@ ViaMCBufferDestroy(ScrnInfoPtr pScrn, XvMCSurfacePtr Buffer)
}
/*
- *
+ * This whole XvMC-VLD crap is soo broken. Not only do we implement subpictures
+ * horribly, we also have a dependance on them. So fool the implementations
+ * that we do have subpictures, but fail to allocate them later on.
*/
-static int
-ViaMCCreateSubpicture(ScrnInfoPtr pScrn, XvMCSubpicturePtr subpicture,
- int *num_priv, CARD32 **priv)
-{
- subpicture->num_palette_entries = 16;
- subpicture->entry_bytes = 3;
-
- return ViaSubPictureGrab(VIAPTR(pScrn)->Swov->SubPicture,
- subpicture->subpicture_id,
- subpicture->width, subpicture->height,
- (subpicture->xvimage_id == FOURCC_AI44) ?
- VIA_SUBPICTURE_TYPE_AI44 :
- VIA_SUBPICTURE_TYPE_IA44);
-}
+static int ViaMCImageIDsBrokenXine[1] = {FOURCC_AI44};
+static XF86MCImageIDList ViaMCImageIDListBrokenXine = {1, ViaMCImageIDsBrokenXine};
+
+static XF86ImageRec ViaMCAI44BrokenXine = XVIMAGE_AI44;
+static XF86ImagePtr ViaMCSubPicturesBrokenXine[1] = {&ViaMCAI44BrokenXine};
+
+static XF86MCSurfaceInfoRec ViaMCMpeg2SurfaceBrokenXine = {
+ FOURCC_YV12,
+ XVMC_CHROMA_FORMAT_420,
+ 0,
+ 1024, 1024, 1024, 1024,
+ XVMC_MPEG_2 | XVMC_VLD,
+ XVMC_OVERLAID_SURFACE,
+ &ViaMCImageIDListBrokenXine
+};
+
+static XF86MCSurfaceInfoPtr ViaMCSurfacesBrokenXine[1] = {&ViaMCMpeg2SurfaceBrokenXine};
+
+static XF86MCAdaptorRec ViaMCAdaptorBrokenXine = {
+ ViaXVAdaptorName,
+ 1, ViaMCSurfacesBrokenXine,
+ 1, ViaMCSubPicturesBrokenXine,
+ ViaMCCreateContext,
+ ViaMCDestroyContext,
+ ViaMCBufferCreate,
+ ViaMCBufferDestroy,
+ NULL,
+ NULL
+};
+static XF86MCAdaptorPtr ViaMCAdaptorsBrokenXine[1] = {&ViaMCAdaptorBrokenXine};
/*
- *
+ * Working XvMC clients that do not need crappily implemented subpictures.
*/
-static void
-ViaMCDestroySubpicture(ScrnInfoPtr pScrn, XvMCSubpicturePtr subpicture)
-{
- ViaSubPictureRelease(VIAPTR(pScrn)->Swov->SubPicture,
- subpicture->subpicture_id);
-}
+static XF86MCSurfaceInfoRec ViaMCMpeg2Surface = {
+ FOURCC_YV12,
+ XVMC_CHROMA_FORMAT_420,
+ 0,
+ 1024, 1024, 1024, 1024,
+ XVMC_MPEG_2 | XVMC_VLD,
+ XVMC_OVERLAID_SURFACE,
+ NULL
+};
+static XF86MCSurfaceInfoPtr ViaMCSurfaces[1] = {&ViaMCMpeg2Surface};
static XF86MCAdaptorRec ViaMCAdaptor = {
ViaXVAdaptorName,
1, ViaMCSurfaces,
- 2, ViaMCSubPictures,
+ 0, NULL,
ViaMCCreateContext,
ViaMCDestroyContext,
ViaMCBufferCreate,
ViaMCBufferDestroy,
- ViaMCCreateSubpicture,
- ViaMCDestroySubpicture
+ NULL,
+ NULL
};
static XF86MCAdaptorPtr ViaMCAdaptors[1] = {&ViaMCAdaptor};
/*
+ * Implement an option to allow broken Xine clients to be fooled.
+ */
+static Bool
+ViaMCBrokenXine(int scrnIndex)
+{
+ enum ViaMCOpts {OPTION_BROKENXINE};
+ static OptionInfoRec ViaMCOptions[] =
+ {
+ {OPTION_BROKENXINE, "XvMCBrokenXine", OPTV_BOOLEAN, {0}, FALSE},
+ {-1, NULL, OPTV_NONE, {0}, FALSE}
+ };
+ OptionInfoPtr Options;
+ Bool ret;
+
+ Options = xnfalloc(sizeof(ViaMCOptions));
+ memcpy(Options, ViaMCOptions, sizeof(ViaMCOptions));
+
+ xf86ProcessOptions(scrnIndex, xf86Screens[scrnIndex]->options, Options);
+
+ ret = xf86ReturnOptValBool(Options, OPTION_BROKENXINE, FALSE);
+
+ xfree(Options);
+ return ret;
+}
+
+/*
*
*/
Bool
ViaXvMCInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
{
+ int ret;
+
VIAFUNC(pScrn);
if (!XvMCEInit(pScrn)) {
@@ -600,7 +590,14 @@ ViaXvMCInit(ScrnInfoPtr pScrn, ScreenPtr pScreen)
return FALSE;
}
- if (!xf86XvMCScreenInit(pScreen, 1, ViaMCAdaptors)) {
+ if (ViaMCBrokenXine(pScrn->scrnIndex)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "%s: working around broken XINE XXMC module.\n", __func__);
+ ret = xf86XvMCScreenInit(pScreen, 1, ViaMCAdaptorsBrokenXine);
+ } else
+ ret = xf86XvMCScreenInit(pScreen, 1, ViaMCAdaptors);
+
+ if (!ret) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"%s: Failed to initialise XvMC.\n", __func__);
return FALSE;