drm/sun4i: Fix formats usable by the primary plane
PATCH 1/3 drm/sun4i: Fix formats usable by the primary plane
Even though all our planes can support the ARGB formats, the lowest plane (ie the primary plane) cannot use the alpha component, otherwise it will just result in the transparent area being entirely black.
Since some applications will still require the ARGB format, let's force the format to XRGB to drop the alpha component entirely.
--- drivers/gpu/drm/sun4i/sun4i_backend.c | 9 ++++-- drivers/gpu/drm/sun4i/sun4i_layer.c | 56 ++++++++++++++++++++++++----------- 2 files changed, 46 insertions(+), 19 deletions(-)
drivers/gpu/drm/sun4i/sun4i_backend.c +7 -2
@@ -83,8 +83,13 @@ void sun4i_backend_layer_enable(struct sun4i_backend *backend, }EXPORT_SYMBOL (sun4i_backend_layer_enable); -static int sun4i_backend_drm_format_to_layer (u32 format,u32 *mode) +static int sun4i_backend_drm_format_to_layer (struct drm_plane *plane, +u32 format,u32 *mode) { +if ((plane->type ==DRM_PLANE_TYPE_PRIMARY ) && + (format ==DRM_FORMAT_ARGB8888 )) + format =DRM_FORMAT_XRGB8888 ; +switch (format) {case DRM_FORMAT_ARGB8888 : *mode =SUN4I_BACKEND_LAY_FBFMT_ARGB8888 ;
@@ -164,7 +169,7 @@ int sun4i_backend_update_layer_formats(struct sun4i_backend *backend,DRM_DEBUG_DRIVER ("Switching display backend interlaced mode %s\n" , interlaced ?"on" :"off" ); - ret =sun4i_backend_drm_format_to_layer (fb->pixel_format, &val); + ret =sun4i_backend_drm_format_to_layer (plane, fb->pixel_format, &val);if (ret) {DRM_DEBUG_DRIVER ("Invalid format\n" );return val;
drivers/gpu/drm/sun4i/sun4i_layer.c +39 -17
108 lines not on this page · raw message
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/3 drm/sun4i: tv: Check mode pointer
The drm_mode_create call might return NULL in case of a failure, and the current code doesn't check for that. Make sure it does.
--- drivers/gpu/drm/sun4i/sun4i_tv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/sun4i/sun4i_tv.c +7 -1
@@ -507,9 +507,15 @@ static int sun4i_tv_comp_get_modes(struct drm_connector *connector)int i;for (i =0 ; i <ARRAY_SIZE (tv_modes); i++) { -struct drm_display_mode *mode =drm_mode_create (connector->dev); +struct drm_display_mode *mode;struct tv_mode *tv_mode = &tv_modes[i]; + mode =drm_mode_create (connector->dev); +if (!mode) { +DRM_ERROR ("Failed to create a new display mode\n" ); +return 0 ; + } +strcpy (mode->name, tv_mode->name);sun4i_tv_mode_to_drm_mode (tv_mode, mode);
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/3 drm/sun4i: Fix the high buffer address mask
In reply to Maxime RipardThe highest 3bits of the 4 layers buffers are all part of the same register. However, our mask computation was wrong, leading to all the lowest register bits being removed when we use regmap_update_bits, which will lead to the buffers being set to some random part of the RAM.
Fix our mask.
--- drivers/gpu/drm/sun4i/sun4i_backend.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_backend.h +2 -2
@@ -52,8 +52,8 @@#define SUN4I_BACKEND_LAYFB_L32ADD_REG (l) (0x850 + (0x4 * (l)))#define SUN4I_BACKEND_LAYFB_H4ADD_REG 0x860 -#define SUN4I_BACKEND_LAYFB_H4ADD_MSK (l) GENMASK(3 + ((l) * 8), 0) -#define SUN4I_BACKEND_LAYFB_H4ADD (l, val) ((val) << ((l) * 8)) +#define SUN4I_BACKEND_LAYFB_H4ADD_MSK (l) GENMASK(3 + ((l) * 8), (l) * 8) +#define SUN4I_BACKEND_LAYFB_H4ADD (l, val) ((val) << ((l) * 8))#define SUN4I_BACKEND_REGBUFFCTL_REG 0x870#define SUN4I_BACKEND_REGBUFFCTL_AUTOLOAD_DIS BIT(1)
Signature · 6 lines
2.9.3 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel