From a7f6697f17ca22b1a1d9ff8d1b8994c2cb6b2dd3 Mon Sep 17 00:00:00 2001 From: Maciej Dziuban Date: Tue, 7 Jan 2020 10:10:57 +0100 Subject: [PATCH] Revert "Do not require Render/Media Compressed flags for compression" This reverts commit e43e06192fe58602dc1d6062a86b9e47d7d7e323. Change-Id: I1dca6d1d60478dcc22946ff2d84cdcf81a88e075 Signed-off-by: Maciej Dziuban --- runtime/gmm_helper/gmm.cpp | 2 +- unit_tests/gmm_helper/gmm_helper_tests.cpp | 11 +++++++---- unit_tests/mocks/mock_gmm_resource_info.cpp | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/runtime/gmm_helper/gmm.cpp b/runtime/gmm_helper/gmm.cpp index 532ec235ca..90c040b183 100644 --- a/runtime/gmm_helper/gmm.cpp +++ b/runtime/gmm_helper/gmm.cpp @@ -245,7 +245,7 @@ uint8_t Gmm::resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t heig bool Gmm::unifiedAuxTranslationCapable() const { auto gmmFlags = this->gmmResourceInfo->getResourceFlags(); UNRECOVERABLE_IF(gmmFlags->Info.RenderCompressed && gmmFlags->Info.MediaCompressed); - return gmmFlags->Gpu.CCS && gmmFlags->Gpu.UnifiedAuxSurface; + return gmmFlags->Gpu.CCS && gmmFlags->Gpu.UnifiedAuxSurface && (gmmFlags->Info.RenderCompressed | gmmFlags->Info.MediaCompressed); } bool Gmm::hasMultisampleControlSurface() const { diff --git a/unit_tests/gmm_helper/gmm_helper_tests.cpp b/unit_tests/gmm_helper/gmm_helper_tests.cpp index 21ec6e05dd..5c94015262 100644 --- a/unit_tests/gmm_helper/gmm_helper_tests.cpp +++ b/unit_tests/gmm_helper/gmm_helper_tests.cpp @@ -438,11 +438,11 @@ TEST_F(GmmMediaCompressedTests, givenMediaAndRenderCompressedGmmUnifiedAuxTransl EXPECT_THROW(gmm->unifiedAuxTranslationCapable(), std::exception); } -TEST_F(GmmMediaCompressedTests, givenNotMediaAndNotRenderCompressedGmmUnifiedAuxTranslationCapableReturnsTrue) { +TEST_F(GmmMediaCompressedTests, givenNotMediaAndNotRenderCompressedGmmUnifiedAuxTranslationCapableReturnsFalse) { flags->Info.MediaCompressed = false; flags->Info.RenderCompressed = false; - EXPECT_TRUE(gmm->unifiedAuxTranslationCapable()); + EXPECT_FALSE(gmm->unifiedAuxTranslationCapable()); } namespace GmmTestConst { @@ -680,8 +680,7 @@ TEST(GmmTest, givenAllValidFlagsWhenAskedForUnifiedAuxTranslationCapabilityThenR mockResource->setUnifiedAuxTranslationCapable(); EXPECT_EQ(1u, mockResource->mockResourceCreateParams.Flags.Gpu.CCS); EXPECT_EQ(1u, mockResource->mockResourceCreateParams.Flags.Gpu.UnifiedAuxSurface); - EXPECT_EQ(0u, mockResource->mockResourceCreateParams.Flags.Info.RenderCompressed); - EXPECT_EQ(0u, mockResource->mockResourceCreateParams.Flags.Info.MediaCompressed); + EXPECT_EQ(1u, mockResource->mockResourceCreateParams.Flags.Info.RenderCompressed); EXPECT_TRUE(gmm->unifiedAuxTranslationCapable()); } @@ -698,6 +697,10 @@ TEST(GmmTest, givenInvalidFlagsSetWhenAskedForUnifiedAuxTranslationCapabilityThe mockResource->mockResourceCreateParams.Flags.Gpu.CCS = 1; mockResource->mockResourceCreateParams.Flags.Gpu.UnifiedAuxSurface = 0; EXPECT_FALSE(gmm->unifiedAuxTranslationCapable()); // UnifiedAuxSurface == 0 + + mockResource->mockResourceCreateParams.Flags.Gpu.UnifiedAuxSurface = 1; + mockResource->mockResourceCreateParams.Flags.Info.RenderCompressed = 0; + EXPECT_FALSE(gmm->unifiedAuxTranslationCapable()); // RenderCompressed == 0 } TEST(GmmTest, givenHwInfoWhenDeviceIsCreatedTheSetThisHwInfoToGmmHelper) { diff --git a/unit_tests/mocks/mock_gmm_resource_info.cpp b/unit_tests/mocks/mock_gmm_resource_info.cpp index 96a5f4cbaf..a0f34d29dd 100644 --- a/unit_tests/mocks/mock_gmm_resource_info.cpp +++ b/unit_tests/mocks/mock_gmm_resource_info.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017-2019 Intel Corporation + * Copyright (C) 2017-2020 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -120,6 +120,7 @@ uint32_t MockGmmResourceInfo::getBitsPerPixel() { void MockGmmResourceInfo::setUnifiedAuxTranslationCapable() { mockResourceCreateParams.Flags.Gpu.CCS = 1; mockResourceCreateParams.Flags.Gpu.UnifiedAuxSurface = 1; + mockResourceCreateParams.Flags.Info.RenderCompressed = 1; } void MockGmmResourceInfo::setMultisampleControlSurface() {