All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] radeon: Set DESKTOP_HEIGHT register to the framebuffer (not mode) height.
@ 2012-02-01 11:09 Michel Dänzer
  2012-02-01 14:16 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Michel Dänzer @ 2012-02-01 11:09 UTC (permalink / raw)
  To: dri-devel

From: Michel Dänzer <michel.daenzer@amd.com>

The value of this register is transferred to the V_COUNTER register at the
beginning of vertical blank. V_COUNTER is the reference for VLINE waits and
goes from VIEWPORT_Y_START to VIEWPORT_Y_START+VIEWPORT_HEIGHT during scanout,
so if VIEWPORT_Y_START is not 0, V_COUNTER actually went backwards at the
beginning of vertical blank, and VLINE waits excluding the whole scanout area
could never finish (possibly only if VIEWPORT_Y_START is larger than the length
of vertical blank in scanlines). Setting DESKTOP_HEIGHT to the framebuffer
height should prevent this for any kind of VLINE wait.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=45329 .

CC: stable@vger.kernel.org
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---

Maybe we should also check/clamp the VLINE ranges from userspace?

 drivers/gpu/drm/radeon/atombios_crtc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 0fda830..c54efd4 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1189,7 +1189,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
 	WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 1);
 
 	WREG32(EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset,
-	       crtc->mode.vdisplay);
+	       target_fb->height);
 	x &= ~3;
 	y &= ~1;
 	WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset,
@@ -1358,7 +1358,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
 	WREG32(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1);
 
 	WREG32(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset,
-	       crtc->mode.vdisplay);
+	       target_fb->height);
 	x &= ~3;
 	y &= ~1;
 	WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset,
-- 
1.7.8.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] radeon: Set DESKTOP_HEIGHT register to the framebuffer (not mode) height.
  2012-02-01 11:09 [PATCH] radeon: Set DESKTOP_HEIGHT register to the framebuffer (not mode) height Michel Dänzer
@ 2012-02-01 14:16 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2012-02-01 14:16 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: dri-devel

2012/2/1 Michel Dänzer <michel@daenzer.net>:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> The value of this register is transferred to the V_COUNTER register at the
> beginning of vertical blank. V_COUNTER is the reference for VLINE waits and
> goes from VIEWPORT_Y_START to VIEWPORT_Y_START+VIEWPORT_HEIGHT during scanout,
> so if VIEWPORT_Y_START is not 0, V_COUNTER actually went backwards at the
> beginning of vertical blank, and VLINE waits excluding the whole scanout area
> could never finish (possibly only if VIEWPORT_Y_START is larger than the length
> of vertical blank in scanlines). Setting DESKTOP_HEIGHT to the framebuffer
> height should prevent this for any kind of VLINE wait.
>
> Fixes https://bugs.freedesktop.org/show_bug.cgi?id=45329 .
>
> CC: stable@vger.kernel.org
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>
> Maybe we should also check/clamp the VLINE ranges from userspace?
>
>  drivers/gpu/drm/radeon/atombios_crtc.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
> index 0fda830..c54efd4 100644
> --- a/drivers/gpu/drm/radeon/atombios_crtc.c
> +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
> @@ -1189,7 +1189,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
>        WREG32(EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset, 1);
>
>        WREG32(EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset,
> -              crtc->mode.vdisplay);
> +              target_fb->height);
>        x &= ~3;
>        y &= ~1;
>        WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset,
> @@ -1358,7 +1358,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
>        WREG32(AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset, 1);
>
>        WREG32(AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset,
> -              crtc->mode.vdisplay);
> +              target_fb->height);
>        x &= ~3;
>        y &= ~1;
>        WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset,
> --
> 1.7.8.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-01 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-01 11:09 [PATCH] radeon: Set DESKTOP_HEIGHT register to the framebuffer (not mode) height Michel Dänzer
2012-02-01 14:16 ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.