mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
Improve AllocationType operations: dont do bit operations on enums
Change-Id: Ie70ca9e2a93ec80b1cd655bad622db9e12abb7f7 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
@@ -20,25 +20,25 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "runtime/memory_manager/svm_memory_manager.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "runtime/gmm_helper/gmm.h"
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/mem_obj/buffer.h"
|
||||
#include "runtime/memory_manager/svm_memory_manager.h"
|
||||
#include "test.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/fixtures/memory_management_fixture.h"
|
||||
#include "unit_tests/fixtures/platform_fixture.h"
|
||||
#include "unit_tests/gen_common/matchers.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/helpers/memory_management.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
#include "unit_tests/mocks/mock_command_queue.h"
|
||||
#include "unit_tests/mocks/mock_gmm_resource_info.h"
|
||||
#include "unit_tests/fixtures/platform_fixture.h"
|
||||
#include "unit_tests/libult/ult_command_stream_receiver.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "unit_tests/mocks/mock_command_queue.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
#include "unit_tests/mocks/mock_gmm_resource_info.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
@@ -357,14 +357,11 @@ TEST_P(NoHostPtr, withBufferGraphicsAllocationReportsBufferType) {
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, buffer);
|
||||
|
||||
auto &allocation = *buffer->getGraphicsAllocation();
|
||||
auto type = allocation.getAllocationType();
|
||||
auto isTypeBuffer = !!(type & GraphicsAllocation::AllocationType::BUFFER);
|
||||
EXPECT_TRUE(isTypeBuffer);
|
||||
auto allocation = buffer->getGraphicsAllocation();
|
||||
EXPECT_TRUE(allocation->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER);
|
||||
|
||||
auto isTypeWritable = !!(type & GraphicsAllocation::AllocationType::WRITABLE);
|
||||
auto isBufferWritable = !(flags & (CL_MEM_READ_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS));
|
||||
EXPECT_EQ(isBufferWritable, isTypeWritable);
|
||||
EXPECT_EQ(isBufferWritable, allocation->isMemObjectsAllocationWithWritableFlags());
|
||||
|
||||
delete buffer;
|
||||
}
|
||||
|
||||
@@ -20,22 +20,22 @@
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "unit_tests/command_queue/command_queue_fixture.h"
|
||||
#include "unit_tests/fixtures/image_fixture.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "runtime/built_ins/built_ins.h"
|
||||
#include "runtime/compiler_interface/compiler_interface.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/helpers/mipmap.h"
|
||||
#include "runtime/built_ins/built_ins.h"
|
||||
#include "runtime/mem_obj/image.h"
|
||||
#include "unit_tests/command_queue/command_queue_fixture.h"
|
||||
#include "unit_tests/fixtures/device_fixture.h"
|
||||
#include "unit_tests/fixtures/image_fixture.h"
|
||||
#include "unit_tests/fixtures/memory_management_fixture.h"
|
||||
#include "unit_tests/gen_common/test.h"
|
||||
#include "unit_tests/helpers/debug_manager_state_restore.h"
|
||||
#include "unit_tests/helpers/kernel_binary_helper.h"
|
||||
#include "unit_tests/helpers/memory_management.h"
|
||||
#include "unit_tests/mocks/mock_context.h"
|
||||
#include "unit_tests/mocks/mock_gmm.h"
|
||||
#include "unit_tests/mocks/mock_memory_manager.h"
|
||||
#include "unit_tests/gen_common/test.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
@@ -480,14 +480,11 @@ TEST_P(CreateImageNoHostPtr, withImageGraphicsAllocationReportsImageType) {
|
||||
ASSERT_EQ(CL_SUCCESS, retVal);
|
||||
ASSERT_NE(nullptr, image);
|
||||
|
||||
auto &allocation = *image->getGraphicsAllocation();
|
||||
auto type = allocation.getAllocationType();
|
||||
auto isTypeImage = !!(type & GraphicsAllocation::AllocationType::IMAGE);
|
||||
EXPECT_TRUE(isTypeImage);
|
||||
auto allocation = image->getGraphicsAllocation();
|
||||
EXPECT_TRUE(allocation->getAllocationType() == GraphicsAllocation::AllocationType::IMAGE);
|
||||
|
||||
auto isTypeWritable = !!(type & GraphicsAllocation::AllocationType::WRITABLE);
|
||||
auto isImageWritable = !(flags & (CL_MEM_READ_ONLY | CL_MEM_HOST_READ_ONLY | CL_MEM_HOST_NO_ACCESS));
|
||||
EXPECT_EQ(isImageWritable, isTypeWritable);
|
||||
EXPECT_EQ(isImageWritable, allocation->isMemObjectsAllocationWithWritableFlags());
|
||||
|
||||
delete image;
|
||||
}
|
||||
@@ -1255,4 +1252,4 @@ HWTEST_F(HwImageTest, givenImageHwWhenSettingCCSParamsThenSetClearColorParamsIsC
|
||||
EXPECT_FALSE(mockImage->setClearColorParamsCalled);
|
||||
mockImage->setAuxParamsForCCS(&surfaceState, graphicsAllocation->gmm);
|
||||
EXPECT_TRUE(mockImage->setClearColorParamsCalled);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user