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)
{
st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT;
if (attribs->flags & ST_CONTEXT_FLAG_ROBUST_ACCESS)
st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB;
- if (attribs->flags & ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED)
+ if (attribs->flags & ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED) {
st->ctx->Const.ResetStrategy = GL_LOSE_CONTEXT_ON_RESET_ARB;
+ st_install_device_reset_callback(st);
+ }
/* need to perform version check */
if (attribs->major > 1 || attribs->minor > 0) {