[PATCH xf86-video-amdgpu 4/6] Consolidate get_drawable_pixmap helper
Michel Dänzer
michel at daenzer.net
Wed Jun 8 08:45:17 UTC 2016
From: Michel Dänzer <michel.daenzer at amd.com>
There were two static helpers for the same purpose. Consolidate them
into a single inline helper which can be used anywhere.
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/amdgpu_bo_helper.h | 16 ++++++++++++++++
src/amdgpu_dri2.c | 9 ---------
src/amdgpu_glamor_wrappers.c | 18 ------------------
3 files changed, 16 insertions(+), 27 deletions(-)
diff --git a/src/amdgpu_bo_helper.h b/src/amdgpu_bo_helper.h
index efbdcda..26fca16 100644
--- a/src/amdgpu_bo_helper.h
+++ b/src/amdgpu_bo_helper.h
@@ -104,4 +104,20 @@ struct amdgpu_buffer *amdgpu_gem_bo_open_prime(amdgpu_device_handle pDev,
int fd_handle,
uint32_t size);
+/**
+ * get_drawable_pixmap() returns the backing pixmap for a given drawable.
+ *
+ * @param drawable the drawable being requested.
+ *
+ * This function returns the backing pixmap for a drawable, whether it is a
+ * redirected window, unredirected window, or already a pixmap.
+ */
+static inline PixmapPtr get_drawable_pixmap(DrawablePtr drawable)
+{
+ if (drawable->type == DRAWABLE_PIXMAP)
+ return (PixmapPtr)drawable;
+ else
+ return drawable->pScreen->GetWindowPixmap((WindowPtr)drawable);
+}
+
#endif /* AMDGPU_BO_HELPER_H */
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 27a0c1a..5f978c9 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -98,15 +98,6 @@ amdgpu_get_flink_name(AMDGPUEntPtr pAMDGPUEnt, PixmapPtr pixmap, uint32_t *name)
return TRUE;
}
-static PixmapPtr get_drawable_pixmap(DrawablePtr drawable)
-{
- if (drawable->type == DRAWABLE_PIXMAP)
- return (PixmapPtr) drawable;
- else
- return (*drawable->pScreen->
- GetWindowPixmap) ((WindowPtr) drawable);
-}
-
static PixmapPtr fixup_glamor(DrawablePtr drawable, PixmapPtr pixmap)
{
PixmapPtr old = get_drawable_pixmap(drawable);
diff --git a/src/amdgpu_glamor_wrappers.c b/src/amdgpu_glamor_wrappers.c
index 35b6d7e..81b212d 100644
--- a/src/amdgpu_glamor_wrappers.c
+++ b/src/amdgpu_glamor_wrappers.c
@@ -39,24 +39,6 @@
#include "amdgpu_pixmap.h"
-/**
- * get_drawable_pixmap() returns the backing pixmap for a given drawable.
- *
- * @param pDrawable the drawable being requested.
- *
- * This function returns the backing pixmap for a drawable, whether it is a
- * redirected window, unredirected window, or already a pixmap.
- */
-static PixmapPtr
-get_drawable_pixmap(DrawablePtr pDrawable)
-{
- if (pDrawable->type == DRAWABLE_WINDOW)
- return pDrawable->pScreen->
- GetWindowPixmap((WindowPtr) pDrawable);
- else
- return (PixmapPtr) pDrawable;
-}
-
/* Are there any outstanding GPU operations for this pixmap? */
static Bool
amdgpu_glamor_gpu_pending(uint_fast32_t gpu_synced, uint_fast32_t gpu_access)
--
2.8.1
More information about the xorg-driver-ati
mailing list