aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_cb_flush.c
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2016-09-30 14:06:04 +0200
committerNicolai Hähnle <[email protected]>2016-10-05 15:51:53 +0200
commita1fa8b731fc5ae12b3f4961dd3a841b384177564 (patch)
tree5fa3a010307983c4fa5c45af4f24be4869968e71 /src/mesa/state_tracker/st_cb_flush.c
parentd856130025be12230ed84fc31fcf5691641f1952 (diff)
st/mesa: set a device reset callback when available
Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_cb_flush.c')
-rw-r--r--src/mesa/state_tracker/st_cb_flush.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index 87c3d819a61..6442fc92253 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -171,12 +171,41 @@ st_get_graphics_reset_status(struct gl_context *ctx)
struct st_context *st = st_context(ctx);
enum pipe_reset_status status;
- status = st->pipe->get_device_reset_status(st->pipe);
+ 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)
{