drm/format-helper: Add RGB888-to-XRGB8888 conversion
authorThomas Zimmermann <tzimmermann@suse.de>
Mon, 25 Apr 2022 07:59:38 +0000 (09:59 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Wed, 27 Apr 2022 06:51:57 +0000 (08:51 +0200)
commit26c30f223123b7feff0ca8722af2f93935b08b85
tree787a5a2a4558fe6c36e8dd2f4d10492c308c48bc
parent7e553e2ab79a13511bb84559287c06db80a461b1
drm/format-helper: Add RGB888-to-XRGB8888 conversion

Add a format helper that converts RGB888 to XRGB8888. Use this
function in drm_fb_blit_toio(). Fixes simpledrm output for this
combination of formats.

UEFI and/or Grub will usually set 32-bit output in XRGB8888 format.
The issue can be reproduced by enabling simpledrm and requesting a
console framebuffer of different format on the kernel command line;
for example

  nomodeset video=1024x768-24

In this case, conversion helpers will display nothing on the console.
The patch makes this work by implementing the rsp conversion helpers.
It also enables odd userspace configurations, such as running Xorg
with 24-bit color depth on a 32-bit output buffer.

v2:
* use helpers for struct drm_rect (Javier)
* improve commit message (Javier)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220425075939.30450-3-tzimmermann@suse.de
drivers/gpu/drm/drm_format_helper.c