sna: Switch from ifdef PICT_ to if XORG_VERSION_CURRENT

Graphics / X.Org / xf86-video-intel - Chris Wilson [chris-wilson.co.uk] - 7 February 2018 19:04 EST

The PICT_ are enums and so never report true to ifdef PICT_a2r10g10b10 and instead we need to check the xserver version they were introduced.

###

diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 4459a562..166635eb 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -108,7 +108,7 @@ static const struct formatinfo {
{PICT_x8r8g8b8, 0, MAPSURF_32BIT | MT_32BIT_XRGB8888, false},
{PICT_a8b8g8r8, 0, MAPSURF_32BIT | MT_32BIT_ABGR8888, false},
{PICT_x8b8g8r8, 0, MAPSURF_32BIT | MT_32BIT_XBGR8888, false},
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
{PICT_a2r10g10b10, PICT_x2r10g10b10, MAPSURF_32BIT | MT_32BIT_ARGB2101010, false},
{PICT_a2b10g10r10, PICT_x2b10g10r10, MAPSURF_32BIT | MT_32BIT_ABGR2101010, false},
#endif
@@ -208,7 +208,7 @@ static bool gen3_check_dst_format(uint32_t format)
case PICT_x1r5g5b5:
case PICT_a1b5g5r5:
case PICT_x1b5g5r5:
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
case PICT_x2r10g10b10:
case PICT_a2b10g10r10:
@@ -233,7 +233,7 @@ static bool gen3_dst_rb_reversed(uint32_t format)
case PICT_r5g6b5:
case PICT_a1r5g5b5:
case PICT_x1r5g5b5:
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
case PICT_x2r10g10b10:
#endif
@@ -267,7 +267,7 @@ static uint32_t gen3_get_dst_format(uint32_t format)
case PICT_a1b5g5r5:
case PICT_x1b5g5r5:
return BIAS | COLR_BUF_ARGB1555;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
case PICT_x2r10g10b10:
case PICT_a2b10g10r10:
@@ -322,7 +322,7 @@ static bool gen3_check_xformat(PicturePtr p)
case PICT_x1r5g5b5:
case PICT_a1b5g5r5:
case PICT_x1b5g5r5:
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
case PICT_x2r10g10b10:
case PICT_a2b10g10r10:
diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c
index 84529994..f74b76f0 100644
--- a/src/sna/gen4_render.c
+++ b/src/sna/gen4_render.c
@@ -305,7 +305,7 @@ static uint32_t gen4_get_card_format(PictFormat format)
return GEN4_SURFACEFORMAT_R8G8B8A8_UNORM;
case PICT_x8b8g8r8:
return GEN4_SURFACEFORMAT_R8G8B8X8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
return GEN4_SURFACEFORMAT_B10G10R10A2_UNORM;
case PICT_x2r10g10b10:
@@ -335,7 +335,7 @@ static uint32_t gen4_get_dest_format(PictFormat format)
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
return GEN4_SURFACEFORMAT_R8G8B8A8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
case PICT_x2r10g10b10:
return GEN4_SURFACEFORMAT_B10G10R10A2_UNORM;
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index 91c58236..46535f7b 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -294,7 +294,7 @@ static uint32_t gen5_get_card_format(PictFormat format)
return GEN5_SURFACEFORMAT_R8G8B8A8_UNORM;
case PICT_x8b8g8r8:
return GEN5_SURFACEFORMAT_R8G8B8X8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
return GEN5_SURFACEFORMAT_B10G10R10A2_UNORM;
case PICT_x2r10g10b10:
@@ -324,7 +324,7 @@ static uint32_t gen5_get_dest_format(PictFormat format)
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
return GEN5_SURFACEFORMAT_R8G8B8A8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
case PICT_x2r10g10b10:
return GEN5_SURFACEFORMAT_B10G10R10A2_UNORM;
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index f8776c61..e847062f 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -269,7 +269,7 @@ static uint32_t gen6_get_card_format(PictFormat format)
return GEN6_SURFACEFORMAT_R8G8B8A8_UNORM;
case PICT_x8b8g8r8:
return GEN6_SURFACEFORMAT_R8G8B8X8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
return GEN6_SURFACEFORMAT_B10G10R10A2_UNORM;
case PICT_x2r10g10b10:
@@ -299,7 +299,7 @@ static uint32_t gen6_get_dest_format(PictFormat format)
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
return GEN6_SURFACEFORMAT_R8G8B8A8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
case PICT_x2r10g10b10:
return GEN6_SURFACEFORMAT_B10G10R10A2_UNORM;
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index ad48453a..c3f81c52 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -369,7 +369,7 @@ static uint32_t gen7_get_card_format(PictFormat format)
return GEN7_SURFACEFORMAT_R8G8B8A8_UNORM;
case PICT_x8b8g8r8:
return GEN7_SURFACEFORMAT_R8G8B8X8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
return GEN7_SURFACEFORMAT_B10G10R10A2_UNORM;
case PICT_x2r10g10b10:
@@ -399,7 +399,7 @@ static uint32_t gen7_get_dest_format(PictFormat format)
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
return GEN7_SURFACEFORMAT_R8G8B8A8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
case PICT_x2r10g10b10:
return GEN7_SURFACEFORMAT_B10G10R10A2_UNORM;
diff --git a/src/sna/gen8_render.c b/src/sna/gen8_render.c
index 02f69b6a..f7a797b3 100644
--- a/src/sna/gen8_render.c
+++ b/src/sna/gen8_render.c
@@ -338,7 +338,7 @@ static uint32_t gen8_get_card_format(PictFormat format)
return SURFACEFORMAT_R8G8B8A8_UNORM;
case PICT_x8b8g8r8:
return SURFACEFORMAT_R8G8B8X8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
return SURFACEFORMAT_B10G10R10A2_UNORM;
case PICT_x2r10g10b10:
@@ -368,7 +368,7 @@ static uint32_t gen8_get_dest_format(PictFormat format)
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
return SURFACEFORMAT_R8G8B8A8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
case PICT_x2r10g10b10:
return SURFACEFORMAT_B10G10R10A2_UNORM;
diff --git a/src/sna/gen9_render.c b/src/sna/gen9_render.c
index 82ff4e27..dd25b7b1 100644
--- a/src/sna/gen9_render.c
+++ b/src/sna/gen9_render.c
@@ -374,7 +374,7 @@ static uint32_t gen9_get_card_format(PictFormat format)
return SURFACEFORMAT_R8G8B8A8_UNORM;
case PICT_x8b8g8r8:
return SURFACEFORMAT_R8G8B8X8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
return SURFACEFORMAT_B10G10R10A2_UNORM;
case PICT_x2r10g10b10:
@@ -404,7 +404,7 @@ static uint32_t gen9_get_dest_format(PictFormat format)
case PICT_a8b8g8r8:
case PICT_x8b8g8r8:
return SURFACEFORMAT_R8G8B8A8_UNORM;
-#ifdef PICT_a2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case PICT_a2r10g10b10:
case PICT_x2r10g10b10:
return SURFACEFORMAT_B10G10R10A2_UNORM;
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index 3e935d57..bba7c942 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -60,7 +60,7 @@ sna_format_for_depth(int depth)
case 16: return PICT_r5g6b5;
default: assert(0);
case 24: return PICT_x8r8g8b8;
-#ifdef PICT_x2r10g10b10
+#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
case 30: return PICT_x2r10g10b10;
#endif
case 32: return PICT_a8r8g8b8;

2d6af9e7 sna: Switch from ifdef PICT_ to if XORG_VERSION_CURRENT
src/sna/gen3_render.c | 10 +++++-----
src/sna/gen4_render.c | 4 ++--
src/sna/gen5_render.c | 4 ++--
src/sna/gen6_render.c | 4 ++--
src/sna/gen7_render.c | 4 ++--
src/sna/gen8_render.c | 4 ++--
src/sna/gen9_render.c | 4 ++--
src/sna/sna_render.c | 2 +-
8 files changed, 18 insertions(+), 18 deletions(-)

Upstream: cgit.freedesktop.org


  • Share