[Mesa-dev] [RFC PATCH v1 29/30] RFC: anv: Kill vkCreateDmaBufImageINTEL()
Lionel Landwerlin
lionel.g.landwerlin at intel.com
Tue Nov 7 16:20:52 UTC 2017
:)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
On 07/11/17 14:48, Chad Versace wrote:
> Replaced by VK_EXT_external_memory_dma_buf and
> VK_EXT_image_drm_format_modifier.
> ---
> include/meson.build | 1 -
> include/vulkan/vulkan_intel.h | 62 -----------------
> src/amd/vulkan/radv_private.h | 1 -
> src/intel/Makefile.sources | 1 -
> src/intel/Makefile.vulkan.am | 3 -
> src/intel/vulkan/anv_entrypoints_gen.py | 10 ---
> src/intel/vulkan/anv_intel.c | 117 --------------------------------
> src/intel/vulkan/anv_private.h | 1 -
> src/intel/vulkan/meson.build | 1 -
> 9 files changed, 197 deletions(-)
> delete mode 100644 include/vulkan/vulkan_intel.h
> delete mode 100644 src/intel/vulkan/anv_intel.c
>
> diff --git a/include/meson.build b/include/meson.build
> index 3cf582a4b12..e5b28af6dea 100644
> --- a/include/meson.build
> +++ b/include/meson.build
> @@ -74,7 +74,6 @@ if _vulkan_drivers != []
> 'vulkan/vk_icd.h',
> 'vulkan/vk_platform.h',
> 'vulkan/vulkan.h',
> - 'vulkan/vulkan_intel.h',
> subdir : 'vulkan',
> )
> endif
> 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/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
> index 0f48681c941..0c32ee4c4be 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -67,7 +67,6 @@ typedef uint32_t xcb_visualid_t;
> typedef uint32_t xcb_window_t;
>
> #include <vulkan/vulkan.h>
> -#include <vulkan/vulkan_intel.h>
> #include <vulkan/vk_icd.h>
>
> #include "radv_entrypoints.h"
> diff --git a/src/intel/Makefile.sources b/src/intel/Makefile.sources
> index 5a09e6d9166..1a831a35a91 100644
> --- a/src/intel/Makefile.sources
> +++ b/src/intel/Makefile.sources
> @@ -215,7 +215,6 @@ VULKAN_FILES := \
> vulkan/anv_formats.c \
> vulkan/anv_genX.h \
> vulkan/anv_image.c \
> - vulkan/anv_intel.c \
> vulkan/anv_nir.h \
> vulkan/anv_nir_apply_pipeline_layout.c \
> vulkan/anv_nir_lower_input_attachments.c \
> diff --git a/src/intel/Makefile.vulkan.am b/src/intel/Makefile.vulkan.am
> index 811faab556e..5d282de7753 100644
> --- a/src/intel/Makefile.vulkan.am
> +++ b/src/intel/Makefile.vulkan.am
> @@ -74,9 +74,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 += vulkan/libvulkan_intel.la
>
> check_LTLIBRARIES += vulkan/libvulkan-test.la
> diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py
> index 23bc8542184..9a558b534f2 100644
> --- a/src/intel/vulkan/anv_entrypoints_gen.py
> +++ b/src/intel/vulkan/anv_entrypoints_gen.py
> @@ -359,16 +359,6 @@ def main():
> entrypoints += get_entrypoints(doc, get_entrypoints_defines(doc),
> start_index=len(entrypoints))
>
> - # Manually add CreateDmaBufImageINTEL for which we don't have an extension
> - # defined.
> - entrypoints.append(('VkResult', 'CreateDmaBufImageINTEL',
> - 'VkDevice device, ' +
> - 'const VkDmaBufImageCreateInfo* pCreateInfo, ' +
> - 'const VkAllocationCallbacks* pAllocator,' +
> - 'VkDeviceMemory* pMem,' +
> - 'VkImage* pImage', len(entrypoints),
> - cal_hash('vkCreateDmaBufImageINTEL'), None))
> -
> # For outputting entrypoints.h we generate a anv_EntryPoint() prototype
> # per entry point.
> try:
> diff --git a/src/intel/vulkan/anv_intel.c b/src/intel/vulkan/anv_intel.c
> deleted file mode 100644
> index 82373f0c91d..00000000000
> --- a/src/intel/vulkan/anv_intel.c
> +++ /dev/null
> @@ -1,117 +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);
> -
> - result = 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);
> - if (result != VK_SUCCESS)
> - goto fail;
> -
> - close(pCreateInfo->fd);
> -
> - image = anv_image_from_handle(image_h);
> -
> - result = anv_bo_cache_import(device, &device->bo_cache,
> - pCreateInfo->fd, &mem->bo);
> - if (result != VK_SUCCESS)
> - goto fail_import;
> -
> - VkDeviceSize aligned_image_size = align_u64(image->size, 4096);
> -
> - if (mem->bo->size < aligned_image_size) {
> - result = vk_errorf(device->instance, device,
> - VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR,
> - "dma-buf too small for image in "
> - "vkCreateDmaBufImageINTEL: %"PRIu64"B < "PRIu64"B",
> - mem->bo->size, aligned_image_size);
> - anv_bo_cache_release(device, &device->bo_cache, mem->bo);
> - goto fail_import;
> - }
> -
> - if (device->instance->physicalDevice.supports_48bit_addresses)
> - mem->bo->flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
> -
> - image->planes[0].bo = mem->bo;
> - image->planes[0].bo_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_import:
> - vk_free2(&device->alloc, pAllocator, image);
> -
> - fail:
> - vk_free2(&device->alloc, pAllocator, mem);
> -
> - return result;
> -}
> diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
> index 2312845570b..d001d238cf1 100644
> --- a/src/intel/vulkan/anv_private.h
> +++ b/src/intel/vulkan/anv_private.h
> @@ -67,7 +67,6 @@ struct anv_debug_report_callback;
> struct gen_l3_config;
>
> #include <vulkan/vulkan.h>
> -#include <vulkan/vulkan_intel.h>
> #include <vulkan/vk_icd.h>
> #include <vulkan/vk_android_native_buffer.h>
>
> diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build
> index ff24e304ef5..3166286367d 100644
> --- a/src/intel/vulkan/meson.build
> +++ b/src/intel/vulkan/meson.build
> @@ -95,7 +95,6 @@ libanv_files = files(
> 'anv_formats.c',
> 'anv_genX.h',
> 'anv_image.c',
> - 'anv_intel.c',
> 'anv_nir.h',
> 'anv_nir_apply_pipeline_layout.c',
> 'anv_nir_lower_input_attachments.c',
More information about the mesa-dev
mailing list