mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 09:14:47 +08:00
Refactor bindAvailable
Related-To: NEO-5316 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e448527150
commit
7330f989ef
@@ -337,6 +337,8 @@ class DrmMockCustom : public Drm {
|
||||
ioctl_expected.contextCreate = static_cast<int>(NEO::HwHelper::get(NEO::defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*NEO::defaultHwInfo).size());
|
||||
ioctl_expected.contextDestroy = ioctl_expected.contextCreate.load();
|
||||
createVirtualMemoryAddressSpace(NEO::HwHelper::getSubDevicesCount(rootDeviceEnvironment.getHardwareInfo()));
|
||||
isVmBindAvailable();
|
||||
reset();
|
||||
}
|
||||
int getErrno() override {
|
||||
return errnoValue;
|
||||
|
||||
@@ -1738,6 +1738,8 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenNonTiledImgWithMipCountZer
|
||||
auto data = alignedMalloc(64u * 4 * 8, MemoryConstants::pageSize);
|
||||
|
||||
auto retVal = CL_SUCCESS;
|
||||
this->mock->createParamsHandle = 0;
|
||||
this->mock->createParamsSize = 0;
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
|
||||
@@ -1784,6 +1786,9 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenNonTiledImgWithMipCountNon
|
||||
|
||||
auto retVal = CL_SUCCESS;
|
||||
|
||||
this->mock->createParamsHandle = 0;
|
||||
this->mock->createParamsSize = 0;
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
|
||||
std::unique_ptr<Image> dstImage(Image::create(
|
||||
@@ -1828,6 +1833,8 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhen1DarrayImageIsBeingCreated
|
||||
auto data = alignedMalloc(64u * 4 * 8, MemoryConstants::pageSize);
|
||||
|
||||
auto retVal = CL_SUCCESS;
|
||||
this->mock->createParamsHandle = 0;
|
||||
this->mock->createParamsSize = 0;
|
||||
|
||||
cl_mem_flags flags = CL_MEM_WRITE_ONLY | CL_MEM_USE_HOST_PTR;
|
||||
auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat, context.getDevice(0)->getHardwareInfo().capabilityTable.supportsOcl21Features);
|
||||
|
||||
@@ -29,6 +29,7 @@ using namespace NEO;
|
||||
// Mock DRM class that responds to DRM_IOCTL_I915_GETPARAMs
|
||||
class DrmMock : public Drm {
|
||||
public:
|
||||
using Drm::bindAvailable;
|
||||
using Drm::checkQueueSliceSupport;
|
||||
using Drm::classHandles;
|
||||
using Drm::engineInfo;
|
||||
@@ -86,6 +87,9 @@ class DrmMock : public Drm {
|
||||
|
||||
void setDeviceID(int deviceId) { this->deviceId = deviceId; }
|
||||
void setDeviceRevID(int revisionId) { this->revisionId = revisionId; }
|
||||
void setBindAvailable() {
|
||||
this->bindAvailable = true;
|
||||
}
|
||||
|
||||
static const int mockFd = 33;
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ int bindBOsWithinContext(BufferObject *const boToPin[], size_t numberOfBos, OsCo
|
||||
int BufferObject::pin(BufferObject *const boToPin[], size_t numberOfBos, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId) {
|
||||
auto retVal = 0;
|
||||
|
||||
if (this->drm->isBindAvailable()) {
|
||||
if (this->drm->isVmBindAvailable()) {
|
||||
retVal = bindBOsWithinContext(boToPin, numberOfBos, osContext, vmHandleId);
|
||||
} else {
|
||||
StackVec<drm_i915_gem_exec_object2, maxFragmentsCount + 1> execObject(numberOfBos + 1);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <cerrno>
|
||||
#include <fcntl.h>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
@@ -111,6 +112,7 @@ class Drm {
|
||||
return requirePerContextVM;
|
||||
}
|
||||
|
||||
bool isVmBindAvailable();
|
||||
MOCKABLE_VIRTUAL bool registerResourceClasses();
|
||||
|
||||
MOCKABLE_VIRTUAL uint32_t registerResource(ResourceClass classType, void *data, size_t size);
|
||||
@@ -143,13 +145,6 @@ class Drm {
|
||||
static Drm *create(std::unique_ptr<HwDeviceId> hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment);
|
||||
static void overrideBindSupport(bool &useVmBind);
|
||||
|
||||
bool isBindAvailable() {
|
||||
return this->bindAvailable;
|
||||
}
|
||||
void setBindAvailable() {
|
||||
this->bindAvailable = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
int getQueueSliceCount(drm_i915_gem_context_param_sseu *sseu);
|
||||
std::string generateUUID();
|
||||
@@ -159,6 +154,7 @@ class Drm {
|
||||
bool nonPersistentContextsSupported = false;
|
||||
bool requirePerContextVM = false;
|
||||
bool bindAvailable = false;
|
||||
std::once_flag checkBindOnce;
|
||||
std::unique_ptr<HwDeviceId> hwDeviceId;
|
||||
int deviceId = 0;
|
||||
int revisionId = 0;
|
||||
|
||||
@@ -58,4 +58,8 @@ int Drm::unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObj
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Drm::isVmBindAvailable() {
|
||||
return this->bindAvailable;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -67,4 +67,8 @@ int Drm::unbindBufferObject(OsContext *osContext, uint32_t vmHandleId, BufferObj
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Drm::isVmBindAvailable() {
|
||||
return this->bindAvailable;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user