drm/tinydrm: Advertise that we can do only DRM_FORMAT_MOD_LINEAR.

Without this, the xserver relies on what the 3D driver exposes and
assumes that the display can handle it, and then the DRM driver
happily tries to scan out a tiled format.

Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20181025162635.6689-1-eric@anholt.net
Acked-by: Noralf Trønnes <noralf@tronnes.org>
This commit is contained in:
Eric Anholt 2018-10-25 09:26:35 -07:00
parent 01f23459cf
commit dff906c3f9
3 changed files with 14 additions and 1 deletions

View File

@ -190,6 +190,13 @@ static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane,
pipe->funcs->cleanup_fb(pipe, state); pipe->funcs->cleanup_fb(pipe, state);
} }
static bool drm_simple_kms_format_mod_supported(struct drm_plane *plane,
uint32_t format,
uint64_t modifier)
{
return modifier == DRM_FORMAT_MOD_LINEAR;
}
static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = { static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = {
.prepare_fb = drm_simple_kms_plane_prepare_fb, .prepare_fb = drm_simple_kms_plane_prepare_fb,
.cleanup_fb = drm_simple_kms_plane_cleanup_fb, .cleanup_fb = drm_simple_kms_plane_cleanup_fb,
@ -204,6 +211,7 @@ static const struct drm_plane_funcs drm_simple_kms_plane_funcs = {
.reset = drm_atomic_helper_plane_reset, .reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
.format_mod_supported = drm_simple_kms_format_mod_supported,
}; };
/** /**

View File

@ -146,6 +146,7 @@ static int tinydrm_init(struct device *parent, struct tinydrm_device *tdev,
drm->dev_private = tdev; drm->dev_private = tdev;
drm_mode_config_init(drm); drm_mode_config_init(drm);
drm->mode_config.funcs = &tinydrm_mode_config_funcs; drm->mode_config.funcs = &tinydrm_mode_config_funcs;
drm->mode_config.allow_fb_modifiers = true;
return 0; return 0;
} }

View File

@ -184,6 +184,10 @@ tinydrm_display_pipe_init(struct tinydrm_device *tdev,
struct drm_display_mode mode_copy; struct drm_display_mode mode_copy;
struct drm_connector *connector; struct drm_connector *connector;
int ret; int ret;
static const uint64_t modifiers[] = {
DRM_FORMAT_MOD_LINEAR,
DRM_FORMAT_MOD_INVALID
};
drm_mode_copy(&mode_copy, mode); drm_mode_copy(&mode_copy, mode);
ret = tinydrm_rotate_mode(&mode_copy, rotation); ret = tinydrm_rotate_mode(&mode_copy, rotation);
@ -202,6 +206,6 @@ tinydrm_display_pipe_init(struct tinydrm_device *tdev,
return PTR_ERR(connector); return PTR_ERR(connector);
return drm_simple_display_pipe_init(drm, &tdev->pipe, funcs, formats, return drm_simple_display_pipe_init(drm, &tdev->pipe, funcs, formats,
format_count, NULL, connector); format_count, modifiers, connector);
} }
EXPORT_SYMBOL(tinydrm_display_pipe_init); EXPORT_SYMBOL(tinydrm_display_pipe_init);