From: Michel Dänzer <[email protected]> Allows drivers to report whether or not the HW cursor can be used on a per-CRTC basis. If the driver reports that the HW cursor cannot be used on any CRTC, SW cursor has to be used for the screen.
Signed-off-by: Michel Dänzer <[email protected]> --- hw/xfree86/modes/xf86Crtc.h | 11 ++++++++++- hw/xfree86/modes/xf86Cursors.c | 22 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index 8b01608..40650d3 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -235,9 +235,18 @@ typedef struct _xf86CrtcFuncs { Bool (*set_scanout_pixmap)(xf86CrtcPtr crtc, PixmapPtr pixmap); + /** + * Check if the CRTC can use the hardware cursor + * Added in ABI version 7 + */ + Bool + (*use_hw_cursor) (xf86CrtcPtr crtc, CursorPtr cursor); + Bool + (*use_hw_cursor_argb) (xf86CrtcPtr crtc, CursorPtr cursor); + } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr; -#define XF86_CRTC_VERSION 6 +#define XF86_CRTC_VERSION 7 struct _xf86Crtc { /** diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c index 321cde7..3d49533 100644 --- a/hw/xfree86/modes/xf86Cursors.c +++ b/hw/xfree86/modes/xf86Cursors.c @@ -515,6 +515,7 @@ xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor) ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; + int c; cursor = RefCursor(cursor); if (xf86_config->cursor) @@ -525,6 +526,18 @@ xf86_use_hw_cursor(ScreenPtr screen, CursorPtr cursor) cursor->bits->height > cursor_info->MaxHeight) return FALSE; + for (c = 0; c < xf86_config->num_crtc; c++) { + xf86CrtcPtr crtc = xf86_config->crtc[c]; + + if (xf86_driver_has_load_cursor_image(crtc) && + crtc->funcs->use_hw_cursor) { + if (!crtc->funcs->use_hw_cursor(crtc, cursor)) + return FALSE; + } else if (crtc->funcs->use_hw_cursor_argb && + !crtc->funcs->use_hw_cursor_argb(crtc, cursor)) + return FALSE; + } + return TRUE; } @@ -534,6 +547,7 @@ xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor) ScrnInfoPtr scrn = xf86ScreenToScrn(screen); xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); xf86CursorInfoPtr cursor_info = xf86_config->cursor_info; + int c; cursor = RefCursor(cursor); if (xf86_config->cursor) @@ -548,6 +562,14 @@ xf86_use_hw_cursor_argb(ScreenPtr screen, CursorPtr cursor) cursor->bits->height > cursor_info->MaxHeight) return FALSE; + for (c = 0; c < xf86_config->num_crtc; c++) { + xf86CrtcPtr crtc = xf86_config->crtc[c]; + + if (crtc->funcs->use_hw_cursor_argb && + !crtc->funcs->use_hw_cursor_argb(crtc, cursor)) + return FALSE; + } + return TRUE; } -- 2.6.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
