null-driver: Function for creating presentable images 56/65756/1
authorTaekyun Kim <tkq.kim@samsung.com>
Tue, 12 Apr 2016 06:27:14 +0000 (15:27 +0900)
committerTaekyun Kim <tkq.kim@samsung.com>
Tue, 12 Apr 2016 06:32:29 +0000 (15:32 +0900)
ICD is responsible for creating VkImage which is used for
presentation in the swapchain. WSI will dlsym the function and
call it to create swapchain images.

Change-Id: Ieacb603ec69b509e3651a46068333001d503ec12

src/null-driver/null-driver.c
src/null-driver/null-driver.h

index 3c9f2e7..6f9fa84 100644 (file)
@@ -106,6 +106,7 @@ struct nulldrv_img {
     VkFlags usage;
     VkSampleCountFlagBits samples;
     size_t total_size;
+       tbm_surface_h tbm_surface;
 };
 
 struct nulldrv_mem {
@@ -472,6 +473,7 @@ img_get_memory_requirements(struct nulldrv_base *base,
 
 static VkResult
 nulldrv_img_create(struct nulldrv_dev *dev,
+                                  tbm_surface_h tbm_surface,
                                   const VkImageCreateInfo *info,
                                   bool scanout,
                                   struct nulldrv_img **img_ret)
@@ -484,6 +486,7 @@ nulldrv_img_create(struct nulldrv_dev *dev,
        if (!img)
                return VK_ERROR_OUT_OF_HOST_MEMORY;
 
+       img->tbm_surface = tbm_surface;
        img->type = info->imageType;
        img->depth = info->extent.depth;
        img->mip_levels = info->mipLevels;
@@ -1587,7 +1590,7 @@ create_image(VkDevice device,
        NULLDRV_LOG_FUNC;
        struct nulldrv_dev *dev = nulldrv_dev(device);
 
-       return nulldrv_img_create(dev, info, false,
+       return nulldrv_img_create(dev, NULL, info, false,
                                                          (struct nulldrv_img **) image);
 }
 
@@ -2506,3 +2509,16 @@ vk_icdGetInstanceProcAddr(VkInstance instance, const char *name)
 
        return NULL;
 }
+
+VK_EXPORT VkImage
+vk_create_presentable_image(VkDevice device, const VkImageCreateInfo *info, tbm_surface_h surface)
+{
+       NULLDRV_LOG_FUNC;
+       struct nulldrv_dev *dev = nulldrv_dev(device);
+       struct nulldrv_img *img;
+
+       if (nulldrv_img_create(dev, surface, info, false, &img) == VK_SUCCESS)
+               return (VkImage)img;
+
+       return NULL;
+}
index 80523c0..460897b 100644 (file)
 
 #include <config.h>
 #include <vulkan/vulkan.h>
+#include <tbm_surface.h>
 
 VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
 vk_icdGetInstanceProcAddr(VkInstance instance, const char *name);
 
+VkImage
+vk_create_presentable_image(VkDevice device, const VkImageCreateInfo *info, tbm_surface_h surface);
+
 #endif /* NULL_DRIVER_H */