[PATCH xf86-video-amdgpu 1/2] Skip some initialization steps for GPU screens
Michel Dänzer
michel at daenzer.net
Thu Mar 9 07:03:04 UTC 2017
From: Michel Dänzer <michel.daenzer at amd.com>
Xorg doesn't use the following functionality of GPU screens, so don't
bother initializing it:
* DRI page flipping
* DRI3 / Present / SYNC fences
* XVideo / XvMC
* Root window with background None
(Ported from radeon commit 67ae5e00a748ad52cf92738d401afff2947b1891)
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/amdgpu_drv.h | 2 ++
src/amdgpu_kms.c | 90 ++++++++++++++++++++++++++++++--------------------------
2 files changed, 51 insertions(+), 41 deletions(-)
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index 0700daecb..532d99daa 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -169,8 +169,10 @@ typedef enum {
#if XF86_CRTC_VERSION >= 5
#define AMDGPU_PIXMAP_SHARING 1
#define amdgpu_is_gpu_screen(screen) (screen)->isGPU
+#define amdgpu_is_gpu_scrn(scrn) (scrn)->is_gpu
#else
#define amdgpu_is_gpu_screen(screen) 0
+#define amdgpu_is_gpu_scrn(scrn) 0
#endif
#define AMDGPU_VSYNC_TIMEOUT 20000 /* Maximum wait for VSYNC (in usecs) */
diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c
index 92bf5fadf..3deaef76c 100644
--- a/src/amdgpu_kms.c
+++ b/src/amdgpu_kms.c
@@ -1397,23 +1397,26 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShadowPrimary enabled\n");
}
- sw_cursor = xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE);
-
- info->allowPageFlip = xf86ReturnOptValBool(info->Options,
- OPTION_PAGE_FLIP,
- TRUE);
- if (sw_cursor || info->shadow_primary) {
- xf86DrvMsg(pScrn->scrnIndex,
- info->allowPageFlip ? X_WARNING : X_DEFAULT,
- "KMS Pageflipping: disabled%s\n",
- info->allowPageFlip ?
- (sw_cursor ? " because of SWcursor" :
- " because of ShadowPrimary") : "");
- info->allowPageFlip = FALSE;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "KMS Pageflipping: %sabled\n",
- info->allowPageFlip ? "en" : "dis");
+ if (!amdgpu_is_gpu_scrn(pScrn)) {
+ sw_cursor = xf86ReturnOptValBool(info->Options,
+ OPTION_SW_CURSOR, FALSE);
+
+ info->allowPageFlip = xf86ReturnOptValBool(info->Options,
+ OPTION_PAGE_FLIP,
+ TRUE);
+ if (sw_cursor || info->shadow_primary) {
+ xf86DrvMsg(pScrn->scrnIndex,
+ info->allowPageFlip ? X_WARNING : X_DEFAULT,
+ "KMS Pageflipping: disabled%s\n",
+ info->allowPageFlip ?
+ (sw_cursor ? " because of SWcursor" :
+ " because of ShadowPrimary") : "");
+ info->allowPageFlip = FALSE;
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_INFO,
+ "KMS Pageflipping: %sabled\n",
+ info->allowPageFlip ? "en" : "dis");
+ }
}
if (xf86ReturnOptValBool(info->Options, OPTION_DELETE_DP12, FALSE)) {
@@ -1736,30 +1739,32 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
}
#endif
- value = xorgGetVersion() >= XORG_VERSION_NUMERIC(1,18,3,0,0);
- from = X_DEFAULT;
+ if (!amdgpu_is_gpu_screen(pScreen)) {
+ value = xorgGetVersion() >= XORG_VERSION_NUMERIC(1,18,3,0,0);
+ from = X_DEFAULT;
- if (info->use_glamor) {
- if (xf86GetOptValBool(info->Options, OPTION_DRI3, &value))
- from = X_CONFIG;
+ if (info->use_glamor) {
+ if (xf86GetOptValBool(info->Options, OPTION_DRI3, &value))
+ from = X_CONFIG;
- if (xf86GetOptValInteger(info->Options, OPTION_DRI, &driLevel) &&
- (driLevel == 2 || driLevel == 3)) {
- from = X_CONFIG;
- value = driLevel == 3;
+ if (xf86GetOptValInteger(info->Options, OPTION_DRI, &driLevel) &&
+ (driLevel == 2 || driLevel == 3)) {
+ from = X_CONFIG;
+ value = driLevel == 3;
+ }
}
- }
- if (value) {
- value = amdgpu_sync_init(pScreen) &&
- amdgpu_present_screen_init(pScreen) &&
- amdgpu_dri3_screen_init(pScreen);
+ if (value) {
+ value = amdgpu_sync_init(pScreen) &&
+ amdgpu_present_screen_init(pScreen) &&
+ amdgpu_dri3_screen_init(pScreen);
- if (!value)
- from = X_WARNING;
- }
+ if (!value)
+ from = X_WARNING;
+ }
- xf86DrvMsg(pScrn->scrnIndex, from, "DRI3 %sabled\n", value ? "en" : "dis");
+ xf86DrvMsg(pScrn->scrnIndex, from, "DRI3 %sabled\n", value ? "en" : "dis");
+ }
pScrn->vtSema = TRUE;
xf86SetBackingStore(pScreen);
@@ -1819,7 +1824,8 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
*/
/* xf86DiDGAInit(pScreen, info->LinearAddr + pScrn->fbOffset); */
#endif
- if (info->shadow_fb == FALSE) {
+ if (info->shadow_fb == FALSE &&
+ !amdgpu_is_gpu_screen(pScreen)) {
/* Init Xv */
xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, AMDGPU_LOGLEVEL_DEBUG,
"Initializing Xv\n");
@@ -1835,12 +1841,14 @@ Bool AMDGPUScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
}
pScrn->pScreen = pScreen;
- if (serverGeneration == 1 && bgNoneRoot && info->use_glamor) {
- info->CreateWindow = pScreen->CreateWindow;
- pScreen->CreateWindow = AMDGPUCreateWindow_oneshot;
+ if (!amdgpu_is_gpu_screen(pScreen)) {
+ if (serverGeneration == 1 && bgNoneRoot && info->use_glamor) {
+ info->CreateWindow = pScreen->CreateWindow;
+ pScreen->CreateWindow = AMDGPUCreateWindow_oneshot;
+ }
+ info->WindowExposures = pScreen->WindowExposures;
+ pScreen->WindowExposures = AMDGPUWindowExposures_oneshot;
}
- info->WindowExposures = pScreen->WindowExposures;
- pScreen->WindowExposures = AMDGPUWindowExposures_oneshot;
/* Provide SaveScreen & wrap BlockHandler and CloseScreen */
/* Wrap CloseScreen */
--
2.11.0
More information about the amd-gfx
mailing list