summaryrefslogtreecommitdiffstats
path: root/src/vulkan/anv_intel.c
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2015-08-14 10:02:19 -0700
committerKristian Høgsberg Kristensen <[email protected]>2015-08-17 11:41:19 -0700
commit6d09d0644b4c3a9e4512c193686cfa556cdaf00f (patch)
tree7fc2dff0365c680bf7d2bd3df7ce1ce31b09930c /src/vulkan/anv_intel.c
parent0deae66eb138ada869105a359ce0c87e412ed713 (diff)
vk: Use anv_image_create() for creating dmabuf VkImage
We need to make sure we use the VkImage infrastructure for creating dmabuf images. Signed-off-by: Kristian Høgsberg Kristensen <[email protected]>
Diffstat (limited to 'src/vulkan/anv_intel.c')
-rw-r--r--src/vulkan/anv_intel.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/src/vulkan/anv_intel.c b/src/vulkan/anv_intel.c
index 9fc06aef6f8..f64e2dcb1e4 100644
--- a/src/vulkan/anv_intel.c
+++ b/src/vulkan/anv_intel.c
@@ -39,6 +39,7 @@ VkResult anv_CreateDmaBufImageINTEL(
struct anv_device_memory *mem;
struct anv_image *image;
VkResult result;
+ VkImage image_h;
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL);
@@ -65,19 +66,30 @@ VkResult anv_CreateDmaBufImageINTEL(
goto fail_mem;
}
- *image = (struct anv_image) {
- .bo = &mem->bo,
- .offset = 0,
- .type = VK_IMAGE_TYPE_2D,
- .extent = pCreateInfo->extent,
- .size = mem->bo.size,
-
- .primary_surface = {
- .offset = 0,
- .stride = pCreateInfo->strideInBytes,
+ anv_image_create(_device,
+ &(struct anv_image_create_info) {
+ .force_tile_mode = true,
.tile_mode = XMAJOR,
- },
- };
+ .stride = pCreateInfo->strideInBytes,
+ .vk_info =
+ &(VkImageCreateInfo) {
+ .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
+ .imageType = VK_IMAGE_TYPE_2D,
+ .format = pCreateInfo->format,
+ .extent = pCreateInfo->extent,
+ .mipLevels = 1,
+ .arraySize = 1,
+ .samples = 1,
+ /* FIXME: Need a way to use X tiling to allow scanout */
+ .tiling = VK_IMAGE_TILING_OPTIMAL,
+ .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
+ .flags = 0,
+ }},
+ &image_h);
+
+ image = anv_image_from_handle(image_h);
+ image->bo = &mem->bo;
+ image->offset = 0;
assert(image->extent.width > 0);
assert(image->extent.height > 0);