All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm/i915: Convert intel_tv connector properties to atomic, v3.
Date: Thu, 16 Mar 2017 16:43:33 +0100	[thread overview]
Message-ID: <20170316154333.gb7fmlr4dkddi53p@phenom.ffwll.local> (raw)
In-Reply-To: <cd7462df-705b-1c3e-8c47-c41e2f49dae1@linux.intel.com>

On Thu, Mar 16, 2017 at 04:27:42PM +0100, Maarten Lankhorst wrote:
> Op 16-03-17 om 15:56 schreef Daniel Vetter:
> > On Thu, Mar 16, 2017 at 01:05:06PM +0100, Maarten Lankhorst wrote:
> >> Op 16-03-17 om 11:48 schreef Daniel Vetter:
> >>> On Wed, Mar 15, 2017 at 11:08:56AM +0100, Maarten Lankhorst wrote:
> >>>> As a proof of concept, first try to convert intel_tv, which is a rarely
> >>>> used connector. It has 5 properties, tv format and 4 margins.
> >>>>
> >>>> I'm less certain about the state behavior itself, should we pass a size
> >>>> parameter to intel_connector_alloc instead, so duplicate_state
> >>>> can be done globally if it can be blindly copied?
> >>>>
> >>>> Can we also have a atomic_check function for connectors, so the
> >>>> crtc_state->connectors_changed can be set there? It would be cleaner
> >>>> and more atomic-like.
> >>>>
> >>>> To match the legacy behavior, format can be changed by probing just like
> >>>> in legacy mode.
> >>>>
> >>>> Changes since v1:
> >>>> - Add intel_encoder->swap_state to allow updating connector state.
> >>>> - Add intel_tv->format for detect_mode and mode_valid, updated on atomic commit.
> >>>> Changes since v2:
> >>>> - Fix typo in tv_choose_preferred modes function name.
> >>>> - Assignment of tv properties is done in core, so intel_tv only needs
> >>>>   a atomic_check function. Thanks Ville!
> >>>>
> >>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> >>>> ---
> >>>>  drivers/gpu/drm/i915/intel_display.c |  15 +++
> >>>>  drivers/gpu/drm/i915/intel_drv.h     |   4 +
> >>>>  drivers/gpu/drm/i915/intel_tv.c      | 200 ++++++++++++++++-------------------
> >>>>  3 files changed, 110 insertions(+), 109 deletions(-)
> >>>>
> >>>> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> >>>> index ac25c9bc8b81..18b7e7546ee1 100644
> >>>> --- a/drivers/gpu/drm/i915/intel_display.c
> >>>> +++ b/drivers/gpu/drm/i915/intel_display.c
> >>>> @@ -12954,6 +12954,20 @@ static void intel_atomic_track_fbs(struct drm_atomic_state *state)
> >>>>  				  to_intel_plane(plane)->frontbuffer_bit);
> >>>>  }
> >>>>  
> >>>> +static void swap_connector_state(struct drm_atomic_state *state)
> >>>> +{
> >>>> +	struct drm_connector *connector;
> >>>> +	struct drm_connector_state *new_conn_state;
> >>>> +	int i;
> >>>> +
> >>>> +	for_each_new_connector_in_state(state, connector, new_conn_state, i) {
> >>>> +		struct intel_connector *conn = to_intel_connector(connector);
> >>>> +
> >>>> +		if (conn->swap_state)
> >>>> +			conn->swap_state(conn, new_conn_state);
> >>>> +	}
> >>>> +}
> >>> So yeah I'm late, but this is pretty much exactly what DK's private state
> >>> object stuff was meant for. Have you looked into rebasing on top of that?
> >>> I think hand-rolling private state stuff everywhere isn't really good.
> >>>
> >>> Afaics DK's patch series is ready for merging into drm-misc, so shouldn't
> >>> end up blocking you.
> >> This swap_state hook is used for connector state. We could probably add a swap_state hook that drivers
> >> can use for this in the core, but the connector state is already part of the state, adding it twice is silly.
> >>
> >> Instead, would adding a hook to the core be useful?
> > Why do you need a hook to swap the state? The core already does that for
> > you ... to_tv_state(intel_tv->base.base->state) is probably what you want,
> > instead of deref'ing a new intel_tv->format.
> > -Daniel
> 
> Well in some way I need to access connector_state->tv.mode in mode_valid, which doesn't hold any connector state locks.
> I think setting it from the state is the easiest way to do so. But I'm open to other approaches. :)

Well fundamentally that access is going to be racy, so you better put a
READ_ONCE into mode_valid. But once we accept that it's racy, we might as
well chase connector->state, the only thing we need is to rcu-protected
the freeing of old atomic state.

I've typed such a patch yesterday (for vblank access to crtc->state from
vblank interrupts), but then thrown it away again. Because it didn't fix
my vblank issue correctly.

I'll resurrect and send out.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-03-16 15:43 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 13:06 [PATCH 0/3] drm/i915: Convert tv/dp_mst and crt connector properties to atomic Maarten Lankhorst
2017-03-09 13:06 ` [PATCH 1/3] drm/i915: Convert intel_tv " Maarten Lankhorst
2017-03-09 17:36   ` Ville Syrjälä
2017-03-13  9:22     ` Maarten Lankhorst
2017-03-13  9:29       ` Ville Syrjälä
2017-03-13 10:38         ` Maarten Lankhorst
2017-03-13 10:55           ` Ville Syrjälä
2017-03-13 12:19             ` Maarten Lankhorst
2017-03-13 16:10             ` [PATCH 1/3] drm/i915: Convert intel_tv connector properties to atomic, v2 Maarten Lankhorst
2017-03-13 16:22               ` Ville Syrjälä
2017-03-13 16:35                 ` Maarten Lankhorst
2017-03-13 16:44                   ` Ville Syrjälä
2017-03-13 17:14                     ` Maarten Lankhorst
2017-03-13 16:44                 ` Maarten Lankhorst
2017-03-14 18:36               ` Ville Syrjälä
2017-03-15  8:32                 ` Maarten Lankhorst
2017-03-15 10:08                 ` [PATCH 1/3] drm/i915: Convert intel_tv connector properties to atomic, v3 Maarten Lankhorst
2017-03-16 10:48                   ` Daniel Vetter
2017-03-16 12:05                     ` Maarten Lankhorst
2017-03-16 14:56                       ` Daniel Vetter
2017-03-16 15:27                         ` Maarten Lankhorst
2017-03-16 15:43                           ` Daniel Vetter [this message]
2017-03-09 13:06 ` [PATCH 2/3] drm/i915: Convert intel_dp_mst connector properties to atomic Maarten Lankhorst
2017-03-09 13:06 ` [PATCH 3/3] drm/i915: Convert intel_crt " Maarten Lankhorst
2017-03-09 16:23 ` ✓ Fi.CI.BAT: success for drm/i915: Convert tv/dp_mst and crt " Patchwork

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=20170316154333.gb7fmlr4dkddi53p@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.