From c02ba69e862b0598d9d8661146a01442f3ca6629 Mon Sep 17 00:00:00 2001 From: Mateusz Hoppe Date: Thu, 9 Jan 2020 11:15:03 +0100 Subject: [PATCH] Refactor Gmm & ImageInfo - rename ImageInfo memebrs to camelCase Change-Id: Idb3547ee56992691f95600298981af162a3f94ef Signed-off-by: Mateusz Hoppe --- runtime/gmm_helper/gmm.cpp | 58 +++++++-------- runtime/gmm_helper/gmm.h | 9 ++- runtime/gmm_helper/gmm_types_converter.cpp | 16 ++--- runtime/gmm_helper/gmm_types_converter.h | 6 +- runtime/helpers/surface_formats.h | 22 +++--- runtime/mem_obj/image.cpp | 54 +++++++------- runtime/sharings/d3d/d3d_sharing.cpp | 12 ++-- runtime/sharings/d3d/d3d_sharing.h | 4 +- runtime/sharings/d3d/d3d_surface.cpp | 50 ++++++------- runtime/sharings/d3d/d3d_surface.h | 10 +-- runtime/sharings/d3d/d3d_texture.cpp | 22 +++--- runtime/sharings/d3d/d3d_texture.h | 4 +- runtime/sharings/gl/gl_texture.cpp | 2 +- unit_tests/d3d_sharing/d3d9_tests.cpp | 82 +++++++++++----------- unit_tests/d3d_sharing/d3d_tests_part1.cpp | 22 +++--- unit_tests/d3d_sharing/d3d_tests_part2.cpp | 10 +-- unit_tests/gmm_helper/gmm_helper_tests.cpp | 36 +++++----- unit_tests/mem_obj/image_tests.cpp | 52 +++++++------- 18 files changed, 235 insertions(+), 236 deletions(-) diff --git a/runtime/gmm_helper/gmm.cpp b/runtime/gmm_helper/gmm.cpp index dffdbac886..61ff15a558 100644 --- a/runtime/gmm_helper/gmm.cpp +++ b/runtime/gmm_helper/gmm.cpp @@ -68,12 +68,12 @@ Gmm::Gmm(GmmClientContext *clientContext, ImageInfo &inputOutputImgInfo, Storage } void Gmm::setupImageResourceParams(ImageInfo &imgInfo) { - uint64_t imageWidth = static_cast(imgInfo.imgDesc.image_width); + uint64_t imageWidth = static_cast(imgInfo.imgDesc.imageWidth); uint32_t imageHeight = 1; uint32_t imageDepth = 1; uint32_t imageCount = 1; - switch (imgInfo.imgDesc.image_type) { + switch (imgInfo.imgDesc.imageType) { case ImageType::Image1D: case ImageType::Image1DArray: case ImageType::Image1DBuffer: @@ -82,20 +82,20 @@ void Gmm::setupImageResourceParams(ImageInfo &imgInfo) { case ImageType::Image2D: case ImageType::Image2DArray: resourceParams.Type = GMM_RESOURCE_TYPE::RESOURCE_2D; - imageHeight = static_cast(imgInfo.imgDesc.image_height); + imageHeight = static_cast(imgInfo.imgDesc.imageHeight); break; case ImageType::Image3D: resourceParams.Type = GMM_RESOURCE_TYPE::RESOURCE_3D; - imageHeight = static_cast(imgInfo.imgDesc.image_height); - imageDepth = static_cast(imgInfo.imgDesc.image_depth); + imageHeight = static_cast(imgInfo.imgDesc.imageHeight); + imageDepth = static_cast(imgInfo.imgDesc.imageDepth); break; default: return; } - if (imgInfo.imgDesc.image_type == ImageType::Image1DArray || - imgInfo.imgDesc.image_type == ImageType::Image2DArray) { - imageCount = static_cast(imgInfo.imgDesc.image_array_size); + if (imgInfo.imgDesc.imageType == ImageType::Image1DArray || + imgInfo.imgDesc.imageType == ImageType::Image2DArray) { + imageCount = static_cast(imgInfo.imgDesc.imageArraySize); } resourceParams.Flags.Info.Linear = imgInfo.linearStorage; @@ -113,8 +113,8 @@ void Gmm::setupImageResourceParams(ImageInfo &imgInfo) { resourceParams.ArraySize = imageCount; resourceParams.Flags.Wa.__ForceOtherHVALIGN4 = hwHelper.hvAlign4Required(); resourceParams.MaxLod = imgInfo.baseMipLevel + imgInfo.mipCount; - if (imgInfo.imgDesc.image_row_pitch && imgInfo.imgDesc.from_parent) { - resourceParams.OverridePitch = (uint32_t)imgInfo.imgDesc.image_row_pitch; + if (imgInfo.imgDesc.imageRowPitch && imgInfo.imgDesc.fromParent) { + resourceParams.OverridePitch = (uint32_t)imgInfo.imgDesc.imageRowPitch; resourceParams.Flags.Info.AllowVirtualPadding = true; } @@ -183,31 +183,31 @@ uint32_t Gmm::queryQPitch(GMM_RESOURCE_TYPE resType) { return gmmResourceInfo->getQPitch(); } -void Gmm::updateImgInfoAndDesc(ImageInfo &imgInfo, cl_uint arrayIndex) { - imgInfo.imgDesc.image_width = gmmResourceInfo->getBaseWidth(); - imgInfo.imgDesc.image_row_pitch = gmmResourceInfo->getRenderPitch(); - if (imgInfo.imgDesc.image_row_pitch == 0) { - size_t width = alignUp(imgInfo.imgDesc.image_width, gmmResourceInfo->getHAlign()); - imgInfo.imgDesc.image_row_pitch = width * (gmmResourceInfo->getBitsPerPixel() >> 3); +void Gmm::updateImgInfoAndDesc(ImageInfo &imgInfo, uint32_t arrayIndex) { + imgInfo.imgDesc.imageWidth = gmmResourceInfo->getBaseWidth(); + imgInfo.imgDesc.imageRowPitch = gmmResourceInfo->getRenderPitch(); + if (imgInfo.imgDesc.imageRowPitch == 0) { + size_t width = alignUp(imgInfo.imgDesc.imageWidth, gmmResourceInfo->getHAlign()); + imgInfo.imgDesc.imageRowPitch = width * (gmmResourceInfo->getBitsPerPixel() >> 3); } - imgInfo.imgDesc.image_height = gmmResourceInfo->getBaseHeight(); - imgInfo.imgDesc.image_depth = gmmResourceInfo->getBaseDepth(); - imgInfo.imgDesc.image_array_size = gmmResourceInfo->getArraySize(); - if (imgInfo.imgDesc.image_depth > 1 || imgInfo.imgDesc.image_array_size > 1) { + imgInfo.imgDesc.imageHeight = gmmResourceInfo->getBaseHeight(); + imgInfo.imgDesc.imageDepth = gmmResourceInfo->getBaseDepth(); + imgInfo.imgDesc.imageArraySize = gmmResourceInfo->getArraySize(); + if (imgInfo.imgDesc.imageDepth > 1 || imgInfo.imgDesc.imageArraySize > 1) { GMM_REQ_OFFSET_INFO reqOffsetInfo = {}; - reqOffsetInfo.Slice = imgInfo.imgDesc.image_depth > 1 ? 1 : 0; - reqOffsetInfo.ArrayIndex = imgInfo.imgDesc.image_array_size > 1 ? 1 : 0; + reqOffsetInfo.Slice = imgInfo.imgDesc.imageDepth > 1 ? 1 : 0; + reqOffsetInfo.ArrayIndex = imgInfo.imgDesc.imageArraySize > 1 ? 1 : 0; reqOffsetInfo.ReqLock = 1; gmmResourceInfo->getOffset(reqOffsetInfo); - imgInfo.imgDesc.image_slice_pitch = static_cast(reqOffsetInfo.Lock.Offset); + imgInfo.imgDesc.imageSlicePitch = static_cast(reqOffsetInfo.Lock.Offset); } else { - imgInfo.imgDesc.image_slice_pitch = gmmResourceInfo->getSizeAllocation(); + imgInfo.imgDesc.imageSlicePitch = gmmResourceInfo->getSizeAllocation(); } updateOffsetsInImgInfo(imgInfo, arrayIndex); } -void Gmm::updateOffsetsInImgInfo(ImageInfo &imgInfo, cl_uint arrayIndex) { +void Gmm::updateOffsetsInImgInfo(ImageInfo &imgInfo, uint32_t arrayIndex) { GMM_REQ_OFFSET_INFO reqOffsetInfo = {}; reqOffsetInfo.ReqRender = 1; reqOffsetInfo.Slice = 0; @@ -219,16 +219,16 @@ void Gmm::updateOffsetsInImgInfo(ImageInfo &imgInfo, cl_uint arrayIndex) { imgInfo.offset = reqOffsetInfo.Render.Offset; } -uint8_t Gmm::resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t height, unsigned char upload, OCLPlane plane) { +uint8_t Gmm::resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t height, unsigned char upload, ImagePlane plane) { GMM_RES_COPY_BLT gmmResourceCopyBLT = {}; - if (plane == OCLPlane::PLANE_V) { + if (plane == ImagePlane::PLANE_V) { sys = ptrOffset(sys, height * pitch * 2); pitch /= 2; - } else if (plane == OCLPlane::PLANE_U) { + } else if (plane == ImagePlane::PLANE_U) { sys = ptrOffset(sys, height * pitch * 2 + height * pitch / 2); pitch /= 2; - } else if (plane == OCLPlane::PLANE_UV) { + } else if (plane == ImagePlane::PLANE_UV) { sys = ptrOffset(sys, height * pitch * 2); } uint32_t size = pitch * height; diff --git a/runtime/gmm_helper/gmm.h b/runtime/gmm_helper/gmm.h index 275b6a4b9e..5ee187d0cb 100644 --- a/runtime/gmm_helper/gmm.h +++ b/runtime/gmm_helper/gmm.h @@ -7,7 +7,6 @@ #pragma once #include "core/gmm_helper/gmm_lib.h" -#include "runtime/api/cl_types.h" #include "storage_info.h" @@ -16,7 +15,7 @@ #include namespace NEO { -enum class OCLPlane; +enum class ImagePlane; struct HardwareInfo; struct ImageInfo; class GmmResourceInfo; @@ -40,9 +39,9 @@ class Gmm { bool hasMultisampleControlSurface() const; uint32_t queryQPitch(GMM_RESOURCE_TYPE resType); - void updateImgInfoAndDesc(ImageInfo &imgInfo, cl_uint arrayIndex); - void updateOffsetsInImgInfo(ImageInfo &imgInfo, cl_uint arrayIndex); - uint8_t resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t height, unsigned char upload, OCLPlane plane); + void updateImgInfoAndDesc(ImageInfo &imgInfo, uint32_t arrayIndex); + void updateOffsetsInImgInfo(ImageInfo &imgInfo, uint32_t arrayIndex); + uint8_t resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t height, unsigned char upload, ImagePlane plane); uint32_t getUnifiedAuxPitchTiles(); uint32_t getAuxQPitch(); diff --git a/runtime/gmm_helper/gmm_types_converter.cpp b/runtime/gmm_helper/gmm_types_converter.cpp index 8637f4f2ba..20ab316964 100644 --- a/runtime/gmm_helper/gmm_types_converter.cpp +++ b/runtime/gmm_helper/gmm_types_converter.cpp @@ -18,12 +18,12 @@ using namespace NEO; void GmmTypesConverter::queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation *gfxAlloc) { // 1D or 2D from buffer - if (imgInfo.imgDesc.image_row_pitch > 0) { - imgInfo.rowPitch = imgInfo.imgDesc.image_row_pitch; + if (imgInfo.imgDesc.imageRowPitch > 0) { + imgInfo.rowPitch = imgInfo.imgDesc.imageRowPitch; } else { - imgInfo.rowPitch = getValidParam(imgInfo.imgDesc.image_width) * imgInfo.surfaceFormat->ImageElementSizeInBytes; + imgInfo.rowPitch = getValidParam(imgInfo.imgDesc.imageWidth) * imgInfo.surfaceFormat->ImageElementSizeInBytes; } - imgInfo.slicePitch = imgInfo.rowPitch * getValidParam(imgInfo.imgDesc.image_height); + imgInfo.slicePitch = imgInfo.rowPitch * getValidParam(imgInfo.imgDesc.imageHeight); imgInfo.size = gfxAlloc->getUnderlyingBufferSize(); imgInfo.qPitch = 0; } @@ -41,12 +41,12 @@ uint32_t GmmTypesConverter::getRenderMultisamplesCount(uint32_t numSamples) { return 0; } -GMM_YUV_PLANE GmmTypesConverter::convertPlane(OCLPlane oclPlane) { - if (oclPlane == OCLPlane::PLANE_Y) { +GMM_YUV_PLANE GmmTypesConverter::convertPlane(ImagePlane imagePlane) { + if (imagePlane == ImagePlane::PLANE_Y) { return GMM_PLANE_Y; - } else if (oclPlane == OCLPlane::PLANE_U || oclPlane == OCLPlane::PLANE_UV) { + } else if (imagePlane == ImagePlane::PLANE_U || imagePlane == ImagePlane::PLANE_UV) { return GMM_PLANE_U; - } else if (oclPlane == OCLPlane::PLANE_V) { + } else if (imagePlane == ImagePlane::PLANE_V) { return GMM_PLANE_V; } diff --git a/runtime/gmm_helper/gmm_types_converter.h b/runtime/gmm_helper/gmm_types_converter.h index 68d27f0171..f9311ae602 100644 --- a/runtime/gmm_helper/gmm_types_converter.h +++ b/runtime/gmm_helper/gmm_types_converter.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,7 +9,7 @@ #include "core/gmm_helper/gmm_lib.h" namespace NEO { -enum class OCLPlane; +enum class ImagePlane; class GraphicsAllocation; struct ImageInfo; @@ -17,6 +17,6 @@ struct GmmTypesConverter { static void queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation *gfxAlloc); static GMM_CUBE_FACE_ENUM getCubeFaceIndex(uint32_t target); static uint32_t getRenderMultisamplesCount(uint32_t numSamples); - static GMM_YUV_PLANE convertPlane(OCLPlane oclPlane); + static GMM_YUV_PLANE convertPlane(ImagePlane imagePlane); }; } // namespace NEO diff --git a/runtime/helpers/surface_formats.h b/runtime/helpers/surface_formats.h index 413b6093d0..dd0e3770aa 100644 --- a/runtime/helpers/surface_formats.h +++ b/runtime/helpers/surface_formats.h @@ -182,7 +182,7 @@ enum GFX3DSTATE_SURFACEFORMAT : unsigned short { NUM_GFX3DSTATE_SURFACEFORMATS }; -enum class OCLPlane { +enum class ImagePlane { NO_PLANE = 0, PLANE_Y, PLANE_U, @@ -211,16 +211,16 @@ enum class ImageType { }; struct ImageDescriptor { - ImageType image_type; - size_t image_width; - size_t image_height; - size_t image_depth; - size_t image_array_size; - size_t image_row_pitch; - size_t image_slice_pitch; - uint32_t num_mip_levels; - uint32_t num_samples; - bool from_parent; + ImageType imageType; + size_t imageWidth; + size_t imageHeight; + size_t imageDepth; + size_t imageArraySize; + size_t imageRowPitch; + size_t imageSlicePitch; + uint32_t numMipLevels; + uint32_t numSamples; + bool fromParent; }; struct ImageInfo { diff --git a/runtime/mem_obj/image.cpp b/runtime/mem_obj/image.cpp index 8374f7cbd0..44aab5bd8b 100644 --- a/runtime/mem_obj/image.cpp +++ b/runtime/mem_obj/image.cpp @@ -429,8 +429,8 @@ Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler sharedImage->setSharingHandler(sharingHandler); sharedImage->setMcsAllocation(mcsAllocation); sharedImage->setQPitch(imgInfo.qPitch); - sharedImage->setHostPtrRowPitch(imgInfo.imgDesc.image_row_pitch); - sharedImage->setHostPtrSlicePitch(imgInfo.imgDesc.image_slice_pitch); + sharedImage->setHostPtrRowPitch(imgInfo.imgDesc.imageRowPitch); + sharedImage->setHostPtrSlicePitch(imgInfo.imgDesc.imageSlicePitch); sharedImage->setCubeFaceIndex(cubeFaceIndex); sharedImage->setSurfaceOffsets(imgInfo.offset, imgInfo.xOffset, imgInfo.yOffset, imgInfo.yOffsetForUVPlane); sharedImage->setMcsSurfaceInfo(mcsSurfaceInfo); @@ -703,25 +703,25 @@ bool Image::isCopyRequired(ImageInfo &imgInfo, const void *hostPtr) { return false; } - size_t imageWidth = imgInfo.imgDesc.image_width; + size_t imageWidth = imgInfo.imgDesc.imageWidth; size_t imageHeight = 1; size_t imageDepth = 1; size_t imageCount = 1; - switch (imgInfo.imgDesc.image_type) { + switch (imgInfo.imgDesc.imageType) { case ImageType::Image3D: - imageDepth = imgInfo.imgDesc.image_depth; + imageDepth = imgInfo.imgDesc.imageDepth; CPP_ATTRIBUTE_FALLTHROUGH; case ImageType::Image2D: case ImageType::Image2DArray: - imageHeight = imgInfo.imgDesc.image_height; + imageHeight = imgInfo.imgDesc.imageHeight; break; default: break; } - auto hostPtrRowPitch = imgInfo.imgDesc.image_row_pitch ? imgInfo.imgDesc.image_row_pitch : imageWidth * imgInfo.surfaceFormat->ImageElementSizeInBytes; - auto hostPtrSlicePitch = imgInfo.imgDesc.image_slice_pitch ? imgInfo.imgDesc.image_slice_pitch : hostPtrRowPitch * imgInfo.imgDesc.image_height; + auto hostPtrRowPitch = imgInfo.imgDesc.imageRowPitch ? imgInfo.imgDesc.imageRowPitch : imageWidth * imgInfo.surfaceFormat->ImageElementSizeInBytes; + auto hostPtrSlicePitch = imgInfo.imgDesc.imageSlicePitch ? imgInfo.imgDesc.imageSlicePitch : hostPtrRowPitch * imgInfo.imgDesc.imageHeight; size_t pointerPassedSize = hostPtrRowPitch * imageHeight * imageDepth * imageCount; auto alignedSizePassedPointer = alignSizeWholePage(const_cast(hostPtr), pointerPassedSize); @@ -779,31 +779,31 @@ ImageType Image::convertType(const cl_mem_object_type type) { ImageDescriptor Image::convertDescriptor(const cl_image_desc &imageDesc) { ImageDescriptor desc = {}; - desc.from_parent = imageDesc.mem_object != nullptr; - desc.image_array_size = imageDesc.image_array_size; - desc.image_depth = imageDesc.image_depth; - desc.image_height = imageDesc.image_height; - desc.image_row_pitch = imageDesc.image_row_pitch; - desc.image_slice_pitch = imageDesc.image_slice_pitch; - desc.image_type = convertType(imageDesc.image_type); - desc.image_width = imageDesc.image_width; - desc.num_mip_levels = imageDesc.num_mip_levels; - desc.num_samples = imageDesc.num_samples; + desc.fromParent = imageDesc.mem_object != nullptr; + desc.imageArraySize = imageDesc.image_array_size; + desc.imageDepth = imageDesc.image_depth; + desc.imageHeight = imageDesc.image_height; + desc.imageRowPitch = imageDesc.image_row_pitch; + desc.imageSlicePitch = imageDesc.image_slice_pitch; + desc.imageType = convertType(imageDesc.image_type); + desc.imageWidth = imageDesc.image_width; + desc.numMipLevels = imageDesc.num_mip_levels; + desc.numSamples = imageDesc.num_samples; return desc; } cl_image_desc Image::convertDescriptor(const ImageDescriptor &imageDesc) { cl_image_desc desc = {}; desc.mem_object = nullptr; - desc.image_array_size = imageDesc.image_array_size; - desc.image_depth = imageDesc.image_depth; - desc.image_height = imageDesc.image_height; - desc.image_row_pitch = imageDesc.image_row_pitch; - desc.image_slice_pitch = imageDesc.image_slice_pitch; - desc.image_type = convertType(imageDesc.image_type); - desc.image_width = imageDesc.image_width; - desc.num_mip_levels = imageDesc.num_mip_levels; - desc.num_samples = imageDesc.num_samples; + desc.image_array_size = imageDesc.imageArraySize; + desc.image_depth = imageDesc.imageDepth; + desc.image_height = imageDesc.imageHeight; + desc.image_row_pitch = imageDesc.imageRowPitch; + desc.image_slice_pitch = imageDesc.imageSlicePitch; + desc.image_type = convertType(imageDesc.imageType); + desc.image_width = imageDesc.imageWidth; + desc.num_mip_levels = imageDesc.numMipLevels; + desc.num_samples = imageDesc.numSamples; return desc; } diff --git a/runtime/sharings/d3d/d3d_sharing.cpp b/runtime/sharings/d3d/d3d_sharing.cpp index 59df5f0ee7..ebfd3edc36 100644 --- a/runtime/sharings/d3d/d3d_sharing.cpp +++ b/runtime/sharings/d3d/d3d_sharing.cpp @@ -67,15 +67,15 @@ void D3DSharing::releaseResource(MemObj *memObject) { } template -void D3DSharing::updateImgInfoAndDesc(Gmm *gmm, ImageInfo &imgInfo, OCLPlane oclPlane, cl_uint arrayIndex) { +void D3DSharing::updateImgInfoAndDesc(Gmm *gmm, ImageInfo &imgInfo, ImagePlane imagePlane, cl_uint arrayIndex) { gmm->updateImgInfoAndDesc(imgInfo, arrayIndex); - if (oclPlane == OCLPlane::PLANE_U || oclPlane == OCLPlane::PLANE_V || oclPlane == OCLPlane::PLANE_UV) { - imgInfo.imgDesc.image_width /= 2; - imgInfo.imgDesc.image_height /= 2; - if (oclPlane != OCLPlane::PLANE_UV) { - imgInfo.imgDesc.image_row_pitch /= 2; + if (imagePlane == ImagePlane::PLANE_U || imagePlane == ImagePlane::PLANE_V || imagePlane == ImagePlane::PLANE_UV) { + imgInfo.imgDesc.imageWidth /= 2; + imgInfo.imgDesc.imageHeight /= 2; + if (imagePlane != ImagePlane::PLANE_UV) { + imgInfo.imgDesc.imageRowPitch /= 2; } } } diff --git a/runtime/sharings/d3d/d3d_sharing.h b/runtime/sharings/d3d/d3d_sharing.h index 63bbae920e..95ade098dd 100644 --- a/runtime/sharings/d3d/d3d_sharing.h +++ b/runtime/sharings/d3d/d3d_sharing.h @@ -12,7 +12,7 @@ enum GMM_RESOURCE_FORMAT_ENUM; namespace NEO { -enum class OCLPlane; +enum class ImagePlane; class Context; class Gmm; struct SurfaceFormatInfo; @@ -40,7 +40,7 @@ class D3DSharing : public SharingHandler { static bool isFormatWithPlane1(DXGI_FORMAT format); protected: - static void updateImgInfoAndDesc(Gmm *gmm, ImageInfo &imgInfo, OCLPlane oclPlane, cl_uint arrayIndex); + static void updateImgInfoAndDesc(Gmm *gmm, ImageInfo &imgInfo, ImagePlane imagePlane, cl_uint arrayIndex); Context *context; D3DSharingFunctions *sharingFunctions = nullptr; diff --git a/runtime/sharings/d3d/d3d_surface.cpp b/runtime/sharings/d3d/d3d_surface.cpp index 9df9e43567..342880f93b 100644 --- a/runtime/sharings/d3d/d3d_surface.cpp +++ b/runtime/sharings/d3d/d3d_surface.cpp @@ -22,9 +22,9 @@ using namespace NEO; D3DSurface::D3DSurface(Context *context, cl_dx9_surface_info_khr *surfaceInfo, D3D9Surface *surfaceStaging, cl_uint plane, - OCLPlane oclPlane, cl_dx9_media_adapter_type_khr adapterType, bool sharedResource, bool lockable) + ImagePlane imagePlane, cl_dx9_media_adapter_type_khr adapterType, bool sharedResource, bool lockable) : D3DSharing(context, surfaceInfo->resource, surfaceStaging, plane, sharedResource), adapterType(adapterType), - surfaceInfo(*surfaceInfo), lockable(lockable), plane(plane), oclPlane(oclPlane), d3d9Surface(surfaceInfo->resource), + surfaceInfo(*surfaceInfo), lockable(lockable), plane(plane), imagePlane(imagePlane), d3d9Surface(surfaceInfo->resource), d3d9SurfaceStaging(surfaceStaging) { if (sharingFunctions) { resourceDevice = sharingFunctions->getDevice(); @@ -38,7 +38,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo ImageInfo imgInfo = {}; cl_image_format imgFormat = {}; McsSurfaceInfo mcsSurfaceInfo = {}; - OCLPlane oclPlane = OCLPlane::NO_PLANE; + ImagePlane imagePlane = ImagePlane::NO_PLANE; if (!context || !context->getSharing>() || !context->getSharing>()->getDevice()) { err.set(CL_INVALID_CONTEXT); @@ -52,24 +52,24 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo sharingFcns->updateDevice(surfaceInfo->resource); - imgInfo.imgDesc.image_type = ImageType::Image2D; + imgInfo.imgDesc.imageType = ImageType::Image2D; D3D9SurfaceDesc surfaceDesc = {}; sharingFcns->getTexture2dDesc(&surfaceDesc, surfaceInfo->resource); - imgInfo.imgDesc.image_width = surfaceDesc.Width; - imgInfo.imgDesc.image_height = surfaceDesc.Height; + imgInfo.imgDesc.imageWidth = surfaceDesc.Width; + imgInfo.imgDesc.imageHeight = surfaceDesc.Height; if (surfaceDesc.Pool != D3DPOOL_DEFAULT) { err.set(CL_INVALID_DX9_RESOURCE_INTEL); return nullptr; } - err.set(findImgFormat(surfaceDesc.Format, imgFormat, plane, oclPlane)); + err.set(findImgFormat(surfaceDesc.Format, imgFormat, plane, imagePlane)); if (err.localErrcode != CL_SUCCESS) { return nullptr; } - imgInfo.plane = GmmTypesConverter::convertPlane(oclPlane); + imgInfo.plane = GmmTypesConverter::convertPlane(imagePlane); imgInfo.surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imgFormat); bool isSharedResource = false; @@ -82,15 +82,15 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo AllocationProperties allocProperties(rootDeviceIndex, false, 0u, GraphicsAllocation::AllocationType::SHARED_IMAGE, false); alloc = context->getMemoryManager()->createGraphicsAllocationFromSharedHandle((osHandle)((UINT_PTR)surfaceInfo->shared_handle), allocProperties, false); - updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, oclPlane, 0u); + updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, imagePlane, 0u); } else { - lockable = !(surfaceDesc.Usage & D3DResourceFlags::USAGE_RENDERTARGET) || oclPlane != OCLPlane::NO_PLANE; + lockable = !(surfaceDesc.Usage & D3DResourceFlags::USAGE_RENDERTARGET) || imagePlane != ImagePlane::NO_PLANE; if (!lockable) { sharingFcns->createTexture2d(&surfaceStaging, &surfaceDesc, 0u); } - if (oclPlane == OCLPlane::PLANE_U || oclPlane == OCLPlane::PLANE_V || oclPlane == OCLPlane::PLANE_UV) { - imgInfo.imgDesc.image_width /= 2; - imgInfo.imgDesc.image_height /= 2; + if (imagePlane == ImagePlane::PLANE_U || imagePlane == ImagePlane::PLANE_V || imagePlane == ImagePlane::PLANE_UV) { + imgInfo.imgDesc.imageWidth /= 2; + imgInfo.imgDesc.imageHeight /= 2; } MemoryPropertiesFlags memoryProperties = MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0); AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(rootDeviceIndex, imgInfo, true, memoryProperties); @@ -98,12 +98,12 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo alloc = context->getMemoryManager()->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr); - imgInfo.imgDesc.image_row_pitch = imgInfo.rowPitch; - imgInfo.imgDesc.image_slice_pitch = imgInfo.slicePitch; + imgInfo.imgDesc.imageRowPitch = imgInfo.rowPitch; + imgInfo.imgDesc.imageSlicePitch = imgInfo.slicePitch; } DEBUG_BREAK_IF(!alloc); - auto surface = new D3DSurface(context, surfaceInfo, surfaceStaging, plane, oclPlane, adapterType, isSharedResource, lockable); + auto surface = new D3DSurface(context, surfaceInfo, surfaceStaging, plane, imagePlane, adapterType, isSharedResource, lockable); return Image::createSharedImage(context, surface, mcsSurfaceInfo, alloc, nullptr, flags, imgInfo, __GMM_NO_CUBE_MAP, 0, 0); } @@ -127,7 +127,7 @@ void D3DSurface::synchronizeObject(UpdateData &updateData) { auto pitch = static_cast(lockedRect.Pitch); auto height = static_cast(image->getImageDesc().image_height); - image->getGraphicsAllocation()->getDefaultGmm()->resourceCopyBlt(sys, gpu, pitch, height, 1u, oclPlane); + image->getGraphicsAllocation()->getDefaultGmm()->resourceCopyBlt(sys, gpu, pitch, height, 1u, imagePlane); context->getMemoryManager()->unlockResource(updateData.memObject->getGraphicsAllocation()); @@ -162,7 +162,7 @@ void D3DSurface::releaseResource(MemObj *memObject) { auto pitch = static_cast(lockedRect.Pitch); auto height = static_cast(image->getImageDesc().image_height); - image->getGraphicsAllocation()->getDefaultGmm()->resourceCopyBlt(sys, gpu, pitch, height, 0u, oclPlane); + image->getGraphicsAllocation()->getDefaultGmm()->resourceCopyBlt(sys, gpu, pitch, height, 0u, imagePlane); context->getMemoryManager()->unlockResource(memObject->getGraphicsAllocation()); @@ -208,8 +208,8 @@ const std::vector D3DSurface::D3DPlane1Formats = { const std::vector D3DSurface::D3DPlane2Formats = {static_cast(MAKEFOURCC('Y', 'V', '1', '2'))}; -cl_int D3DSurface::findImgFormat(D3DFORMAT d3dFormat, cl_image_format &imgFormat, cl_uint plane, OCLPlane &oclPlane) { - oclPlane = OCLPlane::NO_PLANE; +cl_int D3DSurface::findImgFormat(D3DFORMAT d3dFormat, cl_image_format &imgFormat, cl_uint plane, ImagePlane &imagePlane) { + imagePlane = ImagePlane::NO_PLANE; static const cl_image_format unknown_format = {0, 0}; auto element = D3DtoClFormatConversions.find(d3dFormat); @@ -224,11 +224,11 @@ cl_int D3DSurface::findImgFormat(D3DFORMAT d3dFormat, cl_image_format &imgFormat switch (plane) { case 0: imgFormat.image_channel_order = CL_R; - oclPlane = OCLPlane::PLANE_Y; + imagePlane = ImagePlane::PLANE_Y; return CL_SUCCESS; case 1: imgFormat.image_channel_order = CL_RG; - oclPlane = OCLPlane::PLANE_UV; + imagePlane = ImagePlane::PLANE_UV; return CL_SUCCESS; default: imgFormat = unknown_format; @@ -238,15 +238,15 @@ cl_int D3DSurface::findImgFormat(D3DFORMAT d3dFormat, cl_image_format &imgFormat case static_cast(MAKEFOURCC('Y', 'V', '1', '2')): switch (plane) { case 0: - oclPlane = OCLPlane::PLANE_Y; + imagePlane = ImagePlane::PLANE_Y; return CL_SUCCESS; case 1: - oclPlane = OCLPlane::PLANE_V; + imagePlane = ImagePlane::PLANE_V; return CL_SUCCESS; case 2: - oclPlane = OCLPlane::PLANE_U; + imagePlane = ImagePlane::PLANE_U; return CL_SUCCESS; default: diff --git a/runtime/sharings/d3d/d3d_surface.h b/runtime/sharings/d3d/d3d_surface.h index 525d00d6e8..c0be7d19b3 100644 --- a/runtime/sharings/d3d/d3d_surface.h +++ b/runtime/sharings/d3d/d3d_surface.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,7 +12,7 @@ struct ErrorCodeHelper; namespace NEO { -enum class OCLPlane; +enum class ImagePlane; class Image; class Context; @@ -28,7 +28,7 @@ class D3DSurface : public D3DSharing { static const std::map D3DtoClFormatConversions; static const std::vector D3DPlane1Formats; static const std::vector D3DPlane2Formats; - static cl_int findImgFormat(D3DFORMAT d3dFormat, cl_image_format &imgFormat, cl_uint plane, OCLPlane &oclPlane); + static cl_int findImgFormat(D3DFORMAT d3dFormat, cl_image_format &imgFormat, cl_uint plane, ImagePlane &imagePlane); void synchronizeObject(UpdateData &updateData) override; void releaseResource(MemObj *memObject) override; int validateUpdateData(UpdateData &updateData) override; @@ -42,11 +42,11 @@ class D3DSurface : public D3DSharing { protected: D3DSurface(Context *context, cl_dx9_surface_info_khr *surfaceInfo, D3D9Surface *surfaceStaging, cl_uint plane, - OCLPlane oclPlane, cl_dx9_media_adapter_type_khr adapterType, bool sharedResource, bool lockable); + ImagePlane imagePlane, cl_dx9_media_adapter_type_khr adapterType, bool sharedResource, bool lockable); cl_dx9_media_adapter_type_khr adapterType = 0u; cl_dx9_surface_info_khr surfaceInfo = {}; cl_uint plane = 0; - OCLPlane oclPlane; + ImagePlane imagePlane; D3D9Surface *d3d9Surface = nullptr; D3D9Surface *d3d9SurfaceStaging = nullptr; diff --git a/runtime/sharings/d3d/d3d_texture.cpp b/runtime/sharings/d3d/d3d_texture.cpp index 2a1a066181..ad606aae87 100644 --- a/runtime/sharings/d3d/d3d_texture.cpp +++ b/runtime/sharings/d3d/d3d_texture.cpp @@ -26,24 +26,24 @@ template Image *D3DTexture::create2d(Context *context, D3DTexture2d *d3dTexture, cl_mem_flags flags, cl_uint subresource, cl_int *retCode) { ErrorCodeHelper err(retCode, CL_SUCCESS); auto sharingFcns = context->getSharing>(); - OCLPlane oclPlane = OCLPlane::NO_PLANE; + ImagePlane imagePlane = ImagePlane::NO_PLANE; void *sharedHandle = nullptr; cl_uint arrayIndex = 0u; cl_image_format imgFormat = {}; McsSurfaceInfo mcsSurfaceInfo = {}; ImageInfo imgInfo = {}; - imgInfo.imgDesc.image_type = ImageType::Image2D; + imgInfo.imgDesc.imageType = ImageType::Image2D; D3DTexture2dDesc textureDesc = {}; sharingFcns->getTexture2dDesc(&textureDesc, d3dTexture); if ((textureDesc.Format == DXGI_FORMAT_NV12) || (textureDesc.Format == DXGI_FORMAT_P010) || (textureDesc.Format == DXGI_FORMAT_P016)) { if ((subresource % 2) == 0) { - oclPlane = OCLPlane::PLANE_Y; + imagePlane = ImagePlane::PLANE_Y; } else { - oclPlane = OCLPlane::PLANE_UV; + imagePlane = ImagePlane::PLANE_UV; } - imgInfo.plane = GmmTypesConverter::convertPlane(oclPlane); + imgInfo.plane = GmmTypesConverter::convertPlane(imagePlane); arrayIndex = subresource / 2u; } else if (subresource >= textureDesc.MipLevels * textureDesc.ArraySize) { err.set(CL_INVALID_VALUE); @@ -75,12 +75,12 @@ Image *D3DTexture::create2d(Context *context, D3DTexture2d *d3dTexture, cl_ } DEBUG_BREAK_IF(!alloc); - updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, oclPlane, arrayIndex); + updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, imagePlane, arrayIndex); auto d3dTextureObj = new D3DTexture(context, d3dTexture, subresource, textureStaging, sharedResource); if ((textureDesc.Format == DXGI_FORMAT_NV12) || (textureDesc.Format == DXGI_FORMAT_P010) || (textureDesc.Format == DXGI_FORMAT_P016)) { - imgInfo.surfaceFormat = findYuvSurfaceFormatInfo(textureDesc.Format, oclPlane, flags); + imgInfo.surfaceFormat = findYuvSurfaceFormatInfo(textureDesc.Format, imagePlane, flags); } else { imgInfo.surfaceFormat = findSurfaceFormatInfo(alloc->getDefaultGmm()->gmmResourceInfo->getResourceFormat(), flags); } @@ -103,7 +103,7 @@ Image *D3DTexture::create3d(Context *context, D3DTexture3d *d3dTexture, cl_ cl_image_format imgFormat = {}; McsSurfaceInfo mcsSurfaceInfo = {}; ImageInfo imgInfo = {}; - imgInfo.imgDesc.image_type = ImageType::Image3D; + imgInfo.imgDesc.imageType = ImageType::Image3D; D3DTexture3dDesc textureDesc = {}; sharingFcns->getTexture3dDesc(&textureDesc, d3dTexture); @@ -137,7 +137,7 @@ Image *D3DTexture::create3d(Context *context, D3DTexture3d *d3dTexture, cl_ } DEBUG_BREAK_IF(!alloc); - updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, OCLPlane::NO_PLANE, 0u); + updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, ImagePlane::NO_PLANE, 0u); auto d3dTextureObj = new D3DTexture(context, d3dTexture, subresource, textureStaging, sharedResource); @@ -156,9 +156,9 @@ Image *D3DTexture::create3d(Context *context, D3DTexture3d *d3dTexture, cl_ } template -const SurfaceFormatInfo *D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT dxgiFormat, OCLPlane oclPlane, cl_mem_flags flags) { +const SurfaceFormatInfo *D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT dxgiFormat, ImagePlane imagePlane, cl_mem_flags flags) { cl_image_format imgFormat = {}; - if (oclPlane == OCLPlane::PLANE_Y) { + if (imagePlane == ImagePlane::PLANE_Y) { imgFormat.image_channel_order = CL_R; } else { imgFormat.image_channel_order = CL_RG; diff --git a/runtime/sharings/d3d/d3d_texture.h b/runtime/sharings/d3d/d3d_texture.h index 5fa1a0c20e..bccd790713 100644 --- a/runtime/sharings/d3d/d3d_texture.h +++ b/runtime/sharings/d3d/d3d_texture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -27,7 +27,7 @@ class D3DTexture : public D3DSharing { static Image *create3d(Context *context, D3DTexture3d *d3dTexture, cl_mem_flags flags, cl_uint subresource, cl_int *retCode); - static const SurfaceFormatInfo *findYuvSurfaceFormatInfo(DXGI_FORMAT dxgiFormat, OCLPlane oclPlane, cl_mem_flags flags); + static const SurfaceFormatInfo *findYuvSurfaceFormatInfo(DXGI_FORMAT dxgiFormat, ImagePlane imagePlane, cl_mem_flags flags); protected: D3DTexture(Context *context, D3DResource *d3dTexture, cl_uint subresource, D3DResource *textureStaging, bool sharedResource) diff --git a/runtime/sharings/gl/gl_texture.cpp b/runtime/sharings/gl/gl_texture.cpp index 3d70855be4..500d34a491 100644 --- a/runtime/sharings/gl/gl_texture.cpp +++ b/runtime/sharings/gl/gl_texture.cpp @@ -147,7 +147,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl } return Image::createSharedImage(context, glTexture, mcsSurfaceInfo, alloc, mcsAlloc, flags, imgInfo, cubeFaceIndex, - std::max(miplevel, 0), imgInfo.imgDesc.num_mip_levels); + std::max(miplevel, 0), imgInfo.imgDesc.numMipLevels); } // namespace NEO void GlTexture::synchronizeObject(UpdateData &updateData) { diff --git a/unit_tests/d3d_sharing/d3d9_tests.cpp b/unit_tests/d3d_sharing/d3d9_tests.cpp index 686baad069..68727ff86f 100644 --- a/unit_tests/d3d_sharing/d3d9_tests.cpp +++ b/unit_tests/d3d_sharing/d3d9_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -175,8 +175,8 @@ TEST_F(D3D9Tests, getDeviceIdPartialImplementation) { TEST_F(D3D9Tests, createSurface) { cl_int retVal; cl_image_format expectedImgFormat = {}; - OCLPlane oclPlane = OCLPlane::NO_PLANE; - D3DSurface::findImgFormat(mockSharingFcns->mockTexture2dDesc.Format, expectedImgFormat, 0, oclPlane); + ImagePlane imagePlane = ImagePlane::NO_PLANE; + D3DSurface::findImgFormat(mockSharingFcns->mockTexture2dDesc.Format, expectedImgFormat, 0, imagePlane); EXPECT_CALL(*mockSharingFcns, updateDevice((IDirect3DSurface9 *)&dummyD3DSurface)).Times(1); EXPECT_CALL(*mockSharingFcns, getTexture2dDesc(_, _)).Times(1).WillOnce(SetArgPointee<0>(mockSharingFcns->mockTexture2dDesc)); @@ -202,16 +202,16 @@ TEST_F(D3D9Tests, createSurface) { TEST(D3D9SimpleTests, givenWrongFormatWhenFindIsCalledThenErrorIsReturned) { cl_image_format expectedImgFormat = {}; - OCLPlane oclPlane = OCLPlane::NO_PLANE; - auto status = D3DSurface::findImgFormat(D3DFMT_FORCE_DWORD, expectedImgFormat, 0, oclPlane); + ImagePlane imagePlane = ImagePlane::NO_PLANE; + auto status = D3DSurface::findImgFormat(D3DFMT_FORCE_DWORD, expectedImgFormat, 0, imagePlane); EXPECT_EQ(CL_INVALID_IMAGE_FORMAT_DESCRIPTOR, status); } TEST_F(D3D9Tests, createSurfaceIntel) { cl_int retVal; cl_image_format expectedImgFormat = {}; - OCLPlane oclPlane = OCLPlane::NO_PLANE; - D3DSurface::findImgFormat(mockSharingFcns->mockTexture2dDesc.Format, expectedImgFormat, 0, oclPlane); + ImagePlane imagePlane = ImagePlane::NO_PLANE; + D3DSurface::findImgFormat(mockSharingFcns->mockTexture2dDesc.Format, expectedImgFormat, 0, imagePlane); EXPECT_CALL(*mockSharingFcns, updateDevice((IDirect3DSurface9 *)&dummyD3DSurface)).Times(1); EXPECT_CALL(*mockSharingFcns, getTexture2dDesc(_, _)).Times(1).WillOnce(SetArgPointee<0>(mockSharingFcns->mockTexture2dDesc)); @@ -1011,40 +1011,40 @@ TEST_F(D3D9Tests, givenImproperCommandQueueWhenD3D11ObjectsAreReleasedThenReturn } namespace D3D9Formats { -static const std::tuple allImageFormats[] = { +static const std::tuple allImageFormats[] = { // input, input, output, output - std::make_tuple(D3DFMT_R32F, 0, CL_R, CL_FLOAT, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_R16F, 0, CL_R, CL_HALF_FLOAT, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_L16, 0, CL_R, CL_UNORM_INT16, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_A8, 0, CL_A, CL_UNORM_INT8, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_L8, 0, CL_R, CL_UNORM_INT8, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_G32R32F, 0, CL_RG, CL_FLOAT, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_G16R16F, 0, CL_RG, CL_HALF_FLOAT, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_G16R16, 0, CL_RG, CL_UNORM_INT16, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_A8L8, 0, CL_RG, CL_UNORM_INT8, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_A32B32G32R32F, 0, CL_RGBA, CL_FLOAT, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_A16B16G16R16F, 0, CL_RGBA, CL_HALF_FLOAT, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_A16B16G16R16, 0, CL_RGBA, CL_UNORM_INT16, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_A8B8G8R8, 0, CL_RGBA, CL_UNORM_INT8, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_X8B8G8R8, 0, CL_RGBA, CL_UNORM_INT8, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_A8R8G8B8, 0, CL_BGRA, CL_UNORM_INT8, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_X8R8G8B8, 0, CL_BGRA, CL_UNORM_INT8, OCLPlane::NO_PLANE), - std::make_tuple(MAKEFOURCC('N', 'V', '1', '2'), 0, CL_R, CL_UNORM_INT8, OCLPlane::PLANE_Y), - std::make_tuple(MAKEFOURCC('N', 'V', '1', '2'), 1, CL_RG, CL_UNORM_INT8, OCLPlane::PLANE_UV), - std::make_tuple(MAKEFOURCC('N', 'V', '1', '2'), 2, 0, 0, OCLPlane::NO_PLANE), - std::make_tuple(MAKEFOURCC('Y', 'V', '1', '2'), 0, CL_R, CL_UNORM_INT8, OCLPlane::PLANE_Y), - std::make_tuple(MAKEFOURCC('Y', 'V', '1', '2'), 1, CL_R, CL_UNORM_INT8, OCLPlane::PLANE_V), - std::make_tuple(MAKEFOURCC('Y', 'V', '1', '2'), 2, CL_R, CL_UNORM_INT8, OCLPlane::PLANE_U), - std::make_tuple(MAKEFOURCC('Y', 'V', '1', '2'), 3, 0, 0, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_YUY2, 0, CL_YUYV_INTEL, CL_UNORM_INT8, OCLPlane::NO_PLANE), - std::make_tuple(D3DFMT_UYVY, 0, CL_UYVY_INTEL, CL_UNORM_INT8, OCLPlane::NO_PLANE), - std::make_tuple(MAKEFOURCC('Y', 'V', 'Y', 'U'), 0, CL_YVYU_INTEL, CL_UNORM_INT8, OCLPlane::NO_PLANE), - std::make_tuple(MAKEFOURCC('V', 'Y', 'U', 'Y'), 0, CL_VYUY_INTEL, CL_UNORM_INT8, OCLPlane::NO_PLANE), - std::make_tuple(CL_INVALID_VALUE, 0, 0, 0, OCLPlane::NO_PLANE)}; + std::make_tuple(D3DFMT_R32F, 0, CL_R, CL_FLOAT, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_R16F, 0, CL_R, CL_HALF_FLOAT, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_L16, 0, CL_R, CL_UNORM_INT16, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_A8, 0, CL_A, CL_UNORM_INT8, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_L8, 0, CL_R, CL_UNORM_INT8, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_G32R32F, 0, CL_RG, CL_FLOAT, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_G16R16F, 0, CL_RG, CL_HALF_FLOAT, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_G16R16, 0, CL_RG, CL_UNORM_INT16, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_A8L8, 0, CL_RG, CL_UNORM_INT8, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_A32B32G32R32F, 0, CL_RGBA, CL_FLOAT, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_A16B16G16R16F, 0, CL_RGBA, CL_HALF_FLOAT, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_A16B16G16R16, 0, CL_RGBA, CL_UNORM_INT16, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_A8B8G8R8, 0, CL_RGBA, CL_UNORM_INT8, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_X8B8G8R8, 0, CL_RGBA, CL_UNORM_INT8, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_A8R8G8B8, 0, CL_BGRA, CL_UNORM_INT8, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_X8R8G8B8, 0, CL_BGRA, CL_UNORM_INT8, ImagePlane::NO_PLANE), + std::make_tuple(MAKEFOURCC('N', 'V', '1', '2'), 0, CL_R, CL_UNORM_INT8, ImagePlane::PLANE_Y), + std::make_tuple(MAKEFOURCC('N', 'V', '1', '2'), 1, CL_RG, CL_UNORM_INT8, ImagePlane::PLANE_UV), + std::make_tuple(MAKEFOURCC('N', 'V', '1', '2'), 2, 0, 0, ImagePlane::NO_PLANE), + std::make_tuple(MAKEFOURCC('Y', 'V', '1', '2'), 0, CL_R, CL_UNORM_INT8, ImagePlane::PLANE_Y), + std::make_tuple(MAKEFOURCC('Y', 'V', '1', '2'), 1, CL_R, CL_UNORM_INT8, ImagePlane::PLANE_V), + std::make_tuple(MAKEFOURCC('Y', 'V', '1', '2'), 2, CL_R, CL_UNORM_INT8, ImagePlane::PLANE_U), + std::make_tuple(MAKEFOURCC('Y', 'V', '1', '2'), 3, 0, 0, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_YUY2, 0, CL_YUYV_INTEL, CL_UNORM_INT8, ImagePlane::NO_PLANE), + std::make_tuple(D3DFMT_UYVY, 0, CL_UYVY_INTEL, CL_UNORM_INT8, ImagePlane::NO_PLANE), + std::make_tuple(MAKEFOURCC('Y', 'V', 'Y', 'U'), 0, CL_YVYU_INTEL, CL_UNORM_INT8, ImagePlane::NO_PLANE), + std::make_tuple(MAKEFOURCC('V', 'Y', 'U', 'Y'), 0, CL_VYUY_INTEL, CL_UNORM_INT8, ImagePlane::NO_PLANE), + std::make_tuple(CL_INVALID_VALUE, 0, 0, 0, ImagePlane::NO_PLANE)}; } struct D3D9ImageFormatTests - : public ::testing::WithParamInterface>, + : public ::testing::WithParamInterface>, public ::testing::Test { }; @@ -1057,16 +1057,16 @@ TEST_P(D3D9ImageFormatTests, validFormat) { cl_image_format imgFormat = {}; auto format = std::get<0>(GetParam()); auto plane = std::get<1>(GetParam()); - OCLPlane oclPlane = OCLPlane::NO_PLANE; - auto expectedOclPlane = std::get<4>(GetParam()); + ImagePlane imagePlane = ImagePlane::NO_PLANE; + auto expectedImagePlane = std::get<4>(GetParam()); auto expectedClChannelType = static_cast(std::get<3>(GetParam())); auto expectedClChannelOrder = static_cast(std::get<2>(GetParam())); - D3DSurface::findImgFormat((D3DFORMAT)format, imgFormat, plane, oclPlane); + D3DSurface::findImgFormat((D3DFORMAT)format, imgFormat, plane, imagePlane); EXPECT_EQ(imgFormat.image_channel_data_type, expectedClChannelType); EXPECT_EQ(imgFormat.image_channel_order, expectedClChannelOrder); - EXPECT_TRUE(oclPlane == expectedOclPlane); + EXPECT_TRUE(imagePlane == expectedImagePlane); } using D3D9MultiRootDeviceTest = MultiRootDeviceFixture; diff --git a/unit_tests/d3d_sharing/d3d_tests_part1.cpp b/unit_tests/d3d_sharing/d3d_tests_part1.cpp index 4dc5ca8b15..ff66218313 100644 --- a/unit_tests/d3d_sharing/d3d_tests_part1.cpp +++ b/unit_tests/d3d_sharing/d3d_tests_part1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019 Intel Corporation + * Copyright (C) 2019-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -149,7 +149,7 @@ TYPED_TEST_P(D3DTests, givenNV12FormatAndEvenPlaneWhen2dCreatedThenSetPlaneParam auto image = std::unique_ptr(D3DTexture::create2d(this->context, (D3DTexture2d *)&this->dummyD3DTexture, CL_MEM_READ_WRITE, 4, nullptr)); ASSERT_NE(nullptr, image.get()); - auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_NV12, OCLPlane::PLANE_Y, CL_MEM_READ_WRITE); + auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_NV12, ImagePlane::PLANE_Y, CL_MEM_READ_WRITE); EXPECT_TRUE(memcmp(expectedFormat, &image->getSurfaceFormatInfo(), sizeof(SurfaceFormatInfo)) == 0); EXPECT_EQ(1u, mockGmmResInfo->getOffsetCalled); EXPECT_EQ(2u, mockGmmResInfo->arrayIndexPassedToGetOffset); @@ -164,7 +164,7 @@ TYPED_TEST_P(D3DTests, givenNV12FormatAndOddPlaneWhen2dCreatedThenSetPlaneParams auto image = std::unique_ptr(D3DTexture::create2d(this->context, (D3DTexture2d *)&this->dummyD3DTexture, CL_MEM_READ_WRITE, 7, nullptr)); ASSERT_NE(nullptr, image.get()); - auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_NV12, OCLPlane::PLANE_UV, CL_MEM_READ_WRITE); + auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_NV12, ImagePlane::PLANE_UV, CL_MEM_READ_WRITE); EXPECT_TRUE(memcmp(expectedFormat, &image->getSurfaceFormatInfo(), sizeof(SurfaceFormatInfo)) == 0); EXPECT_EQ(1u, mockGmmResInfo->getOffsetCalled); EXPECT_EQ(3u, mockGmmResInfo->arrayIndexPassedToGetOffset); @@ -179,7 +179,7 @@ TYPED_TEST_P(D3DTests, givenP010FormatAndEvenPlaneWhen2dCreatedThenSetPlaneParam auto image = std::unique_ptr(D3DTexture::create2d(this->context, (D3DTexture2d *)&this->dummyD3DTexture, CL_MEM_READ_WRITE, 4, nullptr)); ASSERT_NE(nullptr, image.get()); - auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_P010, OCLPlane::PLANE_Y, CL_MEM_READ_WRITE); + auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_P010, ImagePlane::PLANE_Y, CL_MEM_READ_WRITE); EXPECT_TRUE(memcmp(expectedFormat, &image->getSurfaceFormatInfo(), sizeof(SurfaceFormatInfo)) == 0); EXPECT_EQ(1u, mockGmmResInfo->getOffsetCalled); EXPECT_EQ(2u, mockGmmResInfo->arrayIndexPassedToGetOffset); @@ -194,7 +194,7 @@ TYPED_TEST_P(D3DTests, givenP010FormatAndOddPlaneWhen2dCreatedThenSetPlaneParams auto image = std::unique_ptr(D3DTexture::create2d(this->context, (D3DTexture2d *)&this->dummyD3DTexture, CL_MEM_READ_WRITE, 7, nullptr)); ASSERT_NE(nullptr, image.get()); - auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_P010, OCLPlane::PLANE_UV, CL_MEM_READ_WRITE); + auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_P010, ImagePlane::PLANE_UV, CL_MEM_READ_WRITE); EXPECT_TRUE(memcmp(expectedFormat, &image->getSurfaceFormatInfo(), sizeof(SurfaceFormatInfo)) == 0); EXPECT_EQ(1u, mockGmmResInfo->getOffsetCalled); EXPECT_EQ(3u, mockGmmResInfo->arrayIndexPassedToGetOffset); @@ -209,7 +209,7 @@ TYPED_TEST_P(D3DTests, givenP016FormatAndEvenPlaneWhen2dCreatedThenSetPlaneParam auto image = std::unique_ptr(D3DTexture::create2d(this->context, (D3DTexture2d *)&this->dummyD3DTexture, CL_MEM_READ_WRITE, 4, nullptr)); ASSERT_NE(nullptr, image.get()); - auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_P016, OCLPlane::PLANE_Y, CL_MEM_READ_WRITE); + auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_P016, ImagePlane::PLANE_Y, CL_MEM_READ_WRITE); EXPECT_TRUE(memcmp(expectedFormat, &image->getSurfaceFormatInfo(), sizeof(SurfaceFormatInfo)) == 0); EXPECT_EQ(1u, mockGmmResInfo->getOffsetCalled); EXPECT_EQ(2u, mockGmmResInfo->arrayIndexPassedToGetOffset); @@ -224,7 +224,7 @@ TYPED_TEST_P(D3DTests, givenP016FormatAndOddPlaneWhen2dCreatedThenSetPlaneParams auto image = std::unique_ptr(D3DTexture::create2d(this->context, (D3DTexture2d *)&this->dummyD3DTexture, CL_MEM_READ_WRITE, 7, nullptr)); ASSERT_NE(nullptr, image.get()); - auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_P016, OCLPlane::PLANE_UV, CL_MEM_READ_WRITE); + auto expectedFormat = D3DTexture::findYuvSurfaceFormatInfo(DXGI_FORMAT_P016, ImagePlane::PLANE_UV, CL_MEM_READ_WRITE); EXPECT_TRUE(memcmp(expectedFormat, &image->getSurfaceFormatInfo(), sizeof(SurfaceFormatInfo)) == 0); EXPECT_EQ(1u, mockGmmResInfo->getOffsetCalled); EXPECT_EQ(3u, mockGmmResInfo->arrayIndexPassedToGetOffset); @@ -702,13 +702,13 @@ TEST(D3DSurfaceTest, givenD3DSurfaceWhenInvalidMemObjectIsPassedToValidateUpdate class MockD3DSurface : public D3DSurface { public: MockD3DSurface(Context *context, cl_dx9_surface_info_khr *surfaceInfo, D3DTypesHelper::D3D9::D3DTexture2d *surfaceStaging, cl_uint plane, - OCLPlane oclPlane, cl_dx9_media_adapter_type_khr adapterType, bool sharedResource, bool lockable) : D3DSurface(context, surfaceInfo, surfaceStaging, plane, - oclPlane, adapterType, sharedResource, lockable) {} + ImagePlane imagePlane, cl_dx9_media_adapter_type_khr adapterType, bool sharedResource, bool lockable) : D3DSurface(context, surfaceInfo, surfaceStaging, plane, + imagePlane, adapterType, sharedResource, lockable) {} }; MockContext context; cl_dx9_surface_info_khr surfaceInfo = {}; - OCLPlane oclPlane = OCLPlane::NO_PLANE; - std::unique_ptr surface(new MockD3DSurface(&context, &surfaceInfo, nullptr, 0, oclPlane, 0, false, false)); + ImagePlane imagePlane = ImagePlane::NO_PLANE; + std::unique_ptr surface(new MockD3DSurface(&context, &surfaceInfo, nullptr, 0, imagePlane, 0, false, false)); MockBuffer buffer; UpdateData updateData; diff --git a/unit_tests/d3d_sharing/d3d_tests_part2.cpp b/unit_tests/d3d_sharing/d3d_tests_part2.cpp index c52878fbc4..e3d6a2c36f 100644 --- a/unit_tests/d3d_sharing/d3d_tests_part2.cpp +++ b/unit_tests/d3d_sharing/d3d_tests_part2.cpp @@ -400,23 +400,23 @@ TYPED_TEST_P(D3DTests, givenPlaneWhenFindYuvSurfaceCalledThenReturnValidImgForma DXGI_FORMAT testFormat[] = {DXGI_FORMAT::DXGI_FORMAT_NV12, DXGI_FORMAT::DXGI_FORMAT_P010, DXGI_FORMAT::DXGI_FORMAT_P016}; int channelDataType[] = {CL_UNORM_INT8, CL_UNORM_INT16, CL_UNORM_INT16}; for (int n = 0; n < 3; n++) { - surfaceFormat = D3DTexture::findYuvSurfaceFormatInfo(testFormat[n], OCLPlane::NO_PLANE, CL_MEM_READ_WRITE); + surfaceFormat = D3DTexture::findYuvSurfaceFormatInfo(testFormat[n], ImagePlane::NO_PLANE, CL_MEM_READ_WRITE); EXPECT_TRUE(surfaceFormat->OCLImageFormat.image_channel_order == CL_RG); EXPECT_TRUE(surfaceFormat->OCLImageFormat.image_channel_data_type == channelDataType[n]); - surfaceFormat = D3DTexture::findYuvSurfaceFormatInfo(testFormat[n], OCLPlane::PLANE_U, CL_MEM_READ_WRITE); + surfaceFormat = D3DTexture::findYuvSurfaceFormatInfo(testFormat[n], ImagePlane::PLANE_U, CL_MEM_READ_WRITE); EXPECT_TRUE(surfaceFormat->OCLImageFormat.image_channel_order == CL_RG); EXPECT_TRUE(surfaceFormat->OCLImageFormat.image_channel_data_type == channelDataType[n]); - surfaceFormat = D3DTexture::findYuvSurfaceFormatInfo(testFormat[n], OCLPlane::PLANE_UV, CL_MEM_READ_WRITE); + surfaceFormat = D3DTexture::findYuvSurfaceFormatInfo(testFormat[n], ImagePlane::PLANE_UV, CL_MEM_READ_WRITE); EXPECT_TRUE(surfaceFormat->OCLImageFormat.image_channel_order == CL_RG); EXPECT_TRUE(surfaceFormat->OCLImageFormat.image_channel_data_type == channelDataType[n]); - surfaceFormat = D3DTexture::findYuvSurfaceFormatInfo(testFormat[n], OCLPlane::PLANE_V, CL_MEM_READ_WRITE); + surfaceFormat = D3DTexture::findYuvSurfaceFormatInfo(testFormat[n], ImagePlane::PLANE_V, CL_MEM_READ_WRITE); EXPECT_TRUE(surfaceFormat->OCLImageFormat.image_channel_order == CL_RG); EXPECT_TRUE(surfaceFormat->OCLImageFormat.image_channel_data_type == channelDataType[n]); - surfaceFormat = D3DTexture::findYuvSurfaceFormatInfo(testFormat[n], OCLPlane::PLANE_Y, CL_MEM_READ_WRITE); + surfaceFormat = D3DTexture::findYuvSurfaceFormatInfo(testFormat[n], ImagePlane::PLANE_Y, CL_MEM_READ_WRITE); EXPECT_TRUE(surfaceFormat->OCLImageFormat.image_channel_order == CL_R); EXPECT_TRUE(surfaceFormat->OCLImageFormat.image_channel_data_type == channelDataType[n]); } diff --git a/unit_tests/gmm_helper/gmm_helper_tests.cpp b/unit_tests/gmm_helper/gmm_helper_tests.cpp index fc5b6fe545..c8ad0dc42e 100644 --- a/unit_tests/gmm_helper/gmm_helper_tests.cpp +++ b/unit_tests/gmm_helper/gmm_helper_tests.cpp @@ -241,7 +241,7 @@ TEST_F(GmmTests, given2DimageFromBufferParametersWhenGmmResourceIsCreatedAndPitc SurfaceFormatInfo surfaceFormat = {{CL_RGBA, CL_FLOAT}, GMM_FORMAT_R32G32B32A32_FLOAT_TYPE, (GFX3DSTATE_SURFACEFORMAT)0, 0, 4, 4, 16}; auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, &surfaceFormat); - EXPECT_EQ(imgInfo.imgDesc.image_row_pitch, imgDesc.image_row_pitch); + EXPECT_EQ(imgInfo.imgDesc.imageRowPitch, imgDesc.image_row_pitch); auto queryGmm = MockGmm::queryImgParams(executionEnvironment->getGmmClientContext(), imgInfo); auto renderSize = queryGmm->gmmResourceInfo->getSizeAllocation(); @@ -455,12 +455,12 @@ static const cl_mem_object_type imgTypes[6] = { CL_MEM_OBJECT_IMAGE3D}; } // namespace GmmTestConst -TEST_F(GmmTests, converOclPlaneToGmmPlane) { - std::vector> v = {{OCLPlane::NO_PLANE, GMM_YUV_PLANE::GMM_NO_PLANE}, - {OCLPlane::PLANE_Y, GMM_YUV_PLANE::GMM_PLANE_Y}, - {OCLPlane::PLANE_U, GMM_YUV_PLANE::GMM_PLANE_U}, - {OCLPlane::PLANE_UV, GMM_YUV_PLANE::GMM_PLANE_U}, - {OCLPlane::PLANE_V, GMM_YUV_PLANE::GMM_PLANE_V}}; +TEST_F(GmmTests, converNeoPlaneToGmmPlane) { + std::vector> v = {{ImagePlane::NO_PLANE, GMM_YUV_PLANE::GMM_NO_PLANE}, + {ImagePlane::PLANE_Y, GMM_YUV_PLANE::GMM_PLANE_Y}, + {ImagePlane::PLANE_U, GMM_YUV_PLANE::GMM_PLANE_U}, + {ImagePlane::PLANE_UV, GMM_YUV_PLANE::GMM_PLANE_U}, + {ImagePlane::PLANE_V, GMM_YUV_PLANE::GMM_PLANE_V}}; for (auto p : v) { EXPECT_TRUE(p.second == GmmTypesConverter::convertPlane(p.first)); @@ -532,12 +532,12 @@ TEST_P(GmmImgTest, updateImgInfoAndDesc) { queryGmm->updateImgInfoAndDesc(updateImgInfo, arrayIndex); EXPECT_EQ(expectCalls, mockResInfo->getOffsetCalled); - EXPECT_EQ(imgDesc.image_width, updateImgInfo.imgDesc.image_width); - EXPECT_EQ(imgDesc.image_height, updateImgInfo.imgDesc.image_height); - EXPECT_EQ(imgDesc.image_depth, updateImgInfo.imgDesc.image_depth); - EXPECT_EQ(imgDesc.image_array_size, updateImgInfo.imgDesc.image_array_size); - EXPECT_GT(updateImgInfo.imgDesc.image_row_pitch, 0u); - EXPECT_GT(updateImgInfo.imgDesc.image_slice_pitch, 0u); + EXPECT_EQ(imgDesc.image_width, updateImgInfo.imgDesc.imageWidth); + EXPECT_EQ(imgDesc.image_height, updateImgInfo.imgDesc.imageHeight); + EXPECT_EQ(imgDesc.image_depth, updateImgInfo.imgDesc.imageDepth); + EXPECT_EQ(imgDesc.image_array_size, updateImgInfo.imgDesc.imageArraySize); + EXPECT_GT(updateImgInfo.imgDesc.imageRowPitch, 0u); + EXPECT_GT(updateImgInfo.imgDesc.imageSlicePitch, 0u); if (expectCalls == 1) { EXPECT_TRUE(memcmp(&expectedReqInfo[1], &mockResInfo->givenReqInfo[0], sizeof(GMM_REQ_OFFSET_INFO)) == 0); @@ -635,20 +635,20 @@ TEST_F(GmmTests, copyResourceBlt) { // plane Y EXPECT_CALL(*mockResInfo, cpuBlt(_)).Times(1).WillOnce(Invoke(invokeParamsCopy)); - auto retVal = gmm->resourceCopyBlt(&sys, &gpu, pitch, height, upload, OCLPlane::PLANE_Y); + auto retVal = gmm->resourceCopyBlt(&sys, &gpu, pitch, height, upload, ImagePlane::PLANE_Y); EXPECT_EQ(1u, retVal); EXPECT_TRUE(memcmp(&expectedCpuBlt, &requestedCpuBlt, sizeof(GMM_RES_COPY_BLT)) == 0); // no-plane EXPECT_CALL(*mockResInfo, cpuBlt(_)).Times(1).WillOnce(Invoke(invokeParamsCopy)); - retVal = gmm->resourceCopyBlt(&sys, &gpu, pitch, height, upload, OCLPlane::NO_PLANE); + retVal = gmm->resourceCopyBlt(&sys, &gpu, pitch, height, upload, ImagePlane::NO_PLANE); EXPECT_EQ(1u, retVal); EXPECT_TRUE(memcmp(&expectedCpuBlt, &requestedCpuBlt, sizeof(GMM_RES_COPY_BLT)) == 0); //plane UV expectedCpuBlt.Sys.pData = ptrOffset(&sys, height * pitch * 2u); EXPECT_CALL(*mockResInfo, cpuBlt(_)).Times(1).WillOnce(Invoke(invokeParamsCopy)); - retVal = gmm->resourceCopyBlt(&sys, &gpu, pitch, height, upload, OCLPlane::PLANE_UV); + retVal = gmm->resourceCopyBlt(&sys, &gpu, pitch, height, upload, ImagePlane::PLANE_UV); EXPECT_EQ(1u, retVal); EXPECT_TRUE(memcmp(&expectedCpuBlt, &requestedCpuBlt, sizeof(GMM_RES_COPY_BLT)) == 0); @@ -657,7 +657,7 @@ TEST_F(GmmTests, copyResourceBlt) { expectedCpuBlt.Sys.RowPitch = pitch / 2; expectedCpuBlt.Sys.BufferSize = expectedCpuBlt.Sys.RowPitch * height; EXPECT_CALL(*mockResInfo, cpuBlt(_)).Times(1).WillOnce(Invoke(invokeParamsCopy)); - retVal = gmm->resourceCopyBlt(&sys, &gpu, pitch, height, upload, OCLPlane::PLANE_V); + retVal = gmm->resourceCopyBlt(&sys, &gpu, pitch, height, upload, ImagePlane::PLANE_V); EXPECT_EQ(1u, retVal); EXPECT_TRUE(memcmp(&expectedCpuBlt, &requestedCpuBlt, sizeof(GMM_RES_COPY_BLT)) == 0); @@ -666,7 +666,7 @@ TEST_F(GmmTests, copyResourceBlt) { expectedCpuBlt.Sys.RowPitch = pitch / 2; expectedCpuBlt.Sys.BufferSize = expectedCpuBlt.Sys.RowPitch * height; EXPECT_CALL(*mockResInfo, cpuBlt(_)).Times(1).WillOnce(Invoke(invokeParamsCopy)); - retVal = gmm->resourceCopyBlt(&sys, &gpu, pitch, height, upload, OCLPlane::PLANE_U); + retVal = gmm->resourceCopyBlt(&sys, &gpu, pitch, height, upload, ImagePlane::PLANE_U); EXPECT_EQ(1u, retVal); EXPECT_TRUE(memcmp(&expectedCpuBlt, &requestedCpuBlt, sizeof(GMM_RES_COPY_BLT)) == 0); } diff --git a/unit_tests/mem_obj/image_tests.cpp b/unit_tests/mem_obj/image_tests.cpp index 36f4138a48..b771354a24 100644 --- a/unit_tests/mem_obj/image_tests.cpp +++ b/unit_tests/mem_obj/image_tests.cpp @@ -1391,13 +1391,13 @@ struct ImageConvertTypeTest void TearDown() override { } - std::array, 7> types = {std::make_pair<>(CL_MEM_OBJECT_IMAGE1D, ImageType::Image1D), - std::make_pair<>(CL_MEM_OBJECT_IMAGE2D, ImageType::Image2D), - std::make_pair<>(CL_MEM_OBJECT_IMAGE3D, ImageType::Image3D), - std::make_pair<>(CL_MEM_OBJECT_IMAGE1D_ARRAY, ImageType::Image1DArray), - std::make_pair<>(CL_MEM_OBJECT_IMAGE2D_ARRAY, ImageType::Image2DArray), - std::make_pair<>(CL_MEM_OBJECT_IMAGE1D_BUFFER, ImageType::Image1DBuffer), - std::make_pair<>(0, ImageType::Invalid)}; + std::array, 7> types = {{std::make_pair<>(CL_MEM_OBJECT_IMAGE1D, ImageType::Image1D), + std::make_pair<>(CL_MEM_OBJECT_IMAGE2D, ImageType::Image2D), + std::make_pair<>(CL_MEM_OBJECT_IMAGE3D, ImageType::Image3D), + std::make_pair<>(CL_MEM_OBJECT_IMAGE1D_ARRAY, ImageType::Image1DArray), + std::make_pair<>(CL_MEM_OBJECT_IMAGE2D_ARRAY, ImageType::Image2DArray), + std::make_pair<>(CL_MEM_OBJECT_IMAGE1D_BUFFER, ImageType::Image1DBuffer), + std::make_pair<>(0, ImageType::Invalid)}}; }; TEST_F(ImageConvertTypeTest, givenClMemObjectTypeWhenConvertedThenCorrectImageTypeIsReturned) { @@ -1418,22 +1418,22 @@ TEST(ImageConvertDescriptorTest, givenClImageDescWhenConvertedThenCorrectImageDe cl_image_desc clDesc = {CL_MEM_OBJECT_IMAGE1D, 16, 24, 1, 1, 1024, 2048, 1, 3, {nullptr}}; auto desc = Image::convertDescriptor(clDesc); - EXPECT_EQ(ImageType::Image1D, desc.image_type); - EXPECT_EQ(clDesc.image_array_size, desc.image_array_size); - EXPECT_EQ(clDesc.image_depth, desc.image_depth); - EXPECT_EQ(clDesc.image_height, desc.image_height); - EXPECT_EQ(clDesc.image_row_pitch, desc.image_row_pitch); - EXPECT_EQ(clDesc.image_slice_pitch, desc.image_slice_pitch); - EXPECT_EQ(clDesc.image_width, desc.image_width); - EXPECT_EQ(clDesc.num_mip_levels, desc.num_mip_levels); - EXPECT_EQ(clDesc.num_samples, desc.num_samples); - EXPECT_FALSE(desc.from_parent); + EXPECT_EQ(ImageType::Image1D, desc.imageType); + EXPECT_EQ(clDesc.image_array_size, desc.imageArraySize); + EXPECT_EQ(clDesc.image_depth, desc.imageDepth); + EXPECT_EQ(clDesc.image_height, desc.imageHeight); + EXPECT_EQ(clDesc.image_row_pitch, desc.imageRowPitch); + EXPECT_EQ(clDesc.image_slice_pitch, desc.imageSlicePitch); + EXPECT_EQ(clDesc.image_width, desc.imageWidth); + EXPECT_EQ(clDesc.num_mip_levels, desc.numMipLevels); + EXPECT_EQ(clDesc.num_samples, desc.numSamples); + EXPECT_FALSE(desc.fromParent); cl_mem temporary = reinterpret_cast(0x1234); clDesc.mem_object = temporary; desc = Image::convertDescriptor(clDesc); - EXPECT_TRUE(desc.from_parent); + EXPECT_TRUE(desc.fromParent); } TEST(ImageConvertDescriptorTest, givenImageDescriptorWhenConvertedThenCorrectClImageDescIsReturned) { @@ -1441,14 +1441,14 @@ TEST(ImageConvertDescriptorTest, givenImageDescriptorWhenConvertedThenCorrectClI auto clDesc = Image::convertDescriptor(desc); EXPECT_EQ(clDesc.image_type, static_cast(CL_MEM_OBJECT_IMAGE2D)); - EXPECT_EQ(clDesc.image_array_size, desc.image_array_size); - EXPECT_EQ(clDesc.image_depth, desc.image_depth); - EXPECT_EQ(clDesc.image_height, desc.image_height); - EXPECT_EQ(clDesc.image_row_pitch, desc.image_row_pitch); - EXPECT_EQ(clDesc.image_slice_pitch, desc.image_slice_pitch); - EXPECT_EQ(clDesc.image_width, desc.image_width); - EXPECT_EQ(clDesc.num_mip_levels, desc.num_mip_levels); - EXPECT_EQ(clDesc.num_samples, desc.num_samples); + EXPECT_EQ(clDesc.image_array_size, desc.imageArraySize); + EXPECT_EQ(clDesc.image_depth, desc.imageDepth); + EXPECT_EQ(clDesc.image_height, desc.imageHeight); + EXPECT_EQ(clDesc.image_row_pitch, desc.imageRowPitch); + EXPECT_EQ(clDesc.image_slice_pitch, desc.imageSlicePitch); + EXPECT_EQ(clDesc.image_width, desc.imageWidth); + EXPECT_EQ(clDesc.num_mip_levels, desc.numMipLevels); + EXPECT_EQ(clDesc.num_samples, desc.numSamples); EXPECT_EQ(nullptr, clDesc.mem_object); }