Commit 90367458 authored by Thomas Zimmermann's avatar Thomas Zimmermann

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: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Acked-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Tested-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231009141018.11291-3-tzimmermann@suse.de
parent 38b2d9d3
...@@ -218,7 +218,14 @@ void ...@@ -218,7 +218,14 @@ void
__drm_gem_duplicate_shadow_plane_state(struct drm_plane *plane, __drm_gem_duplicate_shadow_plane_state(struct drm_plane *plane,
struct drm_shadow_plane_state *new_shadow_plane_state) struct drm_shadow_plane_state *new_shadow_plane_state)
{ {
struct drm_plane_state *plane_state = plane->state;
struct drm_shadow_plane_state *shadow_plane_state =
to_drm_shadow_plane_state(plane_state);
__drm_atomic_helper_plane_duplicate_state(plane, &new_shadow_plane_state->base); __drm_atomic_helper_plane_duplicate_state(plane, &new_shadow_plane_state->base);
drm_format_conv_state_copy(&shadow_plane_state->fmtcnv_state,
&new_shadow_plane_state->fmtcnv_state);
} }
EXPORT_SYMBOL(__drm_gem_duplicate_shadow_plane_state); EXPORT_SYMBOL(__drm_gem_duplicate_shadow_plane_state);
...@@ -266,6 +273,7 @@ EXPORT_SYMBOL(drm_gem_duplicate_shadow_plane_state); ...@@ -266,6 +273,7 @@ EXPORT_SYMBOL(drm_gem_duplicate_shadow_plane_state);
*/ */
void __drm_gem_destroy_shadow_plane_state(struct drm_shadow_plane_state *shadow_plane_state) void __drm_gem_destroy_shadow_plane_state(struct drm_shadow_plane_state *shadow_plane_state)
{ {
drm_format_conv_state_release(&shadow_plane_state->fmtcnv_state);
__drm_atomic_helper_plane_destroy_state(&shadow_plane_state->base); __drm_atomic_helper_plane_destroy_state(&shadow_plane_state->base);
} }
EXPORT_SYMBOL(__drm_gem_destroy_shadow_plane_state); EXPORT_SYMBOL(__drm_gem_destroy_shadow_plane_state);
...@@ -302,6 +310,7 @@ void __drm_gem_reset_shadow_plane(struct drm_plane *plane, ...@@ -302,6 +310,7 @@ void __drm_gem_reset_shadow_plane(struct drm_plane *plane,
struct drm_shadow_plane_state *shadow_plane_state) struct drm_shadow_plane_state *shadow_plane_state)
{ {
__drm_atomic_helper_plane_reset(plane, &shadow_plane_state->base); __drm_atomic_helper_plane_reset(plane, &shadow_plane_state->base);
drm_format_conv_state_init(&shadow_plane_state->fmtcnv_state);
} }
EXPORT_SYMBOL(__drm_gem_reset_shadow_plane); EXPORT_SYMBOL(__drm_gem_reset_shadow_plane);
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <linux/iosys-map.h> #include <linux/iosys-map.h>
#include <drm/drm_format_helper.h>
#include <drm/drm_fourcc.h> #include <drm/drm_fourcc.h>
#include <drm/drm_plane.h> #include <drm/drm_plane.h>
...@@ -49,6 +50,15 @@ struct drm_shadow_plane_state { ...@@ -49,6 +50,15 @@ struct drm_shadow_plane_state {
/** @base: plane state */ /** @base: plane state */
struct drm_plane_state base; struct drm_plane_state base;
/**
* @fmtcnv_state: Format-conversion state
*
* Per-plane state for format conversion.
* Flags for copying shadow buffers into backend storage. Also holds
* temporary storage for format conversion.
*/
struct drm_format_conv_state fmtcnv_state;
/* Transitional state - do not export or duplicate */ /* Transitional state - do not export or duplicate */
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment