[Mesa-dev] [PATCH 1/3] gbm: Move gbm_format_canonicalize() to the core.

Eric Anholt eric at anholt.net
Thu Nov 8 18:01:36 UTC 2018


I want it for the format name debugging code.
---
 src/gbm/backends/dri/gbm_dri.c | 16 ----------------
 src/gbm/main/gbm.c             | 16 ++++++++++++++++
 src/gbm/main/gbmint.h          |  3 +++
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 35ec3a1c3a2a..f32c0cd9885f 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -594,22 +594,6 @@ static const struct gbm_dri_visual gbm_dri_visuals_table[] = {
    },
 };
 
-/* The two GBM_BO_FORMAT_[XA]RGB8888 formats alias the GBM_FORMAT_*
- * formats of the same name. We want to accept them whenever someone
- * has a GBM format, but never return them to the user. */
-static int
-gbm_format_canonicalize(uint32_t gbm_format)
-{
-   switch (gbm_format) {
-   case GBM_BO_FORMAT_XRGB8888:
-      return GBM_FORMAT_XRGB8888;
-   case GBM_BO_FORMAT_ARGB8888:
-      return GBM_FORMAT_ARGB8888;
-   default:
-      return gbm_format;
-   }
-}
-
 static int
 gbm_format_to_dri_format(uint32_t gbm_format)
 {
diff --git a/src/gbm/main/gbm.c b/src/gbm/main/gbm.c
index 0bf2922bacdd..d301661b48ee 100644
--- a/src/gbm/main/gbm.c
+++ b/src/gbm/main/gbm.c
@@ -695,3 +695,19 @@ gbm_surface_has_free_buffers(struct gbm_surface *surf)
 {
    return surf->gbm->surface_has_free_buffers(surf);
 }
+
+/* The two GBM_BO_FORMAT_[XA]RGB8888 formats alias the GBM_FORMAT_*
+ * formats of the same name. We want to accept them whenever someone
+ * has a GBM format, but never return them to the user. */
+uint32_t
+gbm_format_canonicalize(uint32_t gbm_format)
+{
+   switch (gbm_format) {
+   case GBM_BO_FORMAT_XRGB8888:
+      return GBM_FORMAT_XRGB8888;
+   case GBM_BO_FORMAT_ARGB8888:
+      return GBM_FORMAT_ARGB8888;
+   default:
+      return gbm_format;
+   }
+}
diff --git a/src/gbm/main/gbmint.h b/src/gbm/main/gbmint.h
index 9220a4ae87da..192577431e25 100644
--- a/src/gbm/main/gbmint.h
+++ b/src/gbm/main/gbmint.h
@@ -133,4 +133,7 @@ struct gbm_backend {
    struct gbm_device *(*create_device)(int fd);
 };
 
+uint32_t
+gbm_format_canonicalize(uint32_t gbm_format);
+
 #endif
-- 
2.19.1



More information about the mesa-dev mailing list