VirtGpuDevice can be null for Goldfish.
Test: atest CtsDeqpTestCases -- --module-arg 'CtsDeqpTestCases:include-filter:dEQP-VK.image.swapchain_mutable.android.2d*' Bug: 438487556 Change-Id: I4a740fbb223e0987a1d0b86f7efe47f09267b65b
This commit is contained in:
parent
055a8b5a05
commit
a110af6a34
1 changed files with 15 additions and 8 deletions
|
|
@ -2139,6 +2139,9 @@ void ResourceTracker::on_vkGetPhysicalDeviceFeatures2KHR(void* context,
|
||||||
void ResourceTracker::on_vkGetPhysicalDeviceProperties2(void* context,
|
void ResourceTracker::on_vkGetPhysicalDeviceProperties2(void* context,
|
||||||
VkPhysicalDevice physicalDevice,
|
VkPhysicalDevice physicalDevice,
|
||||||
VkPhysicalDeviceProperties2* pProperties) {
|
VkPhysicalDeviceProperties2* pProperties) {
|
||||||
|
if (!pProperties) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
#ifdef LINUX_GUEST_BUILD
|
#ifdef LINUX_GUEST_BUILD
|
||||||
if (VK_PHYSICAL_DEVICE_TYPE_CPU == pProperties->properties.deviceType) {
|
if (VK_PHYSICAL_DEVICE_TYPE_CPU == pProperties->properties.deviceType) {
|
||||||
/* For Linux guest: Even if host driver reports DEVICE_TYPE_CPU,
|
/* For Linux guest: Even if host driver reports DEVICE_TYPE_CPU,
|
||||||
|
|
@ -2171,24 +2174,28 @@ void ResourceTracker::on_vkGetPhysicalDeviceProperties2(void* context,
|
||||||
"Mesa " PACKAGE_VERSION MESA_GIT_SHA1);
|
"Mesa " PACKAGE_VERSION MESA_GIT_SHA1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: VirtGpuDevice::getInstance() will return null for Goldfish, as it
|
||||||
|
// does not have the virtio-gpu interface that is expected.
|
||||||
VirtGpuDevice* instance = VirtGpuDevice::getInstance();
|
VirtGpuDevice* instance = VirtGpuDevice::getInstance();
|
||||||
if (!instance) {
|
|
||||||
mesa_loge("%s(): Could not get an instance of the VirtGpuDevice", __func__);
|
const char* transport_name = instance ? "Virtio-GPU GFXStream" : "Goldfish GFXStream";
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
char device_name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
|
char device_name[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
|
||||||
int device_name_len = snprintf(device_name, sizeof(device_name), "Virtio-GPU GFXStream (%s)",
|
int device_name_len = snprintf(device_name, sizeof(device_name), "%s (%s)",
|
||||||
pProperties->properties.deviceName);
|
transport_name, pProperties->properties.deviceName);
|
||||||
if (device_name_len >= (int)VK_MAX_PHYSICAL_DEVICE_NAME_SIZE) {
|
if (device_name_len >= (int)VK_MAX_PHYSICAL_DEVICE_NAME_SIZE) {
|
||||||
memcpy(device_name + VK_MAX_PHYSICAL_DEVICE_NAME_SIZE - 5, "...)", 4);
|
memcpy(device_name + VK_MAX_PHYSICAL_DEVICE_NAME_SIZE - 5, "...)", 4);
|
||||||
device_name_len = VK_MAX_PHYSICAL_DEVICE_NAME_SIZE - 1;
|
device_name_len = VK_MAX_PHYSICAL_DEVICE_NAME_SIZE - 1;
|
||||||
}
|
}
|
||||||
memcpy(pProperties->properties.deviceName, device_name, device_name_len + 1);
|
memcpy(pProperties->properties.deviceName, device_name, device_name_len + 1);
|
||||||
|
|
||||||
|
if (!instance) {
|
||||||
|
mesa_logd("%s(): Could not get an instance of the VirtGpuDevice", __func__);
|
||||||
|
}
|
||||||
|
|
||||||
VkPhysicalDeviceDrmPropertiesEXT* drmProps =
|
VkPhysicalDeviceDrmPropertiesEXT* drmProps =
|
||||||
vk_find_struct(pProperties, PHYSICAL_DEVICE_DRM_PROPERTIES_EXT);
|
vk_find_struct(pProperties, PHYSICAL_DEVICE_DRM_PROPERTIES_EXT);
|
||||||
if (drmProps) {
|
if (instance && drmProps) {
|
||||||
VirtGpuDrmInfo drmInfo;
|
VirtGpuDrmInfo drmInfo;
|
||||||
if (instance->getDrmInfo(&drmInfo)) {
|
if (instance->getDrmInfo(&drmInfo)) {
|
||||||
drmProps->hasPrimary = drmInfo.hasPrimary;
|
drmProps->hasPrimary = drmInfo.hasPrimary;
|
||||||
|
|
@ -2207,7 +2214,7 @@ void ResourceTracker::on_vkGetPhysicalDeviceProperties2(void* context,
|
||||||
|
|
||||||
VkPhysicalDevicePCIBusInfoPropertiesEXT* pciBusInfoProps =
|
VkPhysicalDevicePCIBusInfoPropertiesEXT* pciBusInfoProps =
|
||||||
vk_find_struct(pProperties, PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT);
|
vk_find_struct(pProperties, PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT);
|
||||||
if (pciBusInfoProps) {
|
if (instance && pciBusInfoProps) {
|
||||||
VirtGpuPciBusInfo pciBusInfo;
|
VirtGpuPciBusInfo pciBusInfo;
|
||||||
if (instance->getPciBusInfo(&pciBusInfo)) {
|
if (instance->getPciBusInfo(&pciBusInfo)) {
|
||||||
pciBusInfoProps->pciDomain = pciBusInfo.domain;
|
pciBusInfoProps->pciDomain = pciBusInfo.domain;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue