From: Boris Brezillon <boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
To: Eric Anholt <eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>
Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
"Boris Brezillon"
<boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>,
"Ben Skeggs" <bskeggs-H+wXaHxf7aLQT0dZR+AlfA@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>,
"Ville Syrjälä"
<ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: [PATCH v3 3/3] drm/vc4: Attach underscan props to the HDMI connector
Date: Thu, 22 Nov 2018 12:23:31 +0100 [thread overview]
Message-ID: <20181122112331.17735-4-boris.brezillon@bootlin.com> (raw)
In-Reply-To: <20181122112331.17735-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>
---
Changes in v3:
- none
Changes in v2:
- none
---
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 fd5522fd179e..b1b39256f4bc 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.17.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
prev parent reply other threads:[~2018-11-22 11:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-22 11:23 [PATCH v3 0/3] drm/connector: Provide generic support for underscan Boris Brezillon
2018-11-22 11:23 ` [PATCH v3 1/3] drm/connector: Add generic underscan properties Boris Brezillon
[not found] ` <20181122112331.17735-2-boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-11-22 17:36 ` Brian Starkey
2018-11-28 17:17 ` Eric Anholt
2018-12-03 14:40 ` Ville Syrjälä
2018-12-03 15:36 ` Boris Brezillon
2018-12-03 15:50 ` Eric Anholt
2018-12-04 10:42 ` Daniel Vetter
[not found] ` <20181122112331.17735-1-boris.brezillon-LDxbnhwyfcJBDgjK7y7TUQ@public.gmane.org>
2018-11-22 11:23 ` [PATCH v3 2/3] drm/vc4: Take underscan setup into account when updating planes Boris Brezillon
2018-11-22 11:23 ` Boris Brezillon [this message]
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=20181122112331.17735-4-boris.brezillon@bootlin.com \
--to=boris.brezillon-ldxbnhwyfcjbdgjk7y7tuq@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 \
--cc=ville.syrjala-VuQAYsv1563Yd54FQh9/CA@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox