pipe-loader: Document the behavior regarding screen creating failures

Avoid inconsistent behavior on screen creation failures which might lead
to double free issues.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23054>
This commit is contained in:
Corentin Noël 2023-05-24 16:23:02 +02:00 committed by Marge Bot
parent 744c849a08
commit 6b4f80f7f0

View file

@ -31,8 +31,23 @@
#include "pipe_loader.h"
struct pipe_loader_ops {
/**
* Create a pipe_screen for the specified pipe_loader_device.
*
* Consumers are expected to use pipe_loader_create_screen_vk() or
* pipe_loader_create_screen() which will take care of creating the
* configuration.
*
* Implementations should not free the device here, even on failure.
*
* \param dev The device the screen will be created for
* \param config The screen configuration
* \param sw_vk Whether the device is for software vulkan
* \return a pipe_screen, or NULL on failure
*/
struct pipe_screen *(*create_screen)(struct pipe_loader_device *dev,
const struct pipe_screen_config *config, bool sw_vk);
const struct pipe_screen_config *config,
bool sw_vk);
const struct driOptionDescription *(*get_driconf)(struct pipe_loader_device *dev,
unsigned *count);