[Mesa-dev] [RFC PATCH 10/13] RFC: anv: Drop vkCreateDmaBufImageINTEL()
Jason Ekstrand
jason at jlekstrand.net
Tue Mar 7 22:55:12 UTC 2017
Burn it to the ground!
On Mon, Mar 6, 2017 at 12:40 PM, Chad Versace <chadversary at chromium.org>
wrote:
> This "extension" function predates Vulkan 1.0 and Vulkan WSI. We created
> it during the early days of bringing up the Vulkan driver. We used it
> for testing the early driver because, in those early days, there was no
> other way to import/export a tiled VkImage and examine it. No
> VkSurfaceKHR existed yet in the early API.
>
> We never created a extension for this function.
>
> Since there is no extension, the validation layers don't understand it.
> I've observed the validation layers crash when this function is called.
>
> We now support a real dma_buf extension,
> VK_MESAX_external_image_dma_buf, that can replace this function.
> ---
> include/vulkan/vulkan_intel.h | 62 ------------------------
> src/intel/vulkan/Makefile.am | 3 --
> src/intel/vulkan/Makefile.sources | 1 -
> src/intel/vulkan/anv_intel.c | 99 ------------------------------
> ---------
> 4 files changed, 165 deletions(-)
> delete mode 100644 include/vulkan/vulkan_intel.h
> delete mode 100644 src/intel/vulkan/anv_intel.c
>
> diff --git a/include/vulkan/vulkan_intel.h b/include/vulkan/vulkan_intel.h
> deleted file mode 100644
> index 8ede61b53dc..00000000000
> --- a/include/vulkan/vulkan_intel.h
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -/*
> - * Copyright © 2015 Intel Corporation
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a
> - * copy of this software and associated documentation files (the
> "Software"),
> - * to deal in the Software without restriction, including without
> limitation
> - * the rights to use, copy, modify, merge, publish, distribute,
> sublicense,
> - * and/or sell copies of the Software, and to permit persons to whom the
> - * Software is furnished to do so, subject to the following conditions:
> - *
> - * The above copyright notice and this permission notice (including the
> next
> - * paragraph) shall be included in all copies or substantial portions of
> the
> - * Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
> SHALL
> - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> DEALINGS
> - * IN THE SOFTWARE.
> - */
> -
> -#ifndef __VULKAN_INTEL_H__
> -#define __VULKAN_INTEL_H__
> -
> -#include "vulkan.h"
> -
> -#ifdef __cplusplus
> -extern "C"
> -{
> -#endif // __cplusplus
> -
> -#define VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL 1024
> -typedef struct VkDmaBufImageCreateInfo_
> -{
> - VkStructureType sType;
> // Must be VK_STRUCTURE_TYPE_DMA_BUF_IMAGE_CREATE_INFO_INTEL
> - const void* pNext;
> // Pointer to next structure.
> - int fd;
> - VkFormat format;
> - VkExtent3D extent; // Depth
> must be 1
> - uint32_t strideInBytes;
> -} VkDmaBufImageCreateInfo;
> -
> -typedef VkResult (VKAPI_PTR *PFN_vkCreateDmaBufImageINTEL)(VkDevice
> device, const VkDmaBufImageCreateInfo* pCreateInfo, const
> VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMem, VkImage* pImage);
> -
> -#ifndef VK_NO_PROTOTYPES
> -
> -VKAPI_ATTR VkResult VKAPI_CALL vkCreateDmaBufImageINTEL(
> - VkDevice _device,
> - const VkDmaBufImageCreateInfo* pCreateInfo,
> - const VkAllocationCallbacks* pAllocator,
> - VkDeviceMemory* pMem,
> - VkImage* pImage);
> -
> -#endif
> -
> -#ifdef __cplusplus
> -} // extern "C"
> -#endif // __cplusplus
> -
> -#endif // __VULKAN_INTEL_H__
> diff --git a/src/intel/vulkan/Makefile.am b/src/intel/vulkan/Makefile.am
> index 3cd01e4d028..58c81319fa5 100644
> --- a/src/intel/vulkan/Makefile.am
> +++ b/src/intel/vulkan/Makefile.am
> @@ -27,9 +27,6 @@ noinst_HEADERS = \
> $(top_srcdir)/include/vulkan/vk_platform.h \
> $(top_srcdir)/include/vulkan/vulkan.h
>
> -vulkan_include_HEADERS = \
> - $(top_srcdir)/include/vulkan/vulkan_intel.h
> -
> lib_LTLIBRARIES = libvulkan_intel.la
>
> check_LTLIBRARIES = libvulkan-test.la
> diff --git a/src/intel/vulkan/Makefile.sources
> b/src/intel/vulkan/Makefile.sources
> index fd149b247c6..a19238f80d3 100644
> --- a/src/intel/vulkan/Makefile.sources
> +++ b/src/intel/vulkan/Makefile.sources
> @@ -30,7 +30,6 @@ VULKAN_FILES := \
> anv_formats.c \
> anv_genX.h \
> anv_image.c \
> - anv_intel.c \
> anv_nir.h \
> anv_nir_apply_dynamic_offsets.c \
> anv_nir_apply_pipeline_layout.c \
> diff --git a/src/intel/vulkan/anv_intel.c b/src/intel/vulkan/anv_intel.c
> deleted file mode 100644
> index c356e848fe0..00000000000
> --- a/src/intel/vulkan/anv_intel.c
> +++ /dev/null
> @@ -1,99 +0,0 @@
> -/*
> - * Copyright © 2015 Intel Corporation
> - *
> - * Permission is hereby granted, free of charge, to any person obtaining a
> - * copy of this software and associated documentation files (the
> "Software"),
> - * to deal in the Software without restriction, including without
> limitation
> - * the rights to use, copy, modify, merge, publish, distribute,
> sublicense,
> - * and/or sell copies of the Software, and to permit persons to whom the
> - * Software is furnished to do so, subject to the following conditions:
> - *
> - * The above copyright notice and this permission notice (including the
> next
> - * paragraph) shall be included in all copies or substantial portions of
> the
> - * Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
> SHALL
> - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> DEALINGS
> - * IN THE SOFTWARE.
> - */
> -
> -#include <assert.h>
> -#include <stdbool.h>
> -#include <string.h>
> -#include <unistd.h>
> -#include <fcntl.h>
> -
> -#include "anv_private.h"
> -
> -VkResult anv_CreateDmaBufImageINTEL(
> - VkDevice _device,
> - const VkDmaBufImageCreateInfo* pCreateInfo,
> - const VkAllocationCallbacks* pAllocator,
> - VkDeviceMemory* pMem,
> - VkImage* pImage)
> -{
> - ANV_FROM_HANDLE(anv_device, device, _device);
> - 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);
> -
> - mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8,
> - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
> - if (mem == NULL)
> - return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
> -
> - uint32_t gem_handle = anv_gem_fd_to_handle(device, pCreateInfo->fd);
> - if (!gem_handle) {
> - result = vk_error(VK_ERROR_OUT_OF_DEVICE_MEMORY);
> - goto fail;
> - }
> -
> - uint64_t size = (uint64_t)pCreateInfo->strideInBytes *
> pCreateInfo->extent.height;
> -
> - anv_bo_init(&mem->bo, gem_handle, size);
> -
> - anv_image_create(_device,
> - &(struct anv_image_create_info) {
> - .isl_tiling_flags = ISL_TILING_X_BIT,
> - .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,
> - .arrayLayers = 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,
> - }},
> - pAllocator, &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);
> - assert(image->extent.depth == 1);
> -
> - *pMem = anv_device_memory_to_handle(mem);
> - *pImage = anv_image_to_handle(image);
> -
> - return VK_SUCCESS;
> -
> - fail:
> - vk_free2(&device->alloc, pAllocator, mem);
> -
> - return result;
> -}
> --
> 2.12.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170307/128e8776/attachment.html>
More information about the mesa-dev
mailing list