summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/r600_pipe_common.c
diff options
context:
space:
mode:
authorNicolai Hähnle <nicolai.haehnle@amd.com>2016-09-30 15:21:00 +0200
committerNicolai Hähnle <nicolai.haehnle@amd.com>2016-10-05 15:51:56 +0200
commitb5cd7dfe3e9a04bf6edd5d100f7c74b8fcb5c277 (patch)
tree454864b3310df56bfb4d3984e4d2bbc470784afc /src/gallium/drivers/radeon/r600_pipe_common.c
parenta1fa8b731fc5ae12b3f4961dd3a841b384177564 (diff)
downloadexternal_mesa3d-b5cd7dfe3e9a04bf6edd5d100f7c74b8fcb5c277.zip
external_mesa3d-b5cd7dfe3e9a04bf6edd5d100f7c74b8fcb5c277.tar.gz
external_mesa3d-b5cd7dfe3e9a04bf6edd5d100f7c74b8fcb5c277.tar.bz2
gallium/radeon: implement set_device_reset_callback
Check for device reset on flush. It would be nicer if the kernel just reported this as an error on the submit ioctl (and similarly for fences), but this will do for now. Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Diffstat (limited to 'src/gallium/drivers/radeon/r600_pipe_common.c')
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 3a5a854..6f71ef6 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -484,6 +484,36 @@ static void r600_set_debug_callback(struct pipe_context *ctx,
memset(&rctx->debug, 0, sizeof(rctx->debug));
}
+static void r600_set_device_reset_callback(struct pipe_context *ctx,
+ const struct pipe_device_reset_callback *cb)
+{
+ struct r600_common_context *rctx = (struct r600_common_context *)ctx;
+
+ if (cb)
+ rctx->device_reset_callback = *cb;
+ else
+ memset(&rctx->device_reset_callback, 0,
+ sizeof(rctx->device_reset_callback));
+}
+
+bool r600_check_device_reset(struct r600_common_context *rctx)
+{
+ enum pipe_reset_status status;
+
+ if (!rctx->device_reset_callback.reset)
+ return false;
+
+ if (!rctx->b.get_device_reset_status)
+ return false;
+
+ status = rctx->b.get_device_reset_status(&rctx->b);
+ if (status == PIPE_NO_RESET)
+ return false;
+
+ rctx->device_reset_callback.reset(rctx->device_reset_callback.data, status);
+ return true;
+}
+
bool r600_common_context_init(struct r600_common_context *rctx,
struct r600_common_screen *rscreen,
unsigned context_flags)
@@ -527,6 +557,8 @@ bool r600_common_context_init(struct r600_common_context *rctx,
RADEON_GPU_RESET_COUNTER);
}
+ rctx->b.set_device_reset_callback = r600_set_device_reset_callback;
+
r600_init_context_texture_functions(rctx);
r600_init_viewport_functions(rctx);
r600_streamout_init(rctx);