2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2019-12-30 14:40:24 +01:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-01-09 16:10:48 +01:00
|
|
|
#include "core/gmm_helper/gmm.h"
|
2019-12-04 12:36:16 +01:00
|
|
|
#include "core/gmm_helper/gmm_helper.h"
|
2019-12-30 14:40:24 +01:00
|
|
|
#include "core/gmm_helper/resource_info.h"
|
2019-08-02 13:25:45 -07:00
|
|
|
#include "core/helpers/aligned_memory.h"
|
2019-11-29 15:41:47 +01:00
|
|
|
#include "core/helpers/hw_cmds.h"
|
2018-07-31 09:52:48 +02:00
|
|
|
#include "runtime/execution_environment/execution_environment.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "runtime/helpers/surface_formats.h"
|
|
|
|
|
#include "runtime/mem_obj/image.h"
|
|
|
|
|
|
2019-10-11 12:54:10 +08:00
|
|
|
#include "image_ext.inl"
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
union SURFACE_STATE_BUFFER_LENGTH {
|
|
|
|
|
uint32_t Length;
|
|
|
|
|
struct SurfaceState {
|
|
|
|
|
uint32_t Width : BITFIELD_RANGE(0, 6);
|
|
|
|
|
uint32_t Height : BITFIELD_RANGE(7, 20);
|
|
|
|
|
uint32_t Depth : BITFIELD_RANGE(21, 31);
|
|
|
|
|
} SurfaceState;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2018-03-12 16:32:08 +01:00
|
|
|
void ImageHw<GfxFamily>::setImageArg(void *memory, bool setAsMediaBlockImage, uint32_t mipLevel) {
|
2017-12-21 00:45:38 +01:00
|
|
|
using SURFACE_FORMAT = typename RENDER_SURFACE_STATE::SURFACE_FORMAT;
|
|
|
|
|
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(memory);
|
2019-03-12 13:24:58 +01:00
|
|
|
auto gmm = getGraphicsAllocation()->getDefaultGmm();
|
2018-07-31 09:52:48 +02:00
|
|
|
auto gmmHelper = executionEnvironment->getGmmHelper();
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
auto imageCount = std::max(getImageDesc().image_depth, getImageDesc().image_array_size);
|
|
|
|
|
if (imageCount == 0) {
|
|
|
|
|
imageCount = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-04 09:58:02 +02:00
|
|
|
bool isImageArray = getImageDesc().image_array_size > 1 &&
|
|
|
|
|
(getImageDesc().image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY ||
|
|
|
|
|
getImageDesc().image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
uint32_t renderTargetViewExtent = static_cast<uint32_t>(imageCount);
|
|
|
|
|
uint32_t minimumArrayElement = 0;
|
|
|
|
|
auto hAlign = RENDER_SURFACE_STATE::SURFACE_HORIZONTAL_ALIGNMENT_HALIGN_4;
|
|
|
|
|
auto vAlign = RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4;
|
|
|
|
|
|
2018-01-23 21:22:08 +01:00
|
|
|
if (gmm) {
|
2019-08-22 08:20:42 +02:00
|
|
|
hAlign = static_cast<typename RENDER_SURFACE_STATE::SURFACE_HORIZONTAL_ALIGNMENT>(gmm->gmmResourceInfo->getHAlignSurfaceState());
|
|
|
|
|
vAlign = static_cast<typename RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT>(gmm->gmmResourceInfo->getVAlignSurfaceState());
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cubeFaceIndex != __GMM_NO_CUBE_MAP) {
|
|
|
|
|
isImageArray = true;
|
|
|
|
|
imageCount = __GMM_MAX_CUBE_FACE - cubeFaceIndex;
|
|
|
|
|
renderTargetViewExtent = 1;
|
|
|
|
|
minimumArrayElement = cubeFaceIndex;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
auto imageHeight = getImageDesc().image_height;
|
|
|
|
|
if (imageHeight == 0) {
|
|
|
|
|
imageHeight = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
|
|
|
|
|
surfaceState->setAuxiliarySurfacePitch(1u);
|
|
|
|
|
surfaceState->setAuxiliarySurfaceQpitch(0u);
|
|
|
|
|
surfaceState->setAuxiliarySurfaceBaseAddress(0u);
|
|
|
|
|
|
|
|
|
|
if (getImageDesc().image_type == CL_MEM_OBJECT_IMAGE1D_BUFFER) {
|
|
|
|
|
// image1d_buffer is image1d created from buffer. The length of buffer could be larger
|
|
|
|
|
// than the maximal image width. Mock image1d_buffer with SURFACE_TYPE_SURFTYPE_BUFFER.
|
|
|
|
|
SURFACE_STATE_BUFFER_LENGTH Length = {0};
|
|
|
|
|
Length.Length = static_cast<uint32_t>(getImageDesc().image_width - 1);
|
|
|
|
|
|
|
|
|
|
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));
|
2020-01-08 17:29:15 +01:00
|
|
|
surfaceState->setSurfacePitch(static_cast<uint32_t>(getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes));
|
2017-12-21 00:45:38 +01:00
|
|
|
surfaceState->setSurfaceType(RENDER_SURFACE_STATE::SURFACE_TYPE_SURFTYPE_BUFFER);
|
|
|
|
|
} else {
|
|
|
|
|
if (setAsMediaBlockImage) {
|
2020-01-08 17:29:15 +01:00
|
|
|
uint32_t elSize = static_cast<uint32_t>(getSurfaceFormatInfo().surfaceFormat.ImageElementSizeInBytes);
|
2017-12-21 00:45:38 +01:00
|
|
|
surfaceState->setWidth(static_cast<uint32_t>((getImageDesc().image_width * elSize) / sizeof(uint32_t)));
|
|
|
|
|
} else {
|
|
|
|
|
surfaceState->setWidth(static_cast<uint32_t>(getImageDesc().image_width));
|
|
|
|
|
}
|
|
|
|
|
surfaceState->setHeight(static_cast<uint32_t>(imageHeight));
|
|
|
|
|
surfaceState->setDepth(static_cast<uint32_t>(imageCount));
|
|
|
|
|
surfaceState->setSurfacePitch(static_cast<uint32_t>(getImageDesc().image_row_pitch));
|
|
|
|
|
surfaceState->setSurfaceType(surfaceType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
surfaceState->setSurfaceBaseAddress(getGraphicsAllocation()->getGpuAddress() + this->surfaceOffsets.offset);
|
|
|
|
|
surfaceState->setRenderTargetViewExtent(renderTargetViewExtent);
|
|
|
|
|
surfaceState->setMinimumArrayElement(minimumArrayElement);
|
2018-04-04 09:29:48 +02:00
|
|
|
surfaceState->setSurfaceMinLod(this->baseMipLevel + mipLevel);
|
2018-04-04 14:52:17 +02:00
|
|
|
surfaceState->setMipCountLod((this->mipCount > 0) ? (this->mipCount - 1) : 0);
|
2019-10-28 08:11:18 +01:00
|
|
|
setMipTailStartLod(surfaceState);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
// SurfaceQpitch is in rows but must be a multiple of VALIGN
|
|
|
|
|
surfaceState->setSurfaceQpitch(qPitch);
|
|
|
|
|
|
2020-01-08 17:29:15 +01:00
|
|
|
surfaceState->setSurfaceFormat(static_cast<SURFACE_FORMAT>(getSurfaceFormatInfo().surfaceFormat.GenxSurfaceFormat));
|
2017-12-21 00:45:38 +01:00
|
|
|
surfaceState->setSurfaceArray(isImageArray);
|
|
|
|
|
|
|
|
|
|
cl_channel_order imgChannelOrder = getSurfaceFormatInfo().OCLImageFormat.image_channel_order;
|
2019-09-11 09:50:18 +02:00
|
|
|
int shaderChannelValue = ImageHw<GfxFamily>::getShaderChannelValue(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_RED, imgChannelOrder);
|
|
|
|
|
surfaceState->setShaderChannelSelectRed(static_cast<typename RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT>(shaderChannelValue));
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
if (imgChannelOrder == CL_LUMINANCE) {
|
2019-09-11 09:50:18 +02:00
|
|
|
surfaceState->setShaderChannelSelectGreen(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_RED);
|
|
|
|
|
surfaceState->setShaderChannelSelectBlue(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_RED);
|
2017-12-21 00:45:38 +01:00
|
|
|
} else {
|
2019-09-11 09:50:18 +02:00
|
|
|
shaderChannelValue = ImageHw<GfxFamily>::getShaderChannelValue(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_GREEN, imgChannelOrder);
|
|
|
|
|
surfaceState->setShaderChannelSelectGreen(static_cast<typename RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT>(shaderChannelValue));
|
|
|
|
|
shaderChannelValue = ImageHw<GfxFamily>::getShaderChannelValue(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_BLUE, imgChannelOrder);
|
|
|
|
|
surfaceState->setShaderChannelSelectBlue(static_cast<typename RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT>(shaderChannelValue));
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (IsNV12Image(&this->getImageFormat())) {
|
2019-09-11 09:50:18 +02:00
|
|
|
surfaceState->setShaderChannelSelectAlpha(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_ONE);
|
2017-12-21 00:45:38 +01:00
|
|
|
} else {
|
2019-09-11 09:50:18 +02:00
|
|
|
surfaceState->setShaderChannelSelectAlpha(RENDER_SURFACE_STATE::SHADER_CHANNEL_SELECT_ALPHA);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
surfaceState->setSurfaceHorizontalAlignment(hAlign);
|
|
|
|
|
surfaceState->setSurfaceVerticalAlignment(vAlign);
|
|
|
|
|
|
2019-01-22 10:24:28 +01:00
|
|
|
uint32_t tileMode = gmm ? gmm->gmmResourceInfo->getTileModeSurfaceState()
|
|
|
|
|
: static_cast<uint32_t>(RENDER_SURFACE_STATE::TILE_MODE_LINEAR);
|
|
|
|
|
|
|
|
|
|
surfaceState->setTileMode(static_cast<typename RENDER_SURFACE_STATE::TILE_MODE>(tileMode));
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-07-23 12:23:48 +02:00
|
|
|
surfaceState->setMemoryObjectControlState(gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE));
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
surfaceState->setXOffset(this->surfaceOffsets.xOffset);
|
|
|
|
|
surfaceState->setYOffset(this->surfaceOffsets.yOffset);
|
|
|
|
|
|
2019-10-22 16:51:08 +02:00
|
|
|
surfaceState->setCoherencyType(RENDER_SURFACE_STATE::COHERENCY_TYPE_GPU_COHERENT);
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
if (IsNV12Image(&this->getImageFormat())) {
|
|
|
|
|
surfaceState->setYOffsetForUOrUvPlane(this->surfaceOffsets.yOffsetForUVplane);
|
|
|
|
|
surfaceState->setXOffsetForUOrUvPlane(this->surfaceOffsets.xOffset);
|
|
|
|
|
} else {
|
|
|
|
|
surfaceState->setYOffsetForUOrUvPlane(0);
|
|
|
|
|
surfaceState->setXOffsetForUOrUvPlane(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
surfaceState->setNumberOfMultisamples((typename RENDER_SURFACE_STATE::NUMBER_OF_MULTISAMPLES)mcsSurfaceInfo.multisampleCount);
|
|
|
|
|
surfaceState->setMultisampledSurfaceStorageFormat(RENDER_SURFACE_STATE::MULTISAMPLED_SURFACE_STORAGE_FORMAT::MULTISAMPLED_SURFACE_STORAGE_FORMAT_MSS);
|
|
|
|
|
|
2018-01-23 21:22:08 +01:00
|
|
|
if (imageDesc.num_samples > 1) {
|
|
|
|
|
setAuxParamsForMultisamples(surfaceState);
|
|
|
|
|
} else if (gmm && gmm->isRenderCompressed) {
|
|
|
|
|
setAuxParamsForCCS(surfaceState, gmm);
|
|
|
|
|
}
|
2018-01-23 13:40:37 +01:00
|
|
|
appendSurfaceStateParams(surfaceState);
|
2019-10-11 12:54:10 +08:00
|
|
|
appendSurfaceStateExt(surfaceState);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2018-01-23 21:22:08 +01:00
|
|
|
void ImageHw<GfxFamily>::setAuxParamsForMultisamples(RENDER_SURFACE_STATE *surfaceState) {
|
2018-04-12 14:26:36 +02:00
|
|
|
using SURFACE_FORMAT = typename RENDER_SURFACE_STATE::SURFACE_FORMAT;
|
|
|
|
|
|
2018-01-23 21:22:08 +01:00
|
|
|
if (getMcsAllocation()) {
|
2019-03-12 13:24:58 +01:00
|
|
|
auto mcsGmm = getMcsAllocation()->getDefaultGmm();
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-01-30 11:29:48 +01:00
|
|
|
if (mcsGmm->unifiedAuxTranslationCapable() && mcsGmm->hasMultisampleControlSurface()) {
|
|
|
|
|
setAuxParamsForMCSCCS(surfaceState, mcsGmm);
|
2019-02-08 10:19:22 +01:00
|
|
|
surfaceState->setAuxiliarySurfacePitch(mcsGmm->getUnifiedAuxPitchTiles());
|
|
|
|
|
surfaceState->setAuxiliarySurfaceQpitch(mcsGmm->getAuxQPitch());
|
2019-01-30 11:29:48 +01:00
|
|
|
setClearColorParams(surfaceState, mcsGmm);
|
|
|
|
|
setUnifiedAuxBaseAddress(surfaceState, mcsGmm);
|
|
|
|
|
} else if (mcsGmm->unifiedAuxTranslationCapable()) {
|
2018-01-23 21:22:08 +01:00
|
|
|
setAuxParamsForCCS(surfaceState, mcsGmm);
|
|
|
|
|
} else {
|
2017-12-21 00:45:38 +01:00
|
|
|
surfaceState->setAuxiliarySurfaceMode((typename RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE)1);
|
|
|
|
|
surfaceState->setAuxiliarySurfacePitch(mcsSurfaceInfo.pitch);
|
|
|
|
|
surfaceState->setAuxiliarySurfaceQpitch(mcsSurfaceInfo.qPitch);
|
|
|
|
|
surfaceState->setAuxiliarySurfaceBaseAddress(mcsAllocation->getGpuAddress());
|
|
|
|
|
}
|
2018-04-12 14:26:36 +02:00
|
|
|
} else if (isDepthFormat(imageFormat) && surfaceState->getSurfaceFormat() != SURFACE_FORMAT::SURFACE_FORMAT_R32_FLOAT_X8X24_TYPELESS) {
|
2018-01-23 21:22:08 +01:00
|
|
|
surfaceState->setMultisampledSurfaceStorageFormat(RENDER_SURFACE_STATE::MULTISAMPLED_SURFACE_STORAGE_FORMAT::MULTISAMPLED_SURFACE_STORAGE_FORMAT_DEPTH_STENCIL);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-23 21:22:08 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
void ImageHw<GfxFamily>::setAuxParamsForCCS(RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) {
|
2018-07-10 11:51:30 +02:00
|
|
|
// Its expected to not program pitch/qpitch/baseAddress for Aux surface in CCS scenarios
|
2018-07-05 09:00:55 +02:00
|
|
|
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
2019-08-21 15:42:49 +02:00
|
|
|
setFlagsForMediaCompression(surfaceState, gmm);
|
|
|
|
|
|
2018-07-10 10:46:28 +02:00
|
|
|
setClearColorParams(surfaceState, gmm);
|
2019-01-30 11:29:48 +01:00
|
|
|
setUnifiedAuxBaseAddress(surfaceState, gmm);
|
2018-07-10 10:46:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2019-01-30 11:29:48 +01:00
|
|
|
void ImageHw<GfxFamily>::setUnifiedAuxBaseAddress(RENDER_SURFACE_STATE *surfaceState, const Gmm *gmm) {
|
|
|
|
|
uint64_t baseAddress = surfaceState->getSurfaceBaseAddress() +
|
2019-09-09 00:25:12 -07:00
|
|
|
gmm->gmmResourceInfo->getUnifiedAuxSurfaceOffset(GMM_UNIFIED_AUX_TYPE::GMM_AUX_SURF);
|
2019-01-30 11:29:48 +01:00
|
|
|
surfaceState->setAuxiliarySurfaceBaseAddress(baseAddress);
|
2018-01-23 21:22:08 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-23 13:40:37 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
void ImageHw<GfxFamily>::appendSurfaceStateParams(RENDER_SURFACE_STATE *surfaceState) {
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
template <typename GfxFamily>
|
2019-08-21 15:42:49 +02:00
|
|
|
void ImageHw<GfxFamily>::setFlagsForMediaCompression(RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) {
|
|
|
|
|
if (gmm->gmmResourceInfo->getResourceFlags()->Info.MediaCompressed) {
|
|
|
|
|
surfaceState->setAuxiliarySurfaceMode(AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2017-12-21 00:45:38 +01:00
|
|
|
void ImageHw<GfxFamily>::setMediaImageArg(void *memory) {
|
|
|
|
|
using MEDIA_SURFACE_STATE = typename GfxFamily::MEDIA_SURFACE_STATE;
|
|
|
|
|
using SURFACE_FORMAT = typename MEDIA_SURFACE_STATE::SURFACE_FORMAT;
|
|
|
|
|
SURFACE_FORMAT surfaceFormat = MEDIA_SURFACE_STATE::SURFACE_FORMAT_Y8_UNORM_VA;
|
|
|
|
|
|
2018-07-31 09:52:48 +02:00
|
|
|
auto gmmHelper = executionEnvironment->getGmmHelper();
|
2017-12-21 00:45:38 +01:00
|
|
|
auto surfaceState = reinterpret_cast<MEDIA_SURFACE_STATE *>(memory);
|
2019-01-17 17:10:12 +01:00
|
|
|
*surfaceState = GfxFamily::cmdInitMediaSurfaceState;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
setMediaSurfaceRotation(reinterpret_cast<void *>(surfaceState));
|
|
|
|
|
|
|
|
|
|
DEBUG_BREAK_IF(surfaceFormat == MEDIA_SURFACE_STATE::SURFACE_FORMAT_Y1_UNORM);
|
|
|
|
|
surfaceState->setWidth(static_cast<uint32_t>(getImageDesc().image_width));
|
|
|
|
|
|
|
|
|
|
surfaceState->setHeight(static_cast<uint32_t>(getImageDesc().image_height));
|
|
|
|
|
surfaceState->setPictureStructure(MEDIA_SURFACE_STATE::PICTURE_STRUCTURE_FRAME_PICTURE);
|
|
|
|
|
|
2019-09-09 10:49:41 +02:00
|
|
|
auto gmm = getGraphicsAllocation()->getDefaultGmm();
|
|
|
|
|
auto tileMode = static_cast<typename MEDIA_SURFACE_STATE::TILE_MODE>(gmm->gmmResourceInfo->getTileModeSurfaceState());
|
|
|
|
|
|
|
|
|
|
surfaceState->setTileMode(tileMode);
|
2017-12-21 00:45:38 +01:00
|
|
|
surfaceState->setSurfacePitch(static_cast<uint32_t>(getImageDesc().image_row_pitch));
|
|
|
|
|
|
|
|
|
|
surfaceState->setSurfaceFormat(surfaceFormat);
|
|
|
|
|
|
|
|
|
|
surfaceState->setHalfPitchForChroma(false);
|
|
|
|
|
surfaceState->setInterleaveChroma(false);
|
|
|
|
|
surfaceState->setXOffsetForUCb(0);
|
|
|
|
|
surfaceState->setYOffsetForUCb(0);
|
|
|
|
|
surfaceState->setXOffsetForVCr(0);
|
|
|
|
|
surfaceState->setYOffsetForVCr(0);
|
|
|
|
|
|
|
|
|
|
setSurfaceMemoryObjectControlStateIndexToMocsTable(
|
|
|
|
|
reinterpret_cast<void *>(surfaceState),
|
2018-07-23 12:23:48 +02:00
|
|
|
gmmHelper->getMOCS(GMM_RESOURCE_USAGE_OCL_IMAGE));
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
if (IsNV12Image(&this->getImageFormat())) {
|
|
|
|
|
surfaceState->setInterleaveChroma(true);
|
|
|
|
|
surfaceState->setYOffsetForUCb(this->surfaceOffsets.yOffsetForUVplane);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
surfaceState->setVerticalLineStride(0);
|
|
|
|
|
surfaceState->setVerticalLineStrideOffset(0);
|
|
|
|
|
|
|
|
|
|
surfaceState->setSurfaceBaseAddress(getGraphicsAllocation()->getGpuAddress() + this->surfaceOffsets.offset);
|
|
|
|
|
}
|
2018-03-27 14:30:05 +02:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
void ImageHw<GfxFamily>::transformImage2dArrayTo3d(void *memory) {
|
|
|
|
|
DEBUG_BREAK_IF(imageDesc.image_type != CL_MEM_OBJECT_IMAGE3D);
|
|
|
|
|
using SURFACE_TYPE = typename RENDER_SURFACE_STATE::SURFACE_TYPE;
|
|
|
|
|
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(memory);
|
|
|
|
|
surfaceState->setSurfaceType(SURFACE_TYPE::SURFACE_TYPE_SURFTYPE_3D);
|
|
|
|
|
surfaceState->setSurfaceArray(false);
|
|
|
|
|
}
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
void ImageHw<GfxFamily>::transformImage3dTo2dArray(void *memory) {
|
|
|
|
|
DEBUG_BREAK_IF(imageDesc.image_type != CL_MEM_OBJECT_IMAGE3D);
|
|
|
|
|
using SURFACE_TYPE = typename RENDER_SURFACE_STATE::SURFACE_TYPE;
|
|
|
|
|
auto surfaceState = reinterpret_cast<RENDER_SURFACE_STATE *>(memory);
|
|
|
|
|
surfaceState->setSurfaceType(SURFACE_TYPE::SURFACE_TYPE_SURFTYPE_2D);
|
|
|
|
|
surfaceState->setSurfaceArray(true);
|
|
|
|
|
}
|
2019-05-21 11:38:54 +02:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
void ImageHw<GfxFamily>::setClearColorParams(RENDER_SURFACE_STATE *surfaceState, const Gmm *gmm) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
void ImageHw<GfxFamily>::setAuxParamsForMCSCCS(RENDER_SURFACE_STATE *surfaceState, Gmm *gmm) {
|
|
|
|
|
}
|
2019-10-28 08:11:18 +01:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
void ImageHw<GfxFamily>::setMipTailStartLod(RENDER_SURFACE_STATE *surfaceState) {
|
|
|
|
|
surfaceState->setMipTailStartLod(0);
|
|
|
|
|
|
|
|
|
|
if (auto gmm = getGraphicsAllocation()->getDefaultGmm()) {
|
|
|
|
|
surfaceState->setMipTailStartLod(gmm->gmmResourceInfo->getMipTailStartLodSurfaceState());
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|