[Mesa-dev] [PATCH 01/13] gallium: add flag PIPE_CONTEXT_PREFER_THREADED

Marek Olšák maraeo at gmail.com
Wed May 10 22:45:34 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

State trackers can set this to tell the driver when u_threaded_context is
desirable.
---
 src/gallium/include/pipe/p_defines.h | 8 ++++++++
 src/mesa/state_tracker/st_manager.c  | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 82b9d9c..aafa4f8 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -377,20 +377,28 @@ enum pipe_flush_flags
  */
 #define PIPE_CONTEXT_DEBUG             (1 << 1)
 
 /**
  * Whether out-of-bounds shader loads must return zero and out-of-bounds
  * shader stores must be dropped.
  */
 #define PIPE_CONTEXT_ROBUST_BUFFER_ACCESS (1 << 2)
 
 /**
+ * Prefer threaded pipe_context. It also implies that video codec functions
+ * will not be used. (they will be either no-ops or NULL when threading is
+ * enabled)
+ */
+#define PIPE_CONTEXT_PREFER_THREADED   (1 << 3)
+
+
+/**
  * Flags for pipe_context::memory_barrier.
  */
 #define PIPE_BARRIER_MAPPED_BUFFER     (1 << 0)
 #define PIPE_BARRIER_SHADER_BUFFER     (1 << 1)
 #define PIPE_BARRIER_QUERY_BUFFER      (1 << 2)
 #define PIPE_BARRIER_VERTEX_BUFFER     (1 << 3)
 #define PIPE_BARRIER_INDEX_BUFFER      (1 << 4)
 #define PIPE_BARRIER_CONSTANT_BUFFER   (1 << 5)
 #define PIPE_BARRIER_INDIRECT_BUFFER   (1 << 6)
 #define PIPE_BARRIER_TEXTURE           (1 << 7)
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 41de596..3178e25 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -640,21 +640,21 @@ static struct st_context_iface *
 st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
                       const struct st_context_attribs *attribs,
                       enum st_context_error *error,
                       struct st_context_iface *shared_stctxi)
 {
    struct st_context *shared_ctx = (struct st_context *) shared_stctxi;
    struct st_context *st;
    struct pipe_context *pipe;
    struct gl_config mode;
    gl_api api;
-   unsigned ctx_flags = 0;
+   unsigned ctx_flags = PIPE_CONTEXT_PREFER_THREADED;
 
    if (!(stapi->profile_mask & (1 << attribs->profile)))
       return NULL;
 
    switch (attribs->profile) {
    case ST_PROFILE_DEFAULT:
       api = API_OPENGL_COMPAT;
       break;
    case ST_PROFILE_OPENGL_ES1:
       api = API_OPENGLES;
-- 
2.7.4



More information about the mesa-dev mailing list