[PATCH 09/12] drm/ast: Introduce dedicated cursor-plane state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The cursor-plane state struct ast_cursor_plane_state will store the
involved cursor source BO's mapping into kernel address space.

Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
---
 drivers/gpu/drm/ast/ast_mode.c | 40 ++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index b9b9badcee00..199ad9f9c932 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -749,6 +749,16 @@ static void ast_set_cursor_enabled(struct ast_private *ast, bool enabled)
 	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, mask, vgacrcb);
 }
 
+struct ast_cursor_plane_state {
+	struct drm_plane_state base;
+};
+
+static inline struct ast_cursor_plane_state *
+to_ast_cursor_plane_state(struct drm_plane_state *state)
+{
+	return container_of(state, struct ast_cursor_plane_state, base);
+}
+
 static const uint32_t ast_cursor_plane_formats[] = {
 	DRM_FORMAT_ARGB8888,
 };
@@ -913,13 +923,39 @@ static void ast_cursor_plane_destroy(struct drm_plane *plane)
 	drm_plane_cleanup(plane);
 }
 
+static struct drm_plane_state *
+ast_cursor_plane_atomic_duplicate_state(struct drm_plane *plane)
+{
+	struct ast_cursor_plane_state *new_ast_state;
+	struct drm_device *dev = plane->dev;
+
+	if (drm_WARN_ON(dev, !plane->state))
+		return NULL;
+
+	new_ast_state = kmalloc(sizeof(*new_ast_state), GFP_KERNEL);
+	if (!new_ast_state)
+		return NULL;
+	__drm_atomic_helper_plane_duplicate_state(plane, &new_ast_state->base);
+
+	return &new_ast_state->base;
+}
+
+static void ast_cursor_plane_atomic_destroy_state(struct drm_plane *plane,
+						  struct drm_plane_state *state)
+{
+	struct ast_cursor_plane_state *ast_state = to_ast_cursor_plane_state(state);
+
+	__drm_atomic_helper_plane_destroy_state(&ast_state->base);
+	kfree(ast_state);
+}
+
 static const struct drm_plane_funcs ast_cursor_plane_funcs = {
 	.update_plane = drm_atomic_helper_update_plane,
 	.disable_plane = drm_atomic_helper_disable_plane,
 	.destroy = ast_cursor_plane_destroy,
 	.reset = drm_atomic_helper_plane_reset,
-	.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
-	.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
+	.atomic_duplicate_state = ast_cursor_plane_atomic_duplicate_state,
+	.atomic_destroy_state = ast_cursor_plane_atomic_destroy_state,
 };
 
 static int ast_cursor_plane_init(struct ast_private *ast)
-- 
2.30.0

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux