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

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

Reported-by: Pali Rohár <[email protected]>
(Ported from radeon commit 80cc892ee1ce54fad3cb7dd11bd9df18c359136f)

Signed-off-by: Michel Dänzer <[email protected]>
---
 configure.ac     |  6 ++++++
 src/amdgpu_drv.h | 19 +++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/configure.ac b/configure.ac
index 11dc28544..00249a599 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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>
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h
index ae5b6f94c..0700daecb 100644
--- a/src/amdgpu_drv.h
+++ b/src/amdgpu_drv.h
@@ -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
-- 
2.11.0

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

Reply via email to