Commit 915bf9fe authored by Paul Kocialkowski's avatar Paul Kocialkowski Committed by Maxime Ripard

drm/sun4i: frontend: Pass DRM format info to input format helpers

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: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Acked-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190118145133.21281-5-paul.kocialkowski@bootlin.com
parent 0fff724a
...@@ -104,9 +104,11 @@ void sun4i_frontend_update_buffer(struct sun4i_frontend *frontend, ...@@ -104,9 +104,11 @@ void sun4i_frontend_update_buffer(struct sun4i_frontend *frontend,
} }
EXPORT_SYMBOL(sun4i_frontend_update_buffer); 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: case DRM_FORMAT_XRGB8888:
*val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB; *val = SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_RGB;
return 0; return 0;
...@@ -116,9 +118,11 @@ static int sun4i_frontend_drm_format_to_input_fmt(uint32_t fmt, u32 *val) ...@@ -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; *val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED;
else else
return -EINVAL; return -EINVAL;
...@@ -126,9 +130,11 @@ static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val) ...@@ -126,9 +130,11 @@ static int sun4i_frontend_drm_format_to_input_mode(uint32_t fmt, u32 *val)
return 0; 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: case DRM_FORMAT_BGRX8888:
*val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_BGRX; *val = SUN4I_FRONTEND_INPUT_FMT_DATA_PS_BGRX;
return 0; return 0;
...@@ -183,7 +189,7 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend, ...@@ -183,7 +189,7 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
{ {
struct drm_plane_state *state = plane->state; struct drm_plane_state *state = plane->state;
struct drm_framebuffer *fb = state->fb; 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 out_fmt_val;
u32 in_fmt_val, in_mod_val, in_ps_val; u32 in_fmt_val, in_mod_val, in_ps_val;
int ret; int ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment