[PATCH v6 xserver 3/7] xf86Cursor: Add xf86CheckHWCursor() helper function

Hans de Goede hdegoede at redhat.com
Wed Sep 7 12:26:27 UTC 2016


From: Dave Airlie <airlied at redhat.com>

This is a preparation patch for adding prime hw-cursor support.

Signed-off-by: Dave Airlie <airlied at redhat.com>
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
Changes in v6 (Hans de Goede):
-Do not remove xorg_list_is_empty(&pScreen->pixmap_dirty_list)
 check from xf86CursorSetCursor()

Changes in v5 (Hans de Goede):
-Split xf86CheckHWCursor() helper addition out into its own patch
---
 hw/xfree86/ramdac/xf86Cursor.c     |  9 +--------
 hw/xfree86/ramdac/xf86CursorPriv.h |  1 +
 hw/xfree86/ramdac/xf86HWCurs.c     | 12 ++++++++++++
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index dda4349..0c5d6c9 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -339,14 +339,7 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
 
         if (infoPtr->pScrn->vtSema && xorg_list_is_empty(&pScreen->pixmap_dirty_list) &&
             (ScreenPriv->ForceHWCursorCount ||
-             ((
-               cursor->bits->argb &&
-               infoPtr->UseHWCursorARGB &&
-               (*infoPtr->UseHWCursorARGB)(pScreen, cursor)) ||
-              (cursor->bits->argb == 0 &&
-               (cursor->bits->height <= infoPtr->MaxHeight) &&
-               (cursor->bits->width <= infoPtr->MaxWidth) &&
-               (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor) (pScreen, cursor)))))) {
+             xf86CheckHWCursor(pScreen, cursor, infoPtr))) {
 
             if (ScreenPriv->SWCursor)   /* remove the SW cursor */
                 (*ScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen,
diff --git a/hw/xfree86/ramdac/xf86CursorPriv.h b/hw/xfree86/ramdac/xf86CursorPriv.h
index f34c1c7..397d2a1 100644
--- a/hw/xfree86/ramdac/xf86CursorPriv.h
+++ b/hw/xfree86/ramdac/xf86CursorPriv.h
@@ -43,6 +43,7 @@ void xf86MoveCursor(ScreenPtr pScreen, int x, int y);
 void xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed);
 Bool xf86InitHardwareCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr);
 
+Bool xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr);
 extern _X_EXPORT DevPrivateKeyRec xf86CursorScreenKeyRec;
 
 #define xf86CursorScreenKey (&xf86CursorScreenKeyRec)
diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
index 458781c..0f6990a 100644
--- a/hw/xfree86/ramdac/xf86HWCurs.c
+++ b/hw/xfree86/ramdac/xf86HWCurs.c
@@ -130,6 +130,18 @@ xf86ShowCursor(xf86CursorInfoPtr infoPtr)
 }
 
 Bool
+xf86CheckHWCursor(ScreenPtr pScreen, CursorPtr cursor, xf86CursorInfoPtr infoPtr)
+{
+    return
+        (cursor->bits->argb && infoPtr->UseHWCursorARGB &&
+         infoPtr->UseHWCursorARGB(pScreen, cursor)) ||
+        (cursor->bits->argb == 0 &&
+         cursor->bits->height <= infoPtr->MaxHeight &&
+         cursor->bits->width <= infoPtr->MaxWidth &&
+         (!infoPtr->UseHWCursor || infoPtr->UseHWCursor(pScreen, cursor)));
+}
+
+Bool
 xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
 {
     xf86CursorScreenPtr ScreenPriv =
-- 
2.9.3



More information about the xorg-devel mailing list