AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: "David Airlie" <airlied@linux.ie>,
	nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Ben Skeggs" <bskeggs@redhat.com>
Subject: Re: [PATCH 3/3] drm/vc4: Attach underscan props to the HDMI connector
Date: Mon, 7 May 2018 17:24:08 +0200	[thread overview]
Message-ID: <20180507152408.GE28661@phenom.ffwll.local> (raw)
In-Reply-To: <20180507144434.20466-4-boris.brezillon@bootlin.com>

On Mon, May 07, 2018 at 04:44:34PM +0200, Boris Brezillon wrote:
> Now that the plane code takes the underscan setup into account, we can
> safely attach the underscan props to the HDMI connector.
> 
> We also take care of filling AVI infoframes correctly to expose the
> top/botton/left/right bar.
> 
> Note that these underscan props match pretty well the
> overscan_{left,right,top,bottom} properties defined in config.txt and
> parsed by the VC4 firmware.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---
>  drivers/gpu/drm/vc4/vc4_hdmi.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index 1a6db291d48b..17464b5981f9 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -323,6 +323,16 @@ static struct drm_connector *vc4_hdmi_connector_init(struct drm_device *dev,
>  			   DRM_MODE_CONNECTOR_HDMIA);
>  	drm_connector_helper_add(connector, &vc4_hdmi_connector_helper_funcs);
>  
> +	/* The hborder and vborder limit is arbitrarily set to 1024 which
> +	 * should be more than enough for real use cases. Note that the actual
> +	 * limitation comes from the display mode:
> +	 *	hborder < hdisplay && vborder < vdisplay
> +	 */
> +	drm_connector_attach_underscan_properties(connector,

We should probably sprinkle __must_check over all these :-)
-Daniel

> +						  BIT(DRM_UNDERSCAN_OFF) |
> +						  BIT(DRM_UNDERSCAN_ON),
> +						  1024, 1024);
> +
>  	connector->polled = (DRM_CONNECTOR_POLL_CONNECT |
>  			     DRM_CONNECTOR_POLL_DISCONNECT);
>  
> @@ -408,6 +418,9 @@ static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder,
>  static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
>  {
>  	struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
> +	struct vc4_dev *vc4 = encoder->dev->dev_private;
> +	struct vc4_hdmi *hdmi = vc4->hdmi;
> +	struct drm_connector_state *cstate = hdmi->connector->state;
>  	struct drm_crtc *crtc = encoder->crtc;
>  	const struct drm_display_mode *mode = &crtc->state->adjusted_mode;
>  	union hdmi_infoframe frame;
> @@ -426,6 +439,18 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
>  					   vc4_encoder->rgb_range_selectable,
>  					   false);
>  
> +	if (cstate->underscan.mode == DRM_UNDERSCAN_ON) {
> +		if (cstate->underscan.hborder) {
> +			frame.avi.right_bar = cstate->underscan.hborder / 2;
> +			frame.avi.left_bar = frame.avi.right_bar;
> +		}
> +
> +		if (cstate->underscan.vborder) {
> +			frame.avi.top_bar = cstate->underscan.vborder / 2;
> +			frame.avi.bottom_bar = frame.avi.top_bar;
> +		}
> +	}
> +
>  	vc4_hdmi_write_infoframe(encoder, &frame);
>  }
>  
> -- 
> 2.14.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-05-07 15:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-07 14:44 [PATCH 0/3] drm/connector: Provide generic support for underscan Boris Brezillon
     [not found] ` <20180507144434.20466-1-boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-05-07 14:44   ` [PATCH 1/3] drm/connector: Add generic underscan properties Boris Brezillon
     [not found]     ` <20180507144434.20466-2-boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-05-07 15:01       ` Ville Syrjälä
     [not found]         ` <20180507150144.GE23723-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2018-05-07 16:19           ` Boris Brezillon
2018-05-07 18:26             ` Harry Wentland
     [not found]               ` <bae27de8-aa4d-fc3a-1667-a139e1a9220f-5C7GfCeVMHo@public.gmane.org>
2018-05-08  0:18                 ` Ben Skeggs
     [not found]                   ` <CACAvsv7R=kYvG3_2doHhuC9WcVjRnAFBNYb9XpBho8cUq6hUCQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-05-11 13:46                     ` Boris Brezillon
2018-05-07 20:49       ` kbuild test robot
2018-05-07 15:15     ` Daniel Vetter
     [not found]       ` <20180507151533.GD28661-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-05-07 15:25         ` Daniel Vetter
     [not found]           ` <20180507152530.GF28661-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-05-11 13:48             ` Boris Brezillon
2018-05-07 14:44   ` [PATCH 2/3] drm/vc4: Take underscan setup into account when updating planes Boris Brezillon
2018-05-07 14:44   ` [PATCH 3/3] drm/vc4: Attach underscan props to the HDMI connector Boris Brezillon
2018-05-07 15:24     ` Daniel Vetter [this message]
     [not found]       ` <20180507152408.GE28661-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2018-05-09 14:52         ` Boris Brezillon
2018-05-14 16:43           ` Daniel Vetter
2018-05-09  7:28 ` [PATCH 0/3] drm/connector: Provide generic support for underscan Boris Brezillon

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=20180507152408.GE28661@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=boris.brezillon@bootlin.com \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=nouveau@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