Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/atomic-helper: Add format-conversion state to shadow-plane state

Store an instance of struct drm_format_conv_state in the shadow-plane
state struct drm_shadow_plane_state. Many drivers with shadow planes
use DRM's format helpers to copy or convert the framebuffer data to
backing storage in the scanout buffer. The shadow plane provides the
necessary state and manages the conversion's intermediate buffer memory.

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-3-tzimmermann@suse.de

+19
+9
drivers/gpu/drm/drm_gem_atomic_helper.c
··· 218 218 __drm_gem_duplicate_shadow_plane_state(struct drm_plane *plane, 219 219 struct drm_shadow_plane_state *new_shadow_plane_state) 220 220 { 221 + struct drm_plane_state *plane_state = plane->state; 222 + struct drm_shadow_plane_state *shadow_plane_state = 223 + to_drm_shadow_plane_state(plane_state); 224 + 221 225 __drm_atomic_helper_plane_duplicate_state(plane, &new_shadow_plane_state->base); 226 + 227 + drm_format_conv_state_copy(&shadow_plane_state->fmtcnv_state, 228 + &new_shadow_plane_state->fmtcnv_state); 222 229 } 223 230 EXPORT_SYMBOL(__drm_gem_duplicate_shadow_plane_state); 224 231 ··· 273 266 */ 274 267 void __drm_gem_destroy_shadow_plane_state(struct drm_shadow_plane_state *shadow_plane_state) 275 268 { 269 + drm_format_conv_state_release(&shadow_plane_state->fmtcnv_state); 276 270 __drm_atomic_helper_plane_destroy_state(&shadow_plane_state->base); 277 271 } 278 272 EXPORT_SYMBOL(__drm_gem_destroy_shadow_plane_state); ··· 310 302 struct drm_shadow_plane_state *shadow_plane_state) 311 303 { 312 304 __drm_atomic_helper_plane_reset(plane, &shadow_plane_state->base); 305 + drm_format_conv_state_init(&shadow_plane_state->fmtcnv_state); 313 306 } 314 307 EXPORT_SYMBOL(__drm_gem_reset_shadow_plane); 315 308
+10
include/drm/drm_gem_atomic_helper.h
··· 5 5 6 6 #include <linux/iosys-map.h> 7 7 8 + #include <drm/drm_format_helper.h> 8 9 #include <drm/drm_fourcc.h> 9 10 #include <drm/drm_plane.h> 10 11 ··· 49 48 struct drm_shadow_plane_state { 50 49 /** @base: plane state */ 51 50 struct drm_plane_state base; 51 + 52 + /** 53 + * @fmtcnv_state: Format-conversion state 54 + * 55 + * Per-plane state for format conversion. 56 + * Flags for copying shadow buffers into backend storage. Also holds 57 + * temporary storage for format conversion. 58 + */ 59 + struct drm_format_conv_state fmtcnv_state; 52 60 53 61 /* Transitional state - do not export or duplicate */ 54 62