dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Lankhorst, Maarten" <maarten.lankhorst@intel.com>
To: "Pandiyan, Dhinakaran" <dhinakaran.pandiyan@intel.com>
Cc: "daniel.vetter@ffwll.ch" <daniel.vetter@ffwll.ch>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"bskeggs@redhat.com" <bskeggs@redhat.com>,
	"alexander.deucher@amd.com" <alexander.deucher@amd.com>,
	"harry.wentland@amd.com" <harry.wentland@amd.com>
Subject: Re: [PATCH v3 7/8] drm: Connector helper function to release resources
Date: Mon, 13 Feb 2017 09:05:37 +0000	[thread overview]
Message-ID: <1486976736.7640.11.camel@intel.com> (raw)
In-Reply-To: <1486667623.32142.7.camel@dk-H97M-D3H>

[-- Attachment #1: Type: text/plain, Size: 3191 bytes --]

Pandiyan, Dhinakaran schreef op do 09-02-2017 om 18:55 [+0000]:
> On Thu, 2017-02-09 at 09:01 +0000, Lankhorst, Maarten wrote:
> > 
> > Dhinakaran Pandiyan schreef op wo 08-02-2017 om 22:38 [-0800]:
> > > 
> > > Having a ->atomic_release callback is useful to release shared
> > > resources
> > > that get allocated in compute_config(). This function is expected
> > > to
> > > be
> > > called in the atomic_check() phase before new resources are
> > > acquired.
> > > 
> > > v2: Moved the caller hunk to this patch (Daniel)
> > > 
> > > Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com
> > > >
> > > ---
> > >  drivers/gpu/drm/drm_atomic_helper.c      | 19
> > > +++++++++++++++++++
> > >  include/drm/drm_modeset_helper_vtables.h | 13 +++++++++++++
> > >  2 files changed, 32 insertions(+)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c
> > > b/drivers/gpu/drm/drm_atomic_helper.c
> > > index 8795088..92bd741 100644
> > > --- a/drivers/gpu/drm/drm_atomic_helper.c
> > > +++ b/drivers/gpu/drm/drm_atomic_helper.c
> > > @@ -576,6 +576,25 @@ drm_atomic_helper_check_modeset(struct
> > > drm_device *dev,
> > >  		}
> > >  	}
> > >  
> > > +	for_each_connector_in_state(state, connector,
> > > connector_state, i) {
> > > +		const struct drm_connector_helper_funcs
> > > *conn_funcs;
> > > +		struct drm_crtc_state *crtc_state;
> > > +
> > > +		conn_funcs = connector->helper_private;
> > > +		if (!conn_funcs->atomic_release)
> > > +			continue;
> > > +
> > > +		if (!connector->state->crtc)
> > > +			continue;
> > > +
> > > +		crtc_state =
> > > drm_atomic_get_existing_crtc_state(state, connector->state-
> > > >crtc);
> > > +
> > > +		if (crtc_state->connectors_changed ||
> > > +		    crtc_state->mode_changed ||
> > > +		    (crtc_state->active_changed && !crtc_state-
> > > > 
> > > > active))
> > > +			conn_funcs->atomic_release(connector,
> > > connector_state);
> > > +	}
> > 
> > Could we deal with the VCPI state separately in
> > intel_modeset_checks,
> > like we do with dpll?
> 
> We'd want to release the VCPI slots before they are acquired in
> ->compute_config(). intel_modeset_checks() will be too late to
> release
> them. Are you suggesting both acquiring and releasing slots should be
> done in intel_modeset_checks()?

That makes things a bit more nasty. Maybe add a
conn_funcs->atomic_check that always gets called, something like I did
below?

I'd love to use it for some atomic connector properties too.
> > 
> > 
> > Maybe implementing the relevant VCPI state could be done as an
> > atomic
> > helper function too, so other atomic drivers can just plug it in.
> > 
> The idea was to reduce boilerplate in the drivers and use the
> private_obj state for different object types.
> 
> 
> > 
> > Not sure how doable this is, but if it's not too hard, then it's
> > probably cleaner :)
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch; name="patch", Size: 1579 bytes --]

diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 39cbacd8cd07..1e5f0a95c685 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -381,11 +381,24 @@ mode_fixup(struct drm_atomic_state *state)
 
 	for_each_new_connector_in_state(state, connector, conn_state, i) {
 		const struct drm_encoder_helper_funcs *funcs;
+		const struct drm_connector_helper_funcs *conn_funcs;
 		struct drm_encoder *encoder;
 
+		conn_funcs = connector->helper_private;
+
 		WARN_ON(!!conn_state->best_encoder != !!conn_state->crtc);
 
-		if (!conn_state->crtc || !conn_state->best_encoder)
+		if (!conn_state->crtc || !conn_state->best_encoder) {
+			if (conn_funcs && conn_funcs->atomic_check) {
+				ret = conn_funcs->atomic_check(connector, conn_state);
+
+				if (ret) {
+					DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] check failed\n",
+							 connector->base.id, connector->name);
+					return ret;
+				}
+			}
+
 			continue;
 
 		crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
@@ -404,7 +417,15 @@ mode_fixup(struct drm_atomic_state *state)
 			return -EINVAL;
 		}
 
-		if (funcs && funcs->atomic_check) {
+		if (conn_funcs && conn_funcs->atomic_check) {
+			ret = conn_funcs->atomic_check(connector, conn_state);
+
+			if (ret) {
+				DRM_DEBUG_ATOMIC("[CONNECTOR:%d:%s] check failed\n",
+						  connector->base.id, connector->name);
+				return ret;
+			}
+		} else if (funcs && funcs->atomic_check) {
 			ret = funcs->atomic_check(encoder, crtc_state,
 						  conn_state);
 			if (ret) {

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-02-13  9:05 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-09  6:38 [PATCH v3 0/8] Adding driver-private objects to atomic state Dhinakaran Pandiyan
2017-02-09  6:38 ` [PATCH v3 1/8] drm/dp: Kill total_pbn and total_slots in struct drm_dp_mst_topology_mgr Dhinakaran Pandiyan
2017-02-09  6:38 ` [PATCH v3 2/8] drm/dp: Kill unused MST vcpi slot availability tracking Dhinakaran Pandiyan
2017-02-09  6:38 ` [PATCH v3 3/8] drm/dp: Split drm_dp_mst_allocate_vcpi Dhinakaran Pandiyan
2017-02-09  6:38 ` [PATCH v3 4/8] drm: Add driver-private objects to atomic state Dhinakaran Pandiyan
2017-02-09  8:08   ` Chris Wilson
2017-02-09 18:57     ` Pandiyan, Dhinakaran
2017-02-15 11:23   ` Archit Taneja
2017-02-16  0:13     ` Pandiyan, Dhinakaran
2017-02-17 10:07       ` Archit Taneja
2017-02-22  0:01         ` Pandiyan, Dhinakaran
2017-02-22  4:29           ` Archit Taneja
2017-02-22 21:10             ` Pandiyan, Dhinakaran
2017-02-26 19:57           ` Daniel Vetter
2017-02-27 18:51             ` Pandiyan, Dhinakaran
2017-03-02 22:31   ` Pandiyan, Dhinakaran
2017-02-09  6:38 ` [PATCH v3 5/8] drm/dp: Introduce MST topology state to track available link bandwidth Dhinakaran Pandiyan
2017-02-09  6:38 ` [PATCH v3 6/8] drm/dp: Add DP MST helpers to atomically find and release vcpi slots Dhinakaran Pandiyan
2017-02-09  6:38 ` [PATCH v3 7/8] drm: Connector helper function to release resources Dhinakaran Pandiyan
2017-02-09  9:01   ` Lankhorst, Maarten
2017-02-09 18:55     ` Pandiyan, Dhinakaran
2017-02-13  9:05       ` Lankhorst, Maarten [this message]
2017-02-13 21:26         ` Pandiyan, Dhinakaran
2017-02-13 22:48           ` Pandiyan, Dhinakaran
2017-02-20  9:40             ` Lankhorst, Maarten
2017-02-14 19:51           ` Daniel Vetter
2017-02-14 22:29             ` Pandiyan, Dhinakaran
2017-02-16  9:09             ` Lankhorst, Maarten
2017-02-24  0:52               ` Pandiyan, Dhinakaran
2017-02-26 20:00                 ` [Intel-gfx] " Daniel Vetter
2017-02-27  7:42                   ` Lankhorst, Maarten
2017-02-09  6:38 ` [PATCH v3 8/8] drm/dp: Track MST link bandwidth Dhinakaran Pandiyan

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=1486976736.7640.11.camel@intel.com \
    --to=maarten.lankhorst@intel.com \
    --cc=alexander.deucher@amd.com \
    --cc=bskeggs@redhat.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=intel-gfx@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
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;
as well as URLs for NNTP newsgroup(s).