Hi Alexey,

On Wed, Jun 03, 2026 at 12:15:04PM +0400, Alexey Charkov wrote:
> On Wed, Jun 3, 2026 at 11:55 AM Maxime Ripard <[email protected]> wrote:
> >
> > On Tue, Jun 02, 2026 at 09:00:40PM +0400, Alexey Charkov wrote:
> > > Expose the "overscan" connector property as recognized by KWin and the
> > > likes to compensate for TV overscan cropping.
> > >
> > > The CRTC will use the margin values derived from this overscan percentage
> > > in its post-composition scaler to add appropriate blank margins on all
> > > sides of the output image so that the TV doesn't eat up visible content.
> > >
> > > Signed-off-by: Alexey Charkov <[email protected]>
> > > ---
> > >  drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 16 ++++++++++++++++
> > >  1 file changed, 16 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c 
> > > b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> > > index f35484715c2d..fae44d11dbef 100644
> > > --- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> > > +++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> > > @@ -137,10 +137,18 @@ dw_hdmi_qp_rockchip_encoder_atomic_check(struct 
> > > drm_encoder *encoder,
> > >                                        struct drm_connector_state 
> > > *conn_state)
> > >  {
> > >       struct rockchip_hdmi_qp *hdmi = to_rockchip_hdmi_qp(encoder);
> > > +     const struct drm_display_mode *adj_mode = 
> > > &crtc_state->adjusted_mode;
> > >       struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
> > >       union phy_configure_opts phy_cfg = {};
> > > +     unsigned int overscan;
> > >       int ret;
> > >
> > > +     overscan = min(conn_state->tv.overscan, 100u);
> > > +     s->tv_margins.left   = adj_mode->hdisplay * overscan / 200;
> > > +     s->tv_margins.right  = s->tv_margins.left;
> > > +     s->tv_margins.top    = adj_mode->vdisplay * overscan / 200;
> > > +     s->tv_margins.bottom = s->tv_margins.top;
> > > +
> > >       if (hdmi->tmds_char_rate == conn_state->hdmi.tmds_char_rate &&
> > >           s->output_bpc == conn_state->hdmi.output_bpc)
> > >               return 0;
> > > @@ -603,6 +611,14 @@ static int dw_hdmi_qp_rockchip_bind(struct device 
> > > *dev, struct device *master,
> > >               return dev_err_probe(hdmi->dev, PTR_ERR(connector),
> > >                                    "Failed to init bridge connector\n");
> > >
> > > +     ret = drm_mode_create_tv_properties_legacy(drm, 0, NULL);
> > > +     if (ret)
> > > +             return dev_err_probe(dev, ret,
> > > +                                  "Failed to create TV connector 
> > > properties\n");
> > > +
> > > +     drm_object_attach_property(&connector->base,
> > > +                                drm->mode_config.tv_overscan_property, 
> > > 0);
> > > +
> >
> > As the name suggests, it's a legacy property only ever used for TV. You
> > should be using drm_mode_create_tv_margin_properties()
> 
> Hi Maxime, I tried that one before going for the current solution but
> realized that the userspace tooling I care about (KWin in particular)
> doesn't recognize those properties, but it does recognize "overscan".
> Maybe there's a compat helper somewhere that I missed, which would
> translate between the two?
> 
> It is for TVs. Turns out that having a proper right-sized digital
> input interface doesn't prevent them from doing weird stuff with the
> image data, i.e. overscanning and cropping it right where one would
> expect to see the system tray and panel.

When I said "TV", I meant old-school analog TV, not modern HDMI ones :)

I guess it's a Kwin issue then. To my knowledge, there's 0 HDMI driver
implementing the legacy tv properties, when VC4 implements the margin
ones for HDMI.

Maxime

Attachment: signature.asc
Description: PGP signature

Reply via email to