Skip to contentSkip to conversation

Fixes for building against older Xorg

PATCH In review Michel Dänzer 2 participants 5 messages Mar 6, 2017 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

cover Fixes for building against older Xorg

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

This fixes all errors down to Xorg 1.10.

One warning remains, see below. This could be silenced by casting the return value of amdgpu_get_marketing_name to (char*), but that's ugly and doesn't seem worth it.

../../src/amdgpu_kms.c: In function ‘AMDGPUPreInitChipType_KMS’:
../../src/amdgpu_kms.c:1174:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]

  pScrn->chipset = amdgpu_get_marketing_name(pAMDGPUEnt->pDev);
                 ^

Michel Dänzer (3):
Don't use pScrn->is_gpu in AMDGPUCreateScreenResources_KMS Use local implementation of RegionDuplicate for older xserver Only define transform_region for XF86_CRTC_VERSION >= 4

 configure.ac     |  6 ++++++
 src/amdgpu_drv.h | 19 +++++++++++++++++++
 src/amdgpu_kms.c |  6 +++++-
 3 files changed, 30 insertions(+), 1 deletion(-)
Signature · 6 lines
2.11.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): 20170306093303.32723-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

#2 lore raw

PATCH 1/3 Don't use pScrn->is_gpu in AMDGPUCreateScreenResources_KMS

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

Looks like this snuck in accidentally.

Brings us back in line with the radeon driver, and fixes the build against older versions of xserver which didn't have the is_gpu field yet.

Fixes 6bab8fabb37e ("Remove info->dri2.drm_fd and info->drmmode->fd")
---
 src/amdgpu_kms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/amdgpu_kms.c +1 -1
index c5205e25a..bfc353096 100644
@@ -248,7 +248,7 @@ static Bool AMDGPUCreateScreenResources_KMS(ScreenPtr pScreen)
 		}
 	}
 
-	if (!drmmode_set_desired_modes(pScrn, &info->drmmode, pScrn->is_gpu))
+	if (!drmmode_set_desired_modes(pScrn, &info->drmmode, FALSE))
 		return FALSE;
 
 	drmmode_uevent_init(pScrn, &info->drmmode);
Signature · 6 lines
2.11.0

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

PATCH 2/3 Use local implementation of RegionDuplicate for older xserver

In reply to a message not in the archive

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

It was only added in xserver 1.15. Fixes build against older xserver.

(Ported from radeon commit 80cc892ee1ce54fad3cb7dd11bd9df18c359136f)

---
 configure.ac     |  6 ++++++
 src/amdgpu_drv.h | 19 +++++++++++++++++++
 2 files changed, 25 insertions(+)
configure.ac +6 -0
index 11dc28544..00249a599 100644
@@ -152,6 +152,12 @@ else
 fi
 AM_CONDITIONAL(GLAMOR, test x$GLAMOR != xno)
 
+AC_CHECK_DECL(RegionDuplicate,
+	      [AC_DEFINE(HAVE_REGIONDUPLICATE, 1,
+	      [Have RegionDuplicate API])], [],
+	      [#include <xorg-server.h>
+	       #include <regionstr.h>])
+
 AC_CHECK_DECL(fbGlyphs,
 	      [AC_DEFINE(HAVE_FBGLYPHS, 1, [Have fbGlyphs API])], [],
 	      [#include <X11/Xmd.h>
src/amdgpu_drv.h +19 -0
index ae5b6f94c..0700daecb 100644
@@ -89,6 +89,25 @@
 
 struct _SyncFence;
 
+#ifndef HAVE_REGIONDUPLICATE
+
+static inline RegionPtr
+RegionDuplicate(RegionPtr pOld)
+{
+	RegionPtr pNew;
+
+	pNew = RegionCreate(&pOld->extents, 0);
+	if (!pNew)
+		return NULL;
+	if (!RegionCopy(pNew, pOld)) {
+		RegionDestroy(pNew);
+		return NULL;
+	}
+	return pNew;
+}
+
+#endif
+
 #ifndef MAX
 #define MAX(a,b) ((a)>(b)?(a):(b))
 #endif
Signature · 6 lines
2.11.0

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

PATCH 3/3 Only define transform_region for XF86_CRTC_VERSION >= 4

In reply to a message not in the archive

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

Not used with older versions of Xorg. Fixes warning in that case:

../../src/amdgpu_kms.c:328:1: warning: ‘transform_region’ defined but not used [-Wunused-function]
transform_region(RegionPtr region, struct pict_f_transform *transform, ^~~~~~~~~~~~~~~~

---
 src/amdgpu_kms.c | 4 ++++
 1 file changed, 4 insertions(+)
src/amdgpu_kms.c +4 -0
index bfc353096..d48ad480a 100644
@@ -324,6 +324,8 @@ amdgpu_scanout_extents_intersect(xf86CrtcPtr xf86_crtc, BoxPtr extents)
 	return (extents->x1 < extents->x2 && extents->y1 < extents->y2);
 }
 
+#if XF86_CRTC_VERSION >= 4
+
 static RegionPtr
 transform_region(RegionPtr region, struct pict_f_transform *transform,
 		 int w, int h)
@@ -362,6 +364,8 @@ transform_region(RegionPtr region, struct pict_f_transform *transform,
 	return transformed;
 }
 
+#endif
+
 static void
 amdgpu_sync_scanout_pixmaps(xf86CrtcPtr xf86_crtc, RegionPtr new_region,
 							int scanout_id)
Signature · 6 lines
2.11.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): 20170306093303.32723-4-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#6 lore raw

Re: [PATCH xf86-video-amdgpu 3/3] Only define transform_region for XF86_CRTC_VERSION >= 4

Quoted 9 lines · Michel Dänzer

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

Not used with older versions of Xorg. Fixes warning in that case:

../../src/amdgpu_kms.c:328:1: warning: ‘transform_region’ defined but not used [-Wunused-function]
transform_region(RegionPtr region, struct pict_f_transform *transform, ^~~~~~~~~~~~~~~~

For the series:

Quoted 29 lines
---
 src/amdgpu_kms.c | 4 ++++
 1 file changed, 4 insertions(+)
src/amdgpu_kms.c +4 -1
index bfc353096..d48ad480a 100644
@@ -324,6 +324,8 @@ amdgpu_scanout_extents_intersect(xf86CrtcPtr xf86_crtc, BoxPtr extents)
        return (extents->x1 < extents->x2 && extents->y1 < extents->y2);
 }
 
+#if XF86_CRTC_VERSION >= 4
+
 static RegionPtr
 transform_region(RegionPtr region, struct pict_f_transform *transform,
                 int w, int h)
@@ -362,6 +364,8 @@ transform_region(RegionPtr region, struct pict_f_transform *transform,
        return transformed;
 }
 
+#endif
+
 static void
 amdgpu_sync_scanout_pixmaps(xf86CrtcPtr xf86_crtc, RegionPtr new_region,
                                                        int scanout_id)
--

2.11.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