wsi: Wrapper object for VkPhysicalDevice 72/102972/2
authorTaekyun Kim <tkq.kim@samsung.com>
Wed, 28 Sep 2016 06:36:27 +0000 (15:36 +0900)
committerGwan-gyeong Mun <kk.moon@samsung.com>
Tue, 10 Jan 2017 10:15:58 +0000 (02:15 -0800)
Change-Id: I88ff8018277ce407f1014370e28ccec0d01757a9

src/wsi/icd.c
src/wsi/wsi.h

index 677ea28..6fcc199 100644 (file)
@@ -35,6 +35,18 @@ vk_get_icd(void)
        return &icd;
 }
 
+static vk_physical_device_t dev;
+
+vk_physical_device_t *
+vk_get_physical_device(VkPhysicalDevice pdev)
+{
+       if (dev.pdev != VK_NULL_HANDLE && dev.pdev != pdev)
+               return NULL;
+
+       dev.pdev = pdev;
+       return &dev;
+}
+
 static const VkExtensionProperties wsi_instance_extensions[] = {
        { VK_KHR_SURFACE_EXTENSION_NAME, 25 },
        { VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, 4 },
@@ -98,6 +110,7 @@ module_init(void)
                   ARRAY_LENGTH(wsi_instance_extensions) * sizeof(VkExtensionProperties));
 
        icd.instance_extension_count = count + ARRAY_LENGTH(wsi_instance_extensions);
+       dev.pdev = VK_NULL_HANDLE;
 }
 
 static void __attribute__((destructor))
index 9539a57..09be9b3 100644 (file)
 #include <utils.h>
 #include <tpl.h>
 
-typedef struct vk_surface      vk_surface_t;
-typedef struct vk_swapchain    vk_swapchain_t;
-typedef struct vk_buffer       vk_buffer_t;
-typedef struct vk_icd          vk_icd_t;
+typedef struct vk_surface                      vk_surface_t;
+typedef struct vk_swapchain                    vk_swapchain_t;
+typedef struct vk_buffer                       vk_buffer_t;
+typedef struct vk_physical_device      vk_physical_device_t;
+typedef struct vk_icd                          vk_icd_t;
 
 struct vk_icd {
        void    *lib;
 
-       PFN_vkGetInstanceProcAddr                                       get_proc_addr;
+       PFN_vkGetInstanceProcAddr                                       get_proc_addr;
        PFN_vkEnumerateDeviceExtensionProperties        enum_dev_exts;
 
        uint32_t                                 instance_extension_count;
@@ -56,6 +57,13 @@ struct vk_icd {
 vk_icd_t *
 vk_get_icd(void);
 
+struct vk_physical_device {
+       VkPhysicalDevice        pdev;
+};
+
+vk_physical_device_t *
+vk_get_physical_device(VkPhysicalDevice pdev);
+
 struct vk_buffer {
        tbm_surface_h   tbm;
        VkImage                 image;