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:
parent
f46f409cc4
commit
70cef0cfe8
|
@ -348,7 +348,8 @@ HWTEST_F(ClDrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageWithMipCount
|
|||
|
||||
EXPECT_EQ(1u, this->mock->createParamsHandle);
|
||||
EXPECT_EQ(imageSize, 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(rowPitch, this->mock->setTilingStride);
|
||||
EXPECT_EQ(1u, this->mock->setTilingHandle);
|
||||
|
@ -397,7 +398,8 @@ HWTEST_F(ClDrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageWithMipCount
|
|||
|
||||
EXPECT_EQ(1u, this->mock->createParamsHandle);
|
||||
EXPECT_EQ(imageSize, 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(rowPitch, this->mock->setTilingStride);
|
||||
EXPECT_EQ(1u, this->mock->setTilingHandle);
|
||||
|
@ -511,7 +513,8 @@ HWTEST_F(ClDrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreat
|
|||
|
||||
EXPECT_EQ(1u, this->mock->createParamsHandle);
|
||||
EXPECT_EQ(imageSize, 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(rowPitch, this->mock->setTilingStride);
|
||||
EXPECT_EQ(1u, this->mock->setTilingHandle);
|
||||
|
@ -588,7 +591,8 @@ TEST_F(ClDrmMemoryManagerTest, givenDrmMemoryManagerWhenNonTiledImgWithMipCountZ
|
|||
|
||||
EXPECT_EQ(0u, this->mock->createParamsHandle);
|
||||
EXPECT_EQ(0u, this->mock->createParamsSize);
|
||||
__u32 tilingMode = I915_TILING_NONE;
|
||||
auto ioctlHelper = this->mock->getIoctlHelper();
|
||||
uint32_t tilingMode = ioctlHelper->getDrmParamValue(DrmParam::TilingNone);
|
||||
EXPECT_EQ(tilingMode, this->mock->setTilingMode);
|
||||
EXPECT_EQ(0u, this->mock->setTilingStride);
|
||||
EXPECT_EQ(0u, this->mock->setTilingHandle);
|
||||
|
@ -637,7 +641,8 @@ TEST_F(ClDrmMemoryManagerTest, givenDrmMemoryManagerWhenNonTiledImgWithMipCountN
|
|||
|
||||
EXPECT_EQ(0u, this->mock->createParamsHandle);
|
||||
EXPECT_EQ(0u, this->mock->createParamsSize);
|
||||
__u32 tilingMode = I915_TILING_NONE;
|
||||
auto ioctlHelper = this->mock->getIoctlHelper();
|
||||
uint32_t tilingMode = ioctlHelper->getDrmParamValue(DrmParam::TilingNone);
|
||||
EXPECT_EQ(tilingMode, this->mock->setTilingMode);
|
||||
EXPECT_EQ(0u, this->mock->setTilingStride);
|
||||
EXPECT_EQ(0u, this->mock->setTilingHandle);
|
||||
|
@ -679,7 +684,8 @@ TEST_F(ClDrmMemoryManagerTest, givenDrmMemoryManagerWhen1DarrayImageIsBeingCreat
|
|||
|
||||
EXPECT_EQ(0u, this->mock->createParamsHandle);
|
||||
EXPECT_EQ(0u, this->mock->createParamsSize);
|
||||
__u32 tilingMode = I915_TILING_NONE;
|
||||
auto ioctlHelper = this->mock->getIoctlHelper();
|
||||
uint32_t tilingMode = ioctlHelper->getDrmParamValue(DrmParam::TilingNone);
|
||||
EXPECT_EQ(tilingMode, this->mock->setTilingMode);
|
||||
EXPECT_EQ(0u, this->mock->setTilingStride);
|
||||
EXPECT_EQ(0u, this->mock->setTilingHandle);
|
||||
|
@ -735,7 +741,8 @@ TEST_F(ClDrmMemoryManagerTest, givenOsHandleWithNonTiledObjectWhenCreateFromShar
|
|||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
mock->ioctl_expected.gemGetTiling = 1;
|
||||
mock->getTilingModeOut = I915_TILING_NONE;
|
||||
auto ioctlHelper = this->mock->getIoctlHelper();
|
||||
mock->getTilingModeOut = ioctlHelper->getDrmParamValue(DrmParam::TilingNone);
|
||||
|
||||
osHandle handle = 1u;
|
||||
uint32_t boHandle = 2u;
|
||||
|
@ -777,7 +784,8 @@ TEST_F(ClDrmMemoryManagerTest, givenOsHandleWithTileYObjectWhenCreateFromSharedH
|
|||
mock->ioctl_expected.gemWait = 1;
|
||||
mock->ioctl_expected.gemClose = 1;
|
||||
mock->ioctl_expected.gemGetTiling = 1;
|
||||
mock->getTilingModeOut = I915_TILING_Y;
|
||||
auto ioctlHelper = this->mock->getIoctlHelper();
|
||||
mock->getTilingModeOut = ioctlHelper->getDrmParamValue(DrmParam::TilingY);
|
||||
|
||||
osHandle handle = 1u;
|
||||
uint32_t boHandle = 2u;
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
#include "shared/source/os_interface/os_context.h"
|
||||
#include "shared/source/utilities/stackvec.h"
|
||||
|
||||
#include "drm/i915_drm.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <map>
|
||||
|
@ -35,7 +33,8 @@
|
|||
namespace NEO {
|
||||
|
||||
BufferObject::BufferObject(Drm *drm, uint64_t patIndex, int handle, size_t size, size_t maxOsContextCount) : drm(drm), refCount(1), handle(handle), size(size) {
|
||||
this->tilingMode = I915_TILING_NONE;
|
||||
auto ioctlHelper = drm->getIoctlHelper();
|
||||
this->tilingMode = ioctlHelper->getDrmParamValue(DrmParam::TilingNone);
|
||||
this->lockedAddress = nullptr;
|
||||
this->patIndex = patIndex;
|
||||
|
||||
|
|
|
@ -565,7 +565,8 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImageImpl(const A
|
|||
}
|
||||
bo->setAddress(gpuRange);
|
||||
|
||||
[[maybe_unused]] auto ret2 = bo->setTiling(I915_TILING_Y, static_cast<uint32_t>(allocationData.imgInfo->rowPitch));
|
||||
auto ioctlHelper = drm.getIoctlHelper();
|
||||
[[maybe_unused]] auto ret2 = bo->setTiling(ioctlHelper->getDrmParamValue(DrmParam::TilingY), static_cast<uint32_t>(allocationData.imgInfo->rowPitch));
|
||||
DEBUG_BREAK_IF(ret2 != true);
|
||||
|
||||
auto allocation = new DrmAllocation(allocationData.rootDeviceIndex, allocationData.type, bo.get(), nullptr, gpuRange, allocationData.imgInfo->size, MemoryPool::SystemCpuInaccessible);
|
||||
|
@ -827,7 +828,8 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
|
|||
ret = drm.ioctl(DrmIoctl::GemGetTiling, &getTiling);
|
||||
|
||||
if (ret == 0) {
|
||||
if (getTiling.isTilingDisabled()) {
|
||||
auto ioctlHelper = drm.getIoctlHelper();
|
||||
if (getTiling.tilingMode == static_cast<uint32_t>(ioctlHelper->getDrmParamValue(DrmParam::TilingNone))) {
|
||||
properties.imgInfo->linearStorage = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,8 +41,6 @@ static_assert(offsetof(GemGetTiling, tilingMode) == offsetof(drm_i915_gem_get_ti
|
|||
static_assert(offsetof(GemGetTiling, swizzleMode) == offsetof(drm_i915_gem_get_tiling, swizzle_mode));
|
||||
static_assert(offsetof(GemGetTiling, physSwizzleMode) == offsetof(drm_i915_gem_get_tiling, phys_swizzle_mode));
|
||||
|
||||
bool GemGetTiling::isTilingDisabled() const { return I915_TILING_NONE == tilingMode; }
|
||||
|
||||
static_assert(sizeof(ExecObject) == sizeof(drm_i915_gem_exec_object2));
|
||||
|
||||
static_assert(sizeof(ExecBuffer) == sizeof(drm_i915_gem_execbuffer2));
|
||||
|
|
|
@ -46,8 +46,6 @@ struct GemSetTiling {
|
|||
};
|
||||
|
||||
struct GemGetTiling {
|
||||
bool isTilingDisabled() const;
|
||||
|
||||
uint32_t handle;
|
||||
uint32_t tilingMode;
|
||||
uint32_t swizzleMode;
|
||||
|
@ -257,6 +255,8 @@ enum class DrmParam {
|
|||
QueryHwconfigTable,
|
||||
QueryComputeSlices,
|
||||
QueryMemoryRegions,
|
||||
TilingNone,
|
||||
TilingY,
|
||||
};
|
||||
|
||||
unsigned int getIoctlRequestValue(DrmIoctl ioctlRequest, IoctlHelper *ioctlHelper);
|
||||
|
|
|
@ -230,6 +230,10 @@ int IoctlHelper::getDrmParamValueBase(DrmParam drmParam) const {
|
|||
return DRM_I915_QUERY_ENGINE_INFO;
|
||||
case DrmParam::QueryMemoryRegions:
|
||||
return DRM_I915_QUERY_MEMORY_REGIONS;
|
||||
case DrmParam::TilingNone:
|
||||
return I915_TILING_NONE;
|
||||
case DrmParam::TilingY:
|
||||
return I915_TILING_Y;
|
||||
default:
|
||||
UNRECOVERABLE_IF(true);
|
||||
return 0;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue