From: Ella-0 <23418164+Ella-0@users.noreply.github.com> Date: Sun, 27 Jun 2021 19:29:08 +0000 (+0000) Subject: anv: expose primary node to VK_EXT_physical_device_drm even when VK_KHR_display is... X-Git-Tag: upstream/21.2.3~1207 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=86fe8db4aaedb2c57d2a41546883531c0d97df7d;p=platform%2Fupstream%2Fmesa.git anv: expose primary node to VK_EXT_physical_device_drm even when VK_KHR_display is not enabled Fixes: e9e1e0362b6c2d ("anv: implement VK_EXT_physical_device_drm") Reviewed-by: Lionel Landwerlin Part-of: --- diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index abebfea..f01f4c3 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -991,6 +991,28 @@ anv_physical_device_try_create(struct anv_instance *instance, *device_out = device; + struct stat st; + + if (stat(primary_path, &st) == 0) { + device->has_master = true; + device->master_major = major(st.st_rdev); + device->master_minor = minor(st.st_rdev); + } else { + device->has_master = false; + device->master_major = 0; + device->master_minor = 0; + } + + if (stat(path, &st) == 0) { + device->has_local = true; + device->local_major = major(st.st_rdev); + device->local_minor = minor(st.st_rdev); + } else { + device->has_local = false; + device->local_major = 0; + device->local_minor = 0; + } + return VK_SUCCESS; fail_engine_info: @@ -2351,25 +2373,15 @@ void anv_GetPhysicalDeviceProperties2( case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT: { VkPhysicalDeviceDrmPropertiesEXT *props = (VkPhysicalDeviceDrmPropertiesEXT *)ext; - struct stat st; - - props->hasPrimary = fstat(pdevice->master_fd, &st) == 0; - if (props->hasPrimary) { - props->primaryMajor = (int64_t) major(st.st_rdev); - props->primaryMinor = (int64_t) minor(st.st_rdev); - } else { - props->primaryMajor = 0; - props->primaryMinor = 0; - } - props->hasRender = fstat(pdevice->local_fd, &st) == 0; - if (props->hasRender) { - props->renderMajor = (int64_t) major(st.st_rdev); - props->renderMinor = (int64_t) minor(st.st_rdev); - } else { - props->renderMajor = 0; - props->renderMinor = 0; - } + props->hasPrimary = pdevice->has_master; + props->primaryMajor = pdevice->master_major; + props->primaryMinor = pdevice->master_minor; + + props->hasRender = pdevice->has_local; + props->renderMajor = pdevice->local_major; + props->renderMinor = pdevice->local_minor; + break; } diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index d380d6c..0aa21b4 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -988,7 +988,13 @@ struct anv_physical_device { struct wsi_device wsi_device; int local_fd; + bool has_local; + int64_t local_major; + int64_t local_minor; int master_fd; + bool has_master; + int64_t master_major; + int64_t master_minor; struct drm_i915_query_engine_info * engine_info; void (*cmd_emit_timestamp)(struct anv_batch *, struct anv_bo *, uint32_t );