diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-06-08 16:39:10 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-06-14 18:24:49 +0900 |
commit | 641f4647b7f51dfd2da330376cd10fa9702b6423 (patch) | |
tree | cfda43d2821bde02d158e8824260f8fddb9c8f3c /src/amdgpu_bo_helper.h | |
parent | 8e40f190e4704c2802bf0f073f17e742786d0f18 (diff) |
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>
Diffstat (limited to 'src/amdgpu_bo_helper.h')
-rw-r--r-- | src/amdgpu_bo_helper.h | 16 |
1 files changed, 16 insertions, 0 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 */ |