Add xf86CrtcScreenInit to share initialization across drivers.
xf86CrtcScreenInit performs initialization that needs to happen at ScreenInit time. (cherry picked from commit 558a4f5588ad2ec11254e0b5d6ce9515b137369e)
This commit is contained in:
		
							parent
							
								
									81526232bc
								
							
						
					
					
						commit
						72a23d88d7
					
				|  | @ -545,6 +545,60 @@ xf86OutputDestroy (xf86OutputPtr output) | ||||||
|     xfree (output); |     xfree (output); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /*
 | ||||||
|  |  * Called during CreateScreenResources to hook up RandR | ||||||
|  |  */ | ||||||
|  | static Bool | ||||||
|  | xf86CrtcCreateScreenResources (ScreenPtr screen) | ||||||
|  | { | ||||||
|  |     ScrnInfoPtr		scrn = xf86Screens[screen->myNum]; | ||||||
|  |     xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(scrn); | ||||||
|  | 
 | ||||||
|  |     screen->CreateScreenResources = config->CreateScreenResources; | ||||||
|  |      | ||||||
|  |     if (!(*screen->CreateScreenResources)(screen)) | ||||||
|  | 	return FALSE; | ||||||
|  | 
 | ||||||
|  |     if (!xf86RandR12CreateScreenResources (screen)) | ||||||
|  | 	return FALSE; | ||||||
|  | 
 | ||||||
|  |     return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * Called at ScreenInit time to set up | ||||||
|  |  */ | ||||||
|  | Bool | ||||||
|  | xf86CrtcScreenInit (ScreenPtr screen) | ||||||
|  | { | ||||||
|  |     ScrnInfoPtr		scrn = xf86Screens[screen->myNum]; | ||||||
|  |     xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(scrn); | ||||||
|  |     int			c; | ||||||
|  | 
 | ||||||
|  |     /* Rotation */ | ||||||
|  |     xf86DrvMsg(scrn->scrnIndex, X_INFO, "RandR 1.2 enabled, ignore the following RandR disabled message.\n"); | ||||||
|  |     xf86DisableRandR(); /* Disable old RandR extension support */ | ||||||
|  |     xf86RandR12Init (screen); | ||||||
|  | 
 | ||||||
|  |     /* support all rotations if every crtc has the shadow alloc funcs */ | ||||||
|  |     for (c = 0; c < config->num_crtc; c++) | ||||||
|  |     { | ||||||
|  | 	xf86CrtcPtr crtc = config->crtc[c]; | ||||||
|  | 	if (!crtc->funcs->shadow_allocate || !crtc->funcs->shadow_create) | ||||||
|  | 	    break; | ||||||
|  |     } | ||||||
|  |     if (c == config->num_crtc) | ||||||
|  | 	xf86RandR12SetRotations (screen, RR_Rotate_0 | RR_Rotate_90 | | ||||||
|  | 				 RR_Rotate_180 | RR_Rotate_270); | ||||||
|  |     else | ||||||
|  | 	xf86RandR12SetRotations (screen, RR_Rotate_0); | ||||||
|  |      | ||||||
|  |     /* Wrap CreateScreenResources so we can initialize the RandR code */ | ||||||
|  |     config->CreateScreenResources = screen->CreateScreenResources; | ||||||
|  |     screen->CreateScreenResources = xf86CrtcCreateScreenResources; | ||||||
|  |     return TRUE; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static DisplayModePtr | static DisplayModePtr | ||||||
| xf86DefaultMode (xf86OutputPtr output, int width, int height) | xf86DefaultMode (xf86OutputPtr output, int width, int height) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -494,6 +494,7 @@ typedef struct _xf86CrtcConfig { | ||||||
| 
 | 
 | ||||||
|     const xf86CrtcConfigFuncsRec *funcs; |     const xf86CrtcConfigFuncsRec *funcs; | ||||||
| 
 | 
 | ||||||
|  |     CreateScreenResourcesProcPtr    CreateScreenResources; | ||||||
| } xf86CrtcConfigRec, *xf86CrtcConfigPtr; | } xf86CrtcConfigRec, *xf86CrtcConfigPtr; | ||||||
| 
 | 
 | ||||||
| extern int xf86CrtcConfigPrivateIndex; | extern int xf86CrtcConfigPrivateIndex; | ||||||
|  | @ -524,25 +525,6 @@ void | ||||||
| xf86CrtcDestroy (xf86CrtcPtr		crtc); | xf86CrtcDestroy (xf86CrtcPtr		crtc); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /**
 |  | ||||||
|  * Allocate a crtc for the specified output |  | ||||||
|  * |  | ||||||
|  * Find a currently unused CRTC which is suitable for |  | ||||||
|  * the specified output |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| xf86CrtcPtr  |  | ||||||
| xf86AllocCrtc (xf86OutputPtr		output); |  | ||||||
| 
 |  | ||||||
| /**
 |  | ||||||
|  * Free a crtc |  | ||||||
|  * |  | ||||||
|  * Mark the crtc as unused by any outputs |  | ||||||
|  */ |  | ||||||
| 
 |  | ||||||
| void |  | ||||||
| xf86FreeCrtc (xf86CrtcPtr		crtc); |  | ||||||
| 
 |  | ||||||
| /**
 | /**
 | ||||||
|  * Sets the given video mode on the given crtc |  * Sets the given video mode on the given crtc | ||||||
|  */ |  */ | ||||||
|  | @ -582,6 +564,9 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY); | ||||||
| void | void | ||||||
| xf86SetScrnInfoModes (ScrnInfoPtr pScrn); | xf86SetScrnInfoModes (ScrnInfoPtr pScrn); | ||||||
| 
 | 
 | ||||||
|  | Bool | ||||||
|  | xf86CrtcScreenInit (ScreenPtr pScreen); | ||||||
|  | 
 | ||||||
| Bool | Bool | ||||||
| xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow); | xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -31,6 +31,7 @@ | ||||||
| #define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy) | #define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy) | ||||||
| #define xf86CrtcInUse XF86NAME(xf86CrtcInUse) | #define xf86CrtcInUse XF86NAME(xf86CrtcInUse) | ||||||
| #define xf86CrtcRotate XF86NAME(xf86CrtcRotate) | #define xf86CrtcRotate XF86NAME(xf86CrtcRotate) | ||||||
|  | #define xf86CrtcScreenInit XF86NAME(xf86CrtcScreenInit) | ||||||
| #define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode) | #define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode) | ||||||
| #define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange) | #define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange) | ||||||
| #define xf86CVTMode XF86NAME(xf86CVTMode) | #define xf86CVTMode XF86NAME(xf86CVTMode) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue