gallium: add PIPE_CAP_RESOURCE_FROM_USER_MEMORY_COMPUTE_ONLY
[mesa.git] / src / gallium / include / pipe / p_defines.h
index 0c79cac5cff1d59df73182f945be097b66bab9c1..ccb5fa112088acc75c8510f9d93d313cd957d29a 100644 (file)
@@ -255,10 +255,10 @@ enum pipe_transfer_usage
 
    /** 
     * The transfer should map the texture storage directly. The driver may
-    * return NULL if that isn't possible, and the state tracker needs to cope
+    * return NULL if that isn't possible, and the gallium frontend needs to cope
     * with that and use an alternative path without this flag.
     *
-    * E.g. the state tracker could have a simpler path which maps textures and
+    * E.g. the gallium frontend could have a simpler path which maps textures and
     * does read/modify/write cycles on them directly, and a more complicated
     * path which uses minimal read and write transfers.
     *
@@ -345,6 +345,13 @@ enum pipe_transfer_usage
     */
    PIPE_TRANSFER_COHERENT = (1 << 14),
 
+   /**
+    * Map a resource in a thread-safe manner, because the calling thread can
+    * be any thread. It can only be used if both WRITE and UNSYNCHRONIZED are
+    * set.
+    */
+   PIPE_TRANSFER_THREAD_SAFE = 1 << 15,
+
    /**
     * This and higher bits are reserved for private use by drivers. Drivers
     * should use this as (PIPE_TRANSFER_DRV_PRV << i).
@@ -441,7 +448,7 @@ enum pipe_flush_flags
 #define PIPE_TEXTURE_BARRIER_FRAMEBUFFER  (1 << 1)
 
 /**
- * Resource binding flags -- state tracker must specify in advance all
+ * Resource binding flags -- gallium frontends must specify in advance all
  * the ways a resource might be used.
  */
 #define PIPE_BIND_DEPTH_STENCIL        (1 << 0) /* create_surface */
@@ -455,7 +462,7 @@ enum pipe_flush_flags
 /* gap */
 #define PIPE_BIND_STREAM_OUTPUT        (1 << 10) /* set_stream_output_buffers */
 #define PIPE_BIND_CURSOR               (1 << 11) /* mouse cursor */
-#define PIPE_BIND_CUSTOM               (1 << 12) /* state-tracker/winsys usages */
+#define PIPE_BIND_CUSTOM               (1 << 12) /* gallium frontend/winsys usages */
 #define PIPE_BIND_GLOBAL               (1 << 13) /* set_global_binding */
 #define PIPE_BIND_SHADER_BUFFER        (1 << 14) /* set_shader_buffers */
 #define PIPE_BIND_SHADER_IMAGE         (1 << 15) /* set_shader_images */
@@ -470,10 +477,9 @@ enum pipe_flush_flags
  * below do not fit within that and probably need to be migrated to some
  * other place.
  *
- * It seems like scanout is used by the Xorg state tracker to ask for
- * a texture suitable for actual scanout (hence the name), which
- * implies extra layout constraints on some hardware.  It may also
- * have some special meaning regarding mouse cursor images.
+ * Scanout is used to ask for a texture suitable for actual scanout (hence
+ * the name), which implies extra layout constraints on some hardware.
+ * It may also have some special meaning regarding mouse cursor images.
  *
  * The shared flag is quite underspecified, but certainly isn't a
  * binding flag - it seems more like a message to the winsys to create
@@ -494,8 +500,10 @@ enum pipe_flush_flags
 #define PIPE_RESOURCE_FLAG_MAP_COHERENT   (1 << 1)
 #define PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY (1 << 2)
 #define PIPE_RESOURCE_FLAG_SPARSE                (1 << 3)
+#define PIPE_RESOURCE_FLAG_SINGLE_THREAD_USE     (1 << 4)
+#define PIPE_RESOURCE_FLAG_ENCRYPTED             (1 << 5)
 #define PIPE_RESOURCE_FLAG_DRV_PRIV    (1 << 8) /* driver/winsys private */
-#define PIPE_RESOURCE_FLAG_ST_PRIV     (1 << 24) /* state-tracker/winsys private */
+#define PIPE_RESOURCE_FLAG_FRONTEND_PRIV         (1 << 24) /* gallium frontend private */
 
 /**
  * Hint about the expected lifecycle of a resource.
@@ -625,6 +633,20 @@ enum pipe_swizzle {
    PIPE_SWIZZLE_MAX, /**< Number of enums counter (must be last) */
 };
 
+/**
+ * Viewport swizzles
+ */
+enum pipe_viewport_swizzle {
+   PIPE_VIEWPORT_SWIZZLE_POSITIVE_X,
+   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_X,
+   PIPE_VIEWPORT_SWIZZLE_POSITIVE_Y,
+   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_Y,
+   PIPE_VIEWPORT_SWIZZLE_POSITIVE_Z,
+   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_Z,
+   PIPE_VIEWPORT_SWIZZLE_POSITIVE_W,
+   PIPE_VIEWPORT_SWIZZLE_NEGATIVE_W,
+};
+
 #define PIPE_TIMEOUT_INFINITE 0xffffffffffffffffull
 
 
@@ -693,6 +715,7 @@ enum pipe_cap
    PIPE_CAP_MAX_RENDER_TARGETS,
    PIPE_CAP_OCCLUSION_QUERY,
    PIPE_CAP_QUERY_TIME_ELAPSED,
+   PIPE_CAP_TEXTURE_SHADOW_MAP,
    PIPE_CAP_TEXTURE_SWIZZLE,
    PIPE_CAP_MAX_TEXTURE_2D_SIZE,
    PIPE_CAP_MAX_TEXTURE_3D_LEVELS,
@@ -701,6 +724,10 @@ enum pipe_cap
    PIPE_CAP_BLEND_EQUATION_SEPARATE,
    PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS,
    PIPE_CAP_PRIMITIVE_RESTART,
+   /** subset of PRIMITIVE_RESTART where the restart index is always the fixed
+    * maximum value for the index type
+    */
+   PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX,
    /** blend enables and write masks per rendertarget */
    PIPE_CAP_INDEP_BLEND_ENABLE,
    /** different blend funcs per rendertarget */
@@ -784,6 +811,7 @@ enum pipe_cap
    PIPE_CAP_POLYGON_OFFSET_CLAMP,
    PIPE_CAP_MULTISAMPLE_Z_RESOLVE,
    PIPE_CAP_RESOURCE_FROM_USER_MEMORY,
+   PIPE_CAP_RESOURCE_FROM_USER_MEMORY_COMPUTE_ONLY,
    PIPE_CAP_DEVICE_RESET_STATUS_QUERY,
    PIPE_CAP_MAX_SHADER_PATCH_VARYINGS,
    PIPE_CAP_TEXTURE_FLOAT_LINEAR,
@@ -794,6 +822,7 @@ enum pipe_cap
    PIPE_CAP_SHAREABLE_SHADERS,
    PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS,
    PIPE_CAP_CLEAR_TEXTURE,
+   PIPE_CAP_CLEAR_SCISSORED,
    PIPE_CAP_DRAW_PARAMETERS,
    PIPE_CAP_TGSI_PACK_HALF_FLOAT,
    PIPE_CAP_MULTI_DRAW_INDIRECT,
@@ -883,9 +912,9 @@ enum pipe_cap
    PIPE_CAP_COMPUTE_SHADER_DERIVATIVES,
    PIPE_CAP_TGSI_SKIP_SHRINK_IO_ARRAYS,
    PIPE_CAP_IMAGE_LOAD_FORMATTED,
-   PIPE_CAP_MAX_FRAMES_IN_FLIGHT,
+   PIPE_CAP_THROTTLE,
    PIPE_CAP_DMABUF,
-   PIPE_CAP_PREFER_COMPUTE_BLIT_FOR_MULTIMEDIA,
+   PIPE_CAP_PREFER_COMPUTE_FOR_MULTIMEDIA,
    PIPE_CAP_FRAGMENT_SHADER_INTERLOCK,
    PIPE_CAP_FBFETCH_COHERENT,
    PIPE_CAP_CS_DERIVED_SYSTEM_VALUES_SUPPORTED,
@@ -897,6 +926,33 @@ enum pipe_cap
    PIPE_CAP_TEXTURE_SHADOW_LOD,
    PIPE_CAP_SHADER_SAMPLES_IDENTICAL,
    PIPE_CAP_TGSI_ATOMINC_WRAP,
+   PIPE_CAP_PREFER_IMM_ARRAYS_AS_CONSTBUF,
+   PIPE_CAP_GL_SPIRV,
+   PIPE_CAP_GL_SPIRV_VARIABLE_POINTERS,
+   PIPE_CAP_DEMOTE_TO_HELPER_INVOCATION,
+   PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE,
+   PIPE_CAP_FLATSHADE,
+   PIPE_CAP_ALPHA_TEST,
+   PIPE_CAP_POINT_SIZE_FIXED,
+   PIPE_CAP_TWO_SIDED_COLOR,
+   PIPE_CAP_CLIP_PLANES,
+   PIPE_CAP_MAX_VERTEX_BUFFERS,
+   PIPE_CAP_OPENCL_INTEGER_FUNCTIONS,
+   PIPE_CAP_INTEGER_MULTIPLY_32X16,
+   /* Turn draw, dispatch, blit into NOOP */
+   PIPE_CAP_FRONTEND_NOOP,
+   PIPE_CAP_NIR_IMAGES_AS_DEREF,
+   PIPE_CAP_PACKED_STREAM_OUTPUT,
+   PIPE_CAP_VIEWPORT_TRANSFORM_LOWERED,
+   PIPE_CAP_PSIZ_CLAMPED,
+   PIPE_CAP_DRAW_INFO_START_WITH_USER_INDICES,
+   PIPE_CAP_GL_BEGIN_END_BUFFER_SIZE,
+   PIPE_CAP_VIEWPORT_SWIZZLE,
+   PIPE_CAP_SYSTEM_SVM,
+   PIPE_CAP_VIEWPORT_MASK,
+   PIPE_CAP_ALPHA_TO_COVERAGE_DITHER_CONTROL,
+   PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE,
+   PIPE_CAP_GLSL_ZERO_INIT,
 };
 
 /**
@@ -917,9 +973,9 @@ enum pipe_endian
 {
    PIPE_ENDIAN_LITTLE = 0,
    PIPE_ENDIAN_BIG = 1,
-#if defined(PIPE_ARCH_LITTLE_ENDIAN)
+#if UTIL_ARCH_LITTLE_ENDIAN
    PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_LITTLE
-#elif defined(PIPE_ARCH_BIG_ENDIAN)
+#elif UTIL_ARCH_BIG_ENDIAN
    PIPE_ENDIAN_NATIVE = PIPE_ENDIAN_BIG
 #endif
 };
@@ -964,6 +1020,9 @@ enum pipe_shader_cap
    PIPE_SHADER_CAP_INTEGERS,
    PIPE_SHADER_CAP_INT64_ATOMICS,
    PIPE_SHADER_CAP_FP16,
+   PIPE_SHADER_CAP_FP16_DERIVATIVES,
+   PIPE_SHADER_CAP_INT16,
+   PIPE_SHADER_CAP_GLSL_16BIT_TEMPS,
    PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS,
    PIPE_SHADER_CAP_PREFERRED_IR,
    PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED,
@@ -981,7 +1040,6 @@ enum pipe_shader_cap
    PIPE_SHADER_CAP_TGSI_LDEXP_SUPPORTED,
    PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS,
    PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTER_BUFFERS,
-   PIPE_SHADER_CAP_SCALAR_ISA,
 };
 
 /**
@@ -993,13 +1051,14 @@ enum pipe_shader_cap
  * get TGSI.
  *
  * Note that PIPE_SHADER_IR_TGSI should be zero for backwards compat with
- * state trackers that only understand TGSI.
+ * gallium frontends that only understand TGSI.
  */
 enum pipe_shader_ir
 {
    PIPE_SHADER_IR_TGSI = 0,
    PIPE_SHADER_IR_NATIVE,
    PIPE_SHADER_IR_NIR,
+   PIPE_SHADER_IR_NIR_SERIALIZED,
 };
 
 /**
@@ -1223,15 +1282,27 @@ enum pipe_fd_type
    PIPE_FD_TYPE_SYNCOBJ,
 };
 
-enum pipe_debug_type
+/**
+ * counter type and counter data type enums used by INTEL_performance_query
+ * APIs in gallium drivers.
+ */
+enum pipe_perf_counter_type
+{
+   PIPE_PERF_COUNTER_TYPE_EVENT,
+   PIPE_PERF_COUNTER_TYPE_DURATION_NORM,
+   PIPE_PERF_COUNTER_TYPE_DURATION_RAW,
+   PIPE_PERF_COUNTER_TYPE_THROUGHPUT,
+   PIPE_PERF_COUNTER_TYPE_RAW,
+   PIPE_PERF_COUNTER_TYPE_TIMESTAMP,
+};
+
+enum pipe_perf_counter_data_type
 {
-   PIPE_DEBUG_TYPE_OUT_OF_MEMORY = 1,
-   PIPE_DEBUG_TYPE_ERROR,
-   PIPE_DEBUG_TYPE_SHADER_INFO,
-   PIPE_DEBUG_TYPE_PERF_INFO,
-   PIPE_DEBUG_TYPE_INFO,
-   PIPE_DEBUG_TYPE_FALLBACK,
-   PIPE_DEBUG_TYPE_CONFORMANCE,
+   PIPE_PERF_COUNTER_DATA_TYPE_BOOL32,
+   PIPE_PERF_COUNTER_DATA_TYPE_UINT32,
+   PIPE_PERF_COUNTER_DATA_TYPE_UINT64,
+   PIPE_PERF_COUNTER_DATA_TYPE_FLOAT,
+   PIPE_PERF_COUNTER_DATA_TYPE_DOUBLE,
 };
 
 #define PIPE_UUID_SIZE 16