Xv: Only stop the adaptors when the Pixmap is finally destroyed
Pixmaps are reference counted and DestroyPixmap is called for the removal of every reference. However, we only want to stop the adaptors writing into the Pixmap just before the Pixmap is finally destroyed, similar to how Windows are handled. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
This commit is contained in:
parent
413cb2ff1d
commit
912f1fe2bb
|
@ -327,36 +327,24 @@ XvGetRTPort(void)
|
||||||
return XvRTPort;
|
return XvRTPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static void
|
||||||
XvDestroyPixmap(PixmapPtr pPix)
|
XvStopAdaptors(DrawablePtr pDrawable)
|
||||||
{
|
{
|
||||||
Bool status;
|
ScreenPtr pScreen = pDrawable->pScreen;
|
||||||
ScreenPtr pScreen;
|
XvScreenPtr pxvs = dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
|
||||||
XvScreenPtr pxvs;
|
XvAdaptorPtr pa = pxvs->pAdaptors;
|
||||||
XvAdaptorPtr pa;
|
int na = pxvs->nAdaptors;
|
||||||
int na;
|
|
||||||
XvPortPtr pp;
|
|
||||||
int np;
|
|
||||||
|
|
||||||
pScreen = pPix->drawable.pScreen;
|
|
||||||
|
|
||||||
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
|
|
||||||
|
|
||||||
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
|
|
||||||
|
|
||||||
/* CHECK TO SEE IF THIS PORT IS IN USE */
|
/* CHECK TO SEE IF THIS PORT IS IN USE */
|
||||||
|
|
||||||
pa = pxvs->pAdaptors;
|
|
||||||
na = pxvs->nAdaptors;
|
|
||||||
while (na--) {
|
while (na--) {
|
||||||
np = pa->nPorts;
|
XvPortPtr pp = pa->pPorts;
|
||||||
pp = pa->pPorts;
|
int np = pa->nPorts;
|
||||||
|
|
||||||
while (np--) {
|
while (np--) {
|
||||||
if (pp->pDraw == (DrawablePtr) pPix) {
|
if (pp->pDraw == pDrawable) {
|
||||||
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
|
XvdiSendVideoNotify(pp, pDrawable, XvPreempted);
|
||||||
|
|
||||||
(void) (*pp->pAdaptor->ddStopVideo) (pp, pp->pDraw);
|
(void) (*pp->pAdaptor->ddStopVideo) (pp, pDrawable);
|
||||||
|
|
||||||
pp->pDraw = NULL;
|
pp->pDraw = NULL;
|
||||||
pp->client = NULL;
|
pp->client = NULL;
|
||||||
|
@ -366,9 +354,19 @@ XvDestroyPixmap(PixmapPtr pPix)
|
||||||
}
|
}
|
||||||
pa++;
|
pa++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Bool
|
||||||
|
XvDestroyPixmap(PixmapPtr pPix)
|
||||||
|
{
|
||||||
|
ScreenPtr pScreen = pPix->drawable.pScreen;
|
||||||
|
Bool status;
|
||||||
|
|
||||||
|
if (pPix->refcnt == 1)
|
||||||
|
XvStopAdaptors(&pPix->drawable);
|
||||||
|
|
||||||
|
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
|
||||||
status = (*pScreen->DestroyPixmap) (pPix);
|
status = (*pScreen->DestroyPixmap) (pPix);
|
||||||
|
|
||||||
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
|
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -378,45 +376,13 @@ XvDestroyPixmap(PixmapPtr pPix)
|
||||||
static Bool
|
static Bool
|
||||||
XvDestroyWindow(WindowPtr pWin)
|
XvDestroyWindow(WindowPtr pWin)
|
||||||
{
|
{
|
||||||
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||||
Bool status;
|
Bool status;
|
||||||
ScreenPtr pScreen;
|
|
||||||
XvScreenPtr pxvs;
|
|
||||||
XvAdaptorPtr pa;
|
|
||||||
int na;
|
|
||||||
XvPortPtr pp;
|
|
||||||
int np;
|
|
||||||
|
|
||||||
pScreen = pWin->drawable.pScreen;
|
XvStopAdaptors(&pWin->drawable);
|
||||||
|
|
||||||
SCREEN_PROLOGUE(pScreen, DestroyWindow);
|
SCREEN_PROLOGUE(pScreen, DestroyWindow);
|
||||||
|
|
||||||
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
|
|
||||||
|
|
||||||
/* CHECK TO SEE IF THIS PORT IS IN USE */
|
|
||||||
|
|
||||||
pa = pxvs->pAdaptors;
|
|
||||||
na = pxvs->nAdaptors;
|
|
||||||
while (na--) {
|
|
||||||
np = pa->nPorts;
|
|
||||||
pp = pa->pPorts;
|
|
||||||
|
|
||||||
while (np--) {
|
|
||||||
if (pp->pDraw == (DrawablePtr) pWin) {
|
|
||||||
XvdiSendVideoNotify(pp, pp->pDraw, XvPreempted);
|
|
||||||
|
|
||||||
(void) (*pp->pAdaptor->ddStopVideo) (pp, pp->pDraw);
|
|
||||||
|
|
||||||
pp->pDraw = NULL;
|
|
||||||
pp->client = NULL;
|
|
||||||
pp->time = currentTime;
|
|
||||||
}
|
|
||||||
pp++;
|
|
||||||
}
|
|
||||||
pa++;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = (*pScreen->DestroyWindow) (pWin);
|
status = (*pScreen->DestroyWindow) (pWin);
|
||||||
|
|
||||||
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
|
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
|
Loading…
Reference in New Issue