]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/sun4i: frontend: Pass DRM format info to input format helpers
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Fri, 18 Jan 2019 14:51:14 +0000 (15:51 +0100)
committerMaxime Ripard <maxime.ripard@bootlin.com>
Fri, 18 Jan 2019 18:00:45 +0000 (19:00 +0100)
The helper returning the input mode needs to know the number of planes
for the provided format. Passing the fourcc requires iterating through
the format info list in order to return the number of planes.

Pass the DRM format info structure directly instead to all helpers
related to configuring the input format, since it's available to the
caller. Also rename the input format in the caller function to keep
things consistent.

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

index 1a7ebc45747ec9d9c498adb6a793625661eff945..dd5af30190990d201eeae5f136ae9289c35b2377 100644 (file)
@@ -104,9 +104,11 @@ void sun4i_frontend_update_buffer(struct sun4i_frontend *frontend,
 }
 EXPORT_SYMBOL(sun4i_frontend_update_buffer);
 
-static int sun4i_frontend_drm_format_to_input_fmt(uint32_t fmt, u32 *val)
+static int
+sun4i_frontend_drm_format_to_input_fmt(const struct drm_format_info *format,
+                                      u32 *val)
 {
-       switch (fmt) {
+       switch (format->format) {
        case DRM_FORMAT_XRGB8888:
                *val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB;
                return 0;
@@ -116,9 +118,11 @@ static int sun4i_frontend_drm_format_to_input_fmt(uint32_t fmt, u32 *val)
        }
 }
 
-static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val)
+static int
+sun4i_frontend_drm_format_to_input_mode(const struct drm_format_info *format,
+                                       u32 *val)
 {
-       if (drm_format_num_planes(fmt) == 1)
+       if (format->num_planes == 1)
                *val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED;
        else
                return -EINVAL;
@@ -126,9 +130,11 @@ static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val)
        return 0;
 }
 
-static int sun4i_frontend_drm_format_to_input_sequence(uint32_t fmt, u32 *val)
+static int
+sun4i_frontend_drm_format_to_input_sequence(const struct drm_format_info *format,
+                                           u32 *val)
 {
-       switch (fmt) {
+       switch (format->format) {
        case DRM_FORMAT_BGRX8888:
                *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_BGRX;
                return 0;
@@ -183,7 +189,7 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
 {
        struct drm_plane_state *state = plane->state;
        struct drm_framebuffer *fb = state->fb;
-       uint32_t format = fb->format->format;
+       const struct drm_format_info *format = fb->format;
        u32 out_fmt_val;
        u32 in_fmt_val, in_mod_val, in_ps_val;
        int ret;