All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
To: Eric Anholt <eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>
Cc: "David (ChunMing) Zhou"
	<David1.Zhou-5C7GfCeVMHo@public.gmane.org>,
	"David Airlie" <airlied-cv59FeDIM0c@public.gmane.org>,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"Boris Brezillon"
	<boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"Daniel Vetter" <daniel-/w4YWyX8dFk@public.gmane.org>,
	"Alex Deucher" <alexander.deucher-5C7GfCeVMHo@public.gmane.org>,
	"Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>,
	"Ben Skeggs" <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH 3/3] drm/vc4: Attach underscan props to the HDMI connector
Date: Mon,  7 May 2018 16:44:34 +0200	[thread overview]
Message-ID: <20180507144434.20466-4-boris.brezillon@bootlin.com> (raw)
In-Reply-To: <20180507144434.20466-1-boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>

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,
+						  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

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

  parent reply	other threads:[~2018-05-07 14:44 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   ` Boris Brezillon [this message]
2018-05-07 15:24     ` [PATCH 3/3] drm/vc4: Attach underscan props to the HDMI connector Daniel Vetter
     [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=20180507144434.20466-4-boris.brezillon@bootlin.com \
    --to=boris.brezillon-ldxbnhwyfcjbdgjk7y7tuq@public.gmane.org \
    --cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
    --cc=airlied-cv59FeDIM0c@public.gmane.org \
    --cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=bskeggs-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=daniel-/w4YWyX8dFk@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=eric-WhKQ6XTQaPysTnJN9+BGXg@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 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.