• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2024 The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "VkEmulatedPhysicalDeviceQueue.h"
16 
17 #include <algorithm>
18 #include <limits>
19 
20 namespace gfxstream {
21 namespace vk {
22 
EmulatedPhysicalDeviceQueueProperties(const std::vector<VkQueueFamilyProperties> & host,const gfxstream::host::FeatureSet & features)23 EmulatedPhysicalDeviceQueueProperties::EmulatedPhysicalDeviceQueueProperties(
24     const std::vector<VkQueueFamilyProperties>& host, const gfxstream::host::FeatureSet& features) {
25     mQueueFamilyProperties = host;
26 
27     // Override queueCount for the virtual queue to be provided with device creations
28     mHasVirtualGraphicsQueue = features.VulkanVirtualQueue.enabled;
29     if (mHasVirtualGraphicsQueue) {
30         // This feature will enforce multiple queues on all graphics capable phsical queues
31         // by creating a virtual queue object, which forwards the work streams into the
32         // underlying host queue.
33         // This feature will override queue properties and handling even if the host device
34         // supports multiple graphics queues to reduce divergence.
35         for (VkQueueFamilyProperties& qfp : mQueueFamilyProperties) {
36             if (qfp.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
37                 qfp.queueCount = 2;
38             }
39 
40             // TODO(b/329845987) Protected memory is not supported yet on emulators.
41             qfp.queueFlags &= ~VK_QUEUE_PROTECTED_BIT;
42         }
43     }
44 }
45 
46 }  // namespace vk
47 }  // namespace gfxstream