<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 6, 2019 at 11:02 AM Emil Velikov <<a href="mailto:emil.l.velikov@gmail.com">emil.l.velikov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Emil Velikov <<a href="mailto:emil.velikov@collabora.com" target="_blank">emil.velikov@collabora.com</a>><br>
<br>
By default, the user is likely to pick the first device so it should<br>
not be the least performant (aka software) one.<br>
<br>
Suggested-by: Marek Olšák <<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>><br>
Signed-off-by: Emil Velikov <<a href="mailto:emil.velikov@collabora.com" target="_blank">emil.velikov@collabora.com</a>><br>
---<br>
src/egl/main/egldevice.c | 15 ++++++++++++++-<br>
1 file changed, 14 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/egl/main/egldevice.c b/src/egl/main/egldevice.c<br>
index c5c9a21273a..328d9ea08c5 100644<br>
--- a/src/egl/main/egldevice.c<br>
+++ b/src/egl/main/egldevice.c<br>
@@ -293,13 +293,26 @@ _eglQueryDevicesEXT(EGLint max_devices,<br>
goto out;<br>
}<br>
<br>
+ /* Push the first device (the software one) to the end of the list.<br>
+ * Sending it to the user only if they've requested the full list.<br>
+ *<br>
+ * By default, the user is likely to pick the first device so having the<br>
+ * software (aka least performant) one is not a good idea.<br>
+ */<br>
*num_devices = MIN2(num_devs, max_devices);<br>
<br>
- for (i = 0, dev = devs; i < *num_devices; i++) {<br>
+ for (i = 0, dev = devs->Next; dev && i < max_devices; i++) {<br>
devices[i] = dev;<br>
dev = dev->Next;<br>
}<br>
<br>
+ /* User requested the full device list, add the sofware device. */<br>
+ if (max_devices >= num_devs) {<br>
+ /* The first device is always software */<br></blockquote><div><br></div><div>Oh BTW, the comment here is not congruent with the code.</div><div><br></div><div>Marek<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ assert(_eglDeviceSupports(devs, _EGL_DEVICE_SOFTWARE));<br>
+ devices[num_devs - 1] = devs;<br>
+ }<br>
+<br>
out:<br>
mtx_unlock(_eglGlobal.Mutex);<br>
<br>
-- <br>
2.21.0<br>
<br>
</blockquote></div></div>