diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-12-01 12:28:18 +0100 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2017-12-01 12:28:18 +0100 |
commit | 9de762055ba5713d3500f3f89bc3914ccf489267 (patch) | |
tree | 65a62ae01f2d32309f20298593a9a253567bef4c | |
parent | 232cfb3c551ceec97f9de8e3839b9953f67c0419 (diff) |
dri: use drm and local defines instead of gbm defines
It seems the design really doesn't want us to include gbm.h here.
-rw-r--r-- | dri.c | 39 |
1 files changed, 19 insertions, 20 deletions
@@ -24,7 +24,6 @@ #include <sys/mman.h> #include "drv_priv.h" -#include "gbm.h" #include "helpers.h" #include "util.h" @@ -51,26 +50,26 @@ static bool lookup_extension(const __DRIextension * const *extensions, } static const struct { - uint32_t gbm_format; + uint32_t drm_format; int dri_image_format; -} gbm_to_dri_image_formats[] = { - { GBM_FORMAT_R8, __DRI_IMAGE_FORMAT_R8 }, - { GBM_FORMAT_GR88, __DRI_IMAGE_FORMAT_GR88 }, - { GBM_FORMAT_RGB565, __DRI_IMAGE_FORMAT_RGB565 }, - { GBM_FORMAT_XRGB8888, __DRI_IMAGE_FORMAT_XRGB8888 }, - { GBM_FORMAT_ARGB8888, __DRI_IMAGE_FORMAT_ARGB8888 }, - { GBM_FORMAT_XBGR8888, __DRI_IMAGE_FORMAT_XBGR8888 }, - { GBM_FORMAT_ABGR8888, __DRI_IMAGE_FORMAT_ABGR8888 }, - { GBM_FORMAT_XRGB2101010, __DRI_IMAGE_FORMAT_XRGB2101010 }, - { GBM_FORMAT_ARGB2101010, __DRI_IMAGE_FORMAT_ARGB2101010 }, +} drm_to_dri_image_formats[] = { + { DRM_FORMAT_R8, __DRI_IMAGE_FORMAT_R8 }, + { DRM_FORMAT_GR88, __DRI_IMAGE_FORMAT_GR88 }, + { DRM_FORMAT_RGB565, __DRI_IMAGE_FORMAT_RGB565 }, + { DRM_FORMAT_XRGB8888, __DRI_IMAGE_FORMAT_XRGB8888 }, + { DRM_FORMAT_ARGB8888, __DRI_IMAGE_FORMAT_ARGB8888 }, + { DRM_FORMAT_XBGR8888, __DRI_IMAGE_FORMAT_XBGR8888 }, + { DRM_FORMAT_ABGR8888, __DRI_IMAGE_FORMAT_ABGR8888 }, + { DRM_FORMAT_XRGB2101010, __DRI_IMAGE_FORMAT_XRGB2101010 }, + { DRM_FORMAT_ARGB2101010, __DRI_IMAGE_FORMAT_ARGB2101010 }, }; static int -gbm_format_to_dri_format(uint32_t gbm_format) +drm_format_to_dri_format(uint32_t drm_format) { - for (unsigned i = 0; i < ARRAY_SIZE(gbm_to_dri_image_formats); i++) { - if (gbm_to_dri_image_formats[i].gbm_format == gbm_format) - return gbm_to_dri_image_formats[i].dri_image_format; + for (unsigned i = 0; i < ARRAY_SIZE(drm_to_dri_image_formats); i++) { + if (drm_to_dri_image_formats[i].drm_format == drm_format) + return drm_to_dri_image_formats[i].dri_image_format; } return 0; @@ -166,14 +165,14 @@ int dri_bo_create(struct bo *bo, uint32_t width, uint32_t height, uint32_t forma if (!bo_dri) return -1; - int dri_format = gbm_format_to_dri_format(format); + int dri_format = drm_format_to_dri_format(format); unsigned dri_use = 0; - if (use_flags & GBM_BO_USE_SCANOUT) + if (use_flags & BO_USE_SCANOUT) dri_use |= __DRI_IMAGE_USE_SCANOUT; - if (use_flags & GBM_BO_USE_CURSOR) + if (use_flags & BO_USE_CURSOR) dri_use |= __DRI_IMAGE_USE_CURSOR; - if (use_flags & GBM_BO_USE_LINEAR) + if (use_flags & BO_USE_LINEAR) dri_use |= __DRI_IMAGE_USE_LINEAR; /* Gallium drivers requires shared in order to get the handle/stride */ |