Android: correct libz dependency
[mesa.git] / src / mesa / state_tracker / st_cb_flush.c
index 5cab5a7f156e2f14226d87cea06c56470fb4ff85..6442fc922532988096554084cffc7c5f1ff5a7cc 100644 (file)
@@ -141,19 +141,9 @@ static void st_glFinish(struct gl_context *ctx)
 }
 
 
-/**
- * Query information about GPU resets observed by this context
- *
- * Called via \c dd_function_table::GetGraphicsResetStatus.
- */
 static GLenum
-st_get_graphics_reset_status(struct gl_context *ctx)
+gl_reset_status_from_pipe_reset_status(enum pipe_reset_status status)
 {
-   struct st_context *st = st_context(ctx);
-   enum pipe_reset_status status;
-
-   status = st->pipe->get_device_reset_status(st->pipe);
-
    switch (status) {
    case PIPE_NO_RESET:
       return GL_NO_ERROR;
@@ -170,6 +160,52 @@ st_get_graphics_reset_status(struct gl_context *ctx)
 }
 
 
+/**
+ * Query information about GPU resets observed by this context
+ *
+ * Called via \c dd_function_table::GetGraphicsResetStatus.
+ */
+static GLenum
+st_get_graphics_reset_status(struct gl_context *ctx)
+{
+   struct st_context *st = st_context(ctx);
+   enum pipe_reset_status status;
+
+   if (st->reset_status != PIPE_NO_RESET) {
+      status = st->reset_status;
+      st->reset_status = PIPE_NO_RESET;
+   } else {
+      status = st->pipe->get_device_reset_status(st->pipe);
+   }
+
+   return gl_reset_status_from_pipe_reset_status(status);
+}
+
+
+static void
+st_device_reset_callback(void *data, enum pipe_reset_status status)
+{
+   struct st_context *st = data;
+
+   assert(status != PIPE_NO_RESET);
+
+   st->reset_status = status;
+   _mesa_set_context_lost_dispatch(st->ctx);
+}
+
+
+void
+st_install_device_reset_callback(struct st_context *st)
+{
+   if (st->pipe->set_device_reset_callback) {
+      struct pipe_device_reset_callback cb;
+      cb.reset = st_device_reset_callback;
+      cb.data = st;
+      st->pipe->set_device_reset_callback(st->pipe, &cb);
+   }
+}
+
+
 void st_init_flush_functions(struct pipe_screen *screen,
                              struct dd_function_table *functions)
 {