summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyu.z.wang@intel.com>2007-08-08 09:06:47 +0800
committerZhenyu Wang <zhenyu.z.wang@intel.com>2007-08-08 09:06:47 +0800
commitcfc614b1f9143ed1407733aaa81c4a980c613a63 (patch)
treecf637a9d117646d90dc00d96818dee82ff7ca66e
parentb29a932bec2a3cc5a38e9c09c012cfdc1b6209c1 (diff)
remove xvmc attributes
We don't have extra attributes than Xv port.
-rw-r--r--src/i830_video.h1
-rw-r--r--src/i915_hwmc.c139
-rw-r--r--src/i915_hwmc.h15
-rw-r--r--src/xvmc/I915XvMC.c140
-rw-r--r--src/xvmc/I915XvMC.h5
5 files changed, 5 insertions, 295 deletions
diff --git a/src/i830_video.h b/src/i830_video.h
index 67022f6a..7e2d1498 100644
--- a/src/i830_video.h
+++ b/src/i830_video.h
@@ -77,7 +77,6 @@ typedef struct {
int oneLineMode;
int scaleRatio;
Bool textured;
- void *xvmc_priv;
} I830PortPrivRec, *I830PortPrivPtr;
#define GET_PORT_PRIVATE(pScrn) \
diff --git a/src/i915_hwmc.c b/src/i915_hwmc.c
index 19e2b34e..79fe2849 100644
--- a/src/i915_hwmc.c
+++ b/src/i915_hwmc.c
@@ -57,31 +57,6 @@
#include "i915_hwmc.h"
-#define MAKE_ATOM(a) MakeAtom(a, strlen(a), TRUE)
-
-/*
- * List Attributes for the XvMC extension to handle:
- * As long as the attribute is supported by the Xv adaptor, it needs only to
- * be added here to be supported also by XvMC.
- */
-static char *attrXvMC[I915_NUM_XVMC_ATTRIBUTES] = {
- "XV_BRIGHTNESS",
- "XV_CONTRAST",
-};
-static Atom attrAtoms[I915_NUM_XVMC_ATTRIBUTES];
-
-typedef struct
-{
- unsigned ctxDisplaying;
- int xvmc_port;
- I915XvMCAttrHolder xvAttr;
- int newAttribute;
-
- SetPortAttributeFuncPtr SetPortAttribute;
- GetPortAttributeFuncPtr GetPortAttribute;
- PutImageFuncPtr PutImage;
-} I915XvMCXVPriv;
-
#define I915_XVMC_MAX_BUFFERS 2
#define I915_XVMC_MAX_CONTEXTS 4
#define I915_XVMC_MAX_SURFACES 20
@@ -484,9 +459,6 @@ static int I915XvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext,
I915XvMCCreateContextRec *contextRec = NULL;
I915XvMCPtr pXvMC = pI830->xvmc;
I915XvMCContextPriv *ctxpriv = NULL;
- XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)pContext->port_priv;
- I830PortPrivPtr pPriv = (I830PortPrivPtr)portPriv->DevPriv.ptr;
- I915XvMCXVPriv *vx = (I915XvMCXVPriv *)pPriv->xvmc_priv;
int i;
*priv = NULL;
@@ -583,7 +555,6 @@ static int I915XvMCCreateContext (ScrnInfoPtr pScrn, XvMCContextPtr pContext,
contextRec->screen = pScrn->pScreen->myNum;
contextRec->depth = pScrn->bitsPerPixel;
contextRec->deviceID = pI830DRI->deviceID;
- contextRec->initAttrs = vx->xvAttr;
pXvMC->ncontexts++;
pXvMC->contexts[i] = pContext->context_id;
@@ -828,70 +799,7 @@ static void I915XvMCDestroySubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSub
return;
}
-/*
- *
- */
-static int I915XvMCInterceptXvGetAttribute(ScrnInfoPtr pScrn, Atom attribute,
- INT32 * value, pointer data)
-{
- unsigned i;
- I830PortPrivPtr pPriv = (I830PortPrivPtr)data;
- I915XvMCXVPriv *vx = (I915XvMCXVPriv *)pPriv->xvmc_priv;
- I830Ptr pI830 = I830PTR(pScrn);
- I915XvMCPtr pXvMC = pI830->xvmc;
-
- if (I830PTR(pScrn)->XvMCEnabled) {
- for (i = 0; i < vx->xvAttr.numAttr; ++i) {
- if (vx->xvAttr.attributes[i].attribute == attribute) {
- *value = vx->xvAttr.attributes[i].value;
- return Success;
- }
- }
- }
-
- return pXvMC->saveGetPortAttribute(pScrn, attribute, value, data);
-}
-
-static int I915XvMCInterceptXvAttribute(ScrnInfoPtr pScrn, Atom attribute,
- INT32 value, pointer data)
-{
- unsigned i;
- I830PortPrivPtr pPriv = (I830PortPrivPtr)data;
- I915XvMCXVPriv *vx = (I915XvMCXVPriv *)pPriv->xvmc_priv;
- I830Ptr pI830 = I830PTR(pScrn);
- I915XvMCPtr pXvMC = pI830->xvmc;
-
- if (pI830->XvMCEnabled) {
- for (i = 0; i < vx->xvAttr.numAttr; ++i) {
- if (vx->xvAttr.attributes[i].attribute == attribute) {
- vx->xvAttr.attributes[i].value = value;
- return Success;
- }
- }
- }
-
- return pXvMC->saveSetPortAttribute(pScrn, attribute, value, data);
-}
-
-static int I915XvMCDisplayAttributes(ScrnInfoPtr pScrn,
- const I915XvMCAttrHolder * ah, I830PortPrivPtr pPriv)
-{
- I830Ptr pI830 = I830PTR(pScrn);
- I915XvMCPtr pXvMC = pI830->xvmc;
- unsigned i;
- int ret;
-
- for (i = 0; i < ah->numAttr; ++i) {
- ret = pXvMC->saveSetPortAttribute(pScrn, ah->attributes[i].attribute,
- ah->attributes[i].value, pPriv);
- if (ret)
- return ret;
- }
-
- return Success;
-}
-
-static int I915XvMCInterceptPutImage(ScrnInfoPtr pScrn, short src_x, short src_y,
+static int I915XvMCPutImage(ScrnInfoPtr pScrn, short src_x, short src_y,
short drw_x, short drw_y, short src_w,
short src_h, short drw_w, short drw_h,
int id, unsigned char *buf, short width,
@@ -899,8 +807,6 @@ static int I915XvMCInterceptPutImage(ScrnInfoPtr pScrn, short src_x, short src_y
DrawablePtr pDraw)
{
I830Ptr pI830 = I830PTR(pScrn);
- I830PortPrivPtr pPriv = (I830PortPrivPtr)data;
- I915XvMCXVPriv *vx = (I915XvMCXVPriv *)pPriv->xvmc_priv;
I915XvMCPtr pXvMC = pI830->xvmc;
I915XvMCCommandBuffer *i915XvMCData = (I915XvMCCommandBuffer *)buf;
int ret;
@@ -908,19 +814,12 @@ static int I915XvMCInterceptPutImage(ScrnInfoPtr pScrn, short src_x, short src_y
if (pI830->XvMCEnabled) {
if (FOURCC_XVMC == id) {
switch (i915XvMCData->command) {
- case I915_XVMC_COMMAND_ATTRIBUTES:
- if ((i915XvMCData->ctxNo | I915_XVMC_VALID) != vx->ctxDisplaying)
- return 1;
-
- I915XvMCDisplayAttributes(pScrn, &i915XvMCData->attrib, pPriv);
- return 0;
-
case I915_XVMC_COMMAND_DISPLAY:
if ((i915XvMCData->srfNo >= I915_XVMC_MAX_SURFACES) ||
!pXvMC->surfaces[i915XvMCData->srfNo] ||
!pXvMC->sfprivs[i915XvMCData->srfNo]) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "[XvMC] I915XvMCInterceptPutImage: Invalid parameters !\n");
+ "[XvMC] I915XvMCPutImage: Invalid parameters !\n");
return 1;
}
@@ -958,10 +857,7 @@ Bool I915XvMCInit(ScreenPtr pScreen, XF86VideoAdaptorPtr XvAdapt)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
I830Ptr pI830 = I830PTR(pScrn);
- I830PortPrivPtr pPriv;
- I915XvMCXVPriv *vx;
I915XvMCPtr pXvMC;
- int i, j;
if (!IS_I9XX(pI830) || IS_I965G(pI830))
return FALSE;
@@ -975,38 +871,9 @@ Bool I915XvMCInit(ScreenPtr pScreen, XF86VideoAdaptorPtr XvAdapt)
pI830->xvmc = pXvMC;
initI915XvMC(pXvMC);
- for (j = 0; j < XvAdapt->nPorts; ++j) {
- pPriv = (I830PortPrivPtr) XvAdapt->pPortPrivates[j].ptr;
-
- if (NULL == (pPriv->xvmc_priv = xcalloc(1, sizeof(I915XvMCXVPriv)))) {
- xfree(pI830->xvmc);
- return BadAlloc;
- }
-
- for (i = 0; i < I915_NUM_XVMC_ATTRIBUTES; ++i)
- attrAtoms[i] = MAKE_ATOM(attrXvMC[i]);
-
- vx = (I915XvMCXVPriv *) pPriv->xvmc_priv;
-
- vx->ctxDisplaying = 0;
- vx->xvAttr.numAttr = I915_NUM_XVMC_ATTRIBUTES;
- vx->xvmc_port = -1;
- vx->newAttribute = 1;
-
- for (i = 0; i < I915_NUM_XVMC_ATTRIBUTES; ++i) {
- vx->xvAttr.attributes[i].attribute = attrAtoms[i];
- XvAdapt->GetPortAttribute(pScrn, attrAtoms[i],
- &(vx->xvAttr.attributes[i].value), pPriv);
- }
- }
/* set up wrappers */
- pXvMC->saveGetPortAttribute = XvAdapt->GetPortAttribute;
- pXvMC->saveSetPortAttribute = XvAdapt->SetPortAttribute;
pXvMC->savePutImage = XvAdapt->PutImage;
-
- XvAdapt->GetPortAttribute = I915XvMCInterceptXvGetAttribute;
- XvAdapt->SetPortAttribute = I915XvMCInterceptXvAttribute;
- XvAdapt->PutImage = I915XvMCInterceptPutImage;
+ XvAdapt->PutImage = I915XvMCPutImage;
return TRUE;
}
diff --git a/src/i915_hwmc.h b/src/i915_hwmc.h
index 529636e3..61c7c4bc 100644
--- a/src/i915_hwmc.h
+++ b/src/i915_hwmc.h
@@ -44,19 +44,6 @@
#define I915_XVMC_COMMAND_DISPLAY 0x00
#define I915_XVMC_COMMAND_UNDISPLAY 0x01
-#define I915_XVMC_COMMAND_ATTRIBUTES 0x02
-
-typedef struct
-{
- INT32 attribute;
- INT32 value;
-} I915AttrPair;
-
-typedef struct
-{
- unsigned numAttr;
- I915AttrPair attributes[I915_NUM_XVMC_ATTRIBUTES];
-} I915XvMCAttrHolder;
typedef struct
{
@@ -64,7 +51,6 @@ typedef struct
unsigned ctxNo;
unsigned srfNo;
unsigned subPicNo;
- I915XvMCAttrHolder attrib;
int real_id;
unsigned pad;
} I915XvMCCommandBuffer;
@@ -92,7 +78,6 @@ typedef struct
unsigned screen;
unsigned depth;
int deviceID;
- I915XvMCAttrHolder initAttrs;
} I915XvMCCreateContextRec;
typedef struct
diff --git a/src/xvmc/I915XvMC.c b/src/xvmc/I915XvMC.c
index 3eb0bc38..7040f6af 100644
--- a/src/xvmc/I915XvMC.c
+++ b/src/xvmc/I915XvMC.c
@@ -122,45 +122,6 @@ _STATIC_ int findOverlap(unsigned width, unsigned height,
return 0;
}
-_STATIC_ void setupAttribDesc(Display * display, XvPortID port,
- const I915XvMCAttrHolder * attrib, XvAttribute attribDesc[])
-{
- XvAttribute *XvAttribs, *curAD;
- int num;
- unsigned i, j;
-
- XLockDisplay(display);
- XvAttribs = XvQueryPortAttributes(display, port, &num);
- for (i = 0; i < attrib->numAttr; ++i) {
- curAD = attribDesc + i;
- curAD->flags = 0;
- curAD->min_value = 0;
- curAD->max_value = 0;
- curAD->name = NULL;
- for (j = 0; j < num; ++j) {
- if (attrib->attributes[i].attribute ==
- XInternAtom(display, XvAttribs[j].name, TRUE)) {
- *curAD = XvAttribs[j];
- curAD->name = strdup(XvAttribs[j].name);
- break;
- }
- }
- }
- if (XvAttribs)
- XFree(XvAttribs);
- XUnlockDisplay(display);
-}
-
-_STATIC_ void releaseAttribDesc(int numAttr, XvAttribute attribDesc[])
-{
- int i;
-
- for (i = 0; i < numAttr; ++i) {
- if (attribDesc[i].name)
- free(attribDesc[i].name);
- }
-}
-
_STATIC_ __inline__ void renderError(void)
{
printf("Invalid Macroblock Parameters found.\n");
@@ -1747,7 +1708,6 @@ _STATIC_ void i915_release_resource(Display *display, XvMCContext *context)
pI915XvMC->ref--;
i915_xvmc_unmap_buffers(pI915XvMC);
- releaseAttribDesc(pI915XvMC->attrib.numAttr, pI915XvMC->attribDesc);
driDestroyHashContents(pI915XvMC->drawHash);
drmHashDestroy(pI915XvMC->drawHash);
@@ -1934,7 +1894,6 @@ Status XvMCCreateContext(Display *display, XvPortID port,
pI915XvMC->sarea_priv_offset = tmpComm->sarea_priv_offset;
pI915XvMC->screen = tmpComm->screen;
pI915XvMC->depth = tmpComm->depth;
- pI915XvMC->attrib = tmpComm->initAttrs;
/* Must free the private data we were passed from X */
free(priv_data);
@@ -2047,11 +2006,9 @@ Status XvMCCreateContext(Display *display, XvPortID port,
}
/* Initialize private context values */
- setupAttribDesc(display, port, &pI915XvMC->attrib, pI915XvMC->attribDesc);
pI915XvMC->yStride = STRIDE(width);
pI915XvMC->uvStride = STRIDE(width >> 1);
pI915XvMC->haveXv = 0;
- pI915XvMC->attribChanged = 1;
pI915XvMC->dual_prime = 0;
pI915XvMC->last_flip = 0;
pI915XvMC->locked = 0;
@@ -2582,7 +2539,6 @@ Status XvMCPutSurface(Display *display,XvMCSurface *surface,
buf.srfNo = pI915Surface->srfNo;
pI915SubPic = pI915Surface->privSubPic;
buf.subPicNo = (!pI915SubPic ? 0 : pI915SubPic->srfNo);
- buf.attrib = pI915XvMC->attrib;
buf.real_id = FOURCC_YV12;
XLockDisplay(display);
@@ -2598,7 +2554,6 @@ Status XvMCPutSurface(Display *display,XvMCSurface *surface,
XSync(display, 0);
XUnlockDisplay(display);
- pI915XvMC->attribChanged = 0;
PPTHREAD_MUTEX_UNLOCK(pI915XvMC);
return Success;
@@ -3302,29 +3257,9 @@ Status XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpicture,
XvAttribute *XvMCQueryAttributes(Display *display, XvMCContext *context,
int *number)
{
- i915XvMCContext *pI915XvMC;
- XvAttribute *attributes;
-
- if (!number)
- return NULL;
-
+ /* now XvMC has no extra attribs than Xv */
*number = 0;
-
- if (!display || !context)
- return NULL;
-
- if (!(pI915XvMC = context->privData))
- return NULL;
-
- PPTHREAD_MUTEX_LOCK(pI915XvMC);
- if (NULL != (attributes = (XvAttribute *)
- malloc(I915_NUM_XVMC_ATTRIBUTES * sizeof(XvAttribute)))) {
- memcpy(attributes, pI915XvMC->attribDesc, I915_NUM_XVMC_ATTRIBUTES);
- *number = I915_NUM_XVMC_ATTRIBUTES;
- }
- PPTHREAD_MUTEX_UNLOCK(pI915XvMC);
-
- return attributes;
+ return NULL;
}
/***************************************************************************
@@ -3343,52 +3278,6 @@ XvAttribute *XvMCQueryAttributes(Display *display, XvMCContext *context,
Status XvMCSetAttribute(Display *display, XvMCContext *context,
Atom attribute, int value)
{
- i915XvMCContext *pI915XvMC;
- I915XvMCCommandBuffer buf;
- int found = 0;
- unsigned i;
-
- if (!display)
- return BadValue;
-
- if (!context || !(pI915XvMC = context->privData))
- return (error_base + XvMCBadContext);
-
- PPTHREAD_MUTEX_LOCK(pI915XvMC);
- for (i = 0; i < pI915XvMC->attrib.numAttr; ++i) {
- if (attribute == pI915XvMC->attrib.attributes[i].attribute) {
- if ((!(pI915XvMC->attribDesc[i].flags & XvSettable)) ||
- value < pI915XvMC->attribDesc[i].min_value ||
- value > pI915XvMC->attribDesc[i].max_value) {
- PPTHREAD_MUTEX_UNLOCK(pI915XvMC);
- return BadValue;
- }
-
- pI915XvMC->attrib.attributes[i].value = value;
- found = 1;
- pI915XvMC->attribChanged = 1;
- break;
- }
- }
-
- if (!found) {
- PPTHREAD_MUTEX_UNLOCK(pI915XvMC);
- return BadMatch;
- }
-
- if (pI915XvMC->haveXv) {
- buf.command = I915_XVMC_COMMAND_ATTRIBUTES;
- pI915XvMC->xvImage->data = (char *)&buf;
- buf.ctxNo = pI915XvMC->ctxno | I915_XVMC_VALID;
- buf.attrib = pI915XvMC->attrib;
- XLockDisplay(display);
- pI915XvMC->attribChanged =
- XvPutImage(display, pI915XvMC->port, pI915XvMC->draw,
- pI915XvMC->gc, pI915XvMC->xvImage, 0, 0, 1, 1, 0, 0, 1, 1);
- XUnlockDisplay(display);
- }
-
- PPTHREAD_MUTEX_UNLOCK(pI915XvMC);
return Success;
}
@@ -3410,30 +3299,5 @@ Status XvMCSetAttribute(Display *display, XvMCContext *context,
Status XvMCGetAttribute(Display *display, XvMCContext *context,
Atom attribute, int *value)
{
- i915XvMCContext *pI915XvMC;
- int found = 0;
- unsigned i;
-
- if (!display || !value)
- return BadValue;
-
- if (!context || !(pI915XvMC = context->privData))
- return (error_base + XvMCBadContext);
-
- PPTHREAD_MUTEX_LOCK(pI915XvMC);
- for (i = 0; i < pI915XvMC->attrib.numAttr; ++i) {
- if (attribute == pI915XvMC->attrib.attributes[i].attribute) {
- if (pI915XvMC->attribDesc[i].flags & XvGettable) {
- *value = pI915XvMC->attrib.attributes[i].value;
- found = 1;
- break;
- }
- }
- }
- PPTHREAD_MUTEX_UNLOCK(pI915XvMC);
-
- if (!found)
- return BadMatch;
-
return Success;
}
diff --git a/src/xvmc/I915XvMC.h b/src/xvmc/I915XvMC.h
index 4fc9fc59..3a83edca 100644
--- a/src/xvmc/I915XvMC.h
+++ b/src/xvmc/I915XvMC.h
@@ -89,15 +89,10 @@ typedef struct _i915XvMCContext {
unsigned screen;
unsigned depth;
XvPortID port; /* Xv Port ID when displaying */
- I915XvMCAttrHolder attrib; /* This contexts attributes and their values */
- XvAttribute attribDesc[I915_NUM_XVMC_ATTRIBUTES]; /* Attribute decriptions */
int haveXv; /* Have I initialized the Xv
* connection for this surface? */
XvImage *xvImage; /* Fake Xv Image used for command
* buffer transport to the X server */
- int attribChanged; /* Attributes have changed and need to
- * be uploaded to Xv at next frame
- * display */
GC gc; /* X GC needed for displaying */
Drawable draw; /* Drawable to undisplay from */
XID id;