mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 07:14:10 +08:00
Correct media compression format for planar images
Set most significant bit for chroma planes. Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
586e8510de
commit
3123ab5bf9
@@ -148,6 +148,7 @@ TYPED_TEST_P(D3DTests, givenNV12FormatAndEvenPlaneWhen2dCreatedThenSetPlaneParam
|
||||
|
||||
auto image = std::unique_ptr<Image>(D3DTexture<TypeParam>::create2d(this->context, reinterpret_cast<D3DTexture2d *>(&this->dummyD3DTexture), CL_MEM_READ_WRITE, 4, nullptr));
|
||||
ASSERT_NE(nullptr, image.get());
|
||||
EXPECT_EQ(GMM_PLANE_Y, image->getPlane());
|
||||
|
||||
auto expectedFormat = D3DTexture<TypeParam>::findYuvSurfaceFormatInfo(DXGI_FORMAT_NV12, ImagePlane::PLANE_Y, CL_MEM_READ_WRITE);
|
||||
EXPECT_TRUE(memcmp(expectedFormat, &image->getSurfaceFormatInfo(), sizeof(SurfaceFormatInfo)) == 0);
|
||||
@@ -233,6 +234,7 @@ TYPED_TEST_P(D3DTests, givenNV12FormatAndOddPlaneWhen2dCreatedThenSetPlaneParams
|
||||
|
||||
auto image = std::unique_ptr<Image>(D3DTexture<TypeParam>::create2d(this->context, reinterpret_cast<D3DTexture2d *>(&this->dummyD3DTexture), CL_MEM_READ_WRITE, 7, nullptr));
|
||||
ASSERT_NE(nullptr, image.get());
|
||||
EXPECT_EQ(GMM_PLANE_U, image->getPlane());
|
||||
|
||||
auto expectedFormat = D3DTexture<TypeParam>::findYuvSurfaceFormatInfo(DXGI_FORMAT_NV12, ImagePlane::PLANE_UV, CL_MEM_READ_WRITE);
|
||||
EXPECT_TRUE(memcmp(expectedFormat, &image->getSurfaceFormatInfo(), sizeof(SurfaceFormatInfo)) == 0);
|
||||
|
||||
@@ -343,7 +343,7 @@ HWTEST2_F(XeHPAndLaterImageHelperTests, givenMediaCompressedImageWhenAppendingSu
|
||||
const auto expectedGetMediaSurfaceStateCompressionFormatCalled = gmmClientContext->getMediaSurfaceStateCompressionFormatCalled + 1;
|
||||
|
||||
EncodeSurfaceState<FamilyType>::appendImageCompressionParams(&rss, image->getMultiGraphicsAllocation().getDefaultGraphicsAllocation(),
|
||||
context->getDevice(0)->getGmmHelper(), false);
|
||||
context->getDevice(0)->getGmmHelper(), false, GMM_NO_PLANE);
|
||||
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
EXPECT_EQ(mockCompressionFormat, rss.getCompressionFormat());
|
||||
@@ -351,6 +351,47 @@ HWTEST2_F(XeHPAndLaterImageHelperTests, givenMediaCompressedImageWhenAppendingSu
|
||||
EXPECT_EQ(expectedGetMediaSurfaceStateCompressionFormatCalled, gmmClientContext->getMediaSurfaceStateCompressionFormatCalled);
|
||||
}
|
||||
|
||||
HWTEST2_F(XeHPAndLaterImageHelperTests, givenMediaCompressedPlanarImageWhenAppendingSurfaceStateParamsForCompressionThenCorrectCompressionFormatIsSet, CompressionParamsSupportedMatcher) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
RENDER_SURFACE_STATE rss{};
|
||||
platformsImpl->clear();
|
||||
rss.setMemoryCompressionEnable(true);
|
||||
mockGmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true;
|
||||
|
||||
struct {
|
||||
uint8_t returnedCompressionFormat;
|
||||
uint8_t expectedCompressionFormat;
|
||||
GMM_YUV_PLANE_ENUM plane;
|
||||
} testInputs[] = {
|
||||
// regular image
|
||||
{0x0, 0x0, GMM_NO_PLANE},
|
||||
{0xF, 0xF, GMM_NO_PLANE},
|
||||
{0x10, 0x10, GMM_NO_PLANE},
|
||||
{0x1F, 0x1F, GMM_NO_PLANE},
|
||||
// luma plane
|
||||
{0x0, 0x0, GMM_PLANE_Y},
|
||||
{0xF, 0xF, GMM_PLANE_Y},
|
||||
{0x10, 0x0, GMM_PLANE_Y},
|
||||
{0x1F, 0xF, GMM_PLANE_Y},
|
||||
// chroma plane
|
||||
{0x0, 0x10, GMM_PLANE_U},
|
||||
{0x0, 0x10, GMM_PLANE_V},
|
||||
{0xF, 0x1F, GMM_PLANE_U},
|
||||
{0xF, 0x1F, GMM_PLANE_V},
|
||||
{0x10, 0x10, GMM_PLANE_U},
|
||||
{0x10, 0x10, GMM_PLANE_V},
|
||||
{0x1F, 0x1F, GMM_PLANE_U},
|
||||
{0x1F, 0x1F, GMM_PLANE_V},
|
||||
};
|
||||
|
||||
for (auto &testInput : testInputs) {
|
||||
gmmClientContext->compressionFormatToReturn = testInput.returnedCompressionFormat;
|
||||
EncodeSurfaceState<FamilyType>::appendImageCompressionParams(&rss, image->getMultiGraphicsAllocation().getDefaultGraphicsAllocation(),
|
||||
context->getDevice(0)->getGmmHelper(), false, testInput.plane);
|
||||
EXPECT_EQ(testInput.expectedCompressionFormat, rss.getCompressionFormat());
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST2_F(XeHPAndLaterImageHelperTests, givenNotMediaCompressedImageWhenAppendingSurfaceStateParamsForCompressionThenCallAppriopriateFunction, CompressionParamsSupportedMatcher) {
|
||||
using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE;
|
||||
RENDER_SURFACE_STATE rss{};
|
||||
@@ -362,7 +403,7 @@ HWTEST2_F(XeHPAndLaterImageHelperTests, givenNotMediaCompressedImageWhenAppendin
|
||||
const auto expectedGetMediaSurfaceStateCompressionFormatCalled = gmmClientContext->getMediaSurfaceStateCompressionFormatCalled;
|
||||
|
||||
EncodeSurfaceState<FamilyType>::appendImageCompressionParams(&rss, image->getMultiGraphicsAllocation().getDefaultGraphicsAllocation(),
|
||||
context->getDevice(0)->getGmmHelper(), false);
|
||||
context->getDevice(0)->getGmmHelper(), false, GMM_NO_PLANE);
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
EXPECT_EQ(mockCompressionFormat, rss.getCompressionFormat());
|
||||
EXPECT_EQ(expectedGetSurfaceStateCompressionFormatCalled, gmmClientContext->getSurfaceStateCompressionFormatCalled);
|
||||
@@ -382,7 +423,7 @@ HWTEST2_F(XeHPAndLaterImageHelperTests, givenAuxModeMcsLceWhenAppendingSurfaceSt
|
||||
const auto expectedGetMediaSurfaceStateCompressionFormatCalled = gmmClientContext->getMediaSurfaceStateCompressionFormatCalled + 1;
|
||||
|
||||
EncodeSurfaceState<FamilyType>::appendImageCompressionParams(&rss, image->getMultiGraphicsAllocation().getDefaultGraphicsAllocation(),
|
||||
context->getDevice(0)->getGmmHelper(), false);
|
||||
context->getDevice(0)->getGmmHelper(), false, GMM_NO_PLANE);
|
||||
|
||||
EXPECT_EQ(platform(), nullptr);
|
||||
EXPECT_EQ(mockCompressionFormat, rss.getCompressionFormat());
|
||||
|
||||
@@ -242,6 +242,7 @@ TEST_F(Nv12ImageTest, WhenCreatingYPlaneImageThenDimensionsAreSetCorrectly) {
|
||||
EXPECT_EQ(true, imageYPlane->isImageFromImage());
|
||||
EXPECT_EQ(imageNV12->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex()),
|
||||
imageYPlane->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex()));
|
||||
EXPECT_EQ(GMM_PLANE_Y, imageYPlane->getPlane());
|
||||
|
||||
cl_image_desc parentDimensions, planeDimensions;
|
||||
parentDimensions = imageNV12->getImageDesc();
|
||||
@@ -277,6 +278,7 @@ TEST_F(Nv12ImageTest, WhenCreatingUVPlaneImageThenDimensionsAreSetCorrectly) {
|
||||
EXPECT_EQ(true, imageUVPlane->isImageFromImage());
|
||||
EXPECT_EQ(imageNV12->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex()),
|
||||
imageUVPlane->getGraphicsAllocation(context.getDevice(0)->getRootDeviceIndex()));
|
||||
EXPECT_EQ(GMM_PLANE_U, imageUVPlane->getPlane());
|
||||
|
||||
cl_image_desc parentDimensions, planeDimensions;
|
||||
parentDimensions = imageNV12->getImageDesc();
|
||||
|
||||
Reference in New Issue
Block a user