diff mbox

[1/2] drm/radeon: Try harder to avoid HW cursor ending on a multiple of 128 columns.

Message ID 1342544529-3752-1-git-send-email-michel@daenzer.net (mailing list archive)
State Accepted
Headers show

Commit Message

Michel Dänzer July 17, 2012, 5:02 p.m. UTC
From: Michel Dänzer <michel.daenzer@amd.com>

This could previously fail if either of the enabled displays was using a
horizontal resolution that is a multiple of 128, and only the leftmost column
of the cursor was (supposed to be) visible at the right edge of that display.

The solution is to move the cursor one pixel to the left in that case.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33183

Cc: stable@vger.kernel.org
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
---
 drivers/gpu/drm/radeon/radeon_cursor.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Michel Dänzer July 17, 2012, 5:10 p.m. UTC | #1
Ignore the 1/2, there's no second patch.
Alex Deucher July 17, 2012, 5:43 p.m. UTC | #2
On Tue, Jul 17, 2012 at 1:02 PM, Michel Dänzer <michel@daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@amd.com>
>
> This could previously fail if either of the enabled displays was using a
> horizontal resolution that is a multiple of 128, and only the leftmost column
> of the cursor was (supposed to be) visible at the right edge of that display.
>
> The solution is to move the cursor one pixel to the left in that case.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33183
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>

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

> ---
>  drivers/gpu/drm/radeon/radeon_cursor.c |    8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
> index 42acc64..711e95a 100644
> --- a/drivers/gpu/drm/radeon/radeon_cursor.c
> +++ b/drivers/gpu/drm/radeon/radeon_cursor.c
> @@ -262,8 +262,14 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
>                                 if (!(cursor_end & 0x7f))
>                                         w--;
>                         }
> -                       if (w <= 0)
> +                       if (w <= 0) {
>                                 w = 1;
> +                               cursor_end = x - xorigin + w;
> +                               if (!(cursor_end & 0x7f)) {
> +                                       x--;
> +                                       WARN_ON_ONCE(x < 0);
> +                               }
> +                       }
>                 }
>         }
>
> --
> 1.7.10
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Dave Airlie July 20, 2012, 1:48 a.m. UTC | #3
On Wed, Jul 18, 2012 at 3:43 AM, Alex Deucher <alexdeucher@gmail.com> wrote:
> On Tue, Jul 17, 2012 at 1:02 PM, Michel Dänzer <michel@daenzer.net> wrote:
>> From: Michel Dänzer <michel.daenzer@amd.com>
>>
>> This could previously fail if either of the enabled displays was using a
>> horizontal resolution that is a multiple of 128, and only the leftmost column
>> of the cursor was (supposed to be) visible at the right edge of that display.
>>
>> The solution is to move the cursor one pixel to the left in that case.
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33183
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
>
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>
Applied to -next,

Thanks,
Dave.
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index 42acc64..711e95a 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -262,8 +262,14 @@  int radeon_crtc_cursor_move(struct drm_crtc *crtc,
 				if (!(cursor_end & 0x7f))
 					w--;
 			}
-			if (w <= 0)
+			if (w <= 0) {
 				w = 1;
+				cursor_end = x - xorigin + w;
+				if (!(cursor_end & 0x7f)) {
+					x--;
+					WARN_ON_ONCE(x < 0);
+				}
+			}
 		}
 	}