From d3aaaea6f82db7b3ea46e7e757a129f30e7485a4 Mon Sep 17 00:00:00 2001 From: taosang2 Date: Fri, 23 Jun 2023 08:22:23 -0400 Subject: [PATCH] SWDEV-299127 - Support External Mipmap Support hipExternalMemoryGetMappedMipmappedArray Change-Id: I7e3524cdde53e4df9f728794bcebf4bd3f58d4d8 [ROCm/hip commit: 85e9780f41666e72aa34bd872d9b53205b9d4601] --- projects/hip/include/hip/hip_runtime_api.h | 30 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/projects/hip/include/hip/hip_runtime_api.h b/projects/hip/include/hip/hip_runtime_api.h index b824572ac2..29d7be7140 100644 --- a/projects/hip/include/hip/hip_runtime_api.h +++ b/projects/hip/include/hip/hip_runtime_api.h @@ -1013,6 +1013,13 @@ typedef struct hipExternalMemoryBufferDesc_st { unsigned int flags; unsigned int reserved[16]; } hipExternalMemoryBufferDesc; +typedef struct hipExternalMemoryMipmappedArrayDesc_st { + unsigned long long offset; + hipChannelFormatDesc formatDesc; + hipExtent extent; + unsigned int flags; + unsigned int numLevels; +} hipExternalMemoryMipmappedArrayDesc; typedef void* hipExternalMemory_t; typedef enum hipExternalSemaphoreHandleType_enum { hipExternalSemaphoreHandleTypeOpaqueFd = 1, @@ -2791,6 +2798,25 @@ hipError_t hipExternalMemoryGetMappedBuffer(void **devPtr, hipExternalMemory_t e * @see */ hipError_t hipDestroyExternalMemory(hipExternalMemory_t extMem); +/** + * @brief Maps a mipmapped array onto an external memory object. + * + * @param[out] mipmap mipmapped array to return + * @param[in] extMem external memory object handle + * @param[in] mipmapDesc external mipmapped array descriptor + * + * Returned mipmapped array must be freed using hipFreeMipmappedArray. + * + * @return #hipSuccess, #hipErrorInvalidValue, #hipErrorInvalidResourceHandle + * + * @see hipImportExternalMemory, hipDestroyExternalMemory, hipExternalMemoryGetMappedBuffer, hipFreeMipmappedArray + */ +hipError_t hipExternalMemoryGetMappedMipmappedArray(hipMipmappedArray_t* mipmap, hipExternalMemory_t extMem, + const hipExternalMemoryMipmappedArrayDesc* mipmapDesc); + // end of external resource + /** + * @} + */ /** * @brief Allocate memory on the default accelerator * @@ -2804,10 +2830,6 @@ hipError_t hipDestroyExternalMemory(hipExternalMemory_t extMem); * @see hipMallocPitch, hipFree, hipMallocArray, hipFreeArray, hipMalloc3D, hipMalloc3DArray, * hipHostFree, hipHostMalloc */ - // end of external resource - /** - * @} - */ hipError_t hipMalloc(void** ptr, size_t size); /** * @brief Allocate memory on the default accelerator