Ilia Mirkin
2019-May-25 22:41 UTC
[Nouveau] [PATCH 1/2] drm/nouveau/disp/nv50-: force scaler for any non-default LVDS/eDP modes
Higher layers tend to add a lot of modes not actually in the EDID, such as the standard DMT modes. Changing this would be extremely intrusive to everyone, so just force the scaler more often. There are no practical cases we're aware of where a LVDS/eDP panel has multiple resolutions exposed, and i915 already does it this way. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110660 Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> --- Untested for now, hoping that the bugzilla filer will test it out. Seems obvious though. drivers/gpu/drm/nouveau/dispnv50/disp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c index 134701a837c8..ef8d7a71564a 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c @@ -322,8 +322,13 @@ nv50_outp_atomic_check_view(struct drm_encoder *encoder, switch (connector->connector_type) { case DRM_MODE_CONNECTOR_LVDS: case DRM_MODE_CONNECTOR_eDP: - /* Force use of scaler for non-EDID modes. */ - if (adjusted_mode->type & DRM_MODE_TYPE_DRIVER) + /* Don't force scaler for EDID modes with + * same size as the native one (e.g. different + * refresh rate) + */ + if (adjusted_mode->hdisplay == native_mode->hdisplay && + adjusted_mode->vdisplay == native_mode->vdisplay && + adjusted_mode->type & DRM_MODE_TYPE_DRIVER) break; mode = native_mode; asyc->scaler.full = true; -- 2.21.0
Ilia Mirkin
2019-May-25 22:41 UTC
[Nouveau] [PATCH 2/2] drm/nouveau/disp/nv50-: fix center/aspect-corrected scaling
Previously center scaling would get scaling applied to it (when it was only supposed to center the image), and aspect-corrected scaling did not always correctly pick whether to reduce width or height for a particular combination of inputs/outputs. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110660 Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> --- Tested on a 1920x1200-native screen with a 640x480 mode (got letter boxes on the side) and 720x400 mode (got letter boxes on top/bottom). drivers/gpu/drm/nouveau/dispnv50/head.c | 28 +++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c b/drivers/gpu/drm/nouveau/dispnv50/head.c index ac97ebce5b35..e2207990d3cc 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head.c @@ -169,14 +169,34 @@ nv50_head_atomic_check_view(struct nv50_head_atom *armh, */ switch (mode) { case DRM_MODE_SCALE_CENTER: - asyh->view.oW = min((u16)umode->hdisplay, asyh->view.oW); - asyh->view.oH = min((u16)umode_vdisplay, asyh->view.oH); - /* fall-through */ + /* NOTE: This will cause scaling when the input is + * larger than the output. + */ + asyh->view.oW = min(asyh->view.iW, asyh->view.oW); + asyh->view.oH = min(asyh->view.iH, asyh->view.oH); + break; case DRM_MODE_SCALE_ASPECT: - if (asyh->view.oH < asyh->view.oW) { + /* Determine whether the scaling should be on width or on + * height. This is done by comparing the aspect ratios of the + * sizes. If the output AR is larger than input AR, that means + * we want to change the width (letterboxed on the + * left/right), otherwise on the height (letterboxed on the + * top/bottom). + * + * E.g. 4:3 (1.333) AR image displayed on a 16:10 (1.6) AR + * screen will have letterboxes on the left/right. However a + * 16:9 (1.777) AR image on that same screen will have + * letterboxes on the top/bottom. + * + * inputAR = iW / iH; outputAR = oW / oH + * outputAR > inputAR is equivalent to oW * iH > iW * oH + */ + if (asyh->view.oW * asyh->view.iH > asyh->view.iW * asyh->view.oH) { + /* Recompute output width, i.e. left/right letterbox */ u32 r = (asyh->view.iW << 19) / asyh->view.iH; asyh->view.oW = ((asyh->view.oH * r) + (r / 2)) >> 19; } else { + /* Recompute output height, i.e. top/bottom letterbox */ u32 r = (asyh->view.iH << 19) / asyh->view.iW; asyh->view.oH = ((asyh->view.oW * r) + (r / 2)) >> 19; } -- 2.21.0
Ben Skeggs
2019-May-27 06:24 UTC
[Nouveau] [PATCH 1/2] drm/nouveau/disp/nv50-: force scaler for any non-default LVDS/eDP modes
On Sun, 26 May 2019 at 08:41, Ilia Mirkin <imirkin at alum.mit.edu> wrote:> > Higher layers tend to add a lot of modes not actually in the EDID, such > as the standard DMT modes. Changing this would be extremely intrusive to > everyone, so just force the scaler more often. There are no practical > cases we're aware of where a LVDS/eDP panel has multiple resolutions > exposed, and i915 already does it this way. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110660 > Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>Thanks Ilia, grabbed both patches.> --- > > Untested for now, hoping that the bugzilla filer will test it out. Seems > obvious though. > > drivers/gpu/drm/nouveau/dispnv50/disp.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c > index 134701a837c8..ef8d7a71564a 100644 > --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c > +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c > @@ -322,8 +322,13 @@ nv50_outp_atomic_check_view(struct drm_encoder *encoder, > switch (connector->connector_type) { > case DRM_MODE_CONNECTOR_LVDS: > case DRM_MODE_CONNECTOR_eDP: > - /* Force use of scaler for non-EDID modes. */ > - if (adjusted_mode->type & DRM_MODE_TYPE_DRIVER) > + /* Don't force scaler for EDID modes with > + * same size as the native one (e.g. different > + * refresh rate) > + */ > + if (adjusted_mode->hdisplay == native_mode->hdisplay && > + adjusted_mode->vdisplay == native_mode->vdisplay && > + adjusted_mode->type & DRM_MODE_TYPE_DRIVER) > break; > mode = native_mode; > asyc->scaler.full = true; > -- > 2.21.0 > > _______________________________________________ > Nouveau mailing list > Nouveau at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau
Ilia Mirkin
2019-May-28 20:36 UTC
[Nouveau] [PATCH 1/2] drm/nouveau/disp/nv50-: force scaler for any non-default LVDS/eDP modes
Sigh ... looks like this doesn't actually do what we want. See the last couple comments in: https://bugs.freedesktop.org/show_bug.cgi?id=110660 It seems to work as expected with "mode" instead of "adjusted_mode". Does that make sense? It kinda does based on the later code, which copies mode into adjusted_mode... Assuming it makes sense to use "mode", Ben, want to just do a fixup locally, or want me to send a revert + new patch? -ilia On Mon, May 27, 2019 at 2:24 AM Ben Skeggs <skeggsb at gmail.com> wrote:> > On Sun, 26 May 2019 at 08:41, Ilia Mirkin <imirkin at alum.mit.edu> wrote: > > > > Higher layers tend to add a lot of modes not actually in the EDID, such > > as the standard DMT modes. Changing this would be extremely intrusive to > > everyone, so just force the scaler more often. There are no practical > > cases we're aware of where a LVDS/eDP panel has multiple resolutions > > exposed, and i915 already does it this way. > > > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110660 > > Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> > Thanks Ilia, grabbed both patches. > > > --- > > > > Untested for now, hoping that the bugzilla filer will test it out. Seems > > obvious though. > > > > drivers/gpu/drm/nouveau/dispnv50/disp.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c > > index 134701a837c8..ef8d7a71564a 100644 > > --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c > > +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c > > @@ -322,8 +322,13 @@ nv50_outp_atomic_check_view(struct drm_encoder *encoder, > > switch (connector->connector_type) { > > case DRM_MODE_CONNECTOR_LVDS: > > case DRM_MODE_CONNECTOR_eDP: > > - /* Force use of scaler for non-EDID modes. */ > > - if (adjusted_mode->type & DRM_MODE_TYPE_DRIVER) > > + /* Don't force scaler for EDID modes with > > + * same size as the native one (e.g. different > > + * refresh rate) > > + */ > > + if (adjusted_mode->hdisplay == native_mode->hdisplay && > > + adjusted_mode->vdisplay == native_mode->vdisplay && > > + adjusted_mode->type & DRM_MODE_TYPE_DRIVER) > > break; > > mode = native_mode; > > asyc->scaler.full = true; > > -- > > 2.21.0 > > > > _______________________________________________ > > Nouveau mailing list > > Nouveau at lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/nouveau
Seemingly Similar Threads
- [PATCH 1/2] drm/nouveau/disp/nv50-: force scaler for any non-default LVDS/eDP modes
- [PATCH AUTOSEL 5.4 38/52] drm/nouveau/kms/nv50-: fix panel scaling
- [PATCH] drm/nouveau/disp: Revert a NULL check inside nouveau_connector_get_modes
- scaler plugin fixes
- [PATCH 2/3] drm/nouveau/kms/nv50-: Store the bpc we're using in nv50_head_atom