[Mesa-dev] [PATCH 1/2] gallium: add PIPE_CONTEXT_LOSE_CONTEXT_ON_RESET

Marek Olšák maraeo at gmail.com
Fri Nov 2 20:10:18 UTC 2018


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

---
 src/gallium/include/pipe/p_defines.h | 3 +++
 src/mesa/state_tracker/st_manager.c  | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index dacedf5b936..693f041b1da 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -394,20 +394,23 @@ enum pipe_flush_flags
 /**
  * Create a high priority context.
  */
 #define PIPE_CONTEXT_HIGH_PRIORITY     (1 << 4)
 
 /**
  * Create a low priority context.
  */
 #define PIPE_CONTEXT_LOW_PRIORITY      (1 << 5)
 
+/** Stop execution if the device is reset. */
+#define PIPE_CONTEXT_LOSE_CONTEXT_ON_RESET (1 << 6)
+
 /**
  * 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)
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index eb0b88ef473..bf5493190c8 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -881,20 +881,23 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
       ctx_flags |= PIPE_CONTEXT_ROBUST_BUFFER_ACCESS;
 
    if (attribs->flags & ST_CONTEXT_FLAG_NO_ERROR)
       no_error = true;
 
    if (attribs->flags & ST_CONTEXT_FLAG_LOW_PRIORITY)
       ctx_flags |= PIPE_CONTEXT_LOW_PRIORITY;
    else if (attribs->flags & ST_CONTEXT_FLAG_HIGH_PRIORITY)
       ctx_flags |= PIPE_CONTEXT_HIGH_PRIORITY;
 
+   if (attribs->flags & ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED)
+      ctx_flags |= PIPE_CONTEXT_LOSE_CONTEXT_ON_RESET;
+
    pipe = smapi->screen->context_create(smapi->screen, NULL, ctx_flags);
    if (!pipe) {
       *error = ST_CONTEXT_ERROR_NO_MEMORY;
       return NULL;
    }
 
    st_visual_to_context_mode(&attribs->visual, &mode);
 
    if (attribs->visual.no_config)
       mode_ptr = NULL;
-- 
2.17.1



More information about the mesa-dev mailing list