[PATCH 08/16] xv: Move CloseScreen setup from a DIX hook to normal wrapping.
Keith Packard
keithp at keithp.com
Fri Jul 18 11:46:23 PDT 2014
Eric Anholt <eric at anholt.net> writes:
> Signed-off-by: Eric Anholt <eric at anholt.net>
Now you can get rid of the close screen comment :-)
Reviewed-by: Keith Packard <keithp at keithp.com>
> ---
> Xext/xvdix.h | 1 -
> Xext/xvmain.c | 2 --
> hw/kdrive/src/kxv.c | 18 +++++-------------
> hw/kdrive/src/kxv.h | 1 +
> hw/xfree86/common/xf86xv.c | 19 ++++++-------------
> hw/xfree86/common/xf86xvpriv.h | 1 +
> 6 files changed, 13 insertions(+), 29 deletions(-)
>
> diff --git a/Xext/xvdix.h b/Xext/xvdix.h
> index b61659c..534e7d3 100644
> --- a/Xext/xvdix.h
> +++ b/Xext/xvdix.h
> @@ -213,7 +213,6 @@ typedef struct {
> DestroyWindowProcPtr DestroyWindow;
> DestroyPixmapProcPtr DestroyPixmap;
> CloseScreenProcPtr CloseScreen;
> - Bool (*ddCloseScreen) (ScreenPtr);
> } XvScreenRec, *XvScreenPtr;
>
> #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
> diff --git a/Xext/xvmain.c b/Xext/xvmain.c
> index f6658b9..9abded5 100644
> --- a/Xext/xvmain.c
> +++ b/Xext/xvmain.c
> @@ -302,8 +302,6 @@ XvCloseScreen(ScreenPtr pScreen)
> pScreen->DestroyWindow = pxvs->DestroyWindow;
> pScreen->CloseScreen = pxvs->CloseScreen;
>
> - (*pxvs->ddCloseScreen) (pScreen);
> -
> free(pxvs);
>
> dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
> diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
> index ad51cf9..47e1357 100644
> --- a/hw/kdrive/src/kxv.c
> +++ b/hw/kdrive/src/kxv.c
> @@ -56,10 +56,6 @@ of the copyright holder.
> #include "kxv.h"
> #include "fourcc.h"
>
> -/* XvScreenRec fields */
> -
> -static Bool KdXVCloseScreen(ScreenPtr);
> -
> /* XvAdaptorRec fields */
>
> static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr *);
> @@ -95,6 +91,7 @@ static Bool KdXVCreateWindow(WindowPtr pWin);
> static Bool KdXVDestroyWindow(WindowPtr pWin);
> static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
> static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
> +static Bool KdXVCloseScreen(ScreenPtr);
>
> /* misc */
> static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr, int);
> @@ -132,7 +129,6 @@ Bool
> KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
> {
> KdXVScreenPtr ScreenPriv;
> - XvScreenPtr pxvs;
>
> /* fprintf(stderr,"KdXVScreenInit initializing %d adaptors\n",num); */
>
> @@ -153,13 +149,6 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
> KdXvScreenKey = XvGetScreenKey();
> PortResource = XvGetRTPort();
>
> - pxvs = GET_XV_SCREEN(pScreen);
> -
> - /* Anyone initializing the Xv layer must provide this.
> - The Xv di layer calls it without even checking if it exists! */
> -
> - pxvs->ddCloseScreen = KdXVCloseScreen;
> -
> ScreenPriv = malloc(sizeof(KdXVScreenRec));
> dixSetPrivate(&pScreen->devPrivates, &KdXVScreenPrivateKey, ScreenPriv);
>
> @@ -170,6 +159,7 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
> ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
> ScreenPriv->WindowExposures = pScreen->WindowExposures;
> ScreenPriv->ClipNotify = pScreen->ClipNotify;
> + ScreenPriv->CloseScreen = pScreen->CloseScreen;
>
> /* fprintf(stderr,"XV: Wrapping screen funcs\n"); */
>
> @@ -177,6 +167,7 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
> pScreen->DestroyWindow = KdXVDestroyWindow;
> pScreen->WindowExposures = KdXVWindowExposures;
> pScreen->ClipNotify = KdXVClipNotify;
> + pScreen->CloseScreen = KdXVCloseScreen;
>
> if (!KdXVInitAdaptors(pScreen, adaptors, num))
> return FALSE;
> @@ -990,6 +981,7 @@ KdXVCloseScreen(ScreenPtr pScreen)
> pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
> pScreen->WindowExposures = ScreenPriv->WindowExposures;
> pScreen->ClipNotify = ScreenPriv->ClipNotify;
> + pScreen->CloseScreen = ScreenPriv->CloseScreen;
>
> /* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
>
> @@ -1000,7 +992,7 @@ KdXVCloseScreen(ScreenPtr pScreen)
> free(pxvs->pAdaptors);
> free(ScreenPriv);
>
> - return TRUE;
> + return pScreen->CloseScreen(pScreen);
> }
>
> static Bool
> diff --git a/hw/kdrive/src/kxv.h b/hw/kdrive/src/kxv.h
> index fe467a9..451d3fa 100644
> --- a/hw/kdrive/src/kxv.h
> +++ b/hw/kdrive/src/kxv.h
> @@ -188,6 +188,7 @@ typedef struct {
> DestroyWindowProcPtr DestroyWindow;
> ClipNotifyProcPtr ClipNotify;
> WindowExposuresProcPtr WindowExposures;
> + CloseScreenProcPtr CloseScreen;
> } KdXVScreenRec, *KdXVScreenPtr;
>
> typedef struct {
> diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
> index 0f3b09b..3e31046 100644
> --- a/hw/xfree86/common/xf86xv.c
> +++ b/hw/xfree86/common/xf86xv.c
> @@ -54,10 +54,6 @@
>
> #include "xf86xvpriv.h"
>
> -/* XvScreenRec fields */
> -
> -static Bool xf86XVCloseScreen(ScreenPtr);
> -
> /* XvAdaptorRec fields */
>
> static int xf86XVAllocatePort(unsigned long, XvPortPtr, XvPortPtr *);
> @@ -94,6 +90,7 @@ static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
> static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin,
> VTKind kind);
> static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
> +static Bool xf86XVCloseScreen(ScreenPtr);
>
> #define PostValidateTreeUndefined ((PostValidateTreeProcPtr)-1)
>
> @@ -234,7 +231,6 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
> {
> ScrnInfoPtr pScrn;
> XF86XVScreenPtr ScreenPriv;
> - XvScreenPtr pxvs;
>
> if (num <= 0 || noXvExtension)
> return FALSE;
> @@ -251,13 +247,6 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
>
> PortResource = XvGetRTPort();
>
> - pxvs = GET_XV_SCREEN(pScreen);
> -
> - /* Anyone initializing the Xv layer must provide this.
> - The Xv di layer calls it without even checking if it exists! */
> -
> - pxvs->ddCloseScreen = xf86XVCloseScreen;
> -
> ScreenPriv = malloc(sizeof(XF86XVScreenRec));
> dixSetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey, ScreenPriv);
>
> @@ -270,6 +259,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
> ScreenPriv->WindowExposures = pScreen->WindowExposures;
> ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
> ScreenPriv->ClipNotify = pScreen->ClipNotify;
> + ScreenPriv->CloseScreen = pScreen->CloseScreen;
> ScreenPriv->EnterVT = pScrn->EnterVT;
> ScreenPriv->LeaveVT = pScrn->LeaveVT;
> ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
> @@ -278,6 +268,7 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
> pScreen->DestroyWindow = xf86XVDestroyWindow;
> pScreen->WindowExposures = xf86XVWindowExposures;
> pScreen->ClipNotify = xf86XVClipNotify;
> + pScreen->CloseScreen = xf86XVCloseScreen;
> pScrn->EnterVT = xf86XVEnterVT;
> pScrn->LeaveVT = xf86XVLeaveVT;
> if (pScrn->AdjustFrame)
> @@ -1168,6 +1159,7 @@ xf86XVCloseScreen(ScreenPtr pScreen)
> pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
> pScreen->WindowExposures = ScreenPriv->WindowExposures;
> pScreen->ClipNotify = ScreenPriv->ClipNotify;
> + pScreen->CloseScreen = ScreenPriv->CloseScreen;
>
> pScrn->EnterVT = ScreenPriv->EnterVT;
> pScrn->LeaveVT = ScreenPriv->LeaveVT;
> @@ -1180,7 +1172,8 @@ xf86XVCloseScreen(ScreenPtr pScreen)
>
> free(pxvs->pAdaptors);
> free(ScreenPriv);
> - return TRUE;
> +
> + return pScreen->CloseScreen(pScreen);
> }
>
> /**** ScrnInfoRec fields ****/
> diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
> index e95f959..c0dff16 100644
> --- a/hw/xfree86/common/xf86xvpriv.h
> +++ b/hw/xfree86/common/xf86xvpriv.h
> @@ -45,6 +45,7 @@ typedef struct {
> Bool (*EnterVT) (ScrnInfoPtr);
> void (*LeaveVT) (ScrnInfoPtr);
> xf86ModeSetProc *ModeSet;
> + CloseScreenProcPtr CloseScreen;
> } XF86XVScreenRec, *XF86XVScreenPtr;
>
> typedef struct {
> --
> 2.0.1
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
--
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 810 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20140718/28f7bc5d/attachment.sig>
More information about the xorg-devel
mailing list