dri-devel Archive on lore.kernel.org
 help / color / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: airlied@redhat.com, daniel@ffwll.ch
Cc: Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org
Subject: [PATCH 09/12] drm/ast: Introduce dedicated cursor-plane state
Date: Wed, 27 Jan 2021 13:02:59 +0100
Message-ID: <20210127120302.13532-10-tzimmermann@suse.de> (raw)
In-Reply-To: <20210127120302.13532-1-tzimmermann@suse.de>

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@suse.de>
---
 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply index

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27 12:02 [PATCH 00/12] drm/ast: Move cursor vmap calls out of commit tail Thomas Zimmermann
2021-01-27 12:02 ` [PATCH 01/12] drm/ast: Add constants for VGACRCB register bits Thomas Zimmermann
2021-01-27 12:02 ` [PATCH 02/12] drm/ast: Fix invalid usage of AST_MAX_HWC_WIDTH in cursor atomic_check Thomas Zimmermann
2021-01-27 12:02 ` [PATCH 03/12] drm/ast: Initialize planes in helper functions Thomas Zimmermann
2021-01-27 12:02 ` [PATCH 04/12] drm/ast: Allocate HW cursor BOs during cursor-plane initialization Thomas Zimmermann
2021-01-27 12:02 ` [PATCH 05/12] drm/ast: Inline ast cursor-update functions into modesetting code Thomas Zimmermann
2021-01-27 12:02 ` [PATCH 06/12] drm/ast: Add cursor-plane data structure Thomas Zimmermann
2021-01-27 12:02 ` [PATCH 07/12] drm/ast: Store cursor BOs in cursor plane Thomas Zimmermann
2021-01-27 12:02 ` [PATCH 08/12] drm/ast: Map HW cursor BOs permanently Thomas Zimmermann
2021-01-27 12:02 ` Thomas Zimmermann [this message]
2021-01-27 12:03 ` [PATCH 10/12] drm/ast: Fix cursor BO pinning and mapping Thomas Zimmermann
2021-01-27 13:40   ` Thomas Zimmermann
2021-01-27 12:03 ` [PATCH 11/12] drm/ast: Move all of the cursor-update functionality to atomic_update Thomas Zimmermann
2021-01-27 12:03 ` [PATCH 12/12] drm/ast: Store each HW cursor offset after pinning the rsp BO Thomas Zimmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210127120302.13532-10-tzimmermann@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

dri-devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dri-devel/0 dri-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dri-devel dri-devel/ https://lore.kernel.org/dri-devel \
		dri-devel@lists.freedesktop.org
	public-inbox-index dri-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.dri-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git