]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/sun4i: frontend: Add a helper and a list for supported formats
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Fri, 23 Nov 2018 09:24:37 +0000 (10:24 +0100)
committerMaxime Ripard <maxime.ripard@bootlin.com>
Tue, 27 Nov 2018 08:33:37 +0000 (09:33 +0100)
In order to check whether the frontend supports a specific format, an
explicit list and a related helper are introduced.

Just like in the backend, the prototype of the helper is added to the
frontend header so that it can be used later on. The helper is also
exported because it will be used outside of the frontend module.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181123092515.2511-6-paul.kocialkowski@bootlin.com
drivers/gpu/drm/sun4i/sun4i_frontend.c
drivers/gpu/drm/sun4i/sun4i_frontend.h

index 3ea9255848912b645f4c750e5cc92c4654ef35b8..0f7f8c7b340228702282672e462a07eba661ae24 100644 (file)
@@ -128,6 +128,22 @@ static int sun4i_frontend_drm_format_to_output_fmt(uint32_t fmt, u32 *val)
        }
 }
 
+static const uint32_t sun4i_frontend_formats[] = {
+       DRM_FORMAT_XRGB8888,
+};
+
+bool sun4i_frontend_format_is_supported(uint32_t fmt)
+{
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(sun4i_frontend_formats); i++)
+               if (sun4i_frontend_formats[i] == fmt)
+                       return true;
+
+       return false;
+}
+EXPORT_SYMBOL(sun4i_frontend_format_is_supported);
+
 int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
                                  struct drm_plane *plane, uint32_t out_fmt)
 {
index 02661ce81f3e31c81e8203b6fcc42f0914937bc8..a9cb908ced16230b5f9b4eefec2aeba48b03a7ba 100644 (file)
@@ -95,5 +95,6 @@ void sun4i_frontend_update_coord(struct sun4i_frontend *frontend,
                                 struct drm_plane *plane);
 int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
                                  struct drm_plane *plane, uint32_t out_fmt);
+bool sun4i_frontend_format_is_supported(uint32_t fmt);
 
 #endif /* _SUN4I_FRONTEND_H_ */