gallium: Add PIPE_CAP_ENDIANNESS
authorTom Stellard <thomas.stellard@amd.com>
Wed, 10 Jul 2013 04:21:39 +0000 (21:21 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Mon, 22 Jul 2013 20:43:17 +0000 (22:43 +0200)
Cc: mesa-stable@lists.freedesktop.org
[ Francisco Jerez: Fix "PIPE_ENDIAN_SMALL" in the documentation,
  define PIPE_ENDIAN_NATIVE. ]

14 files changed:
src/gallium/docs/source/screen.rst
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/ilo/ilo_screen.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/nv30/nv30_screen.c
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/nvc0/nvc0_screen.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/radeonsi/radeonsi_pipe.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/drivers/svga/svga_screen.c
src/gallium/include/pipe/p_defines.h

index 683080c0f1ce638d29cbab29517e3ff5cffc8660..60c9af11b067774832de62a4ee00cfe33fabca36 100644 (file)
@@ -168,6 +168,8 @@ The integer capabilities:
   since they are linked) a driver can support. Returning 0 is equivalent
   to returning 1 because every driver has to support at least a single
   viewport/scissor combination.  
+* ''PIPE_CAP_ENDIANNESS``:: The endianness of the device.  Either
+  PIPE_ENDIAN_BIG or PIPE_ENDIAN_LITTLE.
 
 
 .. _pipe_capf:
index ff45b3ebead6bd9c0b7bbedc9c60fa6e5ee8d448..52d51c22966bd51ba53bd82b4380051ffccec7a1 100644 (file)
@@ -227,6 +227,9 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_MAX_TEXEL_OFFSET:
                return 7;
 
+       case PIPE_CAP_ENDIANNESS:
+               return PIPE_ENDIAN_LITTLE;
+
        default:
                DBG("unknown param %d", param);
                return 0;
index 3c751c51bb0d380a845a56f2b3520207d7a7a223..556dda8d337b41bd714367a58275ac60b36c440f 100644 (file)
@@ -263,6 +263,8 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
    case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT:
    case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
       return 0;
+   case PIPE_CAP_ENDIANNESS:
+      return PIPE_ENDIAN_LITTLE;
 
    default:
       debug_printf("%s: Unknown cap %u.\n", __FUNCTION__, cap);
index 75fee906712e4ed928c7fd9bbb4c2baa6820e36c..e8262bc133cd23418188510830aa8ba99df2a301 100644 (file)
@@ -421,6 +421,8 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 1 << 27;
    case PIPE_CAP_MAX_VIEWPORTS:
       return ILO_MAX_VIEWPORTS;
+   case PIPE_CAP_ENDIANNESS:
+      return PIPE_ENDIAN_LITTLE;
 
    default:
       return 0;
index 26aac329e67426eb706c669fbea485366fdd4710..b3cd77fe8d4f4085890f7c6fc505de013d0eb8ea 100644 (file)
@@ -231,6 +231,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 0;
    case PIPE_CAP_MAX_VIEWPORTS:
       return PIPE_MAX_VIEWPORTS;
+   case PIPE_CAP_ENDIANNESS:
+      return PIPE_ENDIAN_NATIVE;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
index 07ffc80161d4e2de9b15adfeced00e66e2accea6..3d55d6fd64997c3a1e989a99e3e5c1de9bac24fa 100644 (file)
@@ -130,6 +130,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
    case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
       return 1;
+   case PIPE_CAP_ENDIANNESS:
+      return PIPE_ENDIAN_LITTLE;
    default:
       debug_printf("unknown param %d\n", param);
       return 0;
index 2ed85d6d2d998518880fa80310482fca7385fdff..2951eb4156d596927c6031c2889897459dc7372a 100644 (file)
@@ -189,6 +189,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
       return 0;
    case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
       return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50;
+   case PIPE_CAP_ENDIANNESS:
+      return PIPE_ENDIAN_LITTLE;
    default:
       NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
       return 0;
index b5abee38a35c61f322c7b92170e6e320470264f6..201d12fd3df7fef930ff55d4b717765e656124c8 100644 (file)
@@ -179,6 +179,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
       return 1;
    case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
       return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50;
+   case PIPE_CAP_ENDIANNESS:
+      return PIPE_ENDIAN_LITTLE;
    default:
       NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
       return 0;
index 9c5d5f24c74dfdf3ebefe48b22a8226a76852a58..8d7ffa94f35cb19ce21be750dd461d76187aad65 100644 (file)
@@ -190,6 +190,8 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         /* Render targets. */
         case PIPE_CAP_MAX_RENDER_TARGETS:
             return 4;
+       case PIPE_CAP_ENDIANNESS:
+            return PIPE_ENDIAN_LITTLE;
     }
     return 0;
 }
index 49abf50487ec088f62e3e21eedbfdcb475f6c97c..74dd9606a34decdcd1784e69be304a5e7019bf13 100644 (file)
@@ -679,6 +679,8 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
 
        case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
                return PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_R600;
+       case PIPE_CAP_ENDIANNESS:
+               return PIPE_ENDIAN_LITTLE;
        }
        return 0;
 }
index 463cc729cd36103e58bdb24690d02f40b51b24eb..69b9ca978984e38f1bce32d3b0167a9249c56aa9 100644 (file)
@@ -440,6 +440,8 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
 
        case PIPE_CAP_MAX_TEXEL_OFFSET:
                return 7;
+       case PIPE_CAP_ENDIANNESS:
+               return PIPE_ENDIAN_LITTLE;
        }
        return 0;
 }
index 2abfe896fab40b0cc02a8c60868857282aac0742..f6acdc872d2477251441ea3dd410cb93989c22ab 100644 (file)
@@ -183,6 +183,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 0;
    case PIPE_CAP_MAX_VIEWPORTS:
       return 1;
+   case PIPE_CAP_ENDIANNESS:
+      return PIPE_ENDIAN_NATIVE;
    }
    /* should only get here on unhandled cases */
    debug_printf("Unexpected PIPE_CAP %d query\n", param);
index 7bf628590489fe8d5ad7c690cc6271b98599eb56..40b35ccb6f8481cca2c841873375bb2fade26f05 100644 (file)
@@ -270,6 +270,8 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
       return 1;
    case PIPE_CAP_MAX_VIEWPORTS:
       return 1;
+   case PIPE_CAP_ENDIANNESS:
+      return PIPE_ENDIAN_LITTLE;
    }
 
    debug_printf("Unexpected PIPE_CAP_ query %u\n", param);
index 9feaef8a983365467d51234448122852c2f64c0e..fb42cdffea6e161745350b1aee87c9f2902c72a1 100644 (file)
@@ -507,12 +507,22 @@ enum pipe_cap {
    PIPE_CAP_QUERY_PIPELINE_STATISTICS = 81,
    PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK = 82,
    PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE = 83,
-   PIPE_CAP_MAX_VIEWPORTS = 84
+   PIPE_CAP_MAX_VIEWPORTS = 84,
+   PIPE_CAP_ENDIANNESS = 85
 };
 
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
 #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_R600 (1 << 1)
 
+enum pipe_endian {
+   PIPE_ENDIAN_LITTLE = 0,
+   PIPE_ENDIAN_BIG = 1,
+#if defined(PIPE_ARCH_LITTLE_ENDIAN)
+   PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_LITTLE
+#elif defined(PIPE_ARCH_BIG_ENDIAN)
+   PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_BIG
+#endif
+};
 
 /**
  * Implementation limits which are queried through