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 <emil.l.velikov@gmail.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> (v1)
This commit is contained in:
Emil Velikov 2014-02-10 21:04:40 +00:00
parent 969e8d15b7
commit dcbf404c0d
2 changed files with 31 additions and 0 deletions

View file

@ -131,6 +131,16 @@ pipe_loader_sw_probe_dri(struct pipe_loader_device **devs,
struct drisw_loader_funcs *drisw_lf);
/**
* 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.
*

View file

@ -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)
{