diff options
author | Emil Velikov <[email protected]> | 2014-02-10 21:04:40 +0000 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2014-02-22 03:26:29 +0000 |
commit | dcbf404c0d1e9a40e0e75562e5112f53f95abe9d (patch) | |
tree | a8b0583670254a0958afae23376ba8437cbf954c | |
parent | 969e8d15b77434a0505e883557529ed1073583a6 (diff) |
pipe-loader: introduce pipe_loader_sw_probe_null helper function
v2: Handle null_sw_create failure, add missing function return type
Signed-off-by: Emil Velikov <[email protected]>
Reviewed-by: Jakob Bornecrantz <[email protected]> (v1)
-rw-r--r-- | src/gallium/auxiliary/pipe-loader/pipe_loader.h | 10 | ||||
-rw-r--r-- | src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c | 21 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/src/gallium/auxiliary/pipe-loader/pipe_loader.h index 9a461608d99..125086d24ab 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h @@ -132,6 +132,16 @@ pipe_loader_sw_probe_dri(struct pipe_loader_device **devs, /** + * Initialize a null sw device. + * + * This function is platform-specific. + * + * \sa pipe_loader_probe + */ +bool +pipe_loader_sw_probe_null(struct pipe_loader_device **devs); + +/** * Get a list of known software devices. * * This function is platform-specific. diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c index abc87a2c744..ece687bf2f5 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c @@ -93,6 +93,27 @@ pipe_loader_sw_probe_dri(struct pipe_loader_device **devs, struct drisw_loader_f return true; } +bool +pipe_loader_sw_probe_null(struct pipe_loader_device **devs) +{ + struct pipe_loader_sw_device *sdev = CALLOC_STRUCT(pipe_loader_sw_device); + + if (!sdev) + return false; + + sdev->base.type = PIPE_LOADER_DEVICE_SOFTWARE; + sdev->base.driver_name = "swrast"; + sdev->base.ops = &pipe_loader_sw_ops; + sdev->ws = null_sw_create(); + if (!sdev->ws) { + FREE(sdev); + return false; + } + *devs = &sdev->base; + + return true; +} + int pipe_loader_sw_probe(struct pipe_loader_device **devs, int ndev) { |