diff options
author | Chuck Atkins <[email protected]> | 2018-01-22 12:09:28 -0500 |
---|---|---|
committer | George Kyriazis <[email protected]> | 2018-01-22 17:56:44 -0600 |
commit | a29d63ecf71546c4798c609e37810f0ec81793d8 (patch) | |
tree | 3b3a784fa47513dd284fd1f877bd8421841290bf /src/gallium/drivers/swr/swr_public.h | |
parent | 56b9060381a02e9e3545c7eda3c281034a7e9b10 (diff) |
swr: refactor swr_create_screen to allow for proper cleanup on error
This makes the following changes to address cleanup issues:
- Error conditions now return NULL instead of calling exit()
- swr_creen is now freed upon error, rather than leak.
- Library handle from dlopen is now closed upon swr_screen destruction
v2: Added additional context in commit msg and remove unnecessary "PUBLIC"
v3: Fix typo in commit message.
Signed-off-by: Chuck Atkins <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Cc: Bruce Cherniak <[email protected]>
Cc: Tim Rowley <[email protected]>
cc: [email protected]
Diffstat (limited to 'src/gallium/drivers/swr/swr_public.h')
-rw-r--r-- | src/gallium/drivers/swr/swr_public.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gallium/drivers/swr/swr_public.h b/src/gallium/drivers/swr/swr_public.h index 4b150705cd7..07ea6280cd6 100644 --- a/src/gallium/drivers/swr/swr_public.h +++ b/src/gallium/drivers/swr/swr_public.h @@ -25,8 +25,9 @@ #define SWR_PUBLIC_H struct pipe_screen; -struct sw_winsys; struct sw_displaytarget; +struct sw_winsys; +struct swr_screen; #ifdef __cplusplus extern "C" { @@ -38,6 +39,9 @@ struct pipe_screen *swr_create_screen(struct sw_winsys *winsys); // arch-specific dll entry point PUBLIC struct pipe_screen *swr_create_screen_internal(struct sw_winsys *winsys); +// cleanup for failed screen creation +void swr_destroy_screen_internal(struct swr_screen **screen); + #ifdef _WIN32 void swr_gdi_swap(struct pipe_screen *screen, struct pipe_resource *res, |