drm/ofdrm: Set preferred depth from format of scanout buffer
authorThomas Zimmermann <tzimmermann@suse.de>
Wed, 23 Nov 2022 11:53:45 +0000 (12:53 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Thu, 24 Nov 2022 13:07:52 +0000 (14:07 +0100)
Set the preferred depth from the format of the scanout buffer. The
value cannot be hardcoded, as the scanout buffer is only known at
runtime. Keeping the existing switch statement just duplicates the
driver's existing logic for format detection.

Also remove the FIXME comment from the call to drm_fbdev_generic_setup()
as the driver now handles color depth and bpp values correctly.

v2:
* fix commit-message typo

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20221123115348.2521-5-tzimmermann@suse.de
drivers/gpu/drm/tiny/ofdrm.c

index dc9e4d71b12ae9644e00d84b9c26598d00ec8585..33eefeba437c5f7b8406a3755a15fb8f90192c52 100644 (file)
@@ -1284,14 +1284,7 @@ static struct ofdrm_device *ofdrm_device_create(struct drm_driver *drv,
        dev->mode_config.min_height = height;
        dev->mode_config.max_height = max_height;
        dev->mode_config.funcs = &ofdrm_mode_config_funcs;
-       switch (depth) {
-       case 32:
-               dev->mode_config.preferred_depth = 24;
-               break;
-       default:
-               dev->mode_config.preferred_depth = depth;
-               break;
-       }
+       dev->mode_config.preferred_depth = format->depth;
        dev->mode_config.quirk_addfb_prefer_host_byte_order = true;
 
        /* Primary plane */
@@ -1390,10 +1383,6 @@ static int ofdrm_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       /*
-        * FIXME: 24-bit color depth does not work reliably with a 32-bpp
-        * value. Force the bpp value of the scanout buffer's format.
-        */
        drm_fbdev_generic_setup(dev, drm_format_info_bpp(odev->format, 0));
 
        return 0;