Buffer manager:
Implement a version check IOCTL for drivers that don't use drmMMInit from user-space. Remove the minor check from the kernel code. That's really up to the driver. Bump major.main
parent
b5cad27e05
commit
11f3e5e53f
|
@ -2855,6 +2855,30 @@ int drmMMUnlock(int fd, unsigned memType, int unlockBM)
|
|||
return (ret) ? -errno : 0;
|
||||
}
|
||||
|
||||
int drmBOVersion(int fd, unsigned int *major,
|
||||
unsigned int *minor,
|
||||
unsigned int *patchlevel)
|
||||
{
|
||||
struct drm_bo_version_arg arg;
|
||||
int ret;
|
||||
|
||||
memset(&arg, 0, sizeof(arg));
|
||||
ret = ioctl(fd, DRM_IOCTL_BO_VERSION, &arg);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (major)
|
||||
*major = arg.major;
|
||||
if (minor)
|
||||
*minor = arg.minor;
|
||||
if (patchlevel)
|
||||
*patchlevel = arg.patchlevel;
|
||||
|
||||
return (ret) ? -errno : 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define DRM_MAX_FDS 16
|
||||
static struct {
|
||||
char *BusID;
|
||||
|
|
|
@ -2260,17 +2260,10 @@ int drm_mm_init_ioctl(struct drm_device *dev, void *data, struct drm_file *file_
|
|||
}
|
||||
if (arg->major != DRM_BO_INIT_MAJOR) {
|
||||
DRM_ERROR("libdrm and kernel DRM buffer object interface major\n"
|
||||
"\tversion don't match. Got %d, expected %d,\n",
|
||||
"\tversion don't match. Got %d, expected %d.\n",
|
||||
arg->major, DRM_BO_INIT_MAJOR);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (arg->minor > DRM_BO_INIT_MINOR) {
|
||||
DRM_ERROR("libdrm expects a newer DRM buffer object interface.\n"
|
||||
"\tlibdrm buffer object interface version is %d.%d.\n"
|
||||
"\tkernel DRM buffer object interface version is %d.%d\n",
|
||||
arg->major, arg->minor, DRM_BO_INIT_MAJOR, DRM_BO_INIT_MINOR);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
if (!bm->initialized) {
|
||||
|
@ -2535,3 +2528,15 @@ static int drm_bo_setup_vm_locked(struct drm_buffer_object * bo)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int drm_bo_version_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv)
|
||||
{
|
||||
struct drm_bo_version_arg *arg = (struct drm_bo_version_arg *)data;
|
||||
|
||||
arg->major = DRM_BO_INIT_MAJOR;
|
||||
arg->minor = DRM_BO_INIT_MINOR;
|
||||
arg->patchlevel = DRM_BO_INIT_PATCH;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -145,6 +145,7 @@ static struct drm_ioctl_desc drm_ioctls[] = {
|
|||
DRM_IOCTL_DEF(DRM_IOCTL_BO_SETSTATUS, drm_bo_setstatus_ioctl, DRM_AUTH),
|
||||
DRM_IOCTL_DEF(DRM_IOCTL_BO_INFO, drm_bo_info_ioctl, DRM_AUTH),
|
||||
DRM_IOCTL_DEF(DRM_IOCTL_BO_WAIT_IDLE, drm_bo_wait_idle_ioctl, DRM_AUTH),
|
||||
DRM_IOCTL_DEF(DRM_IOCTL_BO_VERSION, drm_bo_version_ioctl, 0),
|
||||
};
|
||||
|
||||
#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
|
||||
|
|
|
@ -483,6 +483,7 @@ extern int drm_mm_init_ioctl(struct drm_device *dev, void *data, struct drm_file
|
|||
extern int drm_mm_takedown_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||
extern int drm_mm_lock_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||
extern int drm_mm_unlock_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||
extern int drm_bo_version_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv);
|
||||
extern int drm_bo_driver_finish(struct drm_device *dev);
|
||||
extern int drm_bo_driver_init(struct drm_device *dev);
|
||||
extern int drm_bo_pci_offset(struct drm_device *dev,
|
||||
|
|
|
@ -758,8 +758,9 @@ struct drm_fence_arg {
|
|||
#define DRM_BO_HINT_WAIT_LAZY 0x00000008
|
||||
|
||||
#define DRM_BO_INIT_MAGIC 0xfe769812
|
||||
#define DRM_BO_INIT_MAJOR 0
|
||||
#define DRM_BO_INIT_MAJOR 1
|
||||
#define DRM_BO_INIT_MINOR 1
|
||||
#define DRM_BO_INIT_PATCH 0
|
||||
|
||||
|
||||
struct drm_bo_info_req {
|
||||
|
@ -873,6 +874,12 @@ struct drm_bo_op_arg {
|
|||
#define DRM_BO_LOCK_UNLOCK_BM (1 << 0)
|
||||
#define DRM_BO_LOCK_IGNORE_NO_EVICT (1 << 1)
|
||||
|
||||
struct drm_bo_version_arg {
|
||||
uint32_t major;
|
||||
uint32_t minor;
|
||||
uint32_t patchlevel;
|
||||
};
|
||||
|
||||
struct drm_mm_type_arg {
|
||||
unsigned int mem_type;
|
||||
unsigned int lock_flags;
|
||||
|
@ -976,6 +983,7 @@ struct drm_mm_init_arg {
|
|||
#define DRM_IOCTL_BO_SETSTATUS DRM_IOWR(0xd3, struct drm_bo_map_wait_idle_arg)
|
||||
#define DRM_IOCTL_BO_INFO DRM_IOWR(0xd4, struct drm_bo_reference_info_arg)
|
||||
#define DRM_IOCTL_BO_WAIT_IDLE DRM_IOWR(0xd5, struct drm_bo_map_wait_idle_arg)
|
||||
#define DRM_IOCTL_BO_VERSION DRM_IOR(0xd6, struct drm_bo_version_arg)
|
||||
|
||||
|
||||
/*@}*/
|
||||
|
|
Loading…
Reference in New Issue