public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Lyude Paul <lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 3/6] drm/atomic: Add ->atomic_check() hook for private objects
Date: Tue, 23 Oct 2018 19:12:48 -0400	[thread overview]
Message-ID: <20181023231251.16883-4-lyude@redhat.com> (raw)
In-Reply-To: <20181023231251.16883-1-lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Currently; private objects are mostly used just for driver-specific
atomic state, but not entirely. MST also uses private objects for
holding it's atomic state, but in order to make our MST helpers safer
for atomic we need to be able to check that state after the driver has
performed it's own checks on the atomic state. So, add an optional
->atomic_check() callback into drm_private_state_funcs that gets called
after the driver's atomic checks.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_atomic.c | 14 ++++++++++++++
 include/drm/drm_atomic.h     | 16 ++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 3dbfbddae7e6..2db9f219732b 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -966,6 +966,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
 	struct drm_crtc_state *crtc_state;
 	struct drm_connector *conn;
 	struct drm_connector_state *conn_state;
+	struct drm_private_obj *priv_obj;
+	struct drm_private_state *priv_state;
 	int i, ret = 0;
 
 	DRM_DEBUG_ATOMIC("checking %p\n", state);
@@ -1007,6 +1009,18 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
 		}
 	}
 
+	for_each_new_private_obj_in_state(state, priv_obj, priv_state, i) {
+		if (!priv_obj->funcs->atomic_check)
+			continue;
+
+		ret = priv_obj->funcs->atomic_check(priv_obj, priv_state);
+		if (ret) {
+			DRM_DEBUG_ATOMIC("[PRIVATE:%p] atomic check on state %p failed\n",
+					 priv_obj, priv_state);
+			return ret;
+		}
+	}
+
 	if (!state->allow_modeset) {
 		for_each_new_crtc_in_state(state, crtc, crtc_state, i) {
 			if (drm_atomic_crtc_needs_modeset(crtc_state)) {
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index f9b35834c45d..3e504eeb1122 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -216,6 +216,22 @@ struct drm_private_state_funcs {
 	 */
 	void (*atomic_destroy_state)(struct drm_private_obj *obj,
 				     struct drm_private_state *state);
+
+	/**
+	 * @atomic_check:
+	 *
+	 * Perform a check of the current state of the private object to
+	 * ensure that it's valid. This is an optional callback. If
+	 * implemented, it will be called after atomic checks have been
+	 * performed on all of the planes, CRTCs, connectors, and the new
+	 * &drm_mode_config in the atomic state.
+	 *
+	 * RETURNS:
+	 *
+	 * 0 on success, negative error code on failure.
+	 */
+	int (*atomic_check)(struct drm_private_obj *obj,
+			    struct drm_private_state *state);
 };
 
 /**
-- 
2.17.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2018-10-23 23:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-23 23:12 [PATCH 0/6] drm/dp_mst: Improve VCPI helpers, use in nouveau Lyude Paul
2018-10-23 23:12 ` [PATCH 1/6] drm/dp_mst: Deprecate drm_dp_find_vcpi_slots() Lyude Paul
2018-10-24  8:27   ` Daniel Vetter
2018-10-23 23:12 ` [PATCH 4/6] drm/dp_mst: Start tracking per-port VCPI allocations Lyude Paul
     [not found]   ` <20181023231251.16883-5-lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-10-24  8:55     ` Daniel Vetter
2018-10-23 23:46 ` ✓ Fi.CI.BAT: success for drm/dp_mst: Improve VCPI helpers, use in nouveau Patchwork
2018-10-24  3:57 ` ✓ Fi.CI.IGT: " Patchwork
     [not found] ` <20181023231251.16883-1-lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-10-23 23:12   ` [PATCH 2/6] drm/dp_mst: Remove all evil duplicate state pointers Lyude Paul
2018-10-24  8:27     ` Daniel Vetter
2018-10-23 23:12   ` Lyude Paul [this message]
2018-10-24  8:45     ` [PATCH 3/6] drm/atomic: Add ->atomic_check() hook for private objects Daniel Vetter
2018-10-23 23:12   ` [PATCH 5/6] drm/dp_mst: Check payload count in ->atomic_check() Lyude Paul
     [not found]     ` <20181023231251.16883-6-lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2018-10-24  8:54       ` Daniel Vetter
2018-10-23 23:12   ` [PATCH 6/6] drm/nouveau: Use atomic VCPI helpers for MST Lyude Paul
2018-10-24  8:50   ` [PATCH 0/6] drm/dp_mst: Improve VCPI helpers, use in nouveau Daniel Vetter

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=20181023231251.16883-4-lyude@redhat.com \
    --to=lyude-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox