Create enum values for I915 tiling mode

Related-To: NEO-6852, NEO-6999
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-06-21 17:41:40 +02:00
committed by Compute-Runtime-Automation
parent f46f409cc4
commit 70cef0cfe8
12 changed files with 44 additions and 27 deletions

View File

@ -177,7 +177,7 @@ class DrmMockCustom : public Drm {
uint32_t setTilingHandle = 0;
uint32_t setTilingStride = 0;
//DRM_IOCTL_I915_GEM_GET_TILING
uint32_t getTilingModeOut = I915_TILING_NONE;
uint32_t getTilingModeOut = 0;
uint32_t getTilingHandleIn = 0;
//DRM_IOCTL_PRIME_FD_TO_HANDLE
uint32_t outputHandle = 0;

View File

@ -17,16 +17,14 @@
class TestedBufferObject : public BufferObject {
public:
using BufferObject::handle;
using BufferObject::tilingMode;
TestedBufferObject(Drm *drm) : BufferObject(drm, 3, 1, 0, 1) {
}
TestedBufferObject(Drm *drm, size_t size) : BufferObject(drm, 3, 1, size, 1) {
}
void tileBy(uint32_t mode) {
this->tilingMode = mode;
}
void fillExecObject(ExecObject &execObject, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId) override {
BufferObject::fillExecObject(execObject, osContext, vmHandleId, drmContextId);
execObjectPointerFilled = &execObject;

View File

@ -55,21 +55,24 @@ TEST_F(DrmBufferObjectTest, GivenDetectedGpuHangDuringEvictUnusedAllocationsWhen
TEST_F(DrmBufferObjectTest, WhenSettingTilingThenCallSucceeds) {
mock->ioctl_expected.total = 1; //set_tiling
auto ret = bo->setTiling(I915_TILING_X, 0);
auto tilingY = mock->getIoctlHelper()->getDrmParamValue(DrmParam::TilingY);
auto ret = bo->setTiling(tilingY, 0);
EXPECT_TRUE(ret);
}
TEST_F(DrmBufferObjectTest, WhenSettingSameTilingThenCallSucceeds) {
mock->ioctl_expected.total = 0; //set_tiling
bo->tileBy(I915_TILING_X);
auto ret = bo->setTiling(I915_TILING_X, 0);
auto tilingY = mock->getIoctlHelper()->getDrmParamValue(DrmParam::TilingY);
bo->tilingMode = tilingY;
auto ret = bo->setTiling(tilingY, 0);
EXPECT_TRUE(ret);
}
TEST_F(DrmBufferObjectTest, GivenInvalidTilingWhenSettingTilingThenCallFails) {
mock->ioctl_expected.total = 1; //set_tiling
auto tilingY = mock->getIoctlHelper()->getDrmParamValue(DrmParam::TilingY);
mock->ioctl_res = -1;
auto ret = bo->setTiling(I915_TILING_X, 0);
auto ret = bo->setTiling(tilingY, 0);
EXPECT_FALSE(ret);
}

View File

@ -1435,7 +1435,8 @@ TEST_F(DrmMemoryManagerTest, GivenMemoryManagerWhenAllocateGraphicsMemoryForImag
EXPECT_EQ(1u, this->mock->createParamsHandle);
EXPECT_EQ(imgInfo.size, this->mock->createParamsSize);
__u32 tilingMode = I915_TILING_Y;
auto ioctlHelper = this->mock->getIoctlHelper();
uint32_t tilingMode = ioctlHelper->getDrmParamValue(DrmParam::TilingY);
EXPECT_EQ(tilingMode, this->mock->setTilingMode);
EXPECT_EQ(imgInfo.rowPitch, this->mock->setTilingStride);
EXPECT_EQ(1u, this->mock->setTilingHandle);

View File

@ -88,6 +88,8 @@ TEST_F(IoctlPrelimHelperTests, whenGettingDrmParamValueThenPropertValueIsReturne
EXPECT_EQ(ioctlHelper.getDrmParamValue(DrmParam::QueryHwconfigTable), static_cast<int>(PRELIM_DRM_I915_QUERY_HWCONFIG_TABLE));
EXPECT_EQ(ioctlHelper.getDrmParamValue(DrmParam::QueryMemoryRegions), static_cast<int>(DRM_I915_QUERY_MEMORY_REGIONS));
EXPECT_EQ(ioctlHelper.getDrmParamValue(DrmParam::QueryComputeSlices), static_cast<int>(PRELIM_DRM_I915_QUERY_COMPUTE_SLICES));
EXPECT_EQ(ioctlHelper.getDrmParamValue(DrmParam::TilingNone), static_cast<int>(I915_TILING_NONE));
EXPECT_EQ(ioctlHelper.getDrmParamValue(DrmParam::TilingY), static_cast<int>(I915_TILING_Y));
}
TEST_F(IoctlPrelimHelperTests, givenPrelimsWhenTranslateToMemoryRegionsThenReturnSameData) {

View File

@ -77,6 +77,8 @@ TEST(IoctlHelperUpstreamTest, whenGettingDrmParamValueThenPropertValueIsReturned
EXPECT_EQ(ioctlHelper.getDrmParamValue(DrmParam::QueryHwconfigTable), static_cast<int>(DRM_I915_QUERY_HWCONFIG_TABLE));
EXPECT_EQ(ioctlHelper.getDrmParamValue(DrmParam::QueryMemoryRegions), static_cast<int>(DRM_I915_QUERY_MEMORY_REGIONS));
EXPECT_EQ(ioctlHelper.getDrmParamValue(DrmParam::QueryComputeSlices), 0);
EXPECT_EQ(ioctlHelper.getDrmParamValue(DrmParam::TilingNone), static_cast<int>(I915_TILING_NONE));
EXPECT_EQ(ioctlHelper.getDrmParamValue(DrmParam::TilingY), static_cast<int>(I915_TILING_Y));
}
TEST(IoctlHelperUpstreamTest, whenCreatingVmControlRegionExtThenNullptrIsReturned) {