2022-05-18 01:16:13 +08:00
|
|
|
/*
|
2024-12-17 22:41:33 +08:00
|
|
|
* Copyright (C) 2022-2024 Intel Corporation
|
2022-05-18 01:16:13 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "shared/source/os_interface/linux/drm_wrappers.h"
|
|
|
|
|
2022-05-26 01:05:52 +08:00
|
|
|
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
|
|
|
|
2024-12-17 22:41:33 +08:00
|
|
|
#include "drm.h"
|
|
|
|
|
2022-05-18 01:16:13 +08:00
|
|
|
#include <cstddef>
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
2022-05-26 01:05:52 +08:00
|
|
|
unsigned int getIoctlRequestValue(DrmIoctl ioctlRequest, IoctlHelper *ioctlHelper) {
|
2022-06-08 21:56:36 +08:00
|
|
|
if (ioctlHelper) {
|
|
|
|
return ioctlHelper->getIoctlRequestValue(ioctlRequest);
|
|
|
|
}
|
2022-05-26 01:05:52 +08:00
|
|
|
switch (ioctlRequest) {
|
2023-12-12 16:48:32 +08:00
|
|
|
case DrmIoctl::version:
|
2022-08-08 22:02:17 +08:00
|
|
|
return DRM_IOCTL_VERSION;
|
2022-05-26 01:05:52 +08:00
|
|
|
default:
|
2022-06-08 21:56:36 +08:00
|
|
|
UNRECOVERABLE_IF(true);
|
|
|
|
return 0;
|
2022-05-26 01:05:52 +08:00
|
|
|
}
|
|
|
|
}
|
2022-06-06 23:48:31 +08:00
|
|
|
|
2022-10-19 02:37:33 +08:00
|
|
|
bool checkIfIoctlReinvokeRequired(int error, DrmIoctl ioctlRequest, IoctlHelper *ioctlHelper) {
|
|
|
|
if (ioctlHelper) {
|
|
|
|
return ioctlHelper->checkIfIoctlReinvokeRequired(error, ioctlRequest);
|
|
|
|
}
|
|
|
|
return (error == EINTR || error == EAGAIN || error == EBUSY || error == -EBUSY);
|
|
|
|
}
|
2022-08-08 22:02:17 +08:00
|
|
|
} // namespace NEO
|