drm/format-helper: Cache buffers with struct drm_format_conv_state
authorThomas Zimmermann <tzimmermann@suse.de>
Mon, 9 Oct 2023 14:06:30 +0000 (16:06 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Tue, 14 Nov 2023 09:01:12 +0000 (10:01 +0100)
commit38b2d9d385102f430eb023aee1ed0ed37d9173f5
tree8d1d0ffaa6bdc0f7bb30165e46453e383d58631e
parentb0e396d68fef9c9c050dfbb590cc0066441f65c7
drm/format-helper: Cache buffers with struct drm_format_conv_state

Hold temporary memory for format conversion in an instance of struct
drm_format_conv_state. Update internal helpers of DRM's format-conversion
code accordingly. Drivers will later be able to maintain this cache by
themselves.

Besides caching, struct drm_format_conv_state will be useful to hold
additional information for format conversion, such as palette data or
foreground/background colors. This will enable conversion from indexed
color formats to component-based formats.

v5:
* improve documentation (Javier, Noralf)
v3:
* rename struct drm_xfrm_buf to struct drm_format_conv_state
  (Javier)
* remove managed cleanup
* add drm_format_conv_state_copy() for shadow-plane support

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Acked-by: Noralf Trønnes <noralf@tronnes.org>
Tested-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231009141018.11291-2-tzimmermann@suse.de
drivers/gpu/drm/drm_format_helper.c
include/drm/drm_format_helper.h