diff options
author | Daniel Stone <[email protected]> | 2018-02-06 17:42:03 +0000 |
---|---|---|
committer | Daniel Stone <[email protected]> | 2018-02-09 16:17:16 +0000 |
commit | 314714ac5311c39785d16c0f03484dbaf482c52b (patch) | |
tree | cd52b8b949017c3e0b7a67cc356ce19d7b85852a /src/gbm/backends | |
parent | 2ed344645d65f379f819ffff6596b1b77534e28c (diff) |
gbm/dri: Expose visuals table through gbm_dri_device
Signed-off-by: Daniel Stone <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Tested-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/gbm/backends')
-rw-r--r-- | src/gbm/backends/dri/gbm_dri.c | 21 | ||||
-rw-r--r-- | src/gbm/backends/dri/gbm_driint.h | 9 |
2 files changed, 19 insertions, 11 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c index 7e2423e935f..0d088bd62b6 100644 --- a/src/gbm/backends/dri/gbm_dri.c +++ b/src/gbm/backends/dri/gbm_dri.c @@ -543,11 +543,7 @@ dri_screen_create_sw(struct gbm_dri_device *dri) return dri_screen_create_swrast(dri); } -static const struct { - uint32_t gbm_format; - int dri_image_format; - uint32_t rgba_masks[4]; -} gbm_to_dri_image_formats[] = { +static const struct gbm_dri_visual gbm_dri_visuals_table[] = { { GBM_FORMAT_R8, __DRI_IMAGE_FORMAT_R8, { 0x000000ff, 0x00000000, 0x00000000, 0x00000000 }, @@ -608,9 +604,9 @@ gbm_format_to_dri_format(uint32_t gbm_format) int i; gbm_format = gbm_format_canonicalize(gbm_format); - for (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 (i = 0; i < ARRAY_SIZE(gbm_dri_visuals_table); i++) { + if (gbm_dri_visuals_table[i].gbm_format == gbm_format) + return gbm_dri_visuals_table[i].dri_image_format; } return 0; @@ -621,9 +617,9 @@ gbm_dri_to_gbm_format(int dri_format) { int i; - for (i = 0; i < ARRAY_SIZE(gbm_to_dri_image_formats); i++) { - if (gbm_to_dri_image_formats[i].dri_image_format == dri_format) - return gbm_to_dri_image_formats[i].gbm_format; + for (i = 0; i < ARRAY_SIZE(gbm_dri_visuals_table); i++) { + if (gbm_dri_visuals_table[i].dri_image_format == dri_format) + return gbm_dri_visuals_table[i].gbm_format; } return 0; @@ -1418,6 +1414,9 @@ dri_device_create(int fd) dri->base.name = "drm"; + dri->visual_table = gbm_dri_visuals_table; + dri->num_visuals = ARRAY_SIZE(gbm_dri_visuals_table); + mtx_init(&dri->mutex, mtx_plain); force_sw = env_var_as_boolean("GBM_ALWAYS_SOFTWARE", false); diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h index db9038a623a..84a98533c79 100644 --- a/src/gbm/backends/dri/gbm_driint.h +++ b/src/gbm/backends/dri/gbm_driint.h @@ -40,6 +40,12 @@ struct gbm_dri_surface; struct gbm_dri_bo; +struct gbm_dri_visual { + uint32_t gbm_format; + int dri_image_format; + uint32_t rgba_masks[4]; +}; + struct gbm_dri_device { struct gbm_device base; @@ -97,6 +103,9 @@ struct gbm_dri_device { void *loaderPrivate); struct wl_drm *wl_drm; + + const struct gbm_dri_visual *visual_table; + int num_visuals; }; struct gbm_dri_bo { |