[PATCH 2/7] drm/logicvc: Fix preferred fbdev cpp

Javier Martinez Canillas javierm at redhat.com
Fri Nov 18 13:08:52 UTC 2022


On 11/16/22 17:09, Thomas Zimmermann wrote:
> Logicvc can have different values for the preferred color depth. Set
> the fbdev bpp value depending on the runtime value.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
>  drivers/gpu/drm/logicvc/logicvc_drm.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/logicvc/logicvc_drm.c b/drivers/gpu/drm/logicvc/logicvc_drm.c
> index 9de24d9f0c963..d9cd5d967e31f 100644
> --- a/drivers/gpu/drm/logicvc/logicvc_drm.c
> +++ b/drivers/gpu/drm/logicvc/logicvc_drm.c
> @@ -301,6 +301,7 @@ static int logicvc_drm_probe(struct platform_device *pdev)
>  	struct regmap *regmap = NULL;
>  	struct resource res;
>  	void __iomem *base;
> +	unsigned int preferred_bpp;
>  	int irq;
>  	int ret;
>  
> @@ -438,7 +439,18 @@ static int logicvc_drm_probe(struct platform_device *pdev)
>  		goto error_mode;
>  	}
>  
> -	drm_fbdev_generic_setup(drm_dev, drm_dev->mode_config.preferred_depth);
> +	switch (drm_dev->mode_config.preferred_depth) {
> +	case 15:

Why could have 15? IIUC the formats supported by this driver are:

static uint32_t logicvc_layer_formats_rgb16[] = {
	DRM_FORMAT_RGB565,
	DRM_FORMAT_BGR565,
	DRM_FORMAT_INVALID,
};

static uint32_t logicvc_layer_formats_rgb24[] = {
	DRM_FORMAT_XRGB8888,
	DRM_FORMAT_XBGR8888,
	DRM_FORMAT_INVALID,
};

/*
 * What we call depth in this driver only counts color components, not alpha.
 * This allows us to stay compatible with the LogiCVC bistream definitions.
 */
static uint32_t logicvc_layer_formats_rgb24_alpha[] = {
	DRM_FORMAT_ARGB8888,
	DRM_FORMAT_ABGR8888,
	DRM_FORMAT_INVALID,
};

So shouldn't be just 16, 24 and 32 ?

> +	case 16:
> +		preferred_bpp = 16;
> +		break;
> +	case 24:
> +	case 32:
> +	default:
> +		preferred_bpp = 32;
> +		break;

I'm also not sure if this is needed. Since IIUC in logicvc_mode_init() the
driver does:

	preferred_depth = layer_primary->formats->depth;

	/* DRM counts alpha in depth, our driver doesn't. */
	if (layer_primary->formats->alpha)
		preferred_depth += 8;

	...
	mode_config->preferred_depth = preferred_depth;

So it seems this patch is not needed? Unless I'm misunderstanding the code.

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat



More information about the dri-devel mailing list