All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: Eric Anholt <eric@anholt.net>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/6] drm: Add TV connector states to drm_connector_state
Date: Thu, 1 Dec 2016 09:27:36 +0100	[thread overview]
Message-ID: <20161201092736.6f03ca54@bbrezillon> (raw)
In-Reply-To: <20161129201410.vpnap53xiqfpxb3u@phenom.ffwll.local>

Hi Daniel,

On Tue, 29 Nov 2016 21:14:10 +0100
Daniel Vetter <daniel@ffwll.ch> wrote:

> On Tue, Nov 29, 2016 at 10:41:58AM -0800, Eric Anholt wrote:
> > From: Boris Brezillon <boris.brezillon@free-electrons.com>
> > 
> > Some generic TV connector properties are exposed in drm_mode_config, but
> > they are currently handled independently in each DRM encoder driver.
> > 
> > Extend the drm_connector_state to store TV related states, and modify the
> > drm_atomic_connector_{set,get}_property() helpers to fill the connector
> > state accordingly.
> > 
> > Each driver is then responsible for checking and applying the new config
> > in its ->atomic_mode_{check,set}() operations.
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > Signed-off-by: Eric Anholt <eric@anholt.net>
> > ---
> >  drivers/gpu/drm/drm_atomic.c | 50 ++++++++++++++++++++++++++++++++++++++++++++
> >  include/drm/drm_connector.h  | 32 ++++++++++++++++++++++++++++
> >  2 files changed, 82 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> > index 23739609427d..02b0668f51e1 100644
> > --- a/drivers/gpu/drm/drm_atomic.c
> > +++ b/drivers/gpu/drm/drm_atomic.c
> > @@ -986,12 +986,38 @@ int drm_atomic_connector_set_property(struct drm_connector *connector,
> >  		 * now?) atomic writes to DPMS property:
> >  		 */
> >  		return -EINVAL;
> > +	} else if (property == config->tv_select_subconnector_property) {
> > +		state->tv.subconnector = val;
> > +	} else if (property == config->tv_left_margin_property) {
> > +		state->tv.margins.left = val;
> > +	} else if (property == config->tv_right_margin_property) {
> > +		state->tv.margins.right = val;
> > +	} else if (property == config->tv_top_margin_property) {
> > +		state->tv.margins.bottom = val;  
> 
> s/bottom/top/
> 
> > +	} else if (property == config->tv_bottom_margin_property) {
> > +		state->tv.margins.right = val;  
> 
> s/right/bottom/
> 
> > +	} else if (property == config->tv_mode_property) {
> > +		state->tv.mode = val;
> > +	} else if (property == config->tv_brightness_property) {
> > +		state->tv.brightness = val;
> > +	} else if (property == config->tv_contrast_property) {
> > +		state->tv.contrast = val;
> > +	} else if (property == config->tv_flicker_reduction_property) {
> > +		state->tv.flicker_reduction = val;
> > +	} else if (property == config->tv_overscan_property) {
> > +		state->tv.overscan = val;
> > +	} else if (property == config->tv_saturation_property) {
> > +		state->tv.saturation = val;
> > +	} else if (property == config->tv_hue_property) {
> > +		state->tv.hue = val;
> >  	} else if (connector->funcs->atomic_set_property) {
> >  		return connector->funcs->atomic_set_property(connector,
> >  				state, property, val);
> >  	} else {
> >  		return -EINVAL;
> >  	}
> > +
> > +	return 0;
> >  }
> >  EXPORT_SYMBOL(drm_atomic_connector_set_property);
> >  
> > @@ -1022,6 +1048,30 @@ drm_atomic_connector_get_property(struct drm_connector *connector,
> >  		*val = (state->crtc) ? state->crtc->base.id : 0;
> >  	} else if (property == config->dpms_property) {
> >  		*val = connector->dpms;
> > +	} else if (property == config->tv_select_subconnector_property) {
> > +		*val = state->tv.subconnector;
> > +	} else if (property == config->tv_left_margin_property) {
> > +		*val = state->tv.margins.left;
> > +	} else if (property == config->tv_right_margin_property) {
> > +		*val = state->tv.margins.right;
> > +	} else if (property == config->tv_top_margin_property) {
> > +		*val = state->tv.margins.bottom;  
> 
> s/bottom/top/
> > +	} else if (property == config->tv_bottom_margin_property) {
> > +		*val = state->tv.margins.right;  
> 
> s/right/bottom/

Oops. I'll fix those typos.

> 
> > +	} else if (property == config->tv_mode_property) {
> > +		*val = state->tv.mode;
> > +	} else if (property == config->tv_brightness_property) {
> > +		*val = state->tv.brightness;
> > +	} else if (property == config->tv_contrast_property) {
> > +		*val = state->tv.contrast;
> > +	} else if (property == config->tv_flicker_reduction_property) {
> > +		*val = state->tv.flicker_reduction;
> > +	} else if (property == config->tv_overscan_property) {
> > +		*val = state->tv.overscan;
> > +	} else if (property == config->tv_saturation_property) {
> > +		*val = state->tv.saturation;
> > +	} else if (property == config->tv_hue_property) {
> > +		*val = state->tv.hue;
> >  	} else if (connector->funcs->atomic_get_property) {
> >  		return connector->funcs->atomic_get_property(connector,
> >  				state, property, val);
> > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> > index ac9d7d8e0e43..2382d44e5fff 100644
> > --- a/include/drm/drm_connector.h
> > +++ b/include/drm/drm_connector.h
> > @@ -194,10 +194,40 @@ int drm_display_info_set_bus_formats(struct drm_display_info *info,
> >  				     unsigned int num_formats);
> >  
> >  /**
> > + * struct drm_tv_connector_state - TV connector related states
> > + * @subconnector: selected subconnector
> > + * @margins: left/right/top/bottom margins
> > + * @mode: TV mode
> > + * @brightness: brightness in percent
> > + * @contrast: contrast in percent
> > + * @flicker_reduction: flicker reduction in percent
> > + * @overscan: overscan in percent
> > + * @saturation: saturation in percent
> > + * @hue: hue in percent
> > + */
> > +struct drm_tv_connector_state {
> > +	int subconnector;  
> 
> I think an explicit enum for the possible values would be nice. Slightly
> annoying/fragile since it needs to match the uabi ones, but we I think
> there's a slight preference to explicit enums internally.

Okay.

> 
> > +	struct {
> > +		int left;
> > +		int right;
> > +		int top;
> > +		int bottom;
> > +	} margins;
> > +	int mode;
> > +	int brightness;
> > +	int contrast;
> > +	int flicker_reduction;
> > +	int overscan;
> > +	int saturation;
> > +	int hue;  
> 
> All the above properties are unsigned when exposed to userspace. I think
> for consistency would be good to make them match on the kernel side too.

Sure.

> 
> With the above issues addressed:
> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> And since no one else seems to work on an atomic TV encoder feel free to
> just stash into the next vc4 pull request.

Thanks for the review.

Boris

  reply	other threads:[~2016-12-01  8:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29 18:41 [PATCH 0/6] drm/vc4: VEC (SDTV) output support Eric Anholt
2016-11-29 18:41 ` Eric Anholt
2016-11-29 18:41 ` [PATCH 1/6] drm/vc4: Fix ->clock_select setting for the VEC encoder Eric Anholt
2016-11-29 18:41   ` Eric Anholt
2016-11-29 18:41 ` [PATCH 2/6] drm: Add TV connector states to drm_connector_state Eric Anholt
2016-11-29 18:41   ` Eric Anholt
2016-11-29 20:14   ` Daniel Vetter
2016-11-29 20:14     ` Daniel Vetter
2016-12-01  8:27     ` Boris Brezillon [this message]
2016-11-29 18:41 ` [PATCH 3/6] drm/vc4: Add support for the VEC (Video Encoder) IP Eric Anholt
2016-11-29 18:41   ` Eric Anholt
2016-11-29 18:42 ` [PATCH 4/6] drm/vc4: Document VEC DT binding Eric Anholt
2016-11-29 18:42   ` Eric Anholt
2016-11-29 18:42 ` [PATCH 5/6] ARM: bcm/dt: Add VEC node in bcm283x.dtsi Eric Anholt
2016-11-29 18:42   ` Eric Anholt
2016-11-29 18:42 ` [PATCH 6/6] ARM: bcm/dt: Enable the VEC IP on all RaspberryPi boards Eric Anholt
2016-11-29 18:42   ` Eric Anholt

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=20161201092736.6f03ca54@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=linux-kernel@vger.kernel.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 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.