drm/i915: Don't try to use SPR_SCALE when we don't have a sprite scaler
Subsystems (2)
PATCH 1/1 drm/i915: Don't try to use SPR_SCALE when we don't have a sprite scaler
From: Damien Lespiau <[email protected]>
Haswell does not have a scaler in the sprite pipeline anymore, so let's ensure:
1/ We bail out of update_plate() when someone is trying to ask to
display a scaled framebuffer,
2/ We never write to the nonexistent SPR_SCALE register
--- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -221,6 +221,7 @@ struct intel_plane {struct drm_plane base;enum pipe pipe;struct drm_i915_gem_object *obj; +bool can_scale;int max_downscale;u32 lut_r[1024 ], lut_g[1024 ], lut_b[1024 ]; void (*update_plane)(struct drm_plane *plane,
drivers/gpu/drm/i915/intel_sprite.c +13 -1
@@ -136,7 +136,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,I915_WRITE (SPRLINOFF (pipe), offset); }I915_WRITE (SPRSIZE (pipe), (crtc_h <<16 ) | crtc_w); -I915_WRITE (SPRSCALE (pipe), sprscale); +if (intel_plane->can_scale) +I915_WRITE (SPRSCALE (pipe), sprscale);I915_WRITE (SPRCTL (pipe), sprctl);I915_MODIFY_DISPBASE (SPRSURF (pipe), obj->gtt_offset);POSTING_READ (SPRSURF (pipe));
@@ -474,6 +475,12 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, goto out;/* +* We may not have a scaler, eg. HSW does not have it any more +*/ +if (!intel_plane->can_scale && (crtc_w != src_w || crtc_h != src_h)) +return -EINVAL ; + +/* * We can take a larger source and scale it down, but * only so much... 16x is the max on SNB. */
@@ -666,6 +673,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)switch (INTEL_INFO (dev)->gen) {case 5 :case 6 : + intel_plane->can_scale = true; intel_plane->max_downscale =16 ; intel_plane->update_plane = ilk_update_plane; intel_plane->disable_plane = ilk_disable_plane;
@@ -682,6 +690,10 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)break ;case 7 : +if (IS_HASWELL (dev)) + intel_plane->can_scale = false; +else + intel_plane->can_scale = true; intel_plane->max_downscale =2 ; intel_plane->update_plane = ivb_update_plane; intel_plane->disable_plane = ivb_disable_plane;
Signature · 1 line
1.7.11.7
Quoted 62 lines · On Mon, 22 Oct 2012 18:19:27 +0100 Damien Lespiau <[email protected]>…
From: Damien Lespiau <[email protected]>
Haswell does not have a scaler in the sprite pipeline anymore, so let's ensure:
1/ We bail out ofupdate_plate()when someone is trying to ask to
display a scaled framebuffer,
2/ We never write to the nonexistentSPR_SCALEregisterSigned-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -221,6 +221,7 @@ struct intel_plane {struct drm_plane base;enum pipe pipe;struct drm_i915_gem_object *obj; +bool can_scale;int max_downscale;u32 lut_r[1024 ], lut_g[1024 ], lut_b[1024 ]; void (*update_plane)(struct drm_plane *plane,drivers/gpu/drm/i915/intel_sprite.c +9
-1@@ -136,7 +136,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,I915_WRITE (SPRLINOFF (pipe), offset); }I915_WRITE (SPRSIZE (pipe), (crtc_h <<16 ) | crtc_w); -I915_WRITE (SPRSCALE (pipe), sprscale); +if (intel_plane->can_scale) +I915_WRITE (SPRSCALE (pipe), sprscale);I915_WRITE (SPRCTL (pipe), sprctl);I915_MODIFY_DISPBASE (SPRSURF (pipe), obj->gtt_offset);POSTING_READ (SPRSURF (pipe));@@ -474,6 +475,12 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, goto out;/* +* We may not have a scaler, eg. HSW does not have it any more +*/ +if (!intel_plane->can_scale && (crtc_w != src_w || crtc_h != src_h)) +return -EINVAL ; + +/* * We can take a larger source and scale it down, but * only so much... 16x is the max on SNB. */ @@ -666,6 +673,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)switch (INTEL_INFO (dev)->gen) {case 5 :case 6 : + intel_plane->can_scale = true; intel_plane->max_downscale =16 ; intel_plane->update_plane = ilk_update_plane; intel_plane->disable_plane = ilk_disable_plane;
drivers/gpu/drm/i915/intel_sprite.c intel_plane_init(struct drm_device *dev, enum pipe pipe) · line 699
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c +4
-0@@ -682,6 +690,10 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)break ;case 7 : +if (IS_HASWELL (dev)) + intel_plane->can_scale = false; +else + intel_plane->can_scale = true; intel_plane->max_downscale =2 ; intel_plane->update_plane = ivb_update_plane; intel_plane->disable_plane = ivb_disable_plane;
Yeah, looks fine.
Thanks,
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Daniel Vetter
AppliedQuoted 67 lines · Jesse Barnes
Quoted 64 lines · On Mon, 22 Oct 2012 18:19:27 +0100 Damien Lespiau <[email protected]>…
From: Damien Lespiau <[email protected]>
Haswell does not have a scaler in the sprite pipeline anymore, so let's ensure:
1/ We bail out ofupdate_plate()when someone is trying to ask to
display a scaled framebuffer,
2/ We never write to the nonexistentSPR_SCALEregisterSigned-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -221,6 +221,7 @@ struct intel_plane {struct drm_plane base;enum pipe pipe;struct drm_i915_gem_object *obj; +bool can_scale;int max_downscale;u32 lut_r[1024 ], lut_g[1024 ], lut_b[1024 ]; void (*update_plane)(struct drm_plane *plane,drivers/gpu/drm/i915/intel_sprite.c +9
-1@@ -136,7 +136,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,I915_WRITE (SPRLINOFF (pipe), offset); }I915_WRITE (SPRSIZE (pipe), (crtc_h <<16 ) | crtc_w); -I915_WRITE (SPRSCALE (pipe), sprscale); +if (intel_plane->can_scale) +I915_WRITE (SPRSCALE (pipe), sprscale);I915_WRITE (SPRCTL (pipe), sprctl);I915_MODIFY_DISPBASE (SPRSURF (pipe), obj->gtt_offset);POSTING_READ (SPRSURF (pipe));@@ -474,6 +475,12 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, goto out;/* +* We may not have a scaler, eg. HSW does not have it any more +*/ +if (!intel_plane->can_scale && (crtc_w != src_w || crtc_h != src_h)) +return -EINVAL ; + +/* * We can take a larger source and scale it down, but * only so much... 16x is the max on SNB. */ @@ -666,6 +673,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)switch (INTEL_INFO (dev)->gen) {case 5 :case 6 : + intel_plane->can_scale = true; intel_plane->max_downscale =16 ; intel_plane->update_plane = ilk_update_plane; intel_plane->disable_plane = ilk_disable_plane;@@ -682,6 +690,10 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)break ;
Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c intel_plane_init(struct drm_device *dev, enum pipe pipe) · line 699
Quoted 8 lines
drivers/gpu/drm/i915/intel_sprite.c +4
-0case 7 : +if (IS_HASWELL (dev)) + intel_plane->can_scale = false; +else + intel_plane->can_scale = true; intel_plane->max_downscale =2 ; intel_plane->update_plane = ivb_update_plane; intel_plane->disable_plane = ivb_disable_plane;Yeah, looks fine.
Queued for -next, thanks for the patch.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Hi
2012/10/23 Daniel Vetter <[email protected]>:
Quoted 79 lines · Jesse Barnes
Quoted 67 lines
Quoted 64 lines · On Mon, 22 Oct 2012 18:19:27 +0100 Damien Lespiau <[email protected]>…
From: Damien Lespiau <[email protected]>
Haswell does not have a scaler in the sprite pipeline anymore, so let's ensure:
1/ We bail out ofupdate_plate()when someone is trying to ask to
display a scaled framebuffer,
2/ We never write to the nonexistentSPR_SCALEregisterSigned-off-by Damien Lespiau <[email protected]>--- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -221,6 +221,7 @@ struct intel_plane {struct drm_plane base;enum pipe pipe;struct drm_i915_gem_object *obj; +bool can_scale;int max_downscale;u32 lut_r[1024 ], lut_g[1024 ], lut_b[1024 ]; void (*update_plane)(struct drm_plane *plane,drivers/gpu/drm/i915/intel_sprite.c +9
-1@@ -136,7 +136,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_framebuffer *fb,I915_WRITE (SPRLINOFF (pipe), offset); }I915_WRITE (SPRSIZE (pipe), (crtc_h <<16 ) | crtc_w); -I915_WRITE (SPRSCALE (pipe), sprscale); +if (intel_plane->can_scale) +I915_WRITE (SPRSCALE (pipe), sprscale);I915_WRITE (SPRCTL (pipe), sprctl);I915_MODIFY_DISPBASE (SPRSURF (pipe), obj->gtt_offset);POSTING_READ (SPRSURF (pipe));@@ -474,6 +475,12 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, goto out;/* +* We may not have a scaler, eg. HSW does not have it any more +*/ +if (!intel_plane->can_scale && (crtc_w != src_w || crtc_h != src_h)) +return -EINVAL ; + +/* * We can take a larger source and scale it down, but * only so much... 16x is the max on SNB. */ @@ -666,6 +673,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)switch (INTEL_INFO (dev)->gen) {case 5 :case 6 : + intel_plane->can_scale = true; intel_plane->max_downscale =16 ; intel_plane->update_plane = ilk_update_plane; intel_plane->disable_plane = ilk_disable_plane;@@ -682,6 +690,10 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe)break ;Quoted 10 lines
drivers/gpu/drm/i915/intel_sprite.c intel_plane_init(struct drm_device *dev, enum pipe pipe) · line 699
Quoted 8 lines
drivers/gpu/drm/i915/intel_sprite.c +4
-0case 7 : +if (IS_HASWELL (dev)) + intel_plane->can_scale = false; +else + intel_plane->can_scale = true; intel_plane->max_downscale =2 ; intel_plane->update_plane = ivb_update_plane; intel_plane->disable_plane = ivb_disable_plane;Yeah, looks fine.
Quoted 1 line
Queued for -next, thanks for the patch.
After testing this, I see we also need to patch ivb_disable_plane to not write SPRSCALE. Everything else looks correct, so no problem to include this in a separate patch.
Quoted 9 lines
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Paulo Zanoni