drm/sun4i: frontend: Add support for tiled YUV input mode configuration

This introduces the data input mode definitions for the tiled YUV mode,
that are used in the input mode helper if tiling is requested.

The modifier is passed to the helper from the framebuffer to determine
if tiling is requested.

Only semiplanar and planar YUV formats are supported for tiling mode.

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-13-paul.kocialkowski@bootlin.com
This commit is contained in:
Paul Kocialkowski 2019-01-18 15:51:22 +01:00 committed by Maxime Ripard
parent 08cba016cd
commit 172b789977
No known key found for this signature in database
GPG Key ID: E3EF0D6F671851C5
2 changed files with 12 additions and 4 deletions

View File

@ -191,19 +191,23 @@ sun4i_frontend_drm_format_to_input_fmt(const struct drm_format_info *format,
static int static int
sun4i_frontend_drm_format_to_input_mode(const struct drm_format_info *format, sun4i_frontend_drm_format_to_input_mode(const struct drm_format_info *format,
u32 *val) uint64_t modifier, u32 *val)
{ {
bool tiled = (modifier == DRM_FORMAT_MOD_ALLWINNER_TILED);
switch (format->num_planes) { switch (format->num_planes) {
case 1: case 1:
*val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED; *val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED;
return 0; return 0;
case 2: case 2:
*val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_SEMIPLANAR; *val = tiled ? SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_MB32_SEMIPLANAR
: SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_SEMIPLANAR;
return 0; return 0;
case 3: case 3:
*val = SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PLANAR; *val = tiled ? SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_MB32_PLANAR
: SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PLANAR;
return 0; return 0;
default: default:
@ -325,6 +329,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;
const struct drm_format_info *format = fb->format; const struct drm_format_info *format = fb->format;
uint64_t modifier = fb->modifier;
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;
unsigned int i; unsigned int i;
@ -337,7 +342,8 @@ int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
return ret; return ret;
} }
ret = sun4i_frontend_drm_format_to_input_mode(format, &in_mod_val); ret = sun4i_frontend_drm_format_to_input_mode(format, modifier,
&in_mod_val);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("Invalid input mode\n"); DRM_DEBUG_DRIVER("Invalid input mode\n");
return ret; return ret;

View File

@ -33,6 +33,8 @@
#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PLANAR (0 << 8) #define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PLANAR (0 << 8)
#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED (1 << 8) #define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_PACKED (1 << 8)
#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_SEMIPLANAR (2 << 8) #define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_SEMIPLANAR (2 << 8)
#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_MB32_PLANAR (4 << 8)
#define SUN4I_FRONTEND_INPUT_FMT_DATA_MOD_MB32_SEMIPLANAR (6 << 8)
#define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV444 (0 << 4) #define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV444 (0 << 4)
#define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV422 (1 << 4) #define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV422 (1 << 4)
#define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV420 (2 << 4) #define SUN4I_FRONTEND_INPUT_FMT_DATA_FMT_YUV420 (2 << 4)