Lines Matching +full:master +full:- +full:stats

56  *  - GET_UNIQUE ioctl, implemented by drm_getunique is wrapped up in libdrm
58 * - The libdrm drmSetBusid function is backed by the SET_UNIQUE ioctl. All
60 * - The internal set_busid kernel functions and driver callbacks are
63 * - Other ioctls and functions involved are named consistently.
76 * side-effect this fills out the unique name in the master structure.
77 * 2. Call GET_UNIQUE to read out the unique name from the master structure,
85 * means the unique name for the master node just opening is _not_ filled
119 struct drm_master *master; in drm_getunique() local
121 mutex_lock(&dev->master_mutex); in drm_getunique()
122 master = file_priv->master; in drm_getunique()
123 if (u->unique_len >= master->unique_len) { in drm_getunique()
124 if (copy_to_user(u->unique, master->unique, master->unique_len)) { in drm_getunique()
125 mutex_unlock(&dev->master_mutex); in drm_getunique()
126 return -EFAULT; in drm_getunique()
129 u->unique_len = master->unique_len; in drm_getunique()
130 mutex_unlock(&dev->master_mutex); in drm_getunique()
137 struct drm_master *master) in drm_unset_busid() argument
139 kfree(master->unique); in drm_unset_busid()
140 master->unique = NULL; in drm_unset_busid()
141 master->unique_len = 0; in drm_unset_busid()
146 struct drm_master *master = file_priv->master; in drm_set_busid() local
149 if (master->unique != NULL) in drm_set_busid()
150 drm_unset_busid(dev, master); in drm_set_busid()
152 if (dev->dev && dev_is_pci(dev->dev)) { in drm_set_busid()
153 ret = drm_pci_set_busid(dev, master); in drm_set_busid()
155 drm_unset_busid(dev, master); in drm_set_busid()
159 WARN_ON(!dev->unique); in drm_set_busid()
160 master->unique = kstrdup(dev->unique, GFP_KERNEL); in drm_set_busid()
161 if (master->unique) in drm_set_busid()
162 master->unique_len = strlen(dev->unique); in drm_set_busid()
187 * Hollowed-out getclient ioctl to keep some dead old drm tests/tools in drm_getclient()
189 * get -EINVAL, hence this is the return value we need to hand back for in drm_getclient()
197 if (client->idx == 0) { in drm_getclient()
198 client->auth = file_priv->authenticated; in drm_getclient()
199 client->pid = task_pid_vnr(current); in drm_getclient()
200 client->uid = overflowuid; in drm_getclient()
201 client->magic = 0; in drm_getclient()
202 client->iocs = 0; in drm_getclient()
206 return -EINVAL; in drm_getclient()
223 struct drm_stats *stats = data; in drm_getstats() local
225 /* Clear stats to prevent userspace from eating its stack garbage. */ in drm_getstats()
226 memset(stats, 0, sizeof(*stats)); in drm_getstats()
239 req->value = 0; in drm_getcap()
241 /* Only some caps make sense with UMS/render-only drivers. */ in drm_getcap()
242 switch (req->capability) { in drm_getcap()
244 req->value = 1; in drm_getcap()
247 req->value = DRM_PRIME_CAP_IMPORT | DRM_PRIME_CAP_EXPORT; in drm_getcap()
250 req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ); in drm_getcap()
253 req->value = drm_core_check_feature(dev, DRIVER_SYNCOBJ_TIMELINE); in drm_getcap()
259 return -EOPNOTSUPP; in drm_getcap()
261 switch (req->capability) { in drm_getcap()
263 if (dev->driver->dumb_create) in drm_getcap()
264 req->value = 1; in drm_getcap()
267 req->value = 1; in drm_getcap()
270 req->value = dev->mode_config.preferred_depth; in drm_getcap()
273 req->value = dev->mode_config.prefer_shadow; in drm_getcap()
276 req->value = dev->mode_config.async_page_flip; in drm_getcap()
279 req->value = 1; in drm_getcap()
281 if (!crtc->funcs->page_flip_target) in drm_getcap()
282 req->value = 0; in drm_getcap()
286 if (dev->mode_config.cursor_width) in drm_getcap()
287 req->value = dev->mode_config.cursor_width; in drm_getcap()
289 req->value = 64; in drm_getcap()
292 if (dev->mode_config.cursor_height) in drm_getcap()
293 req->value = dev->mode_config.cursor_height; in drm_getcap()
295 req->value = 64; in drm_getcap()
298 req->value = !dev->mode_config.fb_modifiers_not_supported; in drm_getcap()
301 req->value = 1; in drm_getcap()
304 req->value = drm_core_check_feature(dev, DRIVER_ATOMIC) && in drm_getcap()
305 dev->mode_config.async_page_flip; in drm_getcap()
308 return -EINVAL; in drm_getcap()
321 /* No render-only settable capabilities for now */ in drm_setclientcap()
325 return -EOPNOTSUPP; in drm_setclientcap()
327 switch (req->capability) { in drm_setclientcap()
329 if (req->value > 1) in drm_setclientcap()
330 return -EINVAL; in drm_setclientcap()
331 file_priv->stereo_allowed = req->value; in drm_setclientcap()
334 if (req->value > 1) in drm_setclientcap()
335 return -EINVAL; in drm_setclientcap()
336 file_priv->universal_planes = req->value; in drm_setclientcap()
340 return -EOPNOTSUPP; in drm_setclientcap()
342 if (current->comm[0] == 'X' && req->value == 1) { in drm_setclientcap()
344 return -EOPNOTSUPP; in drm_setclientcap()
346 if (req->value > 2) in drm_setclientcap()
347 return -EINVAL; in drm_setclientcap()
348 file_priv->atomic = req->value; in drm_setclientcap()
349 file_priv->universal_planes = req->value; in drm_setclientcap()
351 * No atomic user-space blows up on aspect ratio mode bits. in drm_setclientcap()
353 file_priv->aspect_ratio_allowed = req->value; in drm_setclientcap()
356 if (req->value > 1) in drm_setclientcap()
357 return -EINVAL; in drm_setclientcap()
358 file_priv->aspect_ratio_allowed = req->value; in drm_setclientcap()
361 if (!file_priv->atomic) in drm_setclientcap()
362 return -EINVAL; in drm_setclientcap()
363 if (req->value > 1) in drm_setclientcap()
364 return -EINVAL; in drm_setclientcap()
365 file_priv->writeback_connectors = req->value; in drm_setclientcap()
369 return -EOPNOTSUPP; in drm_setclientcap()
370 if (!file_priv->atomic) in drm_setclientcap()
371 return -EINVAL; in drm_setclientcap()
372 if (req->value > 1) in drm_setclientcap()
373 return -EINVAL; in drm_setclientcap()
374 file_priv->supports_virtualized_cursor_plane = req->value; in drm_setclientcap()
377 return -EINVAL; in drm_setclientcap()
399 mutex_lock(&dev->master_mutex); in drm_setversion()
400 if (sv->drm_di_major != -1) { in drm_setversion()
401 if (sv->drm_di_major != DRM_IF_MAJOR || in drm_setversion()
402 sv->drm_di_minor < 0 || sv->drm_di_minor > DRM_IF_MINOR) { in drm_setversion()
403 retcode = -EINVAL; in drm_setversion()
406 if_version = DRM_IF_VERSION(sv->drm_di_major, in drm_setversion()
407 sv->drm_di_minor); in drm_setversion()
408 dev->if_version = max(if_version, dev->if_version); in drm_setversion()
409 if (sv->drm_di_minor >= 1) { in drm_setversion()
420 if (sv->drm_dd_major != -1) { in drm_setversion()
421 if (sv->drm_dd_major != dev->driver->major || in drm_setversion()
422 sv->drm_dd_minor < 0 || sv->drm_dd_minor > in drm_setversion()
423 dev->driver->minor) { in drm_setversion()
424 retcode = -EINVAL; in drm_setversion()
430 sv->drm_di_major = DRM_IF_MAJOR; in drm_setversion()
431 sv->drm_di_minor = DRM_IF_MINOR; in drm_setversion()
432 sv->drm_dd_major = dev->driver->major; in drm_setversion()
433 sv->drm_dd_minor = dev->driver->minor; in drm_setversion()
434 mutex_unlock(&dev->master_mutex); in drm_setversion()
440 * drm_noop - DRM no-op ioctl implementation
445 * This no-op implementation for drm ioctls is useful for deprecated
460 * drm_invalid_op - DRM invalid ioctl implementation
465 * This no-op implementation for drm ioctls is useful for deprecated
472 * Always fails with a return value of -EINVAL.
477 return -EINVAL; in drm_invalid_op()
500 * larger than the userspace-supplied buffer) */ in drm_copy_field()
506 return -EFAULT; in drm_copy_field()
527 version->version_major = dev->driver->major; in drm_version()
528 version->version_minor = dev->driver->minor; in drm_version()
529 version->version_patchlevel = dev->driver->patchlevel; in drm_version()
530 err = drm_copy_field(version->name, &version->name_len, in drm_version()
531 dev->driver->name); in drm_version()
533 /* Driver date is deprecated. Userspace expects a non-empty string. */ in drm_version()
535 err = drm_copy_field(version->date, &version->date_len, "0"); in drm_version()
537 err = drm_copy_field(version->desc, &version->desc_len, in drm_version()
538 dev->driver->desc); in drm_version()
547 return -EACCES; in drm_ioctl_permit()
551 !file_priv->authenticated)) in drm_ioctl_permit()
552 return -EACCES; in drm_ioctl_permit()
554 /* MASTER is only for master or control clients */ in drm_ioctl_permit()
557 return -EACCES; in drm_ioctl_permit()
562 return -EACCES; in drm_ioctl_permit()
686 * which define IOCTL for use by the display DRM master, but they all predate
702 * ``Documentation/process/botching-up-ioctls.rst``. Note that drm_ioctl()
703 * automatically zero-extends structures, hence make sure you can add more stuff
725 * the driver-specific IOCTLs are wired up.
731 struct drm_file *file_priv = file->private_data; in drm_ioctl_kernel()
732 struct drm_device *dev = file_priv->minor->dev; in drm_ioctl_kernel()
739 return -ENODEV; in drm_ioctl_kernel()
750 * drm_ioctl - ioctl callback implementation for DRM drivers
765 struct drm_file *file_priv = filp->private_data; in drm_ioctl()
770 int retcode = -EINVAL; in drm_ioctl()
776 dev = file_priv->minor->dev; in drm_ioctl()
779 return -ENODEV; in drm_ioctl()
782 return -ENOTTY; in drm_ioctl()
788 unsigned int index = nr - DRM_COMMAND_BASE; in drm_ioctl()
790 if (index >= dev->driver->num_ioctls) in drm_ioctl()
792 index = array_index_nospec(index, dev->driver->num_ioctls); in drm_ioctl()
793 ioctl = &dev->driver->ioctls[index]; in drm_ioctl()
802 drv_size = _IOC_SIZE(ioctl->cmd); in drm_ioctl()
804 if ((cmd & ioctl->cmd & IOC_IN) == 0) in drm_ioctl()
806 if ((cmd & ioctl->cmd & IOC_OUT) == 0) in drm_ioctl()
811 current->comm, task_pid_nr(current), in drm_ioctl()
812 (long)old_encode_dev(file_priv->minor->kdev->devt), in drm_ioctl()
813 file_priv->authenticated, ioctl->name); in drm_ioctl()
816 func = ioctl->func; in drm_ioctl()
820 retcode = -EINVAL; in drm_ioctl()
829 retcode = -ENOMEM; in drm_ioctl()
835 retcode = -EFAULT; in drm_ioctl()
840 memset(kdata + in_size, 0, ksize - in_size); in drm_ioctl()
842 retcode = drm_ioctl_kernel(filp, func, kdata, ioctl->flags); in drm_ioctl()
844 retcode = -EFAULT; in drm_ioctl()
850 current->comm, task_pid_nr(current), in drm_ioctl()
851 (long)old_encode_dev(file_priv->minor->kdev->devt), in drm_ioctl()
852 file_priv->authenticated, cmd, nr); in drm_ioctl()
858 current->comm, task_pid_nr(current), retcode); in drm_ioctl()
864 * drm_ioctl_flags - Check for core ioctl and return ioctl permission flags