Mesa (master): zink: don't pick a cpu device ever.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 3 23:18:26 UTC 2021


Module: Mesa
Branch: master
Commit: e41b0202c9af96d511546e2e9c78742e86fb981f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e41b0202c9af96d511546e2e9c78742e86fb981f

Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Feb  3 14:17:46 2021 +1000

zink: don't pick a cpu device ever.

This goes down the list and picks the first non-cpu device, when
we merge the CI patch we should add a forcing env var in here.

Fixes: 8d46e35d1 ("zink: introduce opengl over vulkan")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8845>

---

 src/gallium/drivers/zink/zink_screen.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_screen.c b/src/gallium/drivers/zink/zink_screen.c
index e190a7af672..a7b598b7c31 100644
--- a/src/gallium/drivers/zink/zink_screen.c
+++ b/src/gallium/drivers/zink/zink_screen.c
@@ -709,7 +709,7 @@ static VkPhysicalDevice
 choose_pdev(const VkInstance instance)
 {
    uint32_t i, pdev_count;
-   VkPhysicalDevice *pdevs, pdev;
+   VkPhysicalDevice *pdevs, pdev = NULL;
    vkEnumeratePhysicalDevices(instance, &pdev_count, NULL);
    assert(pdev_count > 0);
 
@@ -717,11 +717,10 @@ choose_pdev(const VkInstance instance)
    vkEnumeratePhysicalDevices(instance, &pdev_count, pdevs);
    assert(pdev_count > 0);
 
-   pdev = pdevs[0];
    for (i = 0; i < pdev_count; ++i) {
       VkPhysicalDeviceProperties props;
       vkGetPhysicalDeviceProperties(pdevs[i], &props);
-      if (props.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) {
+      if (props.deviceType != VK_PHYSICAL_DEVICE_TYPE_CPU) {
          pdev = pdevs[i];
          break;
       }
@@ -1095,6 +1094,9 @@ zink_internal_create_screen(const struct pipe_screen_config *config)
       debug_printf("ZINK: failed to setup debug utils\n");
 
    screen->pdev = choose_pdev(screen->instance);
+   if (!screen->pdev)
+      goto fail;
+
    update_queue_props(screen);
 
    screen->have_X8_D24_UNORM_PACK32 = zink_is_depth_format_supported(screen,



More information about the mesa-commit mailing list