[PATCH xserver 1/5] xfree86/modes: Refactor xf86_use_hw_cursor_argb to use xf86_use_hw_cursor
Michel Dänzer
michel at daenzer.net
Wed Dec 23 23:57:25 PST 2015
From: Michel Dänzer <michel.daenzer at amd.com>
This reduces code duplication.
One side effect of this change is that xf86_config->cursor will no longer
be updated for cursors which cannot use the HW cursor.
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
The side effect might actually be a bugfix? Haven't noticed any actual
problems because of this though.
hw/xfree86/modes/xf86Cursors.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
index 321cde7..f487890 100644
--- a/hw/xfree86/modes/xf86Cursors.c
+++ b/hw/xfree86/modes/xf86Cursors.c
@@ -516,15 +516,15 @@ xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
+ if (cursor->bits->width > cursor_info->MaxWidth ||
+ cursor->bits->height > cursor_info->MaxHeight)
+ return FALSE;
+
cursor = RefCursor(cursor);
if (xf86_config->cursor)
FreeCursor(xf86_config->cursor, None);
xf86_config->cursor = cursor;
- if (cursor->bits->width > cursor_info->MaxWidth ||
- cursor->bits->height > cursor_info->MaxHeight)
- return FALSE;
-
return TRUE;
}
@@ -535,20 +535,11 @@ xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor)
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
xf86CursorInfoPtr cursor_info = xf86_config->cursor_info;
- cursor = RefCursor(cursor);
- if (xf86_config->cursor)
- FreeCursor(xf86_config->cursor, None);
- xf86_config->cursor = cursor;
-
/* Make sure ARGB support is available */
if ((cursor_info->Flags & HARDWARE_CURSOR_ARGB) == 0)
return FALSE;
- if (cursor->bits->width > cursor_info->MaxWidth ||
- cursor->bits->height > cursor_info->MaxHeight)
- return FALSE;
-
- return TRUE;
+ return xf86_use_hw_cursor(screen, cursor);
}
static Bool
--
2.6.2
More information about the xorg-devel
mailing list