mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Refactor ImageInfo 2/n
Change-Id: I5e6081a75b802cc98fd89e384d550a219353728b Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
0a39140284
commit
81e9591c31
@@ -1081,7 +1081,7 @@ cl_int CL_API_CALL clGetImageParamsINTEL(cl_context context,
|
||||
"imageDesc", imageDesc,
|
||||
"imageRowPitch", imageRowPitch,
|
||||
"imageSlicePitch", imageSlicePitch);
|
||||
SurfaceFormatInfo *surfaceFormat = nullptr;
|
||||
ClSurfaceFormatInfo *surfaceFormat = nullptr;
|
||||
cl_mem_flags memFlags = CL_MEM_READ_ONLY;
|
||||
retVal = validateObjects(context);
|
||||
auto pContext = castToObject<Context>(context);
|
||||
@@ -1095,7 +1095,7 @@ cl_int CL_API_CALL clGetImageParamsINTEL(cl_context context,
|
||||
retVal = Image::validateImageFormat(imageFormat);
|
||||
}
|
||||
if (CL_SUCCESS == retVal) {
|
||||
surfaceFormat = (SurfaceFormatInfo *)Image::getSurfaceFormatFromTable(memFlags, imageFormat);
|
||||
surfaceFormat = (ClSurfaceFormatInfo *)Image::getSurfaceFormatFromTable(memFlags, imageFormat);
|
||||
retVal = Image::validate(pContext, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(memFlags, 0, 0), surfaceFormat, imageDesc, nullptr);
|
||||
}
|
||||
if (CL_SUCCESS == retVal) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -559,7 +559,7 @@ class BuiltInOp<EBuiltInOps::CopyBufferToImage3d> : public BuiltinDispatchInfoBu
|
||||
multiDispatchInfo.pushRedescribedMemObj(std::unique_ptr<MemObj>(dstImageRedescribed)); // life range same as mdi's
|
||||
|
||||
// Calculate srcRowPitch and srcSlicePitch
|
||||
auto bytesPerPixel = dstImage->getSurfaceFormatInfo().ImageElementSizeInBytes;
|
||||
auto bytesPerPixel = dstImage->getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes;
|
||||
|
||||
size_t region[] = {operationParams.size.x, operationParams.size.y, operationParams.size.z};
|
||||
|
||||
@@ -673,7 +673,7 @@ class BuiltInOp<EBuiltInOps::CopyImage3dToBuffer> : public BuiltinDispatchInfoBu
|
||||
multiDispatchInfo.pushRedescribedMemObj(std::unique_ptr<MemObj>(srcImageRedescribed)); // life range same as mdi's
|
||||
|
||||
// Calculate dstRowPitch and dstSlicePitch
|
||||
auto bytesPerPixel = srcImage->getSurfaceFormatInfo().ImageElementSizeInBytes;
|
||||
auto bytesPerPixel = srcImage->getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes;
|
||||
|
||||
size_t region[] = {operationParams.size.x, operationParams.size.y, operationParams.size.z};
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/helpers/mipmap.h"
|
||||
#include "runtime/helpers/queue_helpers.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
#include "runtime/helpers/timestamp_packet.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
|
||||
@@ -980,7 +980,7 @@ void CommandQueueHw<GfxFamily>::computeOffsetsValueForRectCommands(size_t *buffe
|
||||
|
||||
template <typename GfxFamily>
|
||||
size_t CommandQueueHw<GfxFamily>::calculateHostPtrSizeForImage(const size_t *region, size_t rowPitch, size_t slicePitch, Image *image) {
|
||||
auto bytesPerPixel = image->getSurfaceFormatInfo().ImageElementSizeInBytes;
|
||||
auto bytesPerPixel = image->getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes;
|
||||
auto dstRowPitch = rowPitch ? rowPitch : region[0] * bytesPerPixel;
|
||||
auto dstSlicePitch = slicePitch ? slicePitch : ((image->getImageDesc().image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY ? 1 : region[1]) * dstRowPitch);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/helpers/mipmap.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
#include "runtime/memory_manager/surface.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/helpers/mipmap.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
#include "runtime/memory_manager/surface.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,7 +11,6 @@
|
||||
#include "runtime/command_queue/command_queue_hw.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
#include "runtime/memory_manager/surface.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "runtime/event/event.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/helpers/mipmap.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
#include "runtime/memory_manager/surface.h"
|
||||
|
||||
@@ -47,7 +46,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadImage(
|
||||
auto isMemTransferNeeded = true;
|
||||
if (srcImage->isMemObjZeroCopy()) {
|
||||
size_t hostOffset;
|
||||
Image::calculateHostPtrOffset(&hostOffset, origin, region, inputRowPitch, inputSlicePitch, srcImage->getImageDesc().image_type, srcImage->getSurfaceFormatInfo().ImageElementSizeInBytes);
|
||||
Image::calculateHostPtrOffset(&hostOffset, origin, region, inputRowPitch, inputSlicePitch, srcImage->getImageDesc().image_type, srcImage->getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes);
|
||||
isMemTransferNeeded = srcImage->checkIfMemoryTransferIsRequired(hostOffset, 0, ptr, CL_COMMAND_READ_IMAGE);
|
||||
}
|
||||
if (!isMemTransferNeeded) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/helpers/mipmap.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -39,7 +38,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteImage(
|
||||
auto isMemTransferNeeded = true;
|
||||
if (dstImage->isMemObjZeroCopy()) {
|
||||
size_t hostOffset;
|
||||
Image::calculateHostPtrOffset(&hostOffset, origin, region, inputRowPitch, inputSlicePitch, dstImage->getImageDesc().image_type, dstImage->getSurfaceFormatInfo().ImageElementSizeInBytes);
|
||||
Image::calculateHostPtrOffset(&hostOffset, origin, region, inputRowPitch, inputSlicePitch, dstImage->getImageDesc().image_type, dstImage->getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes);
|
||||
isMemTransferNeeded = dstImage->checkIfMemoryTransferIsRequired(hostOffset, 0, ptr, CL_COMMAND_WRITE_IMAGE);
|
||||
}
|
||||
if (!isMemTransferNeeded) {
|
||||
|
||||
@@ -272,7 +272,7 @@ cl_int Context::getSupportedImageFormats(
|
||||
const bool nv12ExtensionEnabled = device->getDeviceInfo().nv12Extension;
|
||||
const bool packedYuvExtensionEnabled = device->getDeviceInfo().packedYuvExtension;
|
||||
|
||||
auto appendImageFormats = [&](ArrayRef<const SurfaceFormatInfo> formats) {
|
||||
auto appendImageFormats = [&](ArrayRef<const ClSurfaceFormatInfo> formats) {
|
||||
if (imageFormats) {
|
||||
size_t offset = numImageFormats;
|
||||
for (size_t i = 0; i < formats.size() && offset < numEntries; ++i) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "core/helpers/hw_helper.h"
|
||||
#include "core/helpers/hw_info.h"
|
||||
#include "core/helpers/ptr_math.h"
|
||||
#include "runtime/helpers/surface_formats.h"
|
||||
#include "core/helpers/surface_format_info.h"
|
||||
|
||||
namespace NEO {
|
||||
Gmm::Gmm(GmmClientContext *clientContext, const void *alignedPtr, size_t alignedSize, bool uncacheable) : Gmm(clientContext, alignedPtr, alignedSize, uncacheable, false, true, {}) {}
|
||||
|
||||
@@ -66,7 +66,7 @@ uint32_t getMipOffset(Image *image, const size_t *origin) {
|
||||
return 0;
|
||||
}
|
||||
UNRECOVERABLE_IF(origin == nullptr);
|
||||
auto bytesPerPixel = image->getSurfaceFormatInfo().ImageElementSizeInBytes;
|
||||
auto bytesPerPixel = image->getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes;
|
||||
size_t offset{};
|
||||
auto imageType = image->getImageDesc().image_type;
|
||||
auto lod = findMipLevel(imageType, origin);
|
||||
|
||||
@@ -18,122 +18,122 @@ namespace NEO {
|
||||
|
||||
// clang-format off
|
||||
#define COMMONFORMATS \
|
||||
{{CL_RGBA, CL_UNORM_INT8}, GMM_FORMAT_R8G8B8A8_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_UNORM , 0, 4, 1, 4}, \
|
||||
{{CL_RGBA, CL_UNORM_INT16}, GMM_FORMAT_R16G16B16A16_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_UNORM , 0, 4, 2, 8}, \
|
||||
{{CL_RGBA, CL_SIGNED_INT8}, GMM_FORMAT_R8G8B8A8_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_SINT , 0, 4, 1, 4}, \
|
||||
{{CL_RGBA, CL_SIGNED_INT16}, GMM_FORMAT_R16G16B16A16_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_SINT , 0, 4, 2, 8}, \
|
||||
{{CL_RGBA, CL_SIGNED_INT32}, GMM_FORMAT_R32G32B32A32_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_SINT , 0, 4, 4, 16}, \
|
||||
{{CL_RGBA, CL_UNSIGNED_INT8}, GMM_FORMAT_R8G8B8A8_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_UINT , 0, 4, 1, 4}, \
|
||||
{{CL_RGBA, CL_UNSIGNED_INT16}, GMM_FORMAT_R16G16B16A16_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_UINT , 0, 4, 2, 8}, \
|
||||
{{CL_RGBA, CL_UNSIGNED_INT32}, GMM_FORMAT_R32G32B32A32_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_UINT , 0, 4, 4, 16}, \
|
||||
{{CL_RGBA, CL_HALF_FLOAT}, GMM_FORMAT_R16G16B16A16_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_FLOAT , 0, 4, 2, 8}, \
|
||||
{{CL_RGBA, CL_FLOAT}, GMM_FORMAT_R32G32B32A32_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_FLOAT , 0, 4, 4, 16}, \
|
||||
{{CL_BGRA, CL_UNORM_INT8}, GMM_FORMAT_B8G8R8A8_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_B8G8R8A8_UNORM , 0, 4, 1, 4}, \
|
||||
{{CL_R, CL_FLOAT}, GMM_FORMAT_R32_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32_FLOAT , 0, 1, 4, 4}, \
|
||||
{{CL_R, CL_UNORM_INT8}, GMM_FORMAT_R8_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8_UNORM , 0, 1, 1, 1}, \
|
||||
{{CL_R, CL_UNORM_INT16}, GMM_FORMAT_R16_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_UNORM , 0, 1, 2, 2}, \
|
||||
{{CL_R, CL_SIGNED_INT8}, GMM_FORMAT_R8_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8_SINT , 0, 1, 1, 1}, \
|
||||
{{CL_R, CL_SIGNED_INT16}, GMM_FORMAT_R16_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_SINT , 0, 1, 2, 2}, \
|
||||
{{CL_R, CL_SIGNED_INT32}, GMM_FORMAT_R32_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32_SINT , 0, 1, 4, 4}, \
|
||||
{{CL_R, CL_UNSIGNED_INT8}, GMM_FORMAT_R8_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8_UINT , 0, 1, 1, 1}, \
|
||||
{{CL_R, CL_UNSIGNED_INT16}, GMM_FORMAT_R16_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_UINT , 0, 1, 2, 2}, \
|
||||
{{CL_R, CL_UNSIGNED_INT32}, GMM_FORMAT_R32_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32_UINT , 0, 1, 4, 4}, \
|
||||
{{CL_R, CL_HALF_FLOAT}, GMM_FORMAT_R16_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_FLOAT , 0, 1, 2, 2}, \
|
||||
{{CL_A, CL_UNORM_INT8}, GMM_FORMAT_A8_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_A8_UNORM , 0, 1, 1, 1}, \
|
||||
{{CL_RG, CL_UNORM_INT8}, GMM_FORMAT_R8G8_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8_UNORM , 0, 2, 1, 2}, \
|
||||
{{CL_RG, CL_UNORM_INT16}, GMM_FORMAT_R16G16_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16_UNORM , 0, 2, 2, 4}, \
|
||||
{{CL_RG, CL_SIGNED_INT8}, GMM_FORMAT_R8G8_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8_SINT , 0, 2, 1, 2}, \
|
||||
{{CL_RG, CL_SIGNED_INT16}, GMM_FORMAT_R16G16_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16_SINT , 0, 2, 2, 4}, \
|
||||
{{CL_RG, CL_SIGNED_INT32}, GMM_FORMAT_R32G32_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32_SINT , 0, 2, 4, 8}, \
|
||||
{{CL_RG, CL_UNSIGNED_INT8}, GMM_FORMAT_R8G8_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8_UINT , 0, 2, 1, 2}, \
|
||||
{{CL_RG, CL_UNSIGNED_INT16}, GMM_FORMAT_R16G16_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16_UINT , 0, 2, 2, 4}, \
|
||||
{{CL_RG, CL_UNSIGNED_INT32}, GMM_FORMAT_R32G32_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32_UINT , 0, 2, 4, 8}, \
|
||||
{{CL_RG, CL_HALF_FLOAT}, GMM_FORMAT_R16G16_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16_FLOAT , 0, 2, 2, 4}, \
|
||||
{{CL_RG, CL_FLOAT}, GMM_FORMAT_R32G32_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32_FLOAT , 0, 2, 4, 8}, \
|
||||
{{CL_LUMINANCE, CL_UNORM_INT8}, GMM_FORMAT_GENERIC_8BIT, GFX3DSTATE_SURFACEFORMAT_R8_UNORM , 0, 1, 1, 1}, \
|
||||
{{CL_LUMINANCE, CL_UNORM_INT16}, GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_R16_UNORM , 0, 1, 2, 2}, \
|
||||
{{CL_LUMINANCE, CL_HALF_FLOAT}, GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_R16_FLOAT , 0, 1, 2, 2}, \
|
||||
{{CL_LUMINANCE, CL_FLOAT}, GMM_FORMAT_GENERIC_32BIT, GFX3DSTATE_SURFACEFORMAT_R32_FLOAT , 0, 1, 4, 4}, \
|
||||
{{CL_R, CL_SNORM_INT8}, GMM_FORMAT_R8_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8_SNORM , 0, 1, 1, 1}, \
|
||||
{{CL_R, CL_SNORM_INT16}, GMM_FORMAT_R16_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_SNORM , 0, 1, 2, 2}, \
|
||||
{{CL_RG, CL_SNORM_INT8}, GMM_FORMAT_R8G8_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8_SNORM , 0, 2, 1, 2}, \
|
||||
{{CL_RG, CL_SNORM_INT16}, GMM_FORMAT_R16G16_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16_SNORM , 0, 2, 2, 4}, \
|
||||
{{CL_RGBA, CL_SNORM_INT8}, GMM_FORMAT_R8G8B8A8_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_SNORM , 0, 4, 1, 4}, \
|
||||
{{CL_RGBA, CL_SNORM_INT16}, GMM_FORMAT_R16G16B16A16_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_SNORM , 0, 4, 2, 8}
|
||||
{{CL_RGBA, CL_UNORM_INT8}, {GMM_FORMAT_R8G8B8A8_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_UNORM , 0, 4, 1, 4}}, \
|
||||
{{CL_RGBA, CL_UNORM_INT16}, {GMM_FORMAT_R16G16B16A16_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_UNORM , 0, 4, 2, 8}}, \
|
||||
{{CL_RGBA, CL_SIGNED_INT8}, {GMM_FORMAT_R8G8B8A8_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_SINT , 0, 4, 1, 4}}, \
|
||||
{{CL_RGBA, CL_SIGNED_INT16}, {GMM_FORMAT_R16G16B16A16_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_SINT , 0, 4, 2, 8}}, \
|
||||
{{CL_RGBA, CL_SIGNED_INT32}, {GMM_FORMAT_R32G32B32A32_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_SINT , 0, 4, 4, 16}}, \
|
||||
{{CL_RGBA, CL_UNSIGNED_INT8}, {GMM_FORMAT_R8G8B8A8_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_UINT , 0, 4, 1, 4}}, \
|
||||
{{CL_RGBA, CL_UNSIGNED_INT16}, {GMM_FORMAT_R16G16B16A16_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_UINT , 0, 4, 2, 8}}, \
|
||||
{{CL_RGBA, CL_UNSIGNED_INT32}, {GMM_FORMAT_R32G32B32A32_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_UINT , 0, 4, 4, 16}}, \
|
||||
{{CL_RGBA, CL_HALF_FLOAT}, {GMM_FORMAT_R16G16B16A16_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_FLOAT , 0, 4, 2, 8}}, \
|
||||
{{CL_RGBA, CL_FLOAT}, {GMM_FORMAT_R32G32B32A32_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_FLOAT , 0, 4, 4, 16}}, \
|
||||
{{CL_BGRA, CL_UNORM_INT8}, {GMM_FORMAT_B8G8R8A8_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_B8G8R8A8_UNORM , 0, 4, 1, 4}}, \
|
||||
{{CL_R, CL_FLOAT}, {GMM_FORMAT_R32_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32_FLOAT , 0, 1, 4, 4}}, \
|
||||
{{CL_R, CL_UNORM_INT8}, {GMM_FORMAT_R8_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8_UNORM , 0, 1, 1, 1}}, \
|
||||
{{CL_R, CL_UNORM_INT16}, {GMM_FORMAT_R16_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_UNORM , 0, 1, 2, 2}}, \
|
||||
{{CL_R, CL_SIGNED_INT8}, {GMM_FORMAT_R8_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8_SINT , 0, 1, 1, 1}}, \
|
||||
{{CL_R, CL_SIGNED_INT16}, {GMM_FORMAT_R16_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_SINT , 0, 1, 2, 2}}, \
|
||||
{{CL_R, CL_SIGNED_INT32}, {GMM_FORMAT_R32_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32_SINT , 0, 1, 4, 4}}, \
|
||||
{{CL_R, CL_UNSIGNED_INT8}, {GMM_FORMAT_R8_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8_UINT , 0, 1, 1, 1}}, \
|
||||
{{CL_R, CL_UNSIGNED_INT16}, {GMM_FORMAT_R16_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_UINT , 0, 1, 2, 2}}, \
|
||||
{{CL_R, CL_UNSIGNED_INT32}, {GMM_FORMAT_R32_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32_UINT , 0, 1, 4, 4}}, \
|
||||
{{CL_R, CL_HALF_FLOAT}, {GMM_FORMAT_R16_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_FLOAT , 0, 1, 2, 2}}, \
|
||||
{{CL_A, CL_UNORM_INT8}, {GMM_FORMAT_A8_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_A8_UNORM , 0, 1, 1, 1}}, \
|
||||
{{CL_RG, CL_UNORM_INT8}, {GMM_FORMAT_R8G8_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8_UNORM , 0, 2, 1, 2}}, \
|
||||
{{CL_RG, CL_UNORM_INT16}, {GMM_FORMAT_R16G16_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16_UNORM , 0, 2, 2, 4}}, \
|
||||
{{CL_RG, CL_SIGNED_INT8}, {GMM_FORMAT_R8G8_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8_SINT , 0, 2, 1, 2}}, \
|
||||
{{CL_RG, CL_SIGNED_INT16}, {GMM_FORMAT_R16G16_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16_SINT , 0, 2, 2, 4}}, \
|
||||
{{CL_RG, CL_SIGNED_INT32}, {GMM_FORMAT_R32G32_SINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32_SINT , 0, 2, 4, 8}}, \
|
||||
{{CL_RG, CL_UNSIGNED_INT8}, {GMM_FORMAT_R8G8_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8_UINT , 0, 2, 1, 2}}, \
|
||||
{{CL_RG, CL_UNSIGNED_INT16}, {GMM_FORMAT_R16G16_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16_UINT , 0, 2, 2, 4}}, \
|
||||
{{CL_RG, CL_UNSIGNED_INT32}, {GMM_FORMAT_R32G32_UINT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32_UINT , 0, 2, 4, 8}}, \
|
||||
{{CL_RG, CL_HALF_FLOAT}, {GMM_FORMAT_R16G16_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16_FLOAT , 0, 2, 2, 4}}, \
|
||||
{{CL_RG, CL_FLOAT}, {GMM_FORMAT_R32G32_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32G32_FLOAT , 0, 2, 4, 8}}, \
|
||||
{{CL_LUMINANCE, CL_UNORM_INT8}, {GMM_FORMAT_GENERIC_8BIT, GFX3DSTATE_SURFACEFORMAT_R8_UNORM , 0, 1, 1, 1}}, \
|
||||
{{CL_LUMINANCE, CL_UNORM_INT16}, {GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_R16_UNORM , 0, 1, 2, 2}}, \
|
||||
{{CL_LUMINANCE, CL_HALF_FLOAT}, {GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_R16_FLOAT , 0, 1, 2, 2}}, \
|
||||
{{CL_LUMINANCE, CL_FLOAT}, {GMM_FORMAT_GENERIC_32BIT, GFX3DSTATE_SURFACEFORMAT_R32_FLOAT , 0, 1, 4, 4}}, \
|
||||
{{CL_R, CL_SNORM_INT8}, {GMM_FORMAT_R8_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8_SNORM , 0, 1, 1, 1}}, \
|
||||
{{CL_R, CL_SNORM_INT16}, {GMM_FORMAT_R16_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_SNORM , 0, 1, 2, 2}}, \
|
||||
{{CL_RG, CL_SNORM_INT8}, {GMM_FORMAT_R8G8_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8_SNORM , 0, 2, 1, 2}}, \
|
||||
{{CL_RG, CL_SNORM_INT16}, {GMM_FORMAT_R16G16_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16_SNORM , 0, 2, 2, 4}}, \
|
||||
{{CL_RGBA, CL_SNORM_INT8}, {GMM_FORMAT_R8G8B8A8_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_SNORM , 0, 4, 1, 4}}, \
|
||||
{{CL_RGBA, CL_SNORM_INT16}, {GMM_FORMAT_R16G16B16A16_SNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_SNORM , 0, 4, 2, 8}}
|
||||
|
||||
#define READONLYFORMATS \
|
||||
{{CL_INTENSITY, CL_UNORM_INT8}, GMM_FORMAT_GENERIC_8BIT, GFX3DSTATE_SURFACEFORMAT_I8_UNORM , 0, 1, 1, 1}, \
|
||||
{{CL_INTENSITY, CL_UNORM_INT16}, GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_I16_UNORM , 0, 1, 2, 2}, \
|
||||
{{CL_INTENSITY, CL_HALF_FLOAT}, GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_I16_FLOAT , 0, 1, 2, 2}, \
|
||||
{{CL_INTENSITY, CL_FLOAT}, GMM_FORMAT_GENERIC_32BIT, GFX3DSTATE_SURFACEFORMAT_I32_FLOAT , 0, 1, 4, 4}, \
|
||||
{{CL_A, CL_UNORM_INT16}, GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_A16_UNORM , 0, 1, 2, 2}, \
|
||||
{{CL_A, CL_HALF_FLOAT}, GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_A16_FLOAT , 0, 1, 2, 2}, \
|
||||
{{CL_A, CL_FLOAT}, GMM_FORMAT_GENERIC_32BIT, GFX3DSTATE_SURFACEFORMAT_A32_FLOAT , 0, 1, 4, 4}
|
||||
{{CL_INTENSITY, CL_UNORM_INT8}, {GMM_FORMAT_GENERIC_8BIT, GFX3DSTATE_SURFACEFORMAT_I8_UNORM , 0, 1, 1, 1}}, \
|
||||
{{CL_INTENSITY, CL_UNORM_INT16}, {GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_I16_UNORM , 0, 1, 2, 2}}, \
|
||||
{{CL_INTENSITY, CL_HALF_FLOAT}, {GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_I16_FLOAT , 0, 1, 2, 2}}, \
|
||||
{{CL_INTENSITY, CL_FLOAT}, {GMM_FORMAT_GENERIC_32BIT, GFX3DSTATE_SURFACEFORMAT_I32_FLOAT , 0, 1, 4, 4}}, \
|
||||
{{CL_A, CL_UNORM_INT16}, {GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_A16_UNORM , 0, 1, 2, 2}}, \
|
||||
{{CL_A, CL_HALF_FLOAT}, {GMM_FORMAT_GENERIC_16BIT, GFX3DSTATE_SURFACEFORMAT_A16_FLOAT , 0, 1, 2, 2}}, \
|
||||
{{CL_A, CL_FLOAT}, {GMM_FORMAT_GENERIC_32BIT, GFX3DSTATE_SURFACEFORMAT_A32_FLOAT , 0, 1, 4, 4}}
|
||||
|
||||
#define SRGBFORMATS \
|
||||
{{CL_sRGBA, CL_UNORM_INT8}, GMM_FORMAT_R8G8B8A8_UNORM_SRGB_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB , 0, 4, 1, 4}, \
|
||||
{{CL_sBGRA, CL_UNORM_INT8}, GMM_FORMAT_B8G8R8A8_UNORM_SRGB_TYPE, GFX3DSTATE_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB , 0, 4, 1, 4}
|
||||
{{CL_sRGBA, CL_UNORM_INT8}, {GMM_FORMAT_R8G8B8A8_UNORM_SRGB_TYPE, GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB , 0, 4, 1, 4}}, \
|
||||
{{CL_sBGRA, CL_UNORM_INT8}, {GMM_FORMAT_B8G8R8A8_UNORM_SRGB_TYPE, GFX3DSTATE_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB , 0, 4, 1, 4}}
|
||||
|
||||
#define DEPTHFORMATS \
|
||||
{{ CL_DEPTH, CL_FLOAT}, GMM_FORMAT_R32_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32_FLOAT , 0, 1, 4, 4}, \
|
||||
{{ CL_DEPTH, CL_UNORM_INT16}, GMM_FORMAT_R16_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_UNORM , 0, 1, 2, 2}
|
||||
{{ CL_DEPTH, CL_FLOAT}, {GMM_FORMAT_R32_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32_FLOAT , 0, 1, 4, 4}}, \
|
||||
{{ CL_DEPTH, CL_UNORM_INT16}, {GMM_FORMAT_R16_UNORM_TYPE, GFX3DSTATE_SURFACEFORMAT_R16_UNORM , 0, 1, 2, 2}}
|
||||
|
||||
#define DEPTHSTENCILFORMATS \
|
||||
{{ CL_DEPTH_STENCIL, CL_UNORM_INT24}, GMM_FORMAT_GENERIC_32BIT, GFX3DSTATE_SURFACEFORMAT_R24_UNORM_X8_TYPELESS , 0, 1, 4, 4}, \
|
||||
{{ CL_DEPTH_STENCIL, CL_FLOAT}, GMM_FORMAT_R32G32_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32_FLOAT_X8X24_TYPELESS, 0, 2, 4, 8}
|
||||
{{ CL_DEPTH_STENCIL, CL_UNORM_INT24}, {GMM_FORMAT_GENERIC_32BIT, GFX3DSTATE_SURFACEFORMAT_R24_UNORM_X8_TYPELESS , 0, 1, 4, 4}}, \
|
||||
{{ CL_DEPTH_STENCIL, CL_FLOAT}, {GMM_FORMAT_R32G32_FLOAT_TYPE, GFX3DSTATE_SURFACEFORMAT_R32_FLOAT_X8X24_TYPELESS, 0, 2, 4, 8}}
|
||||
|
||||
//Initialize this with the required formats first.
|
||||
//Append the optional one later
|
||||
const SurfaceFormatInfo SurfaceFormats::readOnlySurfaceFormats[] = { COMMONFORMATS, READONLYFORMATS, SRGBFORMATS };
|
||||
const ClSurfaceFormatInfo SurfaceFormats::readOnlySurfaceFormats[] = { COMMONFORMATS, READONLYFORMATS, SRGBFORMATS };
|
||||
|
||||
const SurfaceFormatInfo SurfaceFormats::writeOnlySurfaceFormats[] = { COMMONFORMATS };
|
||||
const ClSurfaceFormatInfo SurfaceFormats::writeOnlySurfaceFormats[] = { COMMONFORMATS };
|
||||
|
||||
const SurfaceFormatInfo SurfaceFormats::readWriteSurfaceFormats[] = { COMMONFORMATS };
|
||||
const ClSurfaceFormatInfo SurfaceFormats::readWriteSurfaceFormats[] = { COMMONFORMATS };
|
||||
|
||||
const SurfaceFormatInfo SurfaceFormats::packedYuvSurfaceFormats[] = {
|
||||
{{CL_YUYV_INTEL, CL_UNORM_INT8}, GMM_FORMAT_YUY2, GFX3DSTATE_SURFACEFORMAT_YCRCB_NORMAL , 0, 2, 1, 2},
|
||||
{{CL_UYVY_INTEL, CL_UNORM_INT8}, GMM_FORMAT_UYVY, GFX3DSTATE_SURFACEFORMAT_YCRCB_SWAPY , 0, 2, 1, 2},
|
||||
{{CL_YVYU_INTEL, CL_UNORM_INT8}, GMM_FORMAT_YVYU, GFX3DSTATE_SURFACEFORMAT_YCRCB_SWAPUV , 0, 2, 1, 2},
|
||||
{{CL_VYUY_INTEL, CL_UNORM_INT8}, GMM_FORMAT_VYUY, GFX3DSTATE_SURFACEFORMAT_YCRCB_SWAPUVY , 0, 2, 1, 2}
|
||||
const ClSurfaceFormatInfo SurfaceFormats::packedYuvSurfaceFormats[] = {
|
||||
{{CL_YUYV_INTEL, CL_UNORM_INT8}, {GMM_FORMAT_YUY2, GFX3DSTATE_SURFACEFORMAT_YCRCB_NORMAL , 0, 2, 1, 2}},
|
||||
{{CL_UYVY_INTEL, CL_UNORM_INT8}, {GMM_FORMAT_UYVY, GFX3DSTATE_SURFACEFORMAT_YCRCB_SWAPY , 0, 2, 1, 2}},
|
||||
{{CL_YVYU_INTEL, CL_UNORM_INT8}, {GMM_FORMAT_YVYU, GFX3DSTATE_SURFACEFORMAT_YCRCB_SWAPUV , 0, 2, 1, 2}},
|
||||
{{CL_VYUY_INTEL, CL_UNORM_INT8}, {GMM_FORMAT_VYUY, GFX3DSTATE_SURFACEFORMAT_YCRCB_SWAPUVY , 0, 2, 1, 2}}
|
||||
};
|
||||
|
||||
const SurfaceFormatInfo SurfaceFormats::planarYuvSurfaceFormats[] = {
|
||||
{{CL_NV12_INTEL, CL_UNORM_INT8}, GMM_FORMAT_NV12, GFX3DSTATE_SURFACEFORMAT_NV12 , 0, 1, 1, 1}
|
||||
const ClSurfaceFormatInfo SurfaceFormats::planarYuvSurfaceFormats[] = {
|
||||
{{CL_NV12_INTEL, CL_UNORM_INT8}, {GMM_FORMAT_NV12, GFX3DSTATE_SURFACEFORMAT_NV12 , 0, 1, 1, 1}}
|
||||
};
|
||||
|
||||
const SurfaceFormatInfo SurfaceFormats::readOnlyDepthSurfaceFormats[] = { DEPTHFORMATS, DEPTHSTENCILFORMATS };
|
||||
const ClSurfaceFormatInfo SurfaceFormats::readOnlyDepthSurfaceFormats[] = { DEPTHFORMATS, DEPTHSTENCILFORMATS };
|
||||
|
||||
const SurfaceFormatInfo SurfaceFormats::readWriteDepthSurfaceFormats[] = { DEPTHFORMATS };
|
||||
const ClSurfaceFormatInfo SurfaceFormats::readWriteDepthSurfaceFormats[] = { DEPTHFORMATS };
|
||||
|
||||
ArrayRef<const SurfaceFormatInfo> SurfaceFormats::readOnly() noexcept {
|
||||
return ArrayRef<const SurfaceFormatInfo>(readOnlySurfaceFormats);
|
||||
ArrayRef<const ClSurfaceFormatInfo> SurfaceFormats::readOnly() noexcept {
|
||||
return ArrayRef<const ClSurfaceFormatInfo>(readOnlySurfaceFormats);
|
||||
}
|
||||
|
||||
ArrayRef<const SurfaceFormatInfo> SurfaceFormats::writeOnly() noexcept {
|
||||
return ArrayRef<const SurfaceFormatInfo>(writeOnlySurfaceFormats);
|
||||
ArrayRef<const ClSurfaceFormatInfo> SurfaceFormats::writeOnly() noexcept {
|
||||
return ArrayRef<const ClSurfaceFormatInfo>(writeOnlySurfaceFormats);
|
||||
}
|
||||
|
||||
ArrayRef<const SurfaceFormatInfo> SurfaceFormats::readWrite() noexcept {
|
||||
return ArrayRef<const SurfaceFormatInfo>(readWriteSurfaceFormats);
|
||||
ArrayRef<const ClSurfaceFormatInfo> SurfaceFormats::readWrite() noexcept {
|
||||
return ArrayRef<const ClSurfaceFormatInfo>(readWriteSurfaceFormats);
|
||||
}
|
||||
|
||||
ArrayRef<const SurfaceFormatInfo> SurfaceFormats::packedYuv() noexcept {
|
||||
return ArrayRef<const SurfaceFormatInfo>(packedYuvSurfaceFormats);
|
||||
ArrayRef<const ClSurfaceFormatInfo> SurfaceFormats::packedYuv() noexcept {
|
||||
return ArrayRef<const ClSurfaceFormatInfo>(packedYuvSurfaceFormats);
|
||||
}
|
||||
|
||||
ArrayRef<const SurfaceFormatInfo> SurfaceFormats::planarYuv() noexcept {
|
||||
return ArrayRef<const SurfaceFormatInfo>(planarYuvSurfaceFormats);
|
||||
ArrayRef<const ClSurfaceFormatInfo> SurfaceFormats::planarYuv() noexcept {
|
||||
return ArrayRef<const ClSurfaceFormatInfo>(planarYuvSurfaceFormats);
|
||||
}
|
||||
|
||||
ArrayRef<const SurfaceFormatInfo> SurfaceFormats::readOnlyDepth() noexcept {
|
||||
return ArrayRef<const SurfaceFormatInfo>(readOnlyDepthSurfaceFormats);
|
||||
ArrayRef<const ClSurfaceFormatInfo> SurfaceFormats::readOnlyDepth() noexcept {
|
||||
return ArrayRef<const ClSurfaceFormatInfo>(readOnlyDepthSurfaceFormats);
|
||||
}
|
||||
|
||||
ArrayRef<const SurfaceFormatInfo> SurfaceFormats::readWriteDepth() noexcept {
|
||||
return ArrayRef<const SurfaceFormatInfo>(readWriteDepthSurfaceFormats);
|
||||
ArrayRef<const ClSurfaceFormatInfo> SurfaceFormats::readWriteDepth() noexcept {
|
||||
return ArrayRef<const ClSurfaceFormatInfo>(readWriteDepthSurfaceFormats);
|
||||
}
|
||||
|
||||
ArrayRef<const SurfaceFormatInfo> SurfaceFormats::surfaceFormats(cl_mem_flags flags) noexcept {
|
||||
ArrayRef<const ClSurfaceFormatInfo> SurfaceFormats::surfaceFormats(cl_mem_flags flags) noexcept {
|
||||
if (flags & CL_MEM_READ_ONLY) {
|
||||
return readOnly();
|
||||
}
|
||||
@@ -145,7 +145,7 @@ ArrayRef<const SurfaceFormatInfo> SurfaceFormats::surfaceFormats(cl_mem_flags fl
|
||||
}
|
||||
}
|
||||
|
||||
ArrayRef<const SurfaceFormatInfo> SurfaceFormats::surfaceFormats(cl_mem_flags flags, const cl_image_format *imageFormat) noexcept {
|
||||
ArrayRef<const ClSurfaceFormatInfo> SurfaceFormats::surfaceFormats(cl_mem_flags flags, const cl_image_format *imageFormat) noexcept {
|
||||
if (NEO::IsNV12Image(imageFormat)) {
|
||||
return planarYuv();
|
||||
}
|
||||
|
||||
@@ -7,269 +7,40 @@
|
||||
|
||||
#pragma once
|
||||
#include "core/gmm_helper/gmm_lib.h"
|
||||
#include "core/helpers/surface_format_info.h"
|
||||
#include "core/utilities/arrayref.h"
|
||||
|
||||
#include "CL/cl.h"
|
||||
|
||||
namespace NEO {
|
||||
enum GFX3DSTATE_SURFACEFORMAT : unsigned short {
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_FLOAT = 0x000,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_SINT = 0x001,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_UINT = 0x002,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_UNORM = 0x003,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_SNORM = 0x004,
|
||||
GFX3DSTATE_SURFACEFORMAT_R64G64_FLOAT = 0x005,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32X32_FLOAT = 0x006,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_SSCALED = 0x007,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32A32_USCALED = 0x008,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32_FLOAT = 0x040,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32_SINT = 0x041,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32_UINT = 0x042,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32_UNORM = 0x043,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32_SNORM = 0x044,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32_SSCALED = 0x045,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32B32_USCALED = 0x046,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_UNORM = 0x080,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_SNORM = 0x081,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_SINT = 0x082,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_UINT = 0x083,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_FLOAT = 0x084,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32_FLOAT = 0x085,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32_SINT = 0x086,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32_UINT = 0x087,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32_FLOAT_X8X24_TYPELESS = 0x088,
|
||||
GFX3DSTATE_SURFACEFORMAT_X32_TYPELESS_G8X24_UINT = 0x089,
|
||||
GFX3DSTATE_SURFACEFORMAT_L32A32_FLOAT = 0x08A,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32_UNORM = 0x08B,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32_SNORM = 0x08C,
|
||||
GFX3DSTATE_SURFACEFORMAT_R64_FLOAT = 0x08D,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16X16_UNORM = 0x08E,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16X16_FLOAT = 0x08F,
|
||||
GFX3DSTATE_SURFACEFORMAT_A32X32_FLOAT = 0x090,
|
||||
GFX3DSTATE_SURFACEFORMAT_L32X32_FLOAT = 0x091,
|
||||
GFX3DSTATE_SURFACEFORMAT_I32X32_FLOAT = 0x092,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_SSCALED = 0x093,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16A16_USCALED = 0x094,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32_SSCALED = 0x095,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32G32_USCALED = 0x096,
|
||||
GFX3DSTATE_SURFACEFORMAT_B8G8R8A8_UNORM = 0x0C0,
|
||||
GFX3DSTATE_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB = 0x0C1,
|
||||
GFX3DSTATE_SURFACEFORMAT_R10G10B10A2_UNORM = 0x0C2,
|
||||
GFX3DSTATE_SURFACEFORMAT_R10G10B10A2_UNORM_SRGB = 0x0C3,
|
||||
GFX3DSTATE_SURFACEFORMAT_R10G10B10A2_UINT = 0x0C4,
|
||||
GFX3DSTATE_SURFACEFORMAT_R10G10B10_SNORM_A2_UNORM = 0x0C5,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_UNORM = 0x0C7,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB = 0x0C8,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_SNORM = 0x0C9,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_SINT = 0x0CA,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_UINT = 0x0CB,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16_UNORM = 0x0CC,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16_SNORM = 0x0CD,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16_SINT = 0x0CE,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16_UINT = 0x0CF,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16_FLOAT = 0x0D0,
|
||||
GFX3DSTATE_SURFACEFORMAT_B10G10R10A2_UNORM = 0x0D1,
|
||||
GFX3DSTATE_SURFACEFORMAT_B10G10R10A2_UNORM_SRGB = 0x0D2,
|
||||
GFX3DSTATE_SURFACEFORMAT_R11G11B10_FLOAT = 0x0D3,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32_SINT = 0x0D6,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32_UINT = 0x0D7,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32_FLOAT = 0x0D8,
|
||||
GFX3DSTATE_SURFACEFORMAT_R24_UNORM_X8_TYPELESS = 0x0D9,
|
||||
GFX3DSTATE_SURFACEFORMAT_X24_TYPELESS_G8_UINT = 0x0DA,
|
||||
GFX3DSTATE_SURFACEFORMAT_L16A16_UNORM = 0x0DF,
|
||||
GFX3DSTATE_SURFACEFORMAT_I24X8_UNORM = 0x0E0,
|
||||
GFX3DSTATE_SURFACEFORMAT_L24X8_UNORM = 0x0E1,
|
||||
GFX3DSTATE_SURFACEFORMAT_A24X8_UNORM = 0x0E2,
|
||||
GFX3DSTATE_SURFACEFORMAT_I32_FLOAT = 0x0E3,
|
||||
GFX3DSTATE_SURFACEFORMAT_L32_FLOAT = 0x0E4,
|
||||
GFX3DSTATE_SURFACEFORMAT_A32_FLOAT = 0x0E5,
|
||||
GFX3DSTATE_SURFACEFORMAT_B8G8R8X8_UNORM = 0x0E9,
|
||||
GFX3DSTATE_SURFACEFORMAT_B8G8R8X8_UNORM_SRGB = 0x0EA,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8X8_UNORM = 0x0EB,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8X8_UNORM_SRGB = 0x0EC,
|
||||
GFX3DSTATE_SURFACEFORMAT_R9G9B9E5_SHAREDEXP = 0x0ED,
|
||||
GFX3DSTATE_SURFACEFORMAT_B10G10R10X2_UNORM = 0x0EE,
|
||||
GFX3DSTATE_SURFACEFORMAT_L16A16_FLOAT = 0x0F0,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32_UNORM = 0x0F1,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32_SNORM = 0x0F2,
|
||||
GFX3DSTATE_SURFACEFORMAT_R10G10B10X2_USCALED = 0x0F3,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_SSCALED = 0x0F4,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8A8_USCALED = 0x0F5,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16_SSCALED = 0x0F6,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16_USCALED = 0x0F7,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32_SSCALED = 0x0F8,
|
||||
GFX3DSTATE_SURFACEFORMAT_R32_USCALED = 0x0F9,
|
||||
GFX3DSTATE_SURFACEFORMAT_B5G6R5_UNORM = 0x100,
|
||||
GFX3DSTATE_SURFACEFORMAT_B5G6R5_UNORM_SRGB = 0x101,
|
||||
GFX3DSTATE_SURFACEFORMAT_B5G5R5A1_UNORM = 0x102,
|
||||
GFX3DSTATE_SURFACEFORMAT_B5G5R5A1_UNORM_SRGB = 0x103,
|
||||
GFX3DSTATE_SURFACEFORMAT_B4G4R4A4_UNORM = 0x104,
|
||||
GFX3DSTATE_SURFACEFORMAT_B4G4R4A4_UNORM_SRGB = 0x105,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8_UNORM = 0x106,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8_SNORM = 0x107,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8_SINT = 0x108,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8_UINT = 0x109,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16_UNORM = 0x10A,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16_SNORM = 0x10B,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16_SINT = 0x10C,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16_UINT = 0x10D,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16_FLOAT = 0x10E,
|
||||
GFX3DSTATE_SURFACEFORMAT_I16_UNORM = 0x111,
|
||||
GFX3DSTATE_SURFACEFORMAT_L16_UNORM = 0x112,
|
||||
GFX3DSTATE_SURFACEFORMAT_A16_UNORM = 0x113,
|
||||
GFX3DSTATE_SURFACEFORMAT_L8A8_UNORM = 0x114,
|
||||
GFX3DSTATE_SURFACEFORMAT_I16_FLOAT = 0x115,
|
||||
GFX3DSTATE_SURFACEFORMAT_L16_FLOAT = 0x116,
|
||||
GFX3DSTATE_SURFACEFORMAT_A16_FLOAT = 0x117,
|
||||
GFX3DSTATE_SURFACEFORMAT_L8A8_UNORM_SRGB = 0x118,
|
||||
GFX3DSTATE_SURFACEFORMAT_R5G5_SNORM_B6_UNORM = 0x119,
|
||||
GFX3DSTATE_SURFACEFORMAT_B5G5R5X1_UNORM = 0x11A,
|
||||
GFX3DSTATE_SURFACEFORMAT_B5G5R5X1_UNORM_SRGB = 0x11B,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8_SSCALED = 0x11C,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8_USCALED = 0x11D,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16_SSCALED = 0x11E,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16_USCALED = 0x11F,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8_UNORM = 0x140,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8_SNORM = 0x141,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8_SINT = 0x142,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8_UINT = 0x143,
|
||||
GFX3DSTATE_SURFACEFORMAT_A8_UNORM = 0x144,
|
||||
GFX3DSTATE_SURFACEFORMAT_I8_UNORM = 0x145,
|
||||
GFX3DSTATE_SURFACEFORMAT_L8_UNORM = 0x146,
|
||||
GFX3DSTATE_SURFACEFORMAT_P4A4_UNORM = 0x147,
|
||||
GFX3DSTATE_SURFACEFORMAT_A4P4_UNORM = 0x148,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8_SSCALED = 0x149,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8_USCALED = 0x14A,
|
||||
GFX3DSTATE_SURFACEFORMAT_P8_UNORM = 0x14B,
|
||||
GFX3DSTATE_SURFACEFORMAT_L8_UNORM_SRGB = 0x14C,
|
||||
GFX3DSTATE_SURFACEFORMAT_DXT1_RGB_SRGB = 0x180,
|
||||
GFX3DSTATE_SURFACEFORMAT_R1_UINT = 0x181,
|
||||
GFX3DSTATE_SURFACEFORMAT_YCRCB_NORMAL = 0x182,
|
||||
GFX3DSTATE_SURFACEFORMAT_YCRCB_SWAPUVY = 0x183,
|
||||
GFX3DSTATE_SURFACEFORMAT_P2_UNORM = 0x184,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC1_UNORM = 0x186,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC2_UNORM = 0x187,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC3_UNORM = 0x188,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC4_UNORM = 0x189,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC5_UNORM = 0x18A,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC1_UNORM_SRGB = 0x18B,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC2_UNORM_SRGB = 0x18C,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC3_UNORM_SRGB = 0x18D,
|
||||
GFX3DSTATE_SURFACEFORMAT_MONO8 = 0x18E,
|
||||
GFX3DSTATE_SURFACEFORMAT_YCRCB_SWAPUV = 0x18F,
|
||||
GFX3DSTATE_SURFACEFORMAT_YCRCB_SWAPY = 0x190,
|
||||
GFX3DSTATE_SURFACEFORMAT_DXT1_RGB = 0x191,
|
||||
GFX3DSTATE_SURFACEFORMAT_FXT1 = 0x192,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8_UNORM = 0x193,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8_SNORM = 0x194,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8_SSCALED = 0x195,
|
||||
GFX3DSTATE_SURFACEFORMAT_R8G8B8_USCALED = 0x196,
|
||||
GFX3DSTATE_SURFACEFORMAT_R64G64B64A64_FLOAT = 0x197,
|
||||
GFX3DSTATE_SURFACEFORMAT_R64G64B64_FLOAT = 0x198,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC4_SNORM = 0x199,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC5_SNORM = 0x19A,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16_FLOAT = 0x19B,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16_UNORM = 0x19C,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16_SNORM = 0x19D,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16_SSCALED = 0x19E,
|
||||
GFX3DSTATE_SURFACEFORMAT_R16G16B16_USCALED = 0x19F,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC6H_SF16 = 0x1A1,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC7_UNORM = 0x1A2,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC7_UNORM_SRGB = 0x1A3,
|
||||
GFX3DSTATE_SURFACEFORMAT_BC6H_UF16 = 0x1A4,
|
||||
GFX3DSTATE_SURFACEFORMAT_NV12 = 0x1A5,
|
||||
GFX3DSTATE_SURFACEFORMAT_RAW = 0x1FF,
|
||||
NUM_GFX3DSTATE_SURFACEFORMATS
|
||||
};
|
||||
|
||||
enum class ImagePlane {
|
||||
NO_PLANE = 0,
|
||||
PLANE_Y,
|
||||
PLANE_U,
|
||||
PLANE_V,
|
||||
PLANE_UV
|
||||
};
|
||||
|
||||
struct SurfaceFormatInfo {
|
||||
struct ClSurfaceFormatInfo {
|
||||
cl_image_format OCLImageFormat;
|
||||
GMM_RESOURCE_FORMAT GMMSurfaceFormat;
|
||||
GFX3DSTATE_SURFACEFORMAT GenxSurfaceFormat;
|
||||
cl_uint GMMTileWalk;
|
||||
cl_uint NumChannels;
|
||||
cl_uint PerChannelSizeInBytes;
|
||||
size_t ImageElementSizeInBytes;
|
||||
};
|
||||
|
||||
enum class ImageType {
|
||||
Invalid,
|
||||
Image1D,
|
||||
Image2D,
|
||||
Image3D,
|
||||
Image1DArray,
|
||||
Image2DArray,
|
||||
Image1DBuffer
|
||||
};
|
||||
|
||||
struct ImageDescriptor {
|
||||
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 {
|
||||
ImageDescriptor imgDesc;
|
||||
const SurfaceFormatInfo *surfaceFormat;
|
||||
size_t size;
|
||||
size_t rowPitch;
|
||||
size_t slicePitch;
|
||||
uint32_t qPitch;
|
||||
size_t offset;
|
||||
uint32_t xOffset;
|
||||
uint32_t yOffset;
|
||||
uint32_t yOffsetForUVPlane;
|
||||
GMM_YUV_PLANE_ENUM plane;
|
||||
uint32_t baseMipLevel;
|
||||
uint32_t mipCount;
|
||||
bool linearStorage;
|
||||
bool preferRenderCompression;
|
||||
bool useLocalMemory;
|
||||
};
|
||||
|
||||
struct McsSurfaceInfo {
|
||||
uint32_t pitch;
|
||||
uint32_t qPitch;
|
||||
uint32_t multisampleCount;
|
||||
SurfaceFormatInfo surfaceFormat;
|
||||
};
|
||||
|
||||
class SurfaceFormats {
|
||||
private:
|
||||
static const SurfaceFormatInfo readOnlySurfaceFormats[];
|
||||
static const SurfaceFormatInfo writeOnlySurfaceFormats[];
|
||||
static const SurfaceFormatInfo readWriteSurfaceFormats[];
|
||||
static const SurfaceFormatInfo readOnlyDepthSurfaceFormats[];
|
||||
static const SurfaceFormatInfo readWriteDepthSurfaceFormats[];
|
||||
static const ClSurfaceFormatInfo readOnlySurfaceFormats[];
|
||||
static const ClSurfaceFormatInfo writeOnlySurfaceFormats[];
|
||||
static const ClSurfaceFormatInfo readWriteSurfaceFormats[];
|
||||
static const ClSurfaceFormatInfo readOnlyDepthSurfaceFormats[];
|
||||
static const ClSurfaceFormatInfo readWriteDepthSurfaceFormats[];
|
||||
|
||||
static const SurfaceFormatInfo packedYuvSurfaceFormats[];
|
||||
static const SurfaceFormatInfo planarYuvSurfaceFormats[];
|
||||
static const ClSurfaceFormatInfo packedYuvSurfaceFormats[];
|
||||
static const ClSurfaceFormatInfo planarYuvSurfaceFormats[];
|
||||
|
||||
public:
|
||||
static ArrayRef<const SurfaceFormatInfo> readOnly() noexcept;
|
||||
static ArrayRef<const SurfaceFormatInfo> writeOnly() noexcept;
|
||||
static ArrayRef<const SurfaceFormatInfo> readWrite() noexcept;
|
||||
static ArrayRef<const SurfaceFormatInfo> packedYuv() noexcept;
|
||||
static ArrayRef<const SurfaceFormatInfo> planarYuv() noexcept;
|
||||
static ArrayRef<const SurfaceFormatInfo> readOnlyDepth() noexcept;
|
||||
static ArrayRef<const SurfaceFormatInfo> readWriteDepth() noexcept;
|
||||
static ArrayRef<const ClSurfaceFormatInfo> readOnly() noexcept;
|
||||
static ArrayRef<const ClSurfaceFormatInfo> writeOnly() noexcept;
|
||||
static ArrayRef<const ClSurfaceFormatInfo> readWrite() noexcept;
|
||||
static ArrayRef<const ClSurfaceFormatInfo> packedYuv() noexcept;
|
||||
static ArrayRef<const ClSurfaceFormatInfo> planarYuv() noexcept;
|
||||
static ArrayRef<const ClSurfaceFormatInfo> readOnlyDepth() noexcept;
|
||||
static ArrayRef<const ClSurfaceFormatInfo> readWriteDepth() noexcept;
|
||||
|
||||
static ArrayRef<const SurfaceFormatInfo> surfaceFormats(cl_mem_flags flags) noexcept;
|
||||
static ArrayRef<const SurfaceFormatInfo> surfaceFormats(cl_mem_flags flags, const cl_image_format *imageFormat) noexcept;
|
||||
static ArrayRef<const ClSurfaceFormatInfo> surfaceFormats(cl_mem_flags flags) noexcept;
|
||||
static ArrayRef<const ClSurfaceFormatInfo> surfaceFormats(cl_mem_flags flags, const cl_image_format *imageFormat) noexcept;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2019 Intel Corporation
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -1392,7 +1392,7 @@ cl_int Kernel::setArgImageWithMipLevel(uint32_t argIndex,
|
||||
patch<uint32_t, uint32_t>(kernelArgInfo.offsetHeap, crossThreadData, kernelArgInfo.offsetObjectId);
|
||||
patch<uint32_t, cl_uint>(imageDesc.num_mip_levels, crossThreadData, kernelArgInfo.offsetNumMipLevels);
|
||||
|
||||
auto pixelSize = pImage->getSurfaceFormatInfo().ImageElementSizeInBytes;
|
||||
auto pixelSize = pImage->getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes;
|
||||
patch<uint64_t, uint64_t>(pImage->getGraphicsAllocation()->getGpuAddress(), crossThreadData, kernelArgInfo.offsetFlatBaseOffset);
|
||||
patch<uint32_t, size_t>((imageDesc.image_width * pixelSize) - 1, crossThreadData, kernelArgInfo.offsetFlatWidth);
|
||||
patch<uint32_t, size_t>((imageDesc.image_height * pixelSize) - 1, crossThreadData, kernelArgInfo.offsetFlatHeight);
|
||||
|
||||
@@ -50,7 +50,7 @@ Image::Image(Context *context,
|
||||
bool isObjectRedescribed,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo &surfaceFormatInfo,
|
||||
const ClSurfaceFormatInfo &surfaceFormatInfo,
|
||||
const SurfaceOffsets *surfaceOffsets)
|
||||
: MemObj(context,
|
||||
imageDesc.image_type,
|
||||
@@ -83,7 +83,7 @@ void Image::transferData(void *dest, size_t destRowPitch, size_t destSlicePitch,
|
||||
void *src, size_t srcRowPitch, size_t srcSlicePitch,
|
||||
std::array<size_t, 3> copyRegion, std::array<size_t, 3> copyOrigin) {
|
||||
|
||||
size_t pixelSize = surfaceFormatInfo.ImageElementSizeInBytes;
|
||||
size_t pixelSize = surfaceFormatInfo.surfaceFormat.ImageElementSizeInBytes;
|
||||
size_t lineWidth = copyRegion[0] * pixelSize;
|
||||
|
||||
DBG_LOG(LogMemoryObject, __FUNCTION__, "memcpy dest:", dest, "sizeRowToCopy:", lineWidth, "src:", src);
|
||||
@@ -114,7 +114,7 @@ Image *Image::create(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
const SurfaceFormatInfo *surfaceFormat,
|
||||
const ClSurfaceFormatInfo *surfaceFormat,
|
||||
const cl_image_desc *imageDesc,
|
||||
const void *hostPtr,
|
||||
cl_int &errcodeRet) {
|
||||
@@ -145,7 +145,7 @@ Image *Image::create(Context *context,
|
||||
}
|
||||
|
||||
imgInfo.imgDesc = Image::convertDescriptor(imageDescriptor);
|
||||
imgInfo.surfaceFormat = surfaceFormat;
|
||||
imgInfo.surfaceFormat = &surfaceFormat->surfaceFormat;
|
||||
imgInfo.mipCount = imageDesc->num_mip_levels;
|
||||
Gmm *gmm = nullptr;
|
||||
|
||||
@@ -183,11 +183,11 @@ Image *Image::create(Context *context,
|
||||
}
|
||||
}
|
||||
|
||||
imgInfo.surfaceFormat = &parentImage->surfaceFormatInfo;
|
||||
imgInfo.surfaceFormat = &parentImage->surfaceFormatInfo.surfaceFormat;
|
||||
imageDescriptor = parentImage->getImageDesc();
|
||||
}
|
||||
|
||||
auto hostPtrRowPitch = imageDesc->image_row_pitch ? imageDesc->image_row_pitch : imageWidth * surfaceFormat->ImageElementSizeInBytes;
|
||||
auto hostPtrRowPitch = imageDesc->image_row_pitch ? imageDesc->image_row_pitch : imageWidth * surfaceFormat->surfaceFormat.ImageElementSizeInBytes;
|
||||
auto hostPtrSlicePitch = imageDesc->image_slice_pitch ? imageDesc->image_slice_pitch : hostPtrRowPitch * imageHeight;
|
||||
imgInfo.linearStorage = !hwHelper.tilingAllowed(context->isSharedContext, Image::isImage1d(*imageDesc),
|
||||
memoryProperties.flags.forceLinearStorage);
|
||||
@@ -408,7 +408,7 @@ Image *Image::createImageHw(Context *context, const MemoryPropertiesFlags &memor
|
||||
const cl_image_format &imageFormat, const cl_image_desc &imageDesc,
|
||||
bool zeroCopy, GraphicsAllocation *graphicsAllocation,
|
||||
bool isObjectRedescribed, uint32_t baseMipLevel, uint32_t mipCount,
|
||||
const SurfaceFormatInfo *surfaceFormatInfo) {
|
||||
const ClSurfaceFormatInfo *surfaceFormatInfo) {
|
||||
const auto device = context->getDevice(0);
|
||||
const auto &hwInfo = device->getHardwareInfo();
|
||||
|
||||
@@ -423,9 +423,9 @@ Image *Image::createImageHw(Context *context, const MemoryPropertiesFlags &memor
|
||||
|
||||
Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler, const McsSurfaceInfo &mcsSurfaceInfo,
|
||||
GraphicsAllocation *graphicsAllocation, GraphicsAllocation *mcsAllocation,
|
||||
cl_mem_flags flags, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount) {
|
||||
cl_mem_flags flags, const ClSurfaceFormatInfo *surfaceFormat, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount) {
|
||||
auto sharedImage = createImageHw(context, MemoryPropertiesFlagsParser::createMemoryPropertiesFlags(flags, 0, 0), flags, 0, graphicsAllocation->getUnderlyingBufferSize(),
|
||||
nullptr, imgInfo.surfaceFormat->OCLImageFormat, Image::convertDescriptor(imgInfo.imgDesc), false, graphicsAllocation, false, baseMipLevel, mipCount, imgInfo.surfaceFormat);
|
||||
nullptr, surfaceFormat->OCLImageFormat, Image::convertDescriptor(imgInfo.imgDesc), false, graphicsAllocation, false, baseMipLevel, mipCount, surfaceFormat);
|
||||
sharedImage->setSharingHandler(sharingHandler);
|
||||
sharedImage->setMcsAllocation(mcsAllocation);
|
||||
sharedImage->setQPitch(imgInfo.qPitch);
|
||||
@@ -439,7 +439,7 @@ Image *Image::createSharedImage(Context *context, SharingHandler *sharingHandler
|
||||
|
||||
cl_int Image::validate(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const SurfaceFormatInfo *surfaceFormat,
|
||||
const ClSurfaceFormatInfo *surfaceFormat,
|
||||
const cl_image_desc *imageDesc,
|
||||
const void *hostPtr) {
|
||||
auto pDevice = context->getDevice(0);
|
||||
@@ -466,7 +466,7 @@ cl_int Image::validate(Context *context,
|
||||
pDevice->getCap<CL_DEVICE_IMAGE_PITCH_ALIGNMENT>(reinterpret_cast<const void *&>(pitchAlignment), srcSize, retSize);
|
||||
pDevice->getCap<CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT>(reinterpret_cast<const void *&>(baseAddressAlignment), srcSize, retSize);
|
||||
|
||||
const auto rowSize = imageDesc->image_row_pitch != 0 ? imageDesc->image_row_pitch : alignUp(imageDesc->image_width * surfaceFormat->NumChannels * surfaceFormat->PerChannelSizeInBytes, *pitchAlignment);
|
||||
const auto rowSize = imageDesc->image_row_pitch != 0 ? imageDesc->image_row_pitch : alignUp(imageDesc->image_width * surfaceFormat->surfaceFormat.NumChannels * surfaceFormat->surfaceFormat.PerChannelSizeInBytes, *pitchAlignment);
|
||||
const auto minimumBufferSize = imageDesc->image_height * rowSize;
|
||||
|
||||
if ((imageDesc->image_row_pitch % (*pitchAlignment)) ||
|
||||
@@ -493,8 +493,8 @@ cl_int Image::validate(Context *context,
|
||||
}
|
||||
} else {
|
||||
if (imageDesc->image_row_pitch != 0) {
|
||||
if (imageDesc->image_row_pitch % surfaceFormat->ImageElementSizeInBytes != 0 ||
|
||||
imageDesc->image_row_pitch < imageDesc->image_width * surfaceFormat->ImageElementSizeInBytes) {
|
||||
if (imageDesc->image_row_pitch % surfaceFormat->surfaceFormat.ImageElementSizeInBytes != 0 ||
|
||||
imageDesc->image_row_pitch < imageDesc->image_width * surfaceFormat->surfaceFormat.ImageElementSizeInBytes) {
|
||||
return CL_INVALID_IMAGE_DESCRIPTOR;
|
||||
}
|
||||
}
|
||||
@@ -666,7 +666,7 @@ void Image::calculateHostPtrOffset(size_t *imageOffset, const size_t *origin, co
|
||||
// Assumption: all parameters are already validated be calling function
|
||||
cl_int Image::getImageParams(Context *context,
|
||||
cl_mem_flags memFlags,
|
||||
const SurfaceFormatInfo *surfaceFormat,
|
||||
const ClSurfaceFormatInfo *surfaceFormat,
|
||||
const cl_image_desc *imageDesc,
|
||||
size_t *imageRowPitch,
|
||||
size_t *imageSlicePitch) {
|
||||
@@ -676,7 +676,7 @@ cl_int Image::getImageParams(Context *context,
|
||||
ImageInfo imgInfo = {};
|
||||
cl_image_desc imageDescriptor = *imageDesc;
|
||||
imgInfo.imgDesc = Image::convertDescriptor(imageDescriptor);
|
||||
imgInfo.surfaceFormat = surfaceFormat;
|
||||
imgInfo.surfaceFormat = &surfaceFormat->surfaceFormat;
|
||||
|
||||
auto gmm = std::make_unique<Gmm>(clientContext, imgInfo, StorageInfo{});
|
||||
|
||||
@@ -694,7 +694,7 @@ const cl_image_format &Image::getImageFormat() const {
|
||||
return imageFormat;
|
||||
}
|
||||
|
||||
const SurfaceFormatInfo &Image::getSurfaceFormatInfo() const {
|
||||
const ClSurfaceFormatInfo &Image::getSurfaceFormatInfo() const {
|
||||
return surfaceFormatInfo;
|
||||
}
|
||||
|
||||
@@ -828,13 +828,13 @@ cl_int Image::getImageInfo(cl_image_info paramName,
|
||||
|
||||
case CL_IMAGE_ELEMENT_SIZE:
|
||||
srcParamSize = sizeof(size_t);
|
||||
srcParam = &(surfFmtInfo.ImageElementSizeInBytes);
|
||||
srcParam = &(surfFmtInfo.surfaceFormat.ImageElementSizeInBytes);
|
||||
break;
|
||||
|
||||
case CL_IMAGE_ROW_PITCH:
|
||||
srcParamSize = sizeof(size_t);
|
||||
if (mcsSurfaceInfo.multisampleCount > 1) {
|
||||
retParam = imageDesc.image_width * surfFmtInfo.ImageElementSizeInBytes * imageDesc.num_samples;
|
||||
retParam = imageDesc.image_width * surfFmtInfo.surfaceFormat.ImageElementSizeInBytes * imageDesc.num_samples;
|
||||
} else {
|
||||
retParam = hostPtrRowPitch;
|
||||
}
|
||||
@@ -919,11 +919,11 @@ Image *Image::redescribeFillImage() {
|
||||
|
||||
auto imageFormatNew = this->imageFormat;
|
||||
auto imageDescNew = this->imageDesc;
|
||||
const SurfaceFormatInfo *surfaceFormat = nullptr;
|
||||
uint32_t redescribeTableCol = this->surfaceFormatInfo.NumChannels / 2;
|
||||
uint32_t redescribeTableRow = this->surfaceFormatInfo.PerChannelSizeInBytes / 2;
|
||||
const ClSurfaceFormatInfo *surfaceFormat = nullptr;
|
||||
uint32_t redescribeTableCol = this->surfaceFormatInfo.surfaceFormat.NumChannels / 2;
|
||||
uint32_t redescribeTableRow = this->surfaceFormatInfo.surfaceFormat.PerChannelSizeInBytes / 2;
|
||||
|
||||
ArrayRef<const SurfaceFormatInfo> readWriteSurfaceFormats = SurfaceFormats::readWrite();
|
||||
ArrayRef<const ClSurfaceFormatInfo> readWriteSurfaceFormats = SurfaceFormats::readWrite();
|
||||
|
||||
uint32_t surfaceFormatIdx = redescribeTable[redescribeTableRow][redescribeTableCol];
|
||||
surfaceFormat = &readWriteSurfaceFormats[surfaceFormatIdx];
|
||||
@@ -964,12 +964,12 @@ Image *Image::redescribe() {
|
||||
7 // {CL_RGBA, CL_UNSIGNED_INT32} 16 byte
|
||||
};
|
||||
|
||||
const uint32_t bytesPerPixel = this->surfaceFormatInfo.NumChannels * surfaceFormatInfo.PerChannelSizeInBytes;
|
||||
const uint32_t bytesPerPixel = this->surfaceFormatInfo.surfaceFormat.NumChannels * surfaceFormatInfo.surfaceFormat.PerChannelSizeInBytes;
|
||||
const uint32_t exponent = Math::log2(bytesPerPixel);
|
||||
DEBUG_BREAK_IF(exponent >= 5u);
|
||||
const uint32_t surfaceFormatIdx = redescribeTableBytes[exponent % 5];
|
||||
const ArrayRef<const SurfaceFormatInfo> readWriteSurfaceFormats = SurfaceFormats::readWrite();
|
||||
const SurfaceFormatInfo *surfaceFormat = &readWriteSurfaceFormats[surfaceFormatIdx];
|
||||
const ArrayRef<const ClSurfaceFormatInfo> readWriteSurfaceFormats = SurfaceFormats::readWrite();
|
||||
const ClSurfaceFormatInfo *surfaceFormat = &readWriteSurfaceFormats[surfaceFormatIdx];
|
||||
|
||||
auto imageFormatNew = this->imageFormat;
|
||||
imageFormatNew.image_channel_order = surfaceFormat->OCLImageFormat.image_channel_order;
|
||||
@@ -1033,7 +1033,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) {
|
||||
imageDesc.mem_object = this;
|
||||
// get access to the Y plane (CL_R)
|
||||
imageDesc.image_depth = 0;
|
||||
SurfaceFormatInfo *surfaceFormat = (SurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
||||
const ClSurfaceFormatInfo *surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
||||
|
||||
// Create NV12 UV Plane image
|
||||
std::unique_ptr<Image> imageYPlane(Image::create(
|
||||
@@ -1058,7 +1058,7 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) {
|
||||
imageFormat.image_channel_order = CL_RG;
|
||||
|
||||
hostPtr = static_cast<const void *>(static_cast<const char *>(hostPtr) + (hostPtrRowPitch * this->imageDesc.image_height));
|
||||
surfaceFormat = (SurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
||||
surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat);
|
||||
// Create NV12 UV Plane image
|
||||
std::unique_ptr<Image> imageUVPlane(Image::create(
|
||||
context,
|
||||
@@ -1075,13 +1075,13 @@ cl_int Image::writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
const SurfaceFormatInfo *Image::getSurfaceFormatFromTable(cl_mem_flags flags, const cl_image_format *imageFormat) {
|
||||
const ClSurfaceFormatInfo *Image::getSurfaceFormatFromTable(cl_mem_flags flags, const cl_image_format *imageFormat) {
|
||||
if (!imageFormat) {
|
||||
DEBUG_BREAK_IF("Invalid format");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ArrayRef<const SurfaceFormatInfo> formats = SurfaceFormats::surfaceFormats(flags, imageFormat);
|
||||
ArrayRef<const ClSurfaceFormatInfo> formats = SurfaceFormats::surfaceFormats(flags, imageFormat);
|
||||
|
||||
for (auto &format : formats) {
|
||||
if (format.OCLImageFormat.image_channel_data_type == imageFormat->image_channel_data_type &&
|
||||
@@ -1335,7 +1335,7 @@ size_t Image::calculateOffsetForMapping(const MemObjOffsetArray &origin) const {
|
||||
size_t rowPitch = mappingOnCpuAllowed() ? imageDesc.image_row_pitch : getHostPtrRowPitch();
|
||||
size_t slicePitch = mappingOnCpuAllowed() ? imageDesc.image_slice_pitch : getHostPtrSlicePitch();
|
||||
|
||||
size_t offset = getSurfaceFormatInfo().ImageElementSizeInBytes * origin[0];
|
||||
size_t offset = getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes * origin[0];
|
||||
|
||||
switch (imageDesc.image_type) {
|
||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef Image *(*ImageCreatFunc)(Context *context,
|
||||
bool isImageRedescribed,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo *surfaceFormatInfo,
|
||||
const ClSurfaceFormatInfo *surfaceFormatInfo,
|
||||
const SurfaceOffsets *surfaceOffsets);
|
||||
|
||||
typedef struct {
|
||||
@@ -55,7 +55,7 @@ class Image : public MemObj {
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
cl_mem_flags flags,
|
||||
cl_mem_flags_intel flagsIntel,
|
||||
const SurfaceFormatInfo *surfaceFormat,
|
||||
const ClSurfaceFormatInfo *surfaceFormat,
|
||||
const cl_image_desc *imageDesc,
|
||||
const void *hostPtr,
|
||||
cl_int &errcodeRet);
|
||||
@@ -73,15 +73,15 @@ class Image : public MemObj {
|
||||
cl_mem_flags_intel flagsIntel, size_t size, void *hostPtr,
|
||||
const cl_image_format &imageFormat, const cl_image_desc &imageDesc,
|
||||
bool zeroCopy, GraphicsAllocation *graphicsAllocation,
|
||||
bool isObjectRedescribed, uint32_t baseMipLevel, uint32_t mipCount, const SurfaceFormatInfo *surfaceFormatInfo = nullptr);
|
||||
bool isObjectRedescribed, uint32_t baseMipLevel, uint32_t mipCount, const ClSurfaceFormatInfo *surfaceFormatInfo = nullptr);
|
||||
|
||||
static Image *createSharedImage(Context *context, SharingHandler *sharingHandler, const McsSurfaceInfo &mcsSurfaceInfo,
|
||||
GraphicsAllocation *graphicsAllocation, GraphicsAllocation *mcsAllocation,
|
||||
cl_mem_flags flags, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount);
|
||||
cl_mem_flags flags, const ClSurfaceFormatInfo *surfaceFormat, ImageInfo &imgInfo, uint32_t cubeFaceIndex, uint32_t baseMipLevel, uint32_t mipCount);
|
||||
|
||||
static cl_int validate(Context *context,
|
||||
const MemoryPropertiesFlags &memoryProperties,
|
||||
const SurfaceFormatInfo *surfaceFormat,
|
||||
const ClSurfaceFormatInfo *surfaceFormat,
|
||||
const cl_image_desc *imageDesc,
|
||||
const void *hostPtr);
|
||||
static cl_int validateImageFormat(const cl_image_format *imageFormat);
|
||||
@@ -101,7 +101,7 @@ class Image : public MemObj {
|
||||
|
||||
static cl_int getImageParams(Context *context,
|
||||
cl_mem_flags flags,
|
||||
const SurfaceFormatInfo *surfaceFormat,
|
||||
const ClSurfaceFormatInfo *surfaceFormat,
|
||||
const cl_image_desc *imageDesc,
|
||||
size_t *imageRowPitch,
|
||||
size_t *imageSlicePitch);
|
||||
@@ -137,7 +137,7 @@ class Image : public MemObj {
|
||||
|
||||
const cl_image_desc &getImageDesc() const;
|
||||
const cl_image_format &getImageFormat() const;
|
||||
const SurfaceFormatInfo &getSurfaceFormatInfo() const;
|
||||
const ClSurfaceFormatInfo &getSurfaceFormatInfo() const;
|
||||
|
||||
void transferDataToHostPtr(MemObjSizeArray ©Size, MemObjOffsetArray ©Offset) override;
|
||||
void transferDataFromHostPtr(MemObjSizeArray ©Size, MemObjOffsetArray ©Offset) override;
|
||||
@@ -174,7 +174,7 @@ class Image : public MemObj {
|
||||
uint32_t peekMipCount() { return mipCount; }
|
||||
void setMipCount(uint32_t mipCountNew) { this->mipCount = mipCountNew; }
|
||||
|
||||
static const SurfaceFormatInfo *getSurfaceFormatFromTable(cl_mem_flags flags, const cl_image_format *imageFormat);
|
||||
static const ClSurfaceFormatInfo *getSurfaceFormatFromTable(cl_mem_flags flags, const cl_image_format *imageFormat);
|
||||
static cl_int validateRegionAndOrigin(const size_t *origin, const size_t *region, const cl_image_desc &imgDesc);
|
||||
|
||||
cl_int writeNV12Planes(const void *hostPtr, size_t hostPtrRowPitch);
|
||||
@@ -205,7 +205,7 @@ class Image : public MemObj {
|
||||
bool isObjectRedescribed,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo &surfaceFormatInfo,
|
||||
const ClSurfaceFormatInfo &surfaceFormatInfo,
|
||||
const SurfaceOffsets *surfaceOffsets = nullptr);
|
||||
|
||||
void getOsSpecificImageInfo(const cl_mem_info ¶mName, size_t *srcParamSize, void **srcParam);
|
||||
@@ -216,7 +216,7 @@ class Image : public MemObj {
|
||||
|
||||
cl_image_format imageFormat;
|
||||
cl_image_desc imageDesc;
|
||||
SurfaceFormatInfo surfaceFormatInfo;
|
||||
ClSurfaceFormatInfo surfaceFormatInfo;
|
||||
McsSurfaceInfo mcsSurfaceInfo = {};
|
||||
uint32_t qPitch = 0;
|
||||
size_t hostPtrRowPitch = 0;
|
||||
@@ -261,7 +261,7 @@ class ImageHw : public Image {
|
||||
bool isObjectRedescribed,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo &surfaceFormatInfo,
|
||||
const ClSurfaceFormatInfo &surfaceFormatInfo,
|
||||
const SurfaceOffsets *surfaceOffsets = nullptr)
|
||||
: Image(context, memoryProperties, flags, flagsIntel, size, hostPtr, imageFormat, imageDesc,
|
||||
zeroCopy, graphicsAllocation, isObjectRedescribed, baseMipLevel, mipCount, surfaceFormatInfo, surfaceOffsets) {
|
||||
@@ -317,7 +317,7 @@ class ImageHw : public Image {
|
||||
bool isObjectRedescribed,
|
||||
uint32_t baseMipLevel,
|
||||
uint32_t mipCount,
|
||||
const SurfaceFormatInfo *surfaceFormatInfo,
|
||||
const ClSurfaceFormatInfo *surfaceFormatInfo,
|
||||
const SurfaceOffsets *surfaceOffsets) {
|
||||
UNRECOVERABLE_IF(surfaceFormatInfo == nullptr);
|
||||
return new ImageHw<GfxFamily>(context,
|
||||
|
||||
@@ -79,11 +79,11 @@ void ImageHw<GfxFamily>::setImageArg(void *memory, bool setAsMediaBlockImage, ui
|
||||
surfaceState->setWidth(static_cast<uint32_t>(Length.SurfaceState.Width + 1));
|
||||
surfaceState->setHeight(static_cast<uint32_t>(Length.SurfaceState.Height + 1));
|
||||
surfaceState->setDepth(static_cast<uint32_t>(Length.SurfaceState.Depth + 1));
|
||||
surfaceState->setSurfacePitch(static_cast<uint32_t>(getSurfaceFormatInfo().ImageElementSizeInBytes));
|
||||
surfaceState->setSurfacePitch(static_cast<uint32_t>(getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes));
|
||||
surfaceState->setSurfaceType(RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER);
|
||||
} else {
|
||||
if (setAsMediaBlockImage) {
|
||||
uint32_t elSize = static_cast<uint32_t>(getSurfaceFormatInfo().ImageElementSizeInBytes);
|
||||
uint32_t elSize = static_cast<uint32_t>(getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes);
|
||||
surfaceState->setWidth(static_cast<uint32_t>((getImageDesc().image_width * elSize) / sizeof(uint32_t)));
|
||||
} else {
|
||||
surfaceState->setWidth(static_cast<uint32_t>(getImageDesc().image_width));
|
||||
@@ -104,7 +104,7 @@ void ImageHw<GfxFamily>::setImageArg(void *memory, bool setAsMediaBlockImage, ui
|
||||
// SurfaceQpitch is in rows but must be a multiple of VALIGN
|
||||
surfaceState->setSurfaceQpitch(qPitch);
|
||||
|
||||
surfaceState->setSurfaceFormat(static_cast<SURFACE_FORMAT>(getSurfaceFormatInfo().GenxSurfaceFormat));
|
||||
surfaceState->setSurfaceFormat(static_cast<SURFACE_FORMAT>(getSurfaceFormatInfo().surfaceFormat.GenxSurfaceFormat));
|
||||
surfaceState->setSurfaceArray(isImageArray);
|
||||
|
||||
cl_channel_order imgChannelOrder = getSurfaceFormatInfo().OCLImageFormat.image_channel_order;
|
||||
|
||||
@@ -81,10 +81,10 @@ void D3DSharing<D3D>::updateImgInfoAndDesc(Gmm *gmm, ImageInfo &imgInfo, ImagePl
|
||||
}
|
||||
|
||||
template <typename D3D>
|
||||
const SurfaceFormatInfo *D3DSharing<D3D>::findSurfaceFormatInfo(GMM_RESOURCE_FORMAT_ENUM gmmFormat, cl_mem_flags flags) {
|
||||
ArrayRef<const SurfaceFormatInfo> formats = SurfaceFormats::surfaceFormats(flags);
|
||||
const ClSurfaceFormatInfo *D3DSharing<D3D>::findSurfaceFormatInfo(GMM_RESOURCE_FORMAT_ENUM gmmFormat, cl_mem_flags flags) {
|
||||
ArrayRef<const ClSurfaceFormatInfo> formats = SurfaceFormats::surfaceFormats(flags);
|
||||
for (auto &format : formats) {
|
||||
if (gmmFormat == format.GMMSurfaceFormat) {
|
||||
if (gmmFormat == format.surfaceFormat.GMMSurfaceFormat) {
|
||||
return &format;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace NEO {
|
||||
enum class ImagePlane;
|
||||
class Context;
|
||||
class Gmm;
|
||||
struct SurfaceFormatInfo;
|
||||
struct ClSurfaceFormatInfo;
|
||||
struct ImageInfo;
|
||||
|
||||
template <typename D3D>
|
||||
@@ -36,7 +36,7 @@ class D3DSharing : public SharingHandler {
|
||||
unsigned int &getSubresource() { return subresource; }
|
||||
typename D3DQuery *getQuery() { return d3dQuery; }
|
||||
bool isSharedResource() { return sharedResource; }
|
||||
static const SurfaceFormatInfo *findSurfaceFormatInfo(GMM_RESOURCE_FORMAT_ENUM gmmFormat, cl_mem_flags flags);
|
||||
static const ClSurfaceFormatInfo *findSurfaceFormatInfo(GMM_RESOURCE_FORMAT_ENUM gmmFormat, cl_mem_flags flags);
|
||||
static bool isFormatWithPlane1(DXGI_FORMAT format);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -70,7 +70,8 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
|
||||
}
|
||||
|
||||
imgInfo.plane = GmmTypesConverter::convertPlane(imagePlane);
|
||||
imgInfo.surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imgFormat);
|
||||
auto *clSurfaceFormat = Image::getSurfaceFormatFromTable(flags, &imgFormat);
|
||||
imgInfo.surfaceFormat = &clSurfaceFormat->surfaceFormat;
|
||||
|
||||
bool isSharedResource = false;
|
||||
bool lockable = false;
|
||||
@@ -105,7 +106,7 @@ Image *D3DSurface::create(Context *context, cl_dx9_surface_info_khr *surfaceInfo
|
||||
|
||||
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);
|
||||
return Image::createSharedImage(context, surface, mcsSurfaceInfo, alloc, nullptr, flags, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, 0, 0);
|
||||
}
|
||||
|
||||
void D3DSurface::synchronizeObject(UpdateData &updateData) {
|
||||
|
||||
@@ -79,10 +79,13 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
|
||||
|
||||
auto d3dTextureObj = new D3DTexture<D3D>(context, d3dTexture, subresource, textureStaging, sharedResource);
|
||||
|
||||
const ClSurfaceFormatInfo *clSurfaceFormat = nullptr;
|
||||
if ((textureDesc.Format == DXGI_FORMAT_NV12) || (textureDesc.Format == DXGI_FORMAT_P010) || (textureDesc.Format == DXGI_FORMAT_P016)) {
|
||||
imgInfo.surfaceFormat = findYuvSurfaceFormatInfo(textureDesc.Format, imagePlane, flags);
|
||||
clSurfaceFormat = findYuvSurfaceFormatInfo(textureDesc.Format, imagePlane, flags);
|
||||
imgInfo.surfaceFormat = &clSurfaceFormat->surfaceFormat;
|
||||
} else {
|
||||
imgInfo.surfaceFormat = findSurfaceFormatInfo(alloc->getDefaultGmm()->gmmResourceInfo->getResourceFormat(), flags);
|
||||
clSurfaceFormat = findSurfaceFormatInfo(alloc->getDefaultGmm()->gmmResourceInfo->getResourceFormat(), flags);
|
||||
imgInfo.surfaceFormat = &clSurfaceFormat->surfaceFormat;
|
||||
}
|
||||
|
||||
auto hwInfo = memoryManager->peekExecutionEnvironment().getHardwareInfo();
|
||||
@@ -92,7 +95,7 @@ Image *D3DTexture<D3D>::create2d(Context *context, D3DTexture2d *d3dTexture, cl_
|
||||
: true;
|
||||
}
|
||||
|
||||
return Image::createSharedImage(context, d3dTextureObj, mcsSurfaceInfo, alloc, nullptr, flags, imgInfo, __GMM_NO_CUBE_MAP, 0, 0);
|
||||
return Image::createSharedImage(context, d3dTextureObj, mcsSurfaceInfo, alloc, nullptr, flags, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, 0, 0);
|
||||
}
|
||||
|
||||
template <typename D3D>
|
||||
@@ -140,10 +143,10 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
|
||||
updateImgInfoAndDesc(alloc->getDefaultGmm(), imgInfo, ImagePlane::NO_PLANE, 0u);
|
||||
|
||||
auto d3dTextureObj = new D3DTexture<D3D>(context, d3dTexture, subresource, textureStaging, sharedResource);
|
||||
|
||||
auto *clSurfaceFormat = findSurfaceFormatInfo(alloc->getDefaultGmm()->gmmResourceInfo->getResourceFormat(), flags);
|
||||
imgInfo.qPitch = alloc->getDefaultGmm()->queryQPitch(GMM_RESOURCE_TYPE::RESOURCE_3D);
|
||||
|
||||
imgInfo.surfaceFormat = findSurfaceFormatInfo(alloc->getDefaultGmm()->gmmResourceInfo->getResourceFormat(), flags);
|
||||
imgInfo.surfaceFormat = &clSurfaceFormat->surfaceFormat;
|
||||
|
||||
auto hwInfo = memoryManager->peekExecutionEnvironment().getHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
@@ -152,11 +155,11 @@ Image *D3DTexture<D3D>::create3d(Context *context, D3DTexture3d *d3dTexture, cl_
|
||||
: true;
|
||||
}
|
||||
|
||||
return Image::createSharedImage(context, d3dTextureObj, mcsSurfaceInfo, alloc, nullptr, flags, imgInfo, __GMM_NO_CUBE_MAP, 0, 0);
|
||||
return Image::createSharedImage(context, d3dTextureObj, mcsSurfaceInfo, alloc, nullptr, flags, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, 0, 0);
|
||||
}
|
||||
|
||||
template <typename D3D>
|
||||
const SurfaceFormatInfo *D3DTexture<D3D>::findYuvSurfaceFormatInfo(DXGI_FORMAT dxgiFormat, ImagePlane imagePlane, cl_mem_flags flags) {
|
||||
const ClSurfaceFormatInfo *D3DTexture<D3D>::findYuvSurfaceFormatInfo(DXGI_FORMAT dxgiFormat, ImagePlane imagePlane, cl_mem_flags flags) {
|
||||
cl_image_format imgFormat = {};
|
||||
if (imagePlane == ImagePlane::PLANE_Y) {
|
||||
imgFormat.image_channel_order = CL_R;
|
||||
|
||||
@@ -27,7 +27,7 @@ class D3DTexture : public D3DSharing<D3D> {
|
||||
|
||||
static Image *create3d(Context *context, D3DTexture3d *d3dTexture, cl_mem_flags flags, cl_uint subresource, cl_int *retCode);
|
||||
|
||||
static const SurfaceFormatInfo *findYuvSurfaceFormatInfo(DXGI_FORMAT dxgiFormat, ImagePlane imagePlane, cl_mem_flags flags);
|
||||
static const ClSurfaceFormatInfo *findYuvSurfaceFormatInfo(DXGI_FORMAT dxgiFormat, ImagePlane imagePlane, cl_mem_flags flags);
|
||||
|
||||
protected:
|
||||
D3DTexture(Context *context, D3DResource *d3dTexture, cl_uint subresource, D3DResource *textureStaging, bool sharedResource)
|
||||
|
||||
@@ -112,7 +112,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
||||
}
|
||||
auto surfaceFormatInfo = *surfaceFormatInfoAddress;
|
||||
if (texInfo.glInternalFormat != GL_RGB10) {
|
||||
surfaceFormatInfo.GenxSurfaceFormat = (GFX3DSTATE_SURFACEFORMAT)texInfo.glHWFormat;
|
||||
surfaceFormatInfo.surfaceFormat.GenxSurfaceFormat = (GFX3DSTATE_SURFACEFORMAT)texInfo.glHWFormat;
|
||||
}
|
||||
|
||||
GraphicsAllocation *mcsAlloc = nullptr;
|
||||
@@ -134,7 +134,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
||||
|
||||
ImageInfo imgInfo = {};
|
||||
imgInfo.imgDesc = Image::convertDescriptor(imgDesc);
|
||||
imgInfo.surfaceFormat = &surfaceFormatInfo;
|
||||
imgInfo.surfaceFormat = &surfaceFormatInfo.surfaceFormat;
|
||||
imgInfo.qPitch = qPitch;
|
||||
|
||||
auto glTexture = new GlTexture(sharingFunctions, getClGlObjectType(target), texture, texInfo, target, std::max(miplevel, 0));
|
||||
@@ -146,7 +146,7 @@ Image *GlTexture::createSharedGlTexture(Context *context, cl_mem_flags flags, cl
|
||||
: true;
|
||||
}
|
||||
|
||||
return Image::createSharedImage(context, glTexture, mcsSurfaceInfo, alloc, mcsAlloc, flags, imgInfo, cubeFaceIndex,
|
||||
return Image::createSharedImage(context, glTexture, mcsSurfaceInfo, alloc, mcsAlloc, flags, &surfaceFormatInfo, imgInfo, cubeFaceIndex,
|
||||
std::max(miplevel, 0), imgInfo.imgDesc.numMipLevels);
|
||||
} // namespace NEO
|
||||
|
||||
|
||||
@@ -24,9 +24,10 @@ Image *UnifiedImage::createSharedUnifiedImage(Context *context, cl_mem_flags fla
|
||||
ErrorCodeHelper errorCode(errcodeRet, CL_SUCCESS);
|
||||
UnifiedSharingFunctions *sharingFunctions = context->getSharing<UnifiedSharingFunctions>();
|
||||
|
||||
auto *clSurfaceFormat = Image::getSurfaceFormatFromTable(flags, imageFormat);
|
||||
ImageInfo imgInfo = {};
|
||||
imgInfo.imgDesc = Image::convertDescriptor(*imageDesc);
|
||||
imgInfo.surfaceFormat = Image::getSurfaceFormatFromTable(flags, imageFormat);
|
||||
imgInfo.surfaceFormat = &clSurfaceFormat->surfaceFormat;
|
||||
|
||||
GraphicsAllocation *graphicsAllocation = createGraphicsAllocation(context, description);
|
||||
if (!graphicsAllocation) {
|
||||
@@ -47,7 +48,7 @@ Image *UnifiedImage::createSharedUnifiedImage(Context *context, cl_mem_flags fla
|
||||
const uint32_t sharedMipmapsCount = imageDesc->num_mip_levels;
|
||||
auto sharingHandler = new UnifiedImage(sharingFunctions, description.type);
|
||||
return Image::createSharedImage(context, sharingHandler, McsSurfaceInfo{}, graphicsAllocation, nullptr,
|
||||
flags, imgInfo, __GMM_NO_CUBE_MAP, baseMipmapIndex, sharedMipmapsCount);
|
||||
flags, clSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, baseMipmapIndex, sharedMipmapsCount);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -56,7 +56,7 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
|
||||
channelType = CL_UNORM_INT16;
|
||||
gmmSurfaceFormat = getExtendedSurfaceFormatInfo(vaImage.format.fourcc);
|
||||
}
|
||||
imgInfo.surfaceFormat = gmmSurfaceFormat;
|
||||
imgInfo.surfaceFormat = &gmmSurfaceFormat->surfaceFormat;
|
||||
|
||||
cl_image_format imgFormat = {channelOrder, channelType};
|
||||
auto imgSurfaceFormat = Image::getSurfaceFormatFromTable(flags, &imgFormat);
|
||||
@@ -69,7 +69,7 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
|
||||
imgDesc.image_row_pitch = imgInfo.rowPitch;
|
||||
imgDesc.image_slice_pitch = 0u;
|
||||
imgInfo.slicePitch = 0u;
|
||||
imgInfo.surfaceFormat = imgSurfaceFormat;
|
||||
imgInfo.surfaceFormat = &imgSurfaceFormat->surfaceFormat;
|
||||
if (plane == 1) {
|
||||
imgDesc.image_width /= 2;
|
||||
imgDesc.image_height /= 2;
|
||||
@@ -83,7 +83,7 @@ Image *VASurface::createSharedVaSurface(Context *context, VASharingFunctions *sh
|
||||
|
||||
auto vaSurface = new VASurface(sharingFunctions, imageId, plane, surface, context->getInteropUserSyncEnabled());
|
||||
|
||||
auto image = Image::createSharedImage(context, vaSurface, mcsSurfaceInfo, alloc, nullptr, flags, imgInfo, __GMM_NO_CUBE_MAP, 0, 0);
|
||||
auto image = Image::createSharedImage(context, vaSurface, mcsSurfaceInfo, alloc, nullptr, flags, imgSurfaceFormat, imgInfo, __GMM_NO_CUBE_MAP, 0, 0);
|
||||
image->setMediaPlaneType(plane);
|
||||
return image;
|
||||
}
|
||||
@@ -115,15 +115,15 @@ bool VASurface::validate(cl_mem_flags flags, cl_uint plane) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const SurfaceFormatInfo *VASurface::getExtendedSurfaceFormatInfo(uint32_t formatFourCC) {
|
||||
const ClSurfaceFormatInfo *VASurface::getExtendedSurfaceFormatInfo(uint32_t formatFourCC) {
|
||||
if (formatFourCC == VA_FOURCC_P010) {
|
||||
static const SurfaceFormatInfo formatInfo = {{CL_NV12_INTEL, CL_UNORM_INT16},
|
||||
GMM_RESOURCE_FORMAT::GMM_FORMAT_P010,
|
||||
static_cast<GFX3DSTATE_SURFACEFORMAT>(NUM_GFX3DSTATE_SURFACEFORMATS), // not used for plane images
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2};
|
||||
static const ClSurfaceFormatInfo formatInfo = {{CL_NV12_INTEL, CL_UNORM_INT16},
|
||||
{GMM_RESOURCE_FORMAT::GMM_FORMAT_P010,
|
||||
static_cast<GFX3DSTATE_SURFACEFORMAT>(NUM_GFX3DSTATE_SURFACEFORMATS), // not used for plane images
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2}};
|
||||
return &formatInfo;
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2017-2019 Intel Corporation
|
||||
* Copyright (C) 2017-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -24,7 +24,7 @@ class VASurface : VASharing {
|
||||
void getMemObjectInfo(size_t ¶mValueSize, void *¶mValue) override;
|
||||
|
||||
static bool validate(cl_mem_flags flags, cl_uint plane);
|
||||
static const SurfaceFormatInfo *getExtendedSurfaceFormatInfo(uint32_t formatFourCC);
|
||||
static const ClSurfaceFormatInfo *getExtendedSurfaceFormatInfo(uint32_t formatFourCC);
|
||||
static bool isSupportedFourCC(int fourcc);
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user