drm/i915: Fix scaling check for 90/270 degree plane rotation
Subsystems (2)
PATCH 1/1 drm/i915: Fix scaling check for 90/270 degree plane rotation
From: Ville Syrjälä <[email protected]>
Starting from commit b63a16f6cd89 ("drm/i915: Compute display surface offset in the plane check hook for SKL+") we've already rotated the src coordinates by 270 degrees by the time we check if a scaler is needed or not, so we must not account for the rotation a second time. Previously we did these steps in the opposite order and hence the scaler check had to deal with rotation itself. The double rotation handling causes us to enable a scaler pretty much every time 90/270 degree plane rotation is requested, leading to fuzzier fonts and whatnot.
--- drivers/gpu/drm/i915/intel_display.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +8 -6
@@ -4671,7 +4671,7 @@ static void cpt_verify_modeset(struct drm_device *dev, int pipe)static int skl_update_scaler (struct intel_crtc_state *crtc_state,bool force_detach, -unsigned scaler_user,int *scaler_id,unsigned int rotation, +unsigned scaler_user,int *scaler_id,int src_w,int src_h,int dst_w,int dst_h) { struct intel_crtc_scaler_state *scaler_state =
@@ -4680,9 +4680,12 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,to_intel_crtc (crtc_state->base.crtc);int need_scaling; - need_scaling =drm_rotation_90_or_270 (rotation) ? - (src_h != dst_w || src_w != dst_h): - (src_w != dst_w || src_h != dst_h); +/* +* Src coordinates are already rotated by 270 degrees for +* the 90/270 degree plane rotation cases (to match the +* GTT mapping), hence no need to account for rotation here. +*/ + need_scaling = src_w != dst_w || src_h != dst_h;/* * if plane is being disabled or scaler is no more required or force detach
@@ -4749,7 +4752,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state) intel_crtc->pipe, SKL_CRTC_INDEX);return skl_update_scaler (state, !state->base.active,SKL_CRTC_INDEX , - &state->scaler_state.scaler_id,DRM_ROTATE_0 , + &state->scaler_state.scaler_id, state->pipe_src_w, state->pipe_src_h, adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay); }
@@ -4783,7 +4786,6 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state, ret = skl_update_scaler(crtc_state, force_detach, drm_plane_index(&intel_plane->base), &plane_state->scaler_id, - plane_state->base.rotation, drm_rect_width(&plane_state->base.src) >> 16, drm_rect_height(&plane_state->base.src) >> 16, drm_rect_width(&plane_state->base.dst),
Signature · 5 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Fix scaling check for 90/270 degree plane rotation
== Series Details ==
== Series Details ==
Series: drm/i915: Fix scaling check for 90/270 degree plane rotation
URL : https://patchwork.freedesktop.org/series/14423/
State : success
== Summary ==
Series 14423v1 drm/i915: Fix scaling check for 90/270 degree plane rotation
https://patchwork.freedesktop.org/api/1.0/series/14423/revisions/1/mbox/
Test drv_module_reload_basic:
dmesg-warn -> PASS (fi-ilk-650)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
dmesg-warn -> PASS (fi-ilk-650)fi-bdw-5557u total:246 pass:231 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:246 pass:204 dwarn:0 dfail:0 fail:0 skip:42 fi-bxt-t5700 total:246 pass:216 dwarn:0 dfail:0 fail:0 skip:30 fi-byt-j1900 total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-byt-n2820 total:246 pass:211 dwarn:0 dfail:0 fail:0 skip:35 fi-hsw-4770 total:246 pass:224 dwarn:0 dfail:0 fail:0 skip:22 fi-hsw-4770r total:246 pass:223 dwarn:0 dfail:0 fail:0 skip:23 fi-ilk-650 total:246 pass:185 dwarn:0 dfail:0 fail:0 skip:61 fi-ivb-3520m total:246 pass:220 dwarn:0 dfail:0 fail:0 skip:26 fi-ivb-3770 total:246 pass:220 dwarn:0 dfail:0 fail:0 skip:26 fi-kbl-7200u total:246 pass:222 dwarn:0 dfail:0 fail:0 skip:24 fi-skl-6260u total:246 pass:232 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:246 pass:223 dwarn:0 dfail:0 fail:0 skip:23 fi-skl-6700k total:246 pass:222 dwarn:1 dfail:0 fail:0 skip:23 fi-skl-6770hq total:246 pass:232 dwarn:0 dfail:0 fail:0 skip:14 fi-snb-2520m total:246 pass:209 dwarn:0 dfail:0 fail:0 skip:37 fi-snb-2600 total:246 pass:208 dwarn:0 dfail:0 fail:0 skip:38
0eefa35311a3d85e6cbfda4bb326809581acc3b1 drm-intel-nightly: 2016y-10m-26d-17h-38m-29s UTC integration manifest a444c32 drm/i915: Fix scaling check for 90/270 degree plane rotation
Full results at https://intel-gfx-ci.01.org/CI/Patchwork_2829/
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_2829/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 61 lines · On 25/10/2016 13:45, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Starting from commit
b63a16f6cd89("drm/i915: Compute display surface offset in the plane check hook for SKL+") we've already rotated the src coordinates by 270 degrees by the time we check if a scaler is needed or not, so we must not account for the rotation a second time. Previously we did these steps in the opposite order and hence the scaler check had to deal with rotation itself. The double rotation handling causes us to enable a scaler pretty much every time 90/270 degree plane rotation is requested, leading to fuzzier fonts and whatnot.Cc Sivakumar Thulasimani <[email protected]>Cc Tvrtko Ursulin <[email protected]>Reported-by Tvrtko Ursulin <[email protected]>Fixes b63a16f6cd89 ("drm/i915: Compute display surface offset in the plane check hook for SKL+")Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_display.c +8
-5@@ -4671,7 +4671,7 @@ static void cpt_verify_modeset(struct drm_device *dev, int pipe)static int skl_update_scaler (struct intel_crtc_state *crtc_state,bool force_detach, -unsigned scaler_user,int *scaler_id,unsigned int rotation, +unsigned scaler_user,int *scaler_id,int src_w,int src_h,int dst_w,int dst_h) { struct intel_crtc_scaler_state *scaler_state =@@ -4680,9 +4680,12 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,to_intel_crtc (crtc_state->base.crtc);int need_scaling; - need_scaling =drm_rotation_90_or_270 (rotation) ? - (src_h != dst_w || src_w != dst_h): - (src_w != dst_w || src_h != dst_h); +/* +* Src coordinates are already rotated by 270 degrees for +* the 90/270 degree plane rotation cases (to match the +* GTT mapping), hence no need to account for rotation here. +*/ + need_scaling = src_w != dst_w || src_h != dst_h;/* * if plane is being disabled or scaler is no more required or force detach @@ -4749,7 +4752,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state) intel_crtc->pipe, SKL_CRTC_INDEX);return skl_update_scaler (state, !state->base.active,SKL_CRTC_INDEX , - &state->scaler_state.scaler_id,DRM_ROTATE_0 , + &state->scaler_state.scaler_id, state->pipe_src_w, state->pipe_src_h, adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay); }
drivers/gpu/drm/i915/intel_display.c static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state, · line 4791
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +0
-1@@ -4783,7 +4786,6 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state, ret = skl_update_scaler(crtc_state, force_detach, drm_plane_index(&intel_plane->base), &plane_state->scaler_id, - plane_state->base.rotation, drm_rect_width(&plane_state->base.src) >> 16, drm_rect_height(&plane_state->base.src) >> 16, drm_rect_width(&plane_state->base.dst),
After this only the DRM core revert remains. Is that one something of a workaround or actually could get in?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 73 lines · Tvrtko Ursulin
Quoted 61 lines · On 25/10/2016 13:45, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Starting from commit
b63a16f6cd89("drm/i915: Compute display surface offset in the plane check hook for SKL+") we've already rotated the src coordinates by 270 degrees by the time we check if a scaler is needed or not, so we must not account for the rotation a second time. Previously we did these steps in the opposite order and hence the scaler check had to deal with rotation itself. The double rotation handling causes us to enable a scaler pretty much every time 90/270 degree plane rotation is requested, leading to fuzzier fonts and whatnot.Cc Sivakumar Thulasimani <[email protected]>Cc Tvrtko Ursulin <[email protected]>Reported-by Tvrtko Ursulin <[email protected]>Fixes b63a16f6cd89 ("drm/i915: Compute display surface offset in the plane check hook for SKL+")Signed-off-by Ville Syrjälä <[email protected]>---
drivers/gpu/drm/i915/intel_display.c| 14 ++++++++------1 file changed, 8 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -4671,7 +4671,7 @@ static void cpt_verify_modeset(struct drm_device *dev, int pipe)static int
skl_update_scaler(structintel_crtc_state*crtc_state, boolforce_detach,drivers/gpu/drm/i915/intel_display.c +1
-1- unsigned scaler_user, int *scaler_id, unsigned int rotation, + unsigned scaler_user, int *scaler_id,int
src_w, intsrc_h, intdst_w, intdst_h)
{
structintel_crtc_scaler_state*scaler_state=drivers/gpu/drm/i915/intel_display.c +7
-4@@ -4680,9 +4680,12 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,to_intel_crtc (crtc_state->base.crtc);int need_scaling; - need_scaling =drm_rotation_90_or_270 (rotation) ? - (src_h != dst_w || src_w != dst_h): - (src_w != dst_w || src_h != dst_h); +/* +* Src coordinates are already rotated by 270 degrees for +* the 90/270 degree plane rotation cases (to match the +* GTT mapping), hence no need to account for rotation here. +*/ + need_scaling = src_w != dst_w || src_h != dst_h;/* * if plane is being disabled or scaler is no more required or force detach @@ -4749,7 +4752,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state) intel_crtc->pipe, SKL_CRTC_INDEX);return skl_update_scaler (state, !state->base.active,SKL_CRTC_INDEX , - &state->scaler_state.scaler_id,DRM_ROTATE_0 , + &state->scaler_state.scaler_id, state->pipe_src_w, state->pipe_src_h, adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay); }drivers/gpu/drm/i915/intel_display.c static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state, · line 4791
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +0
-1@@ -4783,7 +4786,6 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state, ret = skl_update_scaler(crtc_state, force_detach, drm_plane_index(&intel_plane->base), &plane_state->scaler_id, - plane_state->base.rotation, drm_rect_width(&plane_state->base.src) >> 16, drm_rect_height(&plane_state->base.src) >> 16, drm_rect_width(&plane_state->base.dst),Tested-by Tvrtko Ursulin <[email protected]>
Quoted 2 lines
After this only the DRM core revert remains. Is that one something of a workaround or actually could get in?
It itself is a workaround. There are more reasons why it is broken for us than just getting rotation wrong (it breaks the render-vs-modeset ordering, which is both ABI and required for us to prevent GPU hangs). -Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 73 lines · Tvrtko Ursulin
Quoted 61 lines · On 25/10/2016 13:45, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Starting from commit
b63a16f6cd89("drm/i915: Compute display surface offset in the plane check hook for SKL+") we've already rotated the src coordinates by 270 degrees by the time we check if a scaler is needed or not, so we must not account for the rotation a second time. Previously we did these steps in the opposite order and hence the scaler check had to deal with rotation itself. The double rotation handling causes us to enable a scaler pretty much every time 90/270 degree plane rotation is requested, leading to fuzzier fonts and whatnot.Cc Sivakumar Thulasimani <[email protected]>Cc Tvrtko Ursulin <[email protected]>Reported-by Tvrtko Ursulin <[email protected]>Fixes b63a16f6cd89 ("drm/i915: Compute display surface offset in the plane check hook for SKL+")Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_display.c +8
-5@@ -4671,7 +4671,7 @@ static void cpt_verify_modeset(struct drm_device *dev, int pipe)static int skl_update_scaler (struct intel_crtc_state *crtc_state,bool force_detach, -unsigned scaler_user,int *scaler_id,unsigned int rotation, +unsigned scaler_user,int *scaler_id,int src_w,int src_h,int dst_w,int dst_h) { struct intel_crtc_scaler_state *scaler_state =@@ -4680,9 +4680,12 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,to_intel_crtc (crtc_state->base.crtc);int need_scaling; - need_scaling =drm_rotation_90_or_270 (rotation) ? - (src_h != dst_w || src_w != dst_h): - (src_w != dst_w || src_h != dst_h); +/* +* Src coordinates are already rotated by 270 degrees for +* the 90/270 degree plane rotation cases (to match the +* GTT mapping), hence no need to account for rotation here. +*/ + need_scaling = src_w != dst_w || src_h != dst_h;/* * if plane is being disabled or scaler is no more required or force detach @@ -4749,7 +4752,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state) intel_crtc->pipe, SKL_CRTC_INDEX);return skl_update_scaler (state, !state->base.active,SKL_CRTC_INDEX , - &state->scaler_state.scaler_id,DRM_ROTATE_0 , + &state->scaler_state.scaler_id, state->pipe_src_w, state->pipe_src_h, adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay); }drivers/gpu/drm/i915/intel_display.c static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state, · line 4791
Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +0
-1@@ -4783,7 +4786,6 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state, ret = skl_update_scaler(crtc_state, force_detach, drm_plane_index(&intel_plane->base), &plane_state->scaler_id, - plane_state->base.rotation, drm_rect_width(&plane_state->base.src) >> 16, drm_rect_height(&plane_state->base.src) >> 16, drm_rect_width(&plane_state->base.dst),Tested-by Tvrtko Ursulin <[email protected]>
Quoted 2 lines
After this only the DRM core revert remains. Is that one something of a workaround or actually could get in?
We could add an fb_changed boolean to drm_plane_state which drives can use to override the drm helper's decision whether to call prepare_plane. And then i915 could set that if rotation changes.
That's probably the fastest quick fix (but won't type that since I'll be travelling next week).
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx