diff options
author | Kevin Strasser <[email protected]> | 2019-01-24 16:32:48 -0800 |
---|---|---|
committer | Adam Jackson <[email protected]> | 2019-08-21 18:36:57 +0000 |
commit | 7b4ed2b513efad86616e932eb4bca20557addc78 (patch) | |
tree | 9379268ee850c2bac41c54eea8a10ae0a5b9aea1 /src/gbm | |
parent | 3562f48c9d58793429fc5ea655b8b4629b495ce0 (diff) |
egl: Convert configs to use shifts and sizes instead of masks
Change dri2_add_config to take arrays of shifts and sizes, and compare with
those set in the dri config. Convert all platform driver masks
to shifts and sizes.
In order to handle older drivers, where shift attributes aren't available,
we fall back to the mask attributes and compute the shifts with ffs.
Signed-off-by: Kevin Strasser <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/gbm')
-rw-r--r-- | src/gbm/backends/dri/gbm_dri.c | 36 | ||||
-rw-r--r-- | src/gbm/backends/dri/gbm_driint.h | 16 |
2 files changed, 35 insertions, 17 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 8d7e4babc3a..8f1668d476b 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -478,51 +478,63 @@ dri_screen_create_sw(struct gbm_dri_device *dri) static const struct gbm_dri_visual gbm_dri_visuals_table[] = { { GBM_FORMAT_R8, __DRI_IMAGE_FORMAT_R8, - { 0x000000ff, 0x00000000, 0x00000000, 0x00000000 }, + { 0, -1, -1, -1 }, + { 8, 0, 0, 0 }, }, { GBM_FORMAT_GR88, __DRI_IMAGE_FORMAT_GR88, - { 0x000000ff, 0x0000ff00, 0x00000000, 0x00000000 }, + { 0, 8, -1, -1 }, + { 8, 8, 0, 0 }, }, { GBM_FORMAT_ARGB1555, __DRI_IMAGE_FORMAT_ARGB1555, - { 0x00007c00, 0x000003e0, 0x0000001f, 0x00008000 }, + { 10, 5, 0, 11 }, + { 5, 5, 5, 1 }, }, { GBM_FORMAT_RGB565, __DRI_IMAGE_FORMAT_RGB565, - { 0x0000f800, 0x000007e0, 0x0000001f, 0x00000000 }, + { 11, 5, 0, -1 }, + { 5, 6, 5, 0 }, }, { GBM_FORMAT_XRGB8888, __DRI_IMAGE_FORMAT_XRGB8888, - { 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000 }, + { 16, 8, 0, -1 }, + { 8, 8, 8, 0 }, }, { GBM_FORMAT_ARGB8888, __DRI_IMAGE_FORMAT_ARGB8888, - { 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000 }, + { 16, 8, 0, 24 }, + { 8, 8, 8, 8 }, }, { GBM_FORMAT_XBGR8888, __DRI_IMAGE_FORMAT_XBGR8888, - { 0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000 }, + { 0, 8, 16, -1 }, + { 8, 8, 8, 0 }, }, { GBM_FORMAT_ABGR8888, __DRI_IMAGE_FORMAT_ABGR8888, - { 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 }, + { 0, 8, 16, 24 }, + { 8, 8, 8, 8 }, }, { GBM_FORMAT_XRGB2101010, __DRI_IMAGE_FORMAT_XRGB2101010, - { 0x3ff00000, 0x000ffc00, 0x000003ff, 0x00000000 }, + { 20, 10, 0, -1 }, + { 10, 10, 10, 0 }, }, { GBM_FORMAT_ARGB2101010, __DRI_IMAGE_FORMAT_ARGB2101010, - { 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000 }, + { 20, 10, 0, 30 }, + { 10, 10, 10, 2 }, }, { GBM_FORMAT_XBGR2101010, __DRI_IMAGE_FORMAT_XBGR2101010, - { 0x000003ff, 0x000ffc00, 0x3ff00000, 0x00000000 }, + { 0, 10, 20, -1 }, + { 10, 10, 10, 0 }, }, { GBM_FORMAT_ABGR2101010, __DRI_IMAGE_FORMAT_ABGR2101010, - { 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000 }, + { 0, 10, 20, 30 }, + { 10, 10, 10, 2 }, }, }; diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h index 8497be3e8f6..75299bdb846 100644 --- a/src/gbm/backends/dri/gbm_driint.h +++ b/src/gbm/backends/dri/gbm_driint.h @@ -44,11 +44,17 @@ struct gbm_dri_visual { uint32_t gbm_format; int dri_image_format; struct { - uint32_t red; - uint32_t green; - uint32_t blue; - uint32_t alpha; - } rgba_masks; + int red; + int green; + int blue; + int alpha; + } rgba_shifts; + struct { + unsigned int red; + unsigned int green; + unsigned int blue; + unsigned int alpha; + } rgba_sizes; }; struct gbm_dri_device { |