aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@bootlin.com>2018-12-06 09:24:39 -0500
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-12-19 08:47:58 -0500
commitdb999538fdb0679629d90652f8a1437df1e85a7d (patch)
treec1bbff7bf0550a1418b401c634bf46891c02e3cf /drivers/gpu/drm
parent666e73587f90f42d90385c1bea1009a650bf73f4 (diff)
drm/vc4: Attach margin props to the HDMI connector
Now that the plane code takes the margins setup into account, we can safely attach margin props to the HDMI connector. We also take care of filling AVI infoframes correctly to expose the top/botton/left/right bar. Note that those margin 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> Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20181206142439.10441-6-boris.brezillon@bootlin.com
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/vc4/vc4_hdmi.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index fd5522fd179e..2f276222e30f 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -310,6 +310,7 @@ static struct drm_connector *vc4_hdmi_connector_init(struct drm_device *dev,
310{ 310{
311 struct drm_connector *connector; 311 struct drm_connector *connector;
312 struct vc4_hdmi_connector *hdmi_connector; 312 struct vc4_hdmi_connector *hdmi_connector;
313 int ret;
313 314
314 hdmi_connector = devm_kzalloc(dev->dev, sizeof(*hdmi_connector), 315 hdmi_connector = devm_kzalloc(dev->dev, sizeof(*hdmi_connector),
315 GFP_KERNEL); 316 GFP_KERNEL);
@@ -323,6 +324,13 @@ static struct drm_connector *vc4_hdmi_connector_init(struct drm_device *dev,
323 DRM_MODE_CONNECTOR_HDMIA); 324 DRM_MODE_CONNECTOR_HDMIA);
324 drm_connector_helper_add(connector, &vc4_hdmi_connector_helper_funcs); 325 drm_connector_helper_add(connector, &vc4_hdmi_connector_helper_funcs);
325 326
327 /* Create and attach TV margin props to this connector. */
328 ret = drm_mode_create_tv_margin_properties(dev);
329 if (ret)
330 return ERR_PTR(ret);
331
332 drm_connector_attach_tv_margin_properties(connector);
333
326 connector->polled = (DRM_CONNECTOR_POLL_CONNECT | 334 connector->polled = (DRM_CONNECTOR_POLL_CONNECT |
327 DRM_CONNECTOR_POLL_DISCONNECT); 335 DRM_CONNECTOR_POLL_DISCONNECT);
328 336
@@ -408,6 +416,9 @@ static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder,
408static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder) 416static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
409{ 417{
410 struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder); 418 struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder);
419 struct vc4_dev *vc4 = encoder->dev->dev_private;
420 struct vc4_hdmi *hdmi = vc4->hdmi;
421 struct drm_connector_state *cstate = hdmi->connector->state;
411 struct drm_crtc *crtc = encoder->crtc; 422 struct drm_crtc *crtc = encoder->crtc;
412 const struct drm_display_mode *mode = &crtc->state->adjusted_mode; 423 const struct drm_display_mode *mode = &crtc->state->adjusted_mode;
413 union hdmi_infoframe frame; 424 union hdmi_infoframe frame;
@@ -426,6 +437,11 @@ static void vc4_hdmi_set_avi_infoframe(struct drm_encoder *encoder)
426 vc4_encoder->rgb_range_selectable, 437 vc4_encoder->rgb_range_selectable,
427 false); 438 false);
428 439
440 frame.avi.right_bar = cstate->tv.margins.right;
441 frame.avi.left_bar = cstate->tv.margins.left;
442 frame.avi.top_bar = cstate->tv.margins.top;
443 frame.avi.bottom_bar = cstate->tv.margins.bottom;
444
429 vc4_hdmi_write_infoframe(encoder, &frame); 445 vc4_hdmi_write_infoframe(encoder, &frame);
430} 446}
431 447