aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>2018-11-23 04:25:04 -0500
committerMaxime Ripard <maxime.ripard@bootlin.com>2018-11-27 04:12:56 -0500
commit02a3ce3c2a67f3c3693029bc650f0c0571d9a3a2 (patch)
tree99a24c8e39fb4b711f1fd113ed34655e6ab9089b
parentb36d95846117dc47cd5a7e854a862aa2b509026b (diff)
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: Paul Kocialkowski <paul.kocialkowski@bootlin.com> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181123092515.2511-33-paul.kocialkowski@bootlin.com
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_backend.c10
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_backend.h2
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_frontend.c5
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_frontend.h2
4 files changed, 13 insertions, 6 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c
index f43c4b0f1e5d..9e9255ee59cd 100644
--- a/drivers/gpu/drm/sun4i/sun4i_backend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_backend.c
@@ -175,10 +175,13 @@ static const uint32_t sun4i_backend_formats[] = {
175 DRM_FORMAT_YVYU, 175 DRM_FORMAT_YVYU,
176}; 176};
177 177
178bool sun4i_backend_format_is_supported(uint32_t fmt) 178bool sun4i_backend_format_is_supported(uint32_t fmt, uint64_t modifier)
179{ 179{
180 unsigned int i; 180 unsigned int i;
181 181
182 if (modifier != DRM_FORMAT_MOD_LINEAR)
183 return false;
184
182 for (i = 0; i < ARRAY_SIZE(sun4i_backend_formats); i++) 185 for (i = 0; i < ARRAY_SIZE(sun4i_backend_formats); i++)
183 if (sun4i_backend_formats[i] == fmt) 186 if (sun4i_backend_formats[i] == fmt)
184 return true; 187 return true;
@@ -454,14 +457,15 @@ static bool sun4i_backend_plane_uses_frontend(struct drm_plane_state *state)
454 struct sun4i_layer *layer = plane_to_sun4i_layer(state->plane); 457 struct sun4i_layer *layer = plane_to_sun4i_layer(state->plane);
455 struct sun4i_backend *backend = layer->backend; 458 struct sun4i_backend *backend = layer->backend;
456 uint32_t format = state->fb->format->format; 459 uint32_t format = state->fb->format->format;
460 uint64_t modifier = state->fb->modifier;
457 461
458 if (IS_ERR(backend->frontend)) 462 if (IS_ERR(backend->frontend))
459 return false; 463 return false;
460 464
461 if (!sun4i_frontend_format_is_supported(format)) 465 if (!sun4i_frontend_format_is_supported(format, modifier))
462 return false; 466 return false;
463 467
464 if (!sun4i_backend_format_is_supported(format)) 468 if (!sun4i_backend_format_is_supported(format, modifier))
465 return true; 469 return true;
466 470
467 /* 471 /*
diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.h b/drivers/gpu/drm/sun4i/sun4i_backend.h
index 93db3af675b3..01f66463271b 100644
--- a/drivers/gpu/drm/sun4i/sun4i_backend.h
+++ b/drivers/gpu/drm/sun4i/sun4i_backend.h
@@ -198,7 +198,7 @@ engine_to_sun4i_backend(struct sunxi_engine *engine)
198 198
199void sun4i_backend_layer_enable(struct sun4i_backend *backend, 199void sun4i_backend_layer_enable(struct sun4i_backend *backend,
200 int layer, bool enable); 200 int layer, bool enable);
201bool sun4i_backend_format_is_supported(uint32_t fmt); 201bool sun4i_backend_format_is_supported(uint32_t fmt, uint64_t modifier);
202int sun4i_backend_update_layer_coord(struct sun4i_backend *backend, 202int sun4i_backend_update_layer_coord(struct sun4i_backend *backend,
203 int layer, struct drm_plane *plane); 203 int layer, struct drm_plane *plane);
204int sun4i_backend_update_layer_formats(struct sun4i_backend *backend, 204int sun4i_backend_update_layer_formats(struct sun4i_backend *backend,
diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.c b/drivers/gpu/drm/sun4i/sun4i_frontend.c
index 5d765764bff9..1a7ebc45747e 100644
--- a/drivers/gpu/drm/sun4i/sun4i_frontend.c
+++ b/drivers/gpu/drm/sun4i/sun4i_frontend.c
@@ -163,10 +163,13 @@ static const uint32_t sun4i_frontend_formats[] = {
163 DRM_FORMAT_XRGB8888, 163 DRM_FORMAT_XRGB8888,
164}; 164};
165 165
166bool sun4i_frontend_format_is_supported(uint32_t fmt) 166bool sun4i_frontend_format_is_supported(uint32_t fmt, uint64_t modifier)
167{ 167{
168 unsigned int i; 168 unsigned int i;
169 169
170 if (modifier != DRM_FORMAT_MOD_LINEAR)
171 return false;
172
170 for (i = 0; i < ARRAY_SIZE(sun4i_frontend_formats); i++) 173 for (i = 0; i < ARRAY_SIZE(sun4i_frontend_formats); i++)
171 if (sun4i_frontend_formats[i] == fmt) 174 if (sun4i_frontend_formats[i] == fmt)
172 return true; 175 return true;
diff --git a/drivers/gpu/drm/sun4i/sun4i_frontend.h b/drivers/gpu/drm/sun4i/sun4i_frontend.h
index 800a193eebc2..ad146e8d8d70 100644
--- a/drivers/gpu/drm/sun4i/sun4i_frontend.h
+++ b/drivers/gpu/drm/sun4i/sun4i_frontend.h
@@ -97,6 +97,6 @@ void sun4i_frontend_update_coord(struct sun4i_frontend *frontend,
97 struct drm_plane *plane); 97 struct drm_plane *plane);
98int sun4i_frontend_update_formats(struct sun4i_frontend *frontend, 98int sun4i_frontend_update_formats(struct sun4i_frontend *frontend,
99 struct drm_plane *plane, uint32_t out_fmt); 99 struct drm_plane *plane, uint32_t out_fmt);
100bool sun4i_frontend_format_is_supported(uint32_t fmt); 100bool sun4i_frontend_format_is_supported(uint32_t fmt, uint64_t modifier);
101 101
102#endif /* _SUN4I_FRONTEND_H_ */ 102#endif /* _SUN4I_FRONTEND_H_ */