summaryrefslogtreecommitdiff
path: root/src/gbm/backends/dri/gbm_dri.c
diff options
context:
space:
mode:
authorJames Jones <jajones@nvidia.com>2021-06-03 15:24:43 -0700
committerMarge Bot <eric+marge@anholt.net>2021-07-06 16:57:59 +0000
commitf98bcd2f5b1501e51053e2abfbde4fce1a6e51a5 (patch)
treefd7c3b7abb208fa76c4492285976e7a608301308 /src/gbm/backends/dri/gbm_dri.c
parent45bd17610ce10c1b99a966f56a517789cd36ae29 (diff)
gbm: Add gbm_core struct to export code to backends
The GBM core/loader code defines one helper function used by both itself and the built-in DRI backend. Presumably, external backend authors would want to use such functions as well, so package them into a single struct that will be passed explicitly to externally loaded backends in subsequent changes. Another option considered was to simply export the gbm_format_canonicalize() function directly, optionally renaming it to better indicate it is intended only for "internal" use first. However, even with a rename, this would expose it to potential use by applications as well, which is not ideal, as it is not intended to be part of the application-facing GBM ABI. Signed-off-by: James Jones <jajones@nvidia.com> Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9902>
Diffstat (limited to 'src/gbm/backends/dri/gbm_dri.c')
-rw-r--r--src/gbm/backends/dri/gbm_dri.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index e1ec561a117..baac0909025 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -576,7 +576,7 @@ static const struct gbm_dri_visual gbm_dri_visuals_table[] = {
static int
gbm_format_to_dri_format(uint32_t gbm_format)
{
- gbm_format = gbm_format_canonicalize(gbm_format);
+ gbm_format = gbm_core.format_canonicalize(gbm_format);
for (size_t 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;
@@ -607,7 +607,7 @@ gbm_dri_is_format_supported(struct gbm_device *gbm,
if ((usage & GBM_BO_USE_CURSOR) && (usage & GBM_BO_USE_RENDERING))
return 0;
- format = gbm_format_canonicalize(format);
+ format = gbm_core.format_canonicalize(format);
if (gbm_format_to_dri_format(format) == 0)
return 0;
@@ -644,7 +644,7 @@ gbm_dri_get_format_modifier_plane_count(struct gbm_device *gbm,
!dri->image->queryDmaBufFormatModifierAttribs)
return -1;
- format = gbm_format_canonicalize(format);
+ format = gbm_core.format_canonicalize(format);
if (gbm_format_to_dri_format(format) == 0)
return -1;
@@ -992,7 +992,7 @@ gbm_dri_bo_import(struct gbm_device *gbm,
/* GBM's GBM_FORMAT_* tokens are a strict superset of the DRI FourCC
* tokens accepted by createImageFromFds, except for not supporting
* the sARGB format. */
- fourcc = gbm_format_canonicalize(fd_data->format);
+ fourcc = gbm_core.format_canonicalize(fd_data->format);
image = dri->image->createImageFromFds(dri->screen,
fd_data->width,
@@ -1025,7 +1025,7 @@ gbm_dri_bo_import(struct gbm_device *gbm,
/* GBM's GBM_FORMAT_* tokens are a strict superset of the DRI FourCC
* tokens accepted by createImageFromDmaBufs2, except for not supporting
* the sARGB format. */
- fourcc = gbm_format_canonicalize(fd_data->format);
+ fourcc = gbm_core.format_canonicalize(fd_data->format);
image = dri->image->createImageFromDmaBufs2(dri->screen, fd_data->width,
fd_data->height, fourcc,
@@ -1161,7 +1161,7 @@ gbm_dri_bo_create(struct gbm_device *gbm,
*/
assert(!(usage && count));
- format = gbm_format_canonicalize(format);
+ format = gbm_core.format_canonicalize(format);
if (usage & GBM_BO_USE_WRITE || dri->image == NULL)
return create_dumb(gbm, width, height, format, usage);
@@ -1322,7 +1322,7 @@ gbm_dri_surface_create(struct gbm_device *gbm,
surf->base.gbm = gbm;
surf->base.width = width;
surf->base.height = height;
- surf->base.format = gbm_format_canonicalize(format);
+ surf->base.format = gbm_core.format_canonicalize(format);
surf->base.flags = flags;
if (!modifiers) {
assert(!count);