mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-19 06:24:51 +08:00
refactor: reduce including gmmlib headers
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
95f69a5107
commit
3cd135e165
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2023 Intel Corporation
|
||||
* Copyright (C) 2019-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "opencl/source/helpers/gmm_types_converter.h"
|
||||
|
||||
#include "shared/source/gmm_helper/gmm_lib.h"
|
||||
#include "shared/source/helpers/get_info.h"
|
||||
#include "shared/source/helpers/surface_format_info.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
@@ -41,19 +42,14 @@ uint32_t GmmTypesConverter::getRenderMultisamplesCount(uint32_t numSamples) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
GMM_YUV_PLANE GmmTypesConverter::convertPlane(ImagePlane imagePlane) {
|
||||
if (imagePlane == ImagePlane::planeY) {
|
||||
return GMM_PLANE_Y;
|
||||
} else if (imagePlane == ImagePlane::planeU || imagePlane == ImagePlane::planeUV) {
|
||||
return GMM_PLANE_U;
|
||||
} else if (imagePlane == ImagePlane::planeV) {
|
||||
return GMM_PLANE_V;
|
||||
ImagePlane GmmTypesConverter::convertPlane(ImagePlane imagePlane) {
|
||||
if (imagePlane == ImagePlane::planeUV) {
|
||||
return ImagePlane::planeU;
|
||||
}
|
||||
|
||||
return GMM_NO_PLANE;
|
||||
return imagePlane;
|
||||
}
|
||||
|
||||
GMM_CUBE_FACE_ENUM GmmTypesConverter::getCubeFaceIndex(uint32_t target) {
|
||||
GmmCubeFace GmmTypesConverter::getCubeFaceIndex(uint32_t target) {
|
||||
switch (target) {
|
||||
case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
|
||||
return __GMM_CUBE_FACE_NEG_X;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
* Copyright (C) 2019-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/gmm_helper/gmm_lib.h"
|
||||
#include "shared/source/helpers/surface_format_info.h"
|
||||
|
||||
namespace NEO {
|
||||
enum class ImagePlane;
|
||||
@@ -15,8 +15,8 @@ struct ImageInfo;
|
||||
|
||||
struct GmmTypesConverter {
|
||||
static void queryImgFromBufferParams(ImageInfo &imgInfo, GraphicsAllocation *gfxAlloc);
|
||||
static GMM_CUBE_FACE_ENUM getCubeFaceIndex(uint32_t target);
|
||||
static GmmCubeFace getCubeFaceIndex(uint32_t target);
|
||||
static uint32_t getRenderMultisamplesCount(uint32_t numSamples);
|
||||
static GMM_YUV_PLANE convertPlane(ImagePlane imagePlane);
|
||||
static ImagePlane convertPlane(ImagePlane imagePlane);
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -173,8 +173,8 @@ class Image : public MemObj {
|
||||
bool getIsDisplayable() const { return isDisplayable; }
|
||||
void setIsDisplayable(bool displayable) { this->isDisplayable = displayable; }
|
||||
|
||||
void setCubeFaceIndex(uint32_t index) { cubeFaceIndex = index; }
|
||||
uint32_t getCubeFaceIndex() { return cubeFaceIndex; }
|
||||
void setCubeFaceIndex(GmmCubeFace index) { cubeFaceIndex = index; }
|
||||
GmmCubeFace getCubeFaceIndex() { return cubeFaceIndex; }
|
||||
void setMediaPlaneType(cl_uint type) { mediaPlaneType = type; }
|
||||
cl_uint getMediaPlaneType() const { return mediaPlaneType; }
|
||||
int peekBaseMipLevel() { return baseMipLevel; }
|
||||
@@ -242,7 +242,7 @@ class Image : public MemObj {
|
||||
size_t hostPtrRowPitch = 0;
|
||||
size_t hostPtrSlicePitch = 0;
|
||||
size_t imageCount = 0;
|
||||
uint32_t cubeFaceIndex = gmmNoCubeMap;
|
||||
GmmCubeFace cubeFaceIndex = gmmNoCubeMap;
|
||||
cl_uint mediaPlaneType = 0;
|
||||
SurfaceOffsets surfaceOffsets = {0};
|
||||
uint32_t baseMipLevel = 0;
|
||||
|
||||
@@ -116,7 +116,7 @@ HWTEST_F(AUBCreateImageArray, Given1DImageArrayThenExpectationsMet) {
|
||||
EXPECT_EQ(image->getImageDesc().image_row_pitch, imgInfo.rowPitch);
|
||||
EXPECT_GE(image->getImageDesc().image_slice_pitch, image->getImageDesc().image_row_pitch);
|
||||
EXPECT_EQ(image->getQPitch(), imgInfo.qPitch);
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), static_cast<uint32_t>(__GMM_NO_CUBE_MAP));
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), gmmNoCubeMap);
|
||||
|
||||
auto imageHeight = imageDesc.image_height;
|
||||
std::unique_ptr<uint32_t[]> readMemory(new uint32_t[image->getSize() / sizeof(uint32_t)]);
|
||||
@@ -196,7 +196,7 @@ HWTEST_F(AUBCreateImageArray, Given2DImageArrayThenExpectationsMet) {
|
||||
EXPECT_EQ(image->getImageDesc().image_row_pitch, imgInfo.rowPitch);
|
||||
EXPECT_GE(image->getImageDesc().image_slice_pitch, image->getImageDesc().image_row_pitch);
|
||||
EXPECT_EQ(image->getQPitch(), imgInfo.qPitch);
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), static_cast<uint32_t>(__GMM_NO_CUBE_MAP));
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), gmmNoCubeMap);
|
||||
|
||||
auto imageHeight = imageDesc.image_height;
|
||||
std::unique_ptr<uint32_t[]> readMemory(new uint32_t[image->getSize() / sizeof(uint32_t)]);
|
||||
@@ -316,7 +316,7 @@ HWTEST_P(CopyHostPtrTest, GivenImageWithDoubledRowPitchWhenCreatedWithCopyHostPt
|
||||
EXPECT_EQ(image->getImageDesc().image_slice_pitch, imgInfo.slicePitch);
|
||||
EXPECT_GE(image->getImageDesc().image_slice_pitch, image->getImageDesc().image_row_pitch);
|
||||
EXPECT_EQ(image->getQPitch(), imgInfo.qPitch);
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), static_cast<uint32_t>(__GMM_NO_CUBE_MAP));
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), gmmNoCubeMap);
|
||||
|
||||
// now check if data is properly propagated to image
|
||||
|
||||
|
||||
@@ -42,12 +42,12 @@ struct GmmTests : public MockExecutionEnvironmentGmmFixtureTest {
|
||||
};
|
||||
|
||||
TEST(GmmGlTests, givenGmmWhenAskedforCubeFaceIndexThenProperValueIsReturned) {
|
||||
std::vector<std::pair<GMM_CUBE_FACE_ENUM, uint32_t>> v = {{__GMM_CUBE_FACE_NEG_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X},
|
||||
{__GMM_CUBE_FACE_POS_X, GL_TEXTURE_CUBE_MAP_POSITIVE_X},
|
||||
{__GMM_CUBE_FACE_NEG_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y},
|
||||
{__GMM_CUBE_FACE_POS_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Y},
|
||||
{__GMM_CUBE_FACE_NEG_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z},
|
||||
{__GMM_CUBE_FACE_POS_Z, GL_TEXTURE_CUBE_MAP_POSITIVE_Z}};
|
||||
std::vector<std::pair<GmmCubeFace, uint32_t>> v = {{__GMM_CUBE_FACE_NEG_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X},
|
||||
{__GMM_CUBE_FACE_POS_X, GL_TEXTURE_CUBE_MAP_POSITIVE_X},
|
||||
{__GMM_CUBE_FACE_NEG_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y},
|
||||
{__GMM_CUBE_FACE_POS_Y, GL_TEXTURE_CUBE_MAP_POSITIVE_Y},
|
||||
{__GMM_CUBE_FACE_NEG_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z},
|
||||
{__GMM_CUBE_FACE_POS_Z, GL_TEXTURE_CUBE_MAP_POSITIVE_Z}};
|
||||
|
||||
uint32_t maxVal = 0;
|
||||
for (auto p : v) {
|
||||
@@ -129,11 +129,11 @@ static const cl_mem_object_type imgTypes[6] = {
|
||||
} // namespace GmmTestConst
|
||||
|
||||
TEST_F(GmmTests, WhenConvertingPlanesThenCorrectPlaneIsReturned) {
|
||||
std::vector<std::pair<ImagePlane, GMM_YUV_PLANE>> v = {{ImagePlane::noPlane, GMM_YUV_PLANE::GMM_NO_PLANE},
|
||||
{ImagePlane::planeY, GMM_YUV_PLANE::GMM_PLANE_Y},
|
||||
{ImagePlane::planeU, GMM_YUV_PLANE::GMM_PLANE_U},
|
||||
{ImagePlane::planeUV, GMM_YUV_PLANE::GMM_PLANE_U},
|
||||
{ImagePlane::planeV, GMM_YUV_PLANE::GMM_PLANE_V}};
|
||||
std::vector<std::pair<ImagePlane, ImagePlane>> v = {{ImagePlane::noPlane, ImagePlane::noPlane},
|
||||
{ImagePlane::planeY, ImagePlane::planeY},
|
||||
{ImagePlane::planeU, ImagePlane::planeU},
|
||||
{ImagePlane::planeUV, ImagePlane::planeU},
|
||||
{ImagePlane::planeV, ImagePlane::planeV}};
|
||||
|
||||
for (auto p : v) {
|
||||
EXPECT_TRUE(p.second == GmmTypesConverter::convertPlane(p.first));
|
||||
|
||||
@@ -109,7 +109,7 @@ HWTEST_P(CreateImage1DType, GivenValidTypeWhenCreatingImageThenImageParamsAreCor
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), static_cast<uint32_t>(__GMM_NO_CUBE_MAP));
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), gmmNoCubeMap);
|
||||
|
||||
ASSERT_EQ(true, image->isMemObjZeroCopy());
|
||||
EXPECT_FALSE(image->isImageFromImage());
|
||||
|
||||
@@ -83,7 +83,7 @@ TEST_F(Image2dFromBufferTest, WhenCreatingImage2dFromBufferThenImagePropertiesAr
|
||||
EXPECT_NE(nullptr, imageFromBuffer);
|
||||
|
||||
EXPECT_FALSE(imageFromBuffer->isTiledAllocation());
|
||||
EXPECT_EQ(imageFromBuffer->getCubeFaceIndex(), static_cast<uint32_t>(__GMM_NO_CUBE_MAP));
|
||||
EXPECT_EQ(imageFromBuffer->getCubeFaceIndex(), gmmNoCubeMap);
|
||||
|
||||
delete imageFromBuffer;
|
||||
EXPECT_EQ(1, buffer->getRefInternalCount());
|
||||
|
||||
@@ -91,7 +91,7 @@ HWTEST_P(CreateImage2DType, GivenValidTypeWhenCreatingImageThenImageCreatedWithC
|
||||
ASSERT_TRUE(false);
|
||||
}
|
||||
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), static_cast<uint32_t>(__GMM_NO_CUBE_MAP));
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), gmmNoCubeMap);
|
||||
EXPECT_EQ(!defaultHwInfo->capabilityTable.supportsImages, image->isMemObjZeroCopy());
|
||||
|
||||
typedef typename FamilyType::RENDER_SURFACE_STATE SURFACE_STATE;
|
||||
|
||||
@@ -75,7 +75,7 @@ HWTEST_F(CreateImage3DTest, WhenCreatingImageThenPropertiesAreSetCorrectly) {
|
||||
EXPECT_EQ(0u, imgDesc.image_array_size);
|
||||
EXPECT_NE(0u, imgDesc.image_row_pitch);
|
||||
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), static_cast<uint32_t>(__GMM_NO_CUBE_MAP));
|
||||
EXPECT_EQ(image->getCubeFaceIndex(), gmmNoCubeMap);
|
||||
EXPECT_EQ(!defaultHwInfo->capabilityTable.supportsImages, image->isMemObjZeroCopy());
|
||||
|
||||
typedef typename FamilyType::RENDER_SURFACE_STATE SURFACE_STATE;
|
||||
|
||||
@@ -127,9 +127,9 @@ TEST_P(ImageRedescribeTest, givenImageWhenItIsRedescribedThenNewImageDimensionsA
|
||||
TEST_P(ImageRedescribeTest, givenImageWhenItIsRedescribedThenCubeFaceIndexIsProperlySet) {
|
||||
std::unique_ptr<Image> imageNew(image->redescribe());
|
||||
ASSERT_NE(nullptr, imageNew);
|
||||
ASSERT_EQ(imageNew->getCubeFaceIndex(), __GMM_NO_CUBE_MAP);
|
||||
ASSERT_EQ(imageNew->getCubeFaceIndex(), gmmNoCubeMap);
|
||||
|
||||
for (uint32_t n = __GMM_CUBE_FACE_POS_X; n < __GMM_MAX_CUBE_FACE; n++) {
|
||||
for (GmmCubeFace n = __GMM_CUBE_FACE_POS_X; n < __GMM_MAX_CUBE_FACE; n++) {
|
||||
image->setCubeFaceIndex(n);
|
||||
imageNew.reset(image->redescribe());
|
||||
ASSERT_NE(nullptr, imageNew);
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/gmm_helper/gmm_lib.h"
|
||||
#include "shared/source/memory_manager/graphics_allocation.h"
|
||||
|
||||
namespace NEO {
|
||||
@@ -79,7 +78,4 @@ inline bool isImageDumpFormat(DumpFormat dumpFormat) {
|
||||
|
||||
template <typename GfxFamily>
|
||||
aub_stream::SurfaceInfo *getDumpSurfaceInfo(GraphicsAllocation &gfxAllocation, const GmmHelper &gmmHelper, DumpFormat dumpFormat);
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint32_t getImageSurfaceTypeFromGmmResourceType(GMM_RESOURCE_TYPE gmmResourceType);
|
||||
} // namespace AubAllocDump
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/gmm_helper/gmm_lib.h"
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
namespace NEO {
|
||||
class Device;
|
||||
|
||||
@@ -297,6 +297,7 @@ struct SurfaceOffsets {
|
||||
uint32_t yOffsetForUVplane;
|
||||
};
|
||||
|
||||
constexpr uint32_t gmmNoCubeMap = 7;
|
||||
using GmmCubeFace = int32_t;
|
||||
constexpr GmmCubeFace gmmNoCubeMap = 7;
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "shared/source/command_container/cmdcontainer.h"
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/command_container/encode_surface_state.h"
|
||||
#include "shared/source/gmm_helper/gmm_lib.h"
|
||||
#include "shared/source/helpers/in_order_cmd_helpers.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
|
||||
Reference in New Issue
Block a user