Commit 02a3ce3c authored by Paul Kocialkowski's avatar Paul Kocialkowski Committed by Maxime Ripard

drm/sun4i: Pass modifier to backend and frontend format support helpers

To prepare the introduction of tiled mode support, pass the framebuffer
format modifier to the helpers dealing with format support.

Since only linear mode is supported for now, add corresponding checks in
each helper.
Signed-off-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181123092515.2511-33-paul.kocialkowski@bootlin.com
parent b36d9584
...@@ -175,10 +175,13 @@ static const uint32_t sun4i_backend_formats[] = { ...@@ -175,10 +175,13 @@ static const uint32_t sun4i_backend_formats[] = {
DRM_FORMAT_YVYU, DRM_FORMAT_YVYU,
}; };
bool sun4i_backend_format_is_supported(uint32_t fmt) bool sun4i_backend_format_is_supported(uint32_t fmt, uint64_t modifier)
{ {
unsigned int i; unsigned int i;
if (modifier != DRM_FORMAT_MOD_LINEAR)
return false;
for (i = 0; i < ARRAY_SIZE(sun4i_backend_formats); i++) for (i = 0; i < ARRAY_SIZE(sun4i_backend_formats); i++)
if (sun4i_backend_formats[i] == fmt) if (sun4i_backend_formats[i] == fmt)
return true; return true;
...@@ -454,14 +457,15 @@ static bool sun4i_backend_plane_uses_frontend(struct drm_plane_state *state) ...@@ -454,14 +457,15 @@ static bool sun4i_backend_plane_uses_frontend(struct drm_plane_state *state)
struct sun4i_layer *layer = plane_to_sun4i_layer(state->plane); struct sun4i_layer *layer = plane_to_sun4i_layer(state->plane);
struct sun4i_backend *backend = layer->backend; struct sun4i_backend *backend = layer->backend;
uint32_t format = state->fb->format->format; uint32_t format = state->fb->format->format;
uint64_t modifier = state->fb->modifier;
if (IS_ERR(backend->frontend)) if (IS_ERR(backend->frontend))
return false; return false;
if (!sun4i_frontend_format_is_supported(format)) if (!sun4i_frontend_format_is_supported(format, modifier))
return false; return false;
if (!sun4i_backend_format_is_supported(format)) if (!sun4i_backend_format_is_supported(format, modifier))
return true; return true;
/* /*
......
...@@ -198,7 +198,7 @@ engine_to_sun4i_backend(struct sunxi_engine *engine) ...@@ -198,7 +198,7 @@ engine_to_sun4i_backend(struct sunxi_engine *engine)
void sun4i_backend_layer_enable(struct sun4i_backend *backend, void sun4i_backend_layer_enable(struct sun4i_backend *backend,
int layer, bool enable); int layer, bool enable);
bool sun4i_backend_format_is_supported(uint32_t fmt); bool sun4i_backend_format_is_supported(uint32_t fmt, uint64_t modifier);
int sun4i_backend_update_layer_coord(struct sun4i_backend *backend, int sun4i_backend_update_layer_coord(struct sun4i_backend *backend,
int layer, struct drm_plane *plane); int layer, struct drm_plane *plane);
int sun4i_backend_update_layer_formats(struct sun4i_backend *backend, int sun4i_backend_update_layer_formats(struct sun4i_backend *backend,
......
...@@ -163,10 +163,13 @@ static const uint32_t sun4i_frontend_formats[] = { ...@@ -163,10 +163,13 @@ static const uint32_t sun4i_frontend_formats[] = {
DRM_FORMAT_XRGB8888, DRM_FORMAT_XRGB8888,
}; };
bool sun4i_frontend_format_is_supported(uint32_t fmt) bool sun4i_frontend_format_is_supported(uint32_t fmt, uint64_t modifier)
{ {
unsigned int i; unsigned int i;
if (modifier != DRM_FORMAT_MOD_LINEAR)
return false;
for (i = 0; i < ARRAY_SIZE(sun4i_frontend_formats); i++) for (i = 0; i < ARRAY_SIZE(sun4i_frontend_formats); i++)
if (sun4i_frontend_formats[i] == fmt) if (sun4i_frontend_formats[i] == fmt)
return true; return true;
......
...@@ -97,6 +97,6 @@ void sun4i_frontend_update_coord(struct sun4i_frontend *frontend, ...@@ -97,6 +97,6 @@ void sun4i_frontend_update_coord(struct sun4i_frontend *frontend,
struct drm_plane *plane); struct drm_plane *plane);
int sun4i_frontend_update_formats(struct sun4i_frontend *frontend, int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
struct drm_plane *plane, uint32_t out_fmt); struct drm_plane *plane, uint32_t out_fmt);
bool sun4i_frontend_format_is_supported(uint32_t fmt); bool sun4i_frontend_format_is_supported(uint32_t fmt, uint64_t modifier);
#endif /* _SUN4I_FRONTEND_H_ */ #endif /* _SUN4I_FRONTEND_H_ */
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