aboutsummaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2019-05-16 18:01:39 +0100
committerMarek Olšák <[email protected]>2019-06-05 13:35:21 -0400
commit2f1195753282d1176edd7b9772aad17eced24dd8 (patch)
treec8d3d5d62adcbc38e0e16090bc0c6be306a20eab /src/egl
parent2282ec0ad6581b588f7bdde1211357123316b4b9 (diff)
egl: keep the software device at the end of the list
By default, the user is likely to pick the first device so it should not be the least performant (aka software) one. v2: Drop odd comment (Marek) Suggested-by: Marek Olšák <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]> (v1) Reviewed-by: Marek Olšák <[email protected]> (v1) Signed-off-by: Emil Velikov <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/main/egldevice.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/egl/main/egldevice.c b/src/egl/main/egldevice.c
index c5c9a21273a..82af1f47fed 100644
--- a/src/egl/main/egldevice.c
+++ b/src/egl/main/egldevice.c
@@ -293,13 +293,25 @@ _eglQueryDevicesEXT(EGLint max_devices,
goto out;
}
+ /* Push the first device (the software one) to the end of the list.
+ * Sending it to the user only if they've requested the full list.
+ *
+ * By default, the user is likely to pick the first device so having the
+ * software (aka least performant) one is not a good idea.
+ */
*num_devices = MIN2(num_devs, max_devices);
- for (i = 0, dev = devs; i < *num_devices; i++) {
+ for (i = 0, dev = devs->Next; dev && i < max_devices; i++) {
devices[i] = dev;
dev = dev->Next;
}
+ /* User requested the full device list, add the sofware device. */
+ if (max_devices >= num_devs) {
+ assert(_eglDeviceSupports(devs, _EGL_DEVICE_SOFTWARE));
+ devices[num_devs - 1] = devs;
+ }
+
out:
mtx_unlock(_eglGlobal.Mutex);