Re: [PATCH 01/16] cursor: drop ARGB_CURSOR

2015-06-26 Thread Aaron Plattner
On 06/25/2015 04:51 PM, Dave Airlie wrote:
 From: Dave Airlie airl...@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.
 
 Reviewed-by: Alex Deucher alexander.deuc...@amd.com
 Signed-off-by: Dave Airlie airl...@redhat.com

Yes please.

Reviewed-by: Aaron Plattner aplatt...@nvidia.com

FWIW, I removed the checks for these from our driver in 2008.

 ---
  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++  0xff00)
  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 =
  

[PATCH 01/16] cursor: drop ARGB_CURSOR

2015-06-25 Thread Dave Airlie
From: Dave Airlie airl...@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.

Reviewed-by: Alex Deucher alexander.deuc...@amd.com
Signed-off-by: Dave Airlie airl...@redhat.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++  0xff00)
 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