xv: Move the DDX XV screen private allocation into the DDXes.
XV was going against convention by having the core infrastructure allocate the private on behalf of the DDX. I was interested in this because I was trying to make multiple pieces of DDX be able to allocate adaptors, and that wasn't going to work if DDX-specific code was hung off of a single global screen private. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
		
							parent
							
								
									a146c6d421
								
							
						
					
					
						commit
						e7dde86f23
					
				|  | @ -214,7 +214,6 @@ typedef struct { | ||||||
|     DestroyPixmapProcPtr DestroyPixmap; |     DestroyPixmapProcPtr DestroyPixmap; | ||||||
|     CloseScreenProcPtr CloseScreen; |     CloseScreenProcPtr CloseScreen; | ||||||
|     Bool (*ddCloseScreen) (ScreenPtr); |     Bool (*ddCloseScreen) (ScreenPtr); | ||||||
|     DevUnion devPriv; |  | ||||||
| } XvScreenRec, *XvScreenPtr; | } XvScreenRec, *XvScreenPtr; | ||||||
| 
 | 
 | ||||||
| #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \ | #define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \ | ||||||
|  |  | ||||||
|  | @ -103,6 +103,7 @@ static DevPrivateKeyRec KdXVWindowKeyRec; | ||||||
| 
 | 
 | ||||||
| #define KdXVWindowKey (&KdXVWindowKeyRec) | #define KdXVWindowKey (&KdXVWindowKeyRec) | ||||||
| static DevPrivateKey KdXvScreenKey; | static DevPrivateKey KdXvScreenKey; | ||||||
|  | static DevPrivateKeyRec KdXVScreenPrivateKey; | ||||||
| static unsigned long KdXVGeneration = 0; | static unsigned long KdXVGeneration = 0; | ||||||
| static unsigned long PortResource = 0; | static unsigned long PortResource = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -110,7 +111,7 @@ static unsigned long PortResource = 0; | ||||||
|     dixLookupPrivate(&(pScreen)->devPrivates, KdXvScreenKey)) |     dixLookupPrivate(&(pScreen)->devPrivates, KdXvScreenKey)) | ||||||
| 
 | 
 | ||||||
| #define GET_KDXV_SCREEN(pScreen) \ | #define GET_KDXV_SCREEN(pScreen) \ | ||||||
|   	((KdXVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr)) |     ((KdXVScreenPtr)(dixGetPrivate(&pScreen->devPrivates, &KdXVScreenPrivateKey))) | ||||||
| 
 | 
 | ||||||
| #define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \ | #define GET_KDXV_WINDOW(pWin) ((KdXVWindowPtr) \ | ||||||
|     dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey)) |     dixLookupPrivate(&(pWin)->devPrivates, KdXVWindowKey)) | ||||||
|  | @ -143,6 +144,8 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num) | ||||||
| 
 | 
 | ||||||
|     if (!dixRegisterPrivateKey(&KdXVWindowKeyRec, PRIVATE_WINDOW, 0)) |     if (!dixRegisterPrivateKey(&KdXVWindowKeyRec, PRIVATE_WINDOW, 0)) | ||||||
|         return FALSE; |         return FALSE; | ||||||
|  |     if (!dixRegisterPrivateKey(&KdXVScreenPrivateKey, PRIVATE_SCREEN, 0)) | ||||||
|  |         return FALSE; | ||||||
| 
 | 
 | ||||||
|     if (Success != XvScreenInit(pScreen)) |     if (Success != XvScreenInit(pScreen)) | ||||||
|         return FALSE; |         return FALSE; | ||||||
|  | @ -157,13 +160,8 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num) | ||||||
| 
 | 
 | ||||||
|     pxvs->ddCloseScreen = KdXVCloseScreen; |     pxvs->ddCloseScreen = KdXVCloseScreen; | ||||||
| 
 | 
 | ||||||
|     /* The Xv di layer provides us with a private hook so that we don't
 |  | ||||||
|        have to allocate our own screen private.  They also provide |  | ||||||
|        a CloseScreen hook so that we don't have to wrap it.  I'm not |  | ||||||
|        sure that I appreciate that.  */ |  | ||||||
| 
 |  | ||||||
|     ScreenPriv = malloc(sizeof(KdXVScreenRec)); |     ScreenPriv = malloc(sizeof(KdXVScreenRec)); | ||||||
|     pxvs->devPriv.ptr = (void *) ScreenPriv; |     dixSetPrivate(&pScreen->devPrivates, &KdXVScreenPrivateKey, ScreenPriv); | ||||||
| 
 | 
 | ||||||
|     if (!ScreenPriv) |     if (!ScreenPriv) | ||||||
|         return FALSE; |         return FALSE; | ||||||
|  |  | ||||||
|  | @ -112,7 +112,10 @@ static DevPrivateKeyRec XF86XVWindowKeyRec; | ||||||
| 
 | 
 | ||||||
| #define XF86XVWindowKey (&XF86XVWindowKeyRec) | #define XF86XVWindowKey (&XF86XVWindowKeyRec) | ||||||
| 
 | 
 | ||||||
|  | /* dixmain.c XvScreenPtr screen private */ | ||||||
| DevPrivateKey XF86XvScreenKey; | DevPrivateKey XF86XvScreenKey; | ||||||
|  | /** xf86xv.c XF86XVScreenPtr screen private */ | ||||||
|  | static DevPrivateKeyRec XF86XVScreenPrivateKey; | ||||||
| 
 | 
 | ||||||
| static unsigned long PortResource = 0; | static unsigned long PortResource = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -120,7 +123,7 @@ static unsigned long PortResource = 0; | ||||||
|     ((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey)) |     ((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey)) | ||||||
| 
 | 
 | ||||||
| #define GET_XF86XV_SCREEN(pScreen) \ | #define GET_XF86XV_SCREEN(pScreen) \ | ||||||
|     ((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr)) |     ((XF86XVScreenPtr)(dixGetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey))) | ||||||
| 
 | 
 | ||||||
| #define GET_XF86XV_WINDOW(pWin) \ | #define GET_XF86XV_WINDOW(pWin) \ | ||||||
|     ((XF86XVWindowPtr)dixLookupPrivate(&(pWin)->devPrivates, XF86XVWindowKey)) |     ((XF86XVWindowPtr)dixLookupPrivate(&(pWin)->devPrivates, XF86XVWindowKey)) | ||||||
|  | @ -241,6 +244,8 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num) | ||||||
| 
 | 
 | ||||||
|     if (!dixRegisterPrivateKey(&XF86XVWindowKeyRec, PRIVATE_WINDOW, 0)) |     if (!dixRegisterPrivateKey(&XF86XVWindowKeyRec, PRIVATE_WINDOW, 0)) | ||||||
|         return FALSE; |         return FALSE; | ||||||
|  |     if (!dixRegisterPrivateKey(&XF86XVScreenPrivateKey, PRIVATE_SCREEN, 0)) | ||||||
|  |         return FALSE; | ||||||
| 
 | 
 | ||||||
|     XF86XvScreenKey = XvGetScreenKey(); |     XF86XvScreenKey = XvGetScreenKey(); | ||||||
| 
 | 
 | ||||||
|  | @ -253,13 +258,8 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num) | ||||||
| 
 | 
 | ||||||
|     pxvs->ddCloseScreen = xf86XVCloseScreen; |     pxvs->ddCloseScreen = xf86XVCloseScreen; | ||||||
| 
 | 
 | ||||||
|     /* The Xv di layer provides us with a private hook so that we don't
 |  | ||||||
|        have to allocate our own screen private.  They also provide |  | ||||||
|        a CloseScreen hook so that we don't have to wrap it.  I'm not |  | ||||||
|        sure that I appreciate that.  */ |  | ||||||
| 
 |  | ||||||
|     ScreenPriv = malloc(sizeof(XF86XVScreenRec)); |     ScreenPriv = malloc(sizeof(XF86XVScreenRec)); | ||||||
|     pxvs->devPriv.ptr = (void *) ScreenPriv; |     dixSetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey, ScreenPriv); | ||||||
| 
 | 
 | ||||||
|     if (!ScreenPriv) |     if (!ScreenPriv) | ||||||
|         return FALSE; |         return FALSE; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue