Consolidate get_drawable_pixmap helper

There were two static helpers for the same purpose. Consolidate them
into a single inline helper which can be used anywhere.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Qiang Yu <qiang.yu@amd.com>
(Cherry picked from commit 641f4647b7)
This commit is contained in:
Michel Dänzer
2016-09-14 16:48:46 +09:00
committed by Michel Dänzer
parent 5be3295cb2
commit 7dc2c5bae5
3 changed files with 16 additions and 27 deletions

View File

@@ -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 */

View File

@@ -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);

View File

@@ -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)