gallium: add pipe_context::set_device_reset_callback

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
This commit is contained in:
Nicolai Hähnle 2016-09-30 12:32:02 +02:00
parent 8a943564fd
commit 1a3c75e30e
3 changed files with 42 additions and 0 deletions

View file

@ -692,3 +692,18 @@ last_level for layers range from first_layer through last_layer.
It returns TRUE if mipmap generation succeeds, otherwise it
returns FALSE. Mipmap generation may fail when it is not supported
for particular texture types or formats.
Device resets
^^^^^^^^^^^^^
The state tracker can query or request notifications of when the GPU
is reset for whatever reason (application error, driver error). When
a GPU reset happens, the context becomes unusable and all related state
should be considered lost and undefined. Despite that, context
notifications are single-shot, i.e. subsequent calls to
``get_device_reset_status`` will return PIPE_NO_RESET.
* ``get_device_reset_status`` queries whether a device reset has happened
since the last call or since the last notification by callback.
* ``set_device_reset_callback`` sets a callback which will be called when
a device reset is detected. The callback is only called synchronously.

View file

@ -47,6 +47,7 @@ struct pipe_clip_state;
struct pipe_constant_buffer;
struct pipe_debug_callback;
struct pipe_depth_stencil_alpha_state;
struct pipe_device_reset_callback;
struct pipe_draw_info;
struct pipe_grid_info;
struct pipe_fence_handle;
@ -690,6 +691,13 @@ struct pipe_context {
*/
enum pipe_reset_status (*get_device_reset_status)(struct pipe_context *ctx);
/**
* Sets the reset status callback. If the pointer is null, then no callback
* is set, otherwise a copy of the data should be made.
*/
void (*set_device_reset_callback)(struct pipe_context *ctx,
const struct pipe_device_reset_callback *cb);
/**
* Dump driver-specific debug information into a stream. This is
* used by debugging tools.

View file

@ -830,6 +830,25 @@ struct pipe_debug_callback
void *data;
};
/**
* Structure that contains a callback for device reset messages from the driver
* back to the state tracker.
*
* The callback must not be called from driver-created threads.
*/
struct pipe_device_reset_callback
{
/**
* Callback for the driver to report when a device reset is detected.
*
* \param data user-supplied data pointer
* \param status PIPE_*_RESET
*/
void (*reset)(void *data, enum pipe_reset_status status);
void *data;
};
/**
* Information about memory usage. All sizes are in kilobytes.
*/