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

Thomas Zimmermann tzimmermann at suse.de
Fri Nov 18 13:22:21 UTC 2022


Hi

Am 18.11.22 um 14:08 schrieb Javier Martinez Canillas:
> 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 ?

That makes sense.

> 
>> +	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.

The driver uses XRGB8888, so the 24-bit color depth has a 32-bit bpp 
value. Hence the switch.

Best regards
Thomas

> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20221118/dd36fc34/attachment.sig>


More information about the dri-devel mailing list