[PATCH] [RFC] cursor: drop ARGB_CURSOR
Alex Deucher
alexdeucher at gmail.com
Tue Jun 9 06:16:08 PDT 2015
On Tue, Jun 9, 2015 at 1:31 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> I doubt anyone builds with this turned off or has done for a long
> time.
>
> It helps my eyes bleed slightly less when reading the code, I've left
> the define in place as some drivers use it.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> dix/cursor.c | 8 --------
> hw/kdrive/ephyr/ephyrcursor.c | 4 ----
> hw/xfree86/modes/xf86Cursors.c | 8 --------
> hw/xfree86/ramdac/xf86Cursor.c | 2 --
> hw/xfree86/ramdac/xf86Cursor.h | 4 ----
> hw/xfree86/ramdac/xf86HWCurs.c | 6 ------
> hw/xquartz/xpr/xprCursor.c | 2 --
> include/cursorstr.h | 2 --
> mi/midispcur.c | 20 +-------------------
> xfixes/cursor.c | 2 --
> 10 files changed, 1 insertion(+), 57 deletions(-)
>
> diff --git a/dix/cursor.c b/dix/cursor.c
> index 1525857..e459456 100644
> --- a/dix/cursor.c
> +++ b/dix/cursor.c
> @@ -80,9 +80,7 @@ FreeCursorBits(CursorBitsPtr bits)
> return;
> free(bits->source);
> free(bits->mask);
> -#ifdef ARGB_CURSOR
> free(bits->argb);
> -#endif
> dixFiniPrivates(bits, PRIVATE_CURSOR_BITS);
> if (bits->refcnt == 0) {
> GlyphSharePtr *prev, this;
> @@ -165,7 +163,6 @@ CheckForEmptyMask(CursorBitsPtr bits)
> while (n--)
> if (*(msk++) != 0)
> return;
> -#ifdef ARGB_CURSOR
> if (bits->argb) {
> CARD32 *argb = bits->argb;
>
> @@ -174,7 +171,6 @@ CheckForEmptyMask(CursorBitsPtr bits)
> if (*argb++ & 0xff000000)
> return;
> }
> -#endif
> bits->emptyMask = TRUE;
> }
>
> @@ -259,9 +255,7 @@ AllocARGBCursor(unsigned char *psrcbits, unsigned char *pmaskbits,
> dixInitPrivates(bits, bits + 1, PRIVATE_CURSOR_BITS)
> bits->source = psrcbits;
> bits->mask = pmaskbits;
> -#ifdef ARGB_CURSOR
> bits->argb = argb;
> -#endif
> bits->width = cm->width;
> bits->height = cm->height;
> bits->xhot = cm->xhot;
> @@ -400,9 +394,7 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar,
> dixInitPrivates(bits, bits + 1, PRIVATE_CURSOR_BITS);
> bits->source = srcbits;
> bits->mask = mskbits;
> -#ifdef ARGB_CURSOR
> bits->argb = 0;
> -#endif
> bits->width = cm.width;
> bits->height = cm.height;
> bits->xhot = cm.xhot;
> diff --git a/hw/kdrive/ephyr/ephyrcursor.c b/hw/kdrive/ephyr/ephyrcursor.c
> index 852be33..808b3c7 100644
> --- a/hw/kdrive/ephyr/ephyrcursor.c
> +++ b/hw/kdrive/ephyr/ephyrcursor.c
> @@ -100,7 +100,6 @@ ephyrRealizeCoreCursor(EphyrScrPriv *scr, CursorPtr cursor)
> xcb_free_pixmap(conn, mask);
> }
>
> -#ifdef ARGB_CURSOR
> static xcb_render_pictformat_t
> get_argb_format(void)
> {
> @@ -170,7 +169,6 @@ can_argb_cursor(void)
>
> return v->major_version == 0 && v->minor_version >= 5;
> }
> -#endif
>
> static Bool
> ephyrRealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor)
> @@ -179,11 +177,9 @@ ephyrRealizeCursor(DeviceIntPtr dev, ScreenPtr screen, CursorPtr cursor)
> KdScreenInfo *kscr = pScreenPriv->screen;
> EphyrScrPriv *scr = kscr->driver;
>
> -#ifdef ARGB_CURSOR
> if (cursor->bits->argb && can_argb_cursor())
> ephyrRealizeARGBCursor(scr, cursor);
> else
> -#endif
> {
> ephyrRealizeCoreCursor(scr, cursor);
> }
> diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
> index 379a27a..321cde7 100644
> --- a/hw/xfree86/modes/xf86Cursors.c
> +++ b/hw/xfree86/modes/xf86Cursors.c
> @@ -258,9 +258,7 @@ xf86_crtc_convert_cursor_to_argb(xf86CrtcPtr crtc, unsigned char *src)
> CARD32 bits;
> const Rotation rotation = xf86_crtc_cursor_rotation(crtc);
>
> -#ifdef ARGB_CURSOR
> crtc->cursor_argb = FALSE;
> -#endif
>
> for (y = 0; y < cursor_info->MaxHeight; y++)
> for (x = 0; x < cursor_info->MaxWidth; x++) {
> @@ -458,9 +456,7 @@ xf86_crtc_load_cursor_image(xf86CrtcPtr crtc, CARD8 *src)
> CARD8 *cursor_image;
> const Rotation rotation = xf86_crtc_cursor_rotation(crtc);
>
> -#ifdef ARGB_CURSOR
> crtc->cursor_argb = FALSE;
> -#endif
>
> if (rotation == RR_Rotate_0)
> cursor_image = src;
> @@ -632,12 +628,10 @@ xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags)
> cursor_info->HideCursor = xf86_hide_cursors;
> cursor_info->ShowCursor = xf86_show_cursors;
> cursor_info->UseHWCursor = xf86_use_hw_cursor;
> -#ifdef ARGB_CURSOR
> if (flags & HARDWARE_CURSOR_ARGB) {
> cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb;
> cursor_info->LoadCursorARGBCheck = xf86_load_cursor_argb;
> }
> -#endif
>
> xf86_config->cursor = NULL;
> xf86_hide_cursors(scrn);
> @@ -691,11 +685,9 @@ xf86_reload_cursors(ScreenPtr screen)
> void *src =
> dixLookupScreenPrivate(&cursor->devPrivates, CursorScreenKey,
> screen);
> -#ifdef ARGB_CURSOR
> if (cursor->bits->argb && xf86DriverHasLoadCursorARGB(cursor_info))
> xf86DriverLoadCursorARGB(cursor_info, cursor);
> else if (src)
> -#endif
> xf86DriverLoadCursorImage(cursor_info, src);
>
> x += scrn->frameX0 + cursor_screen_priv->HotX;
> diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
> index 04496d5..2a54571 100644
> --- a/hw/xfree86/ramdac/xf86Cursor.c
> +++ b/hw/xfree86/ramdac/xf86Cursor.c
> @@ -340,12 +340,10 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
> if (infoPtr->pScrn->vtSema && xorg_list_is_empty(&pScreen->pixmap_dirty_list) &&
> (ScreenPriv->ForceHWCursorCount ||
> ((
> -#ifdef ARGB_CURSOR
> cursor->bits->argb &&
> infoPtr->UseHWCursorARGB &&
> (*infoPtr->UseHWCursorARGB)(pScreen, cursor)) ||
> (cursor->bits->argb == 0 &&
> -#endif
> (cursor->bits->height <= infoPtr->MaxHeight) &&
> (cursor->bits->width <= infoPtr->MaxWidth) &&
> (!infoPtr->UseHWCursor || (*infoPtr->UseHWCursor) (pScreen, cursor)))))) {
> diff --git a/hw/xfree86/ramdac/xf86Cursor.h b/hw/xfree86/ramdac/xf86Cursor.h
> index a389a99..8c98bb1 100644
> --- a/hw/xfree86/ramdac/xf86Cursor.h
> +++ b/hw/xfree86/ramdac/xf86Cursor.h
> @@ -19,11 +19,9 @@ typedef struct _xf86CursorInfoRec {
> unsigned char *(*RealizeCursor) (struct _xf86CursorInfoRec *, CursorPtr);
> Bool (*UseHWCursor) (ScreenPtr, CursorPtr);
>
> -#ifdef ARGB_CURSOR
> Bool (*UseHWCursorARGB) (ScreenPtr, CursorPtr);
> void (*LoadCursorARGB) (ScrnInfoPtr, CursorPtr);
> Bool (*LoadCursorARGBCheck) (ScrnInfoPtr, CursorPtr);
> -#endif
>
> } xf86CursorInfoRec, *xf86CursorInfoPtr;
>
> @@ -77,8 +75,6 @@ extern _X_EXPORT void xf86ForceHWCursor(ScreenPtr pScreen, Bool on);
> #define HARDWARE_CURSOR_NIBBLE_SWAPPED 0x00000800
> #define HARDWARE_CURSOR_SHOW_TRANSPARENT 0x00001000
> #define HARDWARE_CURSOR_UPDATE_UNHIDDEN 0x00002000
> -#ifdef ARGB_CURSOR
> #define HARDWARE_CURSOR_ARGB 0x00004000
> -#endif
>
> #endif /* _XF86CURSOR_H */
> diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
> index be7154e..84febe0 100644
> --- a/hw/xfree86/ramdac/xf86HWCurs.c
> +++ b/hw/xfree86/ramdac/xf86HWCurs.c
> @@ -139,9 +139,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
> x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
> y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
>
> -#ifdef ARGB_CURSOR
> if (!pCurs->bits->argb || !xf86DriverHasLoadCursorARGB(infoPtr))
> -#endif
> if (!bits) {
> bits = (*infoPtr->RealizeCursor) (infoPtr, pCurs);
> dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen,
> @@ -151,12 +149,10 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
> if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
> (*infoPtr->HideCursor) (infoPtr->pScrn);
>
> -#ifdef ARGB_CURSOR
> if (pCurs->bits->argb && xf86DriverHasLoadCursorARGB(infoPtr)) {
> if (!xf86DriverLoadCursorARGB (infoPtr, pCurs))
> return FALSE;
> } else
> -#endif
> if (bits)
> if (!xf86DriverLoadCursorImage (infoPtr, bits))
> return FALSE;
> @@ -213,12 +209,10 @@ xf86RecolorCursor(ScreenPtr pScreen, CursorPtr pCurs, Bool displayed)
> xf86CursorScreenKey);
> xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
>
> -#ifdef ARGB_CURSOR
> /* recoloring isn't applicable to ARGB cursors and drivers
> shouldn't have to ignore SetCursorColors requests */
> if (pCurs->bits->argb)
> return;
> -#endif
>
> if (ScreenPriv->PalettedCursor) {
> xColorItem sourceColor, maskColor;
> diff --git a/hw/xquartz/xpr/xprCursor.c b/hw/xquartz/xpr/xprCursor.c
> index 4168f7c..5e89348 100644
> --- a/hw/xquartz/xpr/xprCursor.c
> +++ b/hw/xquartz/xpr/xprCursor.c
> @@ -85,7 +85,6 @@ load_cursor(CursorPtr src, int screen)
> hot_x = src->bits->xhot;
> hot_y = src->bits->yhot;
>
> -#ifdef ARGB_CURSOR
> if (src->bits->argb != NULL) {
> #if BITMAP_BIT_ORDER == MSBFirst
> rowbytes = src->bits->width * sizeof(CARD32);
> @@ -104,7 +103,6 @@ load_cursor(CursorPtr src, int screen)
> #endif
> }
> else
> -#endif
> {
> fg_color = 0xFF00 | (src->foreRed >> 8);
> fg_color <<= 16;
> diff --git a/include/cursorstr.h b/include/cursorstr.h
> index 221cd70..3f306a4 100644
> --- a/include/cursorstr.h
> +++ b/include/cursorstr.h
> @@ -64,9 +64,7 @@ typedef struct _CursorBits {
> unsigned short width, height, xhot, yhot; /* metrics */
> int refcnt; /* can be shared */
> PrivateRec *devPrivates; /* set by pScr->RealizeCursor */
> -#ifdef ARGB_CURSOR
> CARD32 *argb; /* full-color alpha blended */
> -#endif
> } CursorBits, *CursorBitsPtr;
>
> #define CURSOR_BITS_SIZE (sizeof(CursorBits) + dixPrivatesSize(PRIVATE_CURSOR_BITS))
> diff --git a/mi/midispcur.c b/mi/midispcur.c
> index 50f0dd2..d1da0fd 100644
> --- a/mi/midispcur.c
> +++ b/mi/midispcur.c
> @@ -46,9 +46,7 @@ in this Software without prior written authorization from The Open Group.
> #include "misprite.h"
> #include "gcstruct.h"
>
> -#ifdef ARGB_CURSOR
> #include "picturestr.h"
> -#endif
>
> #include "inputstr.h"
>
> @@ -68,9 +66,7 @@ typedef struct {
> GCPtr pSourceGC, pMaskGC;
> GCPtr pSaveGC, pRestoreGC;
> PixmapPtr pSave;
> -#ifdef ARGB_CURSOR
> PicturePtr pRootPicture;
> -#endif
> } miDCBufferRec, *miDCBufferPtr;
>
> #define miGetDCDevice(dev, screen) \
> @@ -86,9 +82,7 @@ typedef struct {
> CloseScreenProcPtr CloseScreen;
> PixmapPtr sourceBits; /* source bits */
> PixmapPtr maskBits; /* mask bits */
> -#ifdef ARGB_CURSOR
> PicturePtr pPicture;
> -#endif
> CursorPtr pCursor;
> } miDCScreenRec, *miDCScreenPtr;
>
> @@ -133,11 +127,9 @@ miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBit
> (*pScreen->DestroyPixmap)(pScreenPriv->maskBits);
> pScreenPriv->maskBits = maskBits;
>
> -#ifdef ARGB_CURSOR
> if (pScreenPriv->pPicture)
> FreePicture(pScreenPriv->pPicture, 0);
> pScreenPriv->pPicture = pPicture;
> -#endif
>
> pScreenPriv->pCursor = pCursor;
> }
> @@ -162,7 +154,6 @@ miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor)
> return TRUE;
> }
>
> -#ifdef ARGB_CURSOR
> #define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win))
>
> static PicturePtr
> @@ -182,7 +173,6 @@ miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin)
> *ppPicture = pPicture;
> return pPicture;
> }
> -#endif
>
> static Bool
> miDCRealize(ScreenPtr pScreen, CursorPtr pCursor)
> @@ -195,8 +185,6 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor)
> if (pScreenPriv->pCursor == pCursor)
> return TRUE;
>
> -#ifdef ARGB_CURSOR
> -
> if (pCursor->bits->argb) {
> PixmapPtr pPixmap;
> PictFormatPtr pFormat;
> @@ -233,7 +221,7 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor)
> miDCSwitchScreenCursor(pScreen, pCursor, NULL, NULL, pPicture);
> return TRUE;
> }
> -#endif
> +
> sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width,
> pCursor->bits->height, 1, 0);
> if (!sourceBits)
> @@ -373,7 +361,6 @@ miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
> pWin = pScreen->root;
> pBuffer = miGetDCDevice(pDev, pScreen);
>
> -#ifdef ARGB_CURSOR
> if (pScreenPriv->pPicture) {
> if (!EnsurePicture(pBuffer->pRootPicture, &pWin->drawable, pWin))
> return FALSE;
> @@ -385,7 +372,6 @@ miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
> x, y, pCursor->bits->width, pCursor->bits->height);
> }
> else
> -#endif
> {
> miDCPutBits((DrawablePtr) pWin,
> pBuffer->pSourceGC, pBuffer->pMaskGC,
> @@ -486,9 +472,7 @@ miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
> if (!pBuffer->pRestoreGC)
> goto failure;
>
> -#ifdef ARGB_CURSOR
> pBuffer->pRootPicture = NULL;
> -#endif
>
> /* (re)allocated lazily depending on the cursor size */
> pBuffer->pSave = NULL;
> @@ -525,11 +509,9 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
> if (pBuffer->pRestoreGC)
> FreeGC(pBuffer->pRestoreGC, (GContext) 0);
>
> -#ifdef ARGB_CURSOR
> /* If a pRootPicture was allocated for a root window, it
> * is freed when that root window is destroyed, so don't
> * free it again here. */
> -#endif
>
> if (pBuffer->pSave)
> (*pScreen->DestroyPixmap) (pBuffer->pSave);
> diff --git a/xfixes/cursor.c b/xfixes/cursor.c
> index 94d24a8..5619aad 100644
> --- a/xfixes/cursor.c
> +++ b/xfixes/cursor.c
> @@ -306,11 +306,9 @@ CopyCursorToImage(CursorPtr pCursor, CARD32 *image)
> int height = pCursor->bits->height;
> int npixels = width * height;
>
> -#ifdef ARGB_CURSOR
> if (pCursor->bits->argb)
> memcpy(image, pCursor->bits->argb, npixels * sizeof(CARD32));
> else
> -#endif
> {
> unsigned char *srcLine = pCursor->bits->source;
> unsigned char *mskLine = pCursor->bits->mask;
> --
> 2.4.2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
More information about the xorg-devel
mailing list