Skip to contentSkip to conversation

glamor: Check glamor module version for depth 30 support

PATCH In review Michel Dänzer 2 participants 2 messages Aug 3, 2018 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 glamor: Check glamor module version for depth 30 support

From: Michel Dänzer <[email protected]>

Instead of the Xorg version. This should allow glamor backported from xserver >= 1.20 to work with older Xorg versions.

---
 src/amdgpu_glamor.c |  8 ++++++++
 src/amdgpu_kms.c    | 20 ++++++++------------
 2 files changed, 16 insertions(+), 12 deletions(-)
src/amdgpu_glamor.c +8 -0
index ea49f822f..13d68fe36 100644
@@ -99,6 +99,14 @@ Bool amdgpu_glamor_pre_init(ScrnInfoPtr scrn)
 		} else {
 			AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
 
+			if (scrn->depth == 30 &&
+			    version < MODULE_VERSION_NUMERIC(1, 0, 1)) {
+				xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+					   "Depth 30 requires glamor >= 1.0.1 (xserver 1.20),"
+					   " can't enable glamor\n");
+				return FALSE;
+			}
+
 			if (glamor_egl_init(scrn, pAMDGPUEnt->fd)) {
 				xf86DrvMsg(scrn->scrnIndex, X_INFO,
 					   "glamor detected, initialising EGL layer.\n");
src/amdgpu_kms.c +8 -12
index 7b13d777e..9807e084b 100644
@@ -1168,14 +1168,6 @@ static Bool AMDGPUPreInitAccel_KMS(ScrnInfoPtr pScrn)
 			use_glamor = FALSE;
 #endif
 
-		if (pScrn->depth == 30 && use_glamor &&
-		    xorgGetVersion() < XORG_VERSION_NUMERIC(1,19,99,1,0)) {
-			xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-				   "Depth 30 is not supported by GLAMOR with "
-				   "Xorg < 1.19.99.1\n");
-			goto shadowfb;
-		}
-
 #ifdef DRI2
 		info->dri2.available = ! !xf86LoadSubModule(pScrn, "dri2");
 #endif
@@ -1184,16 +1176,20 @@ static Bool AMDGPUPreInitAccel_KMS(ScrnInfoPtr pScrn)
 			info->gbm = gbm_create_device(pAMDGPUEnt->fd);
 
 		if (info->gbm) {
-			if (!use_glamor ||
-			    amdgpu_glamor_pre_init(pScrn))
-				return TRUE;
+			if (use_glamor) {
+				if (amdgpu_glamor_pre_init(pScrn))
+					return TRUE;
+
+				xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+					   "amdgpu_glamor_pre_init returned "
+					   "FALSE, using ShadowFB\n");
+			}
 		} else {
 			xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
 				   "gbm_create_device returned NULL, using "
 				   "ShadowFB\n");
 		}
 	} else {
-shadowfb:
 		xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
 			   "GPU acceleration disabled, using ShadowFB\n");
 	}
Signature · 6 lines
2.18.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180803155320.26670-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 6 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

Instead of the Xorg version. This should allow glamor backported from xserver >= 1.20 to work with older Xorg versions.

Quoted 71 lines
---
 src/amdgpu_glamor.c |  8 ++++++++
 src/amdgpu_kms.c    | 20 ++++++++------------
 2 files changed, 16 insertions(+), 12 deletions(-)
src/amdgpu_glamor.c +8 -0
index ea49f822f..13d68fe36 100644
@@ -99,6 +99,14 @@ Bool amdgpu_glamor_pre_init(ScrnInfoPtr scrn)
                } else {
                        AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
 
+                       if (scrn->depth == 30 &&
+                           version < MODULE_VERSION_NUMERIC(1, 0, 1)) {
+                               xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+                                          "Depth 30 requires glamor >= 1.0.1 (xserver 1.20),"
+                                          " can't enable glamor\n");
+                               return FALSE;
+                       }
+
                        if (glamor_egl_init(scrn, pAMDGPUEnt->fd)) {
                                xf86DrvMsg(scrn->scrnIndex, X_INFO,
                                           "glamor detected, initialising EGL layer.\n");
src/amdgpu_kms.c +8 -13
index 7b13d777e..9807e084b 100644
@@ -1168,14 +1168,6 @@ static Bool AMDGPUPreInitAccel_KMS(ScrnInfoPtr pScrn)
                        use_glamor = FALSE;
 #endif
 
-               if (pScrn->depth == 30 && use_glamor &&
-                   xorgGetVersion() < XORG_VERSION_NUMERIC(1,19,99,1,0)) {
-                       xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
-                                  "Depth 30 is not supported by GLAMOR with "
-                                  "Xorg < 1.19.99.1\n");
-                       goto shadowfb;
-               }
-
 #ifdef DRI2
                info->dri2.available = ! !xf86LoadSubModule(pScrn, "dri2");
 #endif
@@ -1184,16 +1176,20 @@ static Bool AMDGPUPreInitAccel_KMS(ScrnInfoPtr pScrn)
                        info->gbm = gbm_create_device(pAMDGPUEnt->fd);
 
                if (info->gbm) {
-                       if (!use_glamor ||
-                           amdgpu_glamor_pre_init(pScrn))
-                               return TRUE;
+                       if (use_glamor) {
+                               if (amdgpu_glamor_pre_init(pScrn))
+                                       return TRUE;
+
+                               xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+                                          "amdgpu_glamor_pre_init returned "
+                                          "FALSE, using ShadowFB\n");
+                       }
                } else {
                        xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
                                   "gbm_create_device returned NULL, using "
                                   "ShadowFB\n");
                }
        } else {
-shadowfb:
                xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
                           "GPU acceleration disabled, using ShadowFB\n");
        }
--

2.18.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx