From: Marius Vlad marius.vlad0@gmail.com
Currently driver-specific ioctls have to be declared static and are confined to DRM core driver. This patch series provides the means to remove those constrains and allow to register driver-specific ioctls dynamically by keeping a list of registered ioctls in struct drm_driver, then each component of the driver can then register its own specific ioctls using this interface.
The driver must assign ioctl_register/ioctl_deregister in its drm_driver structure in order to make use of it.
While SoC drivers benefit the most from this approach (by not polluting DRM core driver and allowing sub drivers to implement and register driver-specific ioctls dynamically), further patches shows how easy is to convert drm/i915 to this approach by registering GEM and perf ioctls separately.
Marius Vlad (4): drm/gpu: Support registering driver-specific ioctls dynamically drm/i915: Convert i915 to use ioctl_register/ioctl_deregister. drm/i915: Register perf_ ioctls directly in i915_perf file. drm/i915: Register GEM ioctls directly in i915_gem file.
drivers/gpu/drm/drm_drv.c | 1 + drivers/gpu/drm/drm_ioctl.c | 99 ++++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/i915_drv.c | 107 +++++++++++++++------------------------ drivers/gpu/drm/i915/i915_gem.c | 52 +++++++++++++++++++ drivers/gpu/drm/i915/i915_perf.c | 21 ++++++++ include/drm/drm_drv.h | 34 +++++++++++++ include/drm/drm_ioctl.h | 6 +++ 7 files changed, 249 insertions(+), 71 deletions(-)
From: Marius Vlad marius.vlad0@gmail.com
Signed-off-by: Marius Vlad marius.vlad0@gmail.com Signed-off-by: Marius-Adrian Negreanu groleo@gmail.com --- drivers/gpu/drm/drm_drv.c | 1 + drivers/gpu/drm/drm_ioctl.c | 99 +++++++++++++++++++++++++++++++++++++++++++-- include/drm/drm_drv.h | 34 ++++++++++++++++ include/drm/drm_ioctl.h | 6 +++ 4 files changed, 136 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index be38ac7..7727662 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -513,6 +513,7 @@ int drm_dev_init(struct drm_device *dev, INIT_LIST_HEAD(&dev->vmalist); INIT_LIST_HEAD(&dev->maplist); INIT_LIST_HEAD(&dev->vblank_event_list); + INIT_LIST_HEAD(&dev->driver->registered_ioctls);
spin_lock_init(&dev->buf_lock); spin_lock_init(&dev->event_lock); diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index a9ae6dd..03868d8 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -777,10 +777,18 @@ long drm_ioctl(struct file *filp, is_driver_ioctl = nr >= DRM_COMMAND_BASE && nr < DRM_COMMAND_END;
if (is_driver_ioctl) { - /* driver ioctl */ - if (nr - DRM_COMMAND_BASE >= dev->driver->num_ioctls) - goto err_i1; - ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE]; + /* check first if the driver has registered dynamically ioctls */ + if (dev->driver->ioctl_register && dev->driver->ioctl_deregister) { + struct drm_ioctl_desc *pos = drm_ioctl_get_ioctl(dev, nr); + if (!pos) + goto err_i1; + ioctl = pos; + } else { + /* driver ioctl */ + if (nr - DRM_COMMAND_BASE >= dev->driver->num_ioctls) + goto err_i1; + ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE]; + } } else { /* core ioctl */ if (nr >= DRM_CORE_IOCTL_COUNT) @@ -871,3 +879,86 @@ bool drm_ioctl_flags(unsigned int nr, unsigned int *flags) return true; } EXPORT_SYMBOL(drm_ioctl_flags); + +/** + * drm_ioctl_register - registers a driver-specific ioctl + * @drm: the drm device + * @ioctl: the ioctl to register + * + * This method can be used to dynamically register a driver-specific + * ioctl, without the need to have an array of drm_ioctl_desc declared + * in DRM core driver. + */ +void drm_ioctl_register(struct drm_device *drm, struct drm_ioctl_desc *ioctl) +{ + mutex_lock(&drm_global_mutex); + list_add_tail(&ioctl->next, &drm->driver->registered_ioctls); + mutex_unlock(&drm_global_mutex); +} +EXPORT_SYMBOL_GPL(drm_ioctl_register); + +/** + * drm_ioctl_deregister - removes the ioctl previously registered + * @drm: the drm device + * @ioctl: the ioctl to be removed + * + * Use this method to remove previously registered ioctls. + */ +void drm_ioctl_deregister(struct drm_device *drm, struct drm_ioctl_desc *ioctl) +{ + struct drm_ioctl_desc *pos, *ppos; + struct list_head *head = &drm->driver->registered_ioctls; + + mutex_lock(&drm_global_mutex); + list_for_each_entry_safe(pos, ppos, head, next) { + if (DRM_IOCTL_NR(pos->cmd) == DRM_IOCTL_NR(ioctl->cmd)) { + list_del(&pos->next); + break; + } + } + mutex_unlock(&drm_global_mutex); +} +EXPORT_SYMBOL_GPL(drm_ioctl_deregister); + +/** + * drm_ioctl_get_ioctl - retrieve a ioctl based on its IOCTL nr + * @drm: the drm device + * @nr: ioctl number + * + * Returns: a pointer to struct drm_ioctl_desc or NULL otherwise + */ +struct drm_ioctl_desc *drm_ioctl_get_ioctl(struct drm_device *drm, unsigned int nr) +{ + struct drm_ioctl_desc *pos, *found; + struct list_head *head = &drm->driver->registered_ioctls; + + found = NULL; + + mutex_lock(&drm_global_mutex); + list_for_each_entry(pos, head, next) { + if (DRM_IOCTL_NR(pos->cmd) == nr) { + found = pos; + break; + } + } + mutex_unlock(&drm_global_mutex); + return found; +} + +/** + * drm_ioctl_get_registered - retrieve the number of ioctls registered so far + * @drm: the drm device + */ +size_t drm_ioctl_get_registered(struct drm_device *drm) +{ + size_t cnt = 0; + struct list_head *pos; + + mutex_lock(&drm_global_mutex); + list_for_each(pos, &drm->driver->registered_ioctls) + cnt++; + mutex_unlock(&drm_global_mutex); + + return cnt; +} +EXPORT_SYMBOL_GPL(drm_ioctl_get_registered); diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 71bbaae..9e43152 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -31,6 +31,7 @@ #include <linux/irqreturn.h>
#include <drm/drm_device.h> +#include <drm/drm_ioctl.h>
struct drm_file; struct drm_gem_object; @@ -537,6 +538,28 @@ struct drm_driver { struct drm_device *dev, uint32_t handle);
+ + /** + * @ioctl_register: + * + * Registers an ioctl. + */ + void (*ioctl_register)(struct drm_device *drm, struct drm_ioctl_desc *ioctl); + + /** + * @ioctl_deregister: + * + * Removes a previously registered ioctl. + */ + void (*ioctl_deregister)(struct drm_device *drm, struct drm_ioctl_desc *ioctl); + + /** + * @ioctl_get_registered: + * + * Return the number of ioctls currently registered. + */ + size_t (*ioctl_get_registered)(struct drm_device *drm); + /** * @gem_vm_ops: Driver private ops for this object */ @@ -571,6 +594,17 @@ struct drm_driver { int num_ioctls;
/** + * @registered_ioctls: + * + * A list holding dynamically registered ioctls, as an alternative way of + * having a static array of drm_ioctl_desc. + * + * Drivers must initialize ioctl_register and ioctl_deregister (or use + * the already provided drm_ioctl_register/drm_ioctl_deregister). + */ + struct list_head registered_ioctls; + + /** * @fops: * * File operations for the DRM device node. See the discussion in diff --git a/include/drm/drm_ioctl.h b/include/drm/drm_ioctl.h index add4280..ae96e39 100644 --- a/include/drm/drm_ioctl.h +++ b/include/drm/drm_ioctl.h @@ -150,6 +150,7 @@ struct drm_ioctl_desc { enum drm_ioctl_flags flags; drm_ioctl_t *func; const char *name; + struct list_head next; };
/** @@ -181,6 +182,11 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); #endif bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
+void drm_ioctl_register(struct drm_device *drm, struct drm_ioctl_desc *ioctl); +void drm_ioctl_deregister(struct drm_device *drm, struct drm_ioctl_desc *ioctl); +struct drm_ioctl_desc *drm_ioctl_get_ioctl(struct drm_device *drm, unsigned int nr); +size_t drm_ioctl_get_registered(struct drm_device *drm); + int drm_noop(struct drm_device *dev, void *data, struct drm_file *file_priv); int drm_invalid_op(struct drm_device *dev, void *data,
Hi Marius,
[auto build test WARNING on drm-intel/for-linux-next] [also build test WARNING on next-20170905] [cannot apply to v4.13] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Marius-Vlad/RFC-drm-Allow-driver-sp... base: git://anongit.freedesktop.org/drm-intel for-linux-next reproduce: make htmldocs
All warnings (new ones prefixed by >>):
WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org) include/linux/init.h:1: warning: no structured comments found include/linux/mod_devicetable.h:687: warning: Excess struct/union/enum/typedef member 'ver_major' description in 'fsl_mc_device_id' include/linux/mod_devicetable.h:687: warning: Excess struct/union/enum/typedef member 'ver_minor' description in 'fsl_mc_device_id' kernel/sys.c:1: warning: no structured comments found include/linux/device.h:968: warning: No description found for parameter 'dma_ops' drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found include/linux/sync_file.h:51: warning: No description found for parameter 'flags' include/linux/iio/iio.h:603: warning: No description found for parameter 'trig_readonly' include/linux/iio/trigger.h:151: warning: No description found for parameter 'indio_dev' include/linux/iio/trigger.h:151: warning: No description found for parameter 'trig' include/linux/device.h:969: warning: No description found for parameter 'dma_ops' arch/s390/include/asm/cmb.h:1: warning: no structured comments found drivers/scsi/scsi_lib.c:1116: warning: No description found for parameter 'rq' drivers/scsi/constants.c:1: warning: no structured comments found include/linux/usb/gadget.h:230: warning: No description found for parameter 'claimed' include/linux/usb/gadget.h:230: warning: No description found for parameter 'enabled' include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_altset_not_supp' include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_stall_not_supp' include/linux/usb/gadget.h:412: warning: No description found for parameter 'quirk_zlp_not_supp' fs/inode.c:1666: warning: No description found for parameter 'rcu' include/linux/jbd2.h:443: warning: No description found for parameter 'i_transaction' include/linux/jbd2.h:443: warning: No description found for parameter 'i_next_transaction' include/linux/jbd2.h:443: warning: No description found for parameter 'i_list' include/linux/jbd2.h:443: warning: No description found for parameter 'i_vfs_inode' include/linux/jbd2.h:443: warning: No description found for parameter 'i_flags' include/linux/jbd2.h:497: warning: No description found for parameter 'h_rsv_handle' include/linux/jbd2.h:497: warning: No description found for parameter 'h_reserved' include/linux/jbd2.h:497: warning: No description found for parameter 'h_type' include/linux/jbd2.h:497: warning: No description found for parameter 'h_line_no' include/linux/jbd2.h:497: warning: No description found for parameter 'h_start_jiffies' include/linux/jbd2.h:497: warning: No description found for parameter 'h_requested_credits' include/linux/jbd2.h:497: warning: No description found for parameter 'saved_alloc_context' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chkpt_bhs' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_devname' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_average_commit_time' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_min_batch_time' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_max_batch_time' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_commit_callback' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_failed_commit' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_chksum_driver' include/linux/jbd2.h:1050: warning: No description found for parameter 'j_csum_seed' fs/jbd2/transaction.c:511: warning: No description found for parameter 'type' fs/jbd2/transaction.c:511: warning: No description found for parameter 'line_no' fs/jbd2/transaction.c:641: warning: No description found for parameter 'gfp_mask' include/drm/drm_drv.h:628: warning: No description found for parameter 'gem_prime_pin' include/drm/drm_drv.h:628: warning: No description found for parameter 'gem_prime_unpin' include/drm/drm_drv.h:628: warning: No description found for parameter 'gem_prime_res_obj' include/drm/drm_drv.h:628: warning: No description found for parameter 'gem_prime_get_sg_table' include/drm/drm_drv.h:628: warning: No description found for parameter 'gem_prime_import_sg_table' include/drm/drm_drv.h:628: warning: No description found for parameter 'gem_prime_vmap' include/drm/drm_drv.h:628: warning: No description found for parameter 'gem_prime_vunmap' include/drm/drm_drv.h:628: warning: No description found for parameter 'gem_prime_mmap' include/drm/drm_mode_config.h:771: warning: No description found for parameter 'modifiers_property' include/drm/drm_mode_config.h:771: warning: Excess struct/union/enum/typedef member 'modifiers' description in 'drm_mode_config' include/drm/drm_plane.h:544: warning: No description found for parameter 'modifiers' include/drm/drm_plane.h:544: warning: No description found for parameter 'modifier_count'
include/drm/drm_ioctl.h:155: warning: No description found for parameter 'next'
drivers/gpu/host1x/bus.c:50: warning: No description found for parameter 'driver' Documentation/doc-guide/sphinx.rst:121: ERROR: Unknown target name: "sphinx c domain". kernel/sched/fair.c:7584: WARNING: Inline emphasis start-string without end-string. kernel/time/timer.c:1200: ERROR: Unexpected indentation. kernel/time/timer.c:1202: ERROR: Unexpected indentation. kernel/time/timer.c:1203: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:108: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/wait.h:111: ERROR: Unexpected indentation. include/linux/wait.h:113: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/time/hrtimer.c:991: WARNING: Block quote ends without a blank line; unexpected unindent. kernel/signal.c:323: WARNING: Inline literal start-string without end-string. kernel/rcu/tree.c:3187: ERROR: Unexpected indentation. kernel/rcu/tree.c:3214: ERROR: Unexpected indentation. kernel/rcu/tree.c:3215: WARNING: Bullet list ends without a blank line; unexpected unindent. include/linux/iio/iio.h:219: ERROR: Unexpected indentation. include/linux/iio/iio.h:220: WARNING: Block quote ends without a blank line; unexpected unindent. include/linux/iio/iio.h:226: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/iio/industrialio-core.c:633: ERROR: Unknown target name: "iio_val". drivers/iio/industrialio-core.c:640: ERROR: Unknown target name: "iio_val". drivers/ata/libata-core.c:5906: ERROR: Unknown target name: "hw". drivers/message/fusion/mptbase.c:5051: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/tty/serial/serial_core.c:1897: WARNING: Definition list ends without a blank line; unexpected unindent. drivers/pci/pci.c:3470: ERROR: Unexpected indentation. include/linux/regulator/driver.h:271: ERROR: Unknown target name: "regulator_regmap_x_voltage". include/linux/spi/spi.h:373: ERROR: Unexpected indentation. drivers/w1/w1_io.c:196: WARNING: Definition list ends without a blank line; unexpected unindent. block/bio.c:404: ERROR: Unknown target name: "gfp". sound/soc/soc-core.c:2703: ERROR: Unknown target name: "snd_soc_daifmt". sound/core/jack.c:312: ERROR: Unknown target name: "snd_jack_btn". Documentation/virtual/kvm/vcpu-requests.rst:: WARNING: document isn't included in any toctree Documentation/dev-tools/kselftest.rst:15: WARNING: Could not lex literal_block as "c". Highlighting skipped. Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "~/.fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected
vim +/next +155 include/drm/drm_ioctl.h
7cfdf711 Daniel Vetter 2017-03-22 @155
:::::: The code at line 155 was first introduced by commit :::::: 7cfdf711ffb02b45a4c84fdc4e7272320ec9fd2e drm: Extract drm_ioctl.h
:::::: TO: Daniel Vetter daniel.vetter@ffwll.ch :::::: CC: Daniel Vetter daniel.vetter@ffwll.ch
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
From: Marius Vlad marius.vlad0@gmail.com
Signed-off-by: Marius Vlad marius.vlad0@gmail.com Signed-off-by: Marius-Adrian Negreanu groleo@gmail.com --- drivers/gpu/drm/i915/i915_drv.c | 145 +++++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 67 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 4310022..73be83d 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1183,6 +1183,71 @@ static void i915_driver_cleanup_hw(struct drm_i915_private *dev_priv) i915_ggtt_cleanup_hw(dev_priv); }
+static int +i915_gem_reject_pin_ioctl(struct drm_device *dev, void *data, + struct drm_file *file) +{ + return -ENODEV; +} + +static struct drm_ioctl_desc i915_ioctls[] = { + DRM_IOCTL_DEF_DRV(I915_INIT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_FLUSH, drm_noop, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_FLIP, drm_noop, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_BATCHBUFFER, drm_noop, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_IRQ_EMIT, drm_noop, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_IRQ_WAIT, drm_noop, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_GETPARAM, i915_getparam, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_SETPARAM, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_ALLOC, drm_noop, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_FREE, drm_noop, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_INIT_HEAP, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_CMDBUFFER, drm_noop, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_DESTROY_HEAP, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_SET_VBLANK_PIPE, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GET_VBLANK_PIPE, drm_noop, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_VBLANK_SWAP, drm_noop, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_HWS_ADDR, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GEM_INIT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER2_WR, i915_gem_execbuffer2, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_PIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GEM_UNPIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_SET_CACHING, i915_gem_set_caching_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_GET_CACHING, i915_gem_get_caching_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_THROTTLE, i915_gem_throttle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_ENTERVT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GEM_LEAVEVT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GEM_CREATE, i915_gem_create_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_PREAD, i915_gem_pread_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_PWRITE, i915_gem_pwrite_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_MMAP, i915_gem_mmap_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_MMAP_GTT, i915_gem_mmap_gtt_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_SET_DOMAIN, i915_gem_set_domain_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_SW_FINISH, i915_gem_sw_finish_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_SET_TILING, i915_gem_set_tiling_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_GET_TILING, i915_gem_get_tiling_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_GET_APERTURE, i915_gem_get_aperture_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GET_PIPE_FROM_CRTC_ID, intel_get_pipe_from_crtc_id, 0), + DRM_IOCTL_DEF_DRV(I915_GEM_MADVISE, i915_gem_madvise_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_OVERLAY_PUT_IMAGE, intel_overlay_put_image_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), + DRM_IOCTL_DEF_DRV(I915_OVERLAY_ATTRS, intel_overlay_attrs_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), + DRM_IOCTL_DEF_DRV(I915_SET_SPRITE_COLORKEY, intel_sprite_set_colorkey, DRM_MASTER|DRM_CONTROL_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GET_SPRITE_COLORKEY, drm_noop, DRM_MASTER|DRM_CONTROL_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_WAIT, i915_gem_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_CREATE, i915_gem_context_create_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_DESTROY, i915_gem_context_destroy_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_REG_READ, i915_reg_read_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GET_RESET_STATS, i915_gem_context_reset_stats_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_USERPTR, i915_gem_userptr_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_GETPARAM, i915_gem_context_getparam_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_SETPARAM, i915_gem_context_setparam_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_PERF_OPEN, i915_perf_open_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_PERF_ADD_CONFIG, i915_perf_add_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_PERF_REMOVE_CONFIG, i915_perf_remove_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), +}; + /** * i915_driver_register - register the driver with the rest of the system * @dev_priv: device private @@ -1193,6 +1258,7 @@ static void i915_driver_cleanup_hw(struct drm_i915_private *dev_priv) static void i915_driver_register(struct drm_i915_private *dev_priv) { struct drm_device *dev = &dev_priv->drm; + unsigned int i;
i915_gem_shrinker_init(dev_priv);
@@ -1225,6 +1291,9 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
intel_audio_init(dev_priv);
+ for (i = 0; i < ARRAY_SIZE(i915_ioctls); i++) + dev->driver->ioctl_register(dev, &i915_ioctls[i]); + /* * Some ports require correctly set-up hpd registers for detection to * work properly (leading to ghost connected connector status), e.g. VGA @@ -1241,6 +1310,12 @@ static void i915_driver_register(struct drm_i915_private *dev_priv) */ static void i915_driver_unregister(struct drm_i915_private *dev_priv) { + unsigned int i; + struct drm_device *dev = &dev_priv->drm; + + for (i = 0; i < ARRAY_SIZE(i915_ioctls); i++) + dev->driver->ioctl_deregister(dev, &i915_ioctls[i]); + intel_fbdev_unregister(dev_priv); intel_audio_deinit(dev_priv);
@@ -2669,71 +2744,6 @@ static const struct file_operations i915_driver_fops = { .llseek = noop_llseek, };
-static int -i915_gem_reject_pin_ioctl(struct drm_device *dev, void *data, - struct drm_file *file) -{ - return -ENODEV; -} - -static const struct drm_ioctl_desc i915_ioctls[] = { - DRM_IOCTL_DEF_DRV(I915_INIT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_FLUSH, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_FLIP, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_BATCHBUFFER, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_IRQ_EMIT, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_IRQ_WAIT, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_GETPARAM, i915_getparam, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_SETPARAM, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_ALLOC, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_FREE, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_INIT_HEAP, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_CMDBUFFER, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_DESTROY_HEAP, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_SET_VBLANK_PIPE, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GET_VBLANK_PIPE, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_VBLANK_SWAP, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_HWS_ADDR, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_INIT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER2_WR, i915_gem_execbuffer2, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_PIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_UNPIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_SET_CACHING, i915_gem_set_caching_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_GET_CACHING, i915_gem_get_caching_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_THROTTLE, i915_gem_throttle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_ENTERVT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_LEAVEVT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_CREATE, i915_gem_create_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_PREAD, i915_gem_pread_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_PWRITE, i915_gem_pwrite_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_MMAP, i915_gem_mmap_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_MMAP_GTT, i915_gem_mmap_gtt_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_SET_DOMAIN, i915_gem_set_domain_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_SW_FINISH, i915_gem_sw_finish_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_SET_TILING, i915_gem_set_tiling_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_GET_TILING, i915_gem_get_tiling_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_GET_APERTURE, i915_gem_get_aperture_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GET_PIPE_FROM_CRTC_ID, intel_get_pipe_from_crtc_id, 0), - DRM_IOCTL_DEF_DRV(I915_GEM_MADVISE, i915_gem_madvise_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_OVERLAY_PUT_IMAGE, intel_overlay_put_image_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), - DRM_IOCTL_DEF_DRV(I915_OVERLAY_ATTRS, intel_overlay_attrs_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), - DRM_IOCTL_DEF_DRV(I915_SET_SPRITE_COLORKEY, intel_sprite_set_colorkey, DRM_MASTER|DRM_CONTROL_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GET_SPRITE_COLORKEY, drm_noop, DRM_MASTER|DRM_CONTROL_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_WAIT, i915_gem_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_CREATE, i915_gem_context_create_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_DESTROY, i915_gem_context_destroy_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_REG_READ, i915_reg_read_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GET_RESET_STATS, i915_gem_context_reset_stats_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_USERPTR, i915_gem_userptr_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_GETPARAM, i915_gem_context_getparam_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_SETPARAM, i915_gem_context_setparam_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_PERF_OPEN, i915_perf_open_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_PERF_ADD_CONFIG, i915_perf_add_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_PERF_REMOVE_CONFIG, i915_perf_remove_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), -}; - static struct drm_driver driver = { /* Don't use MTRRs here; the Xserver or userspace app should * deal with them for Intel hardware. @@ -2757,8 +2767,9 @@ static struct drm_driver driver = {
.dumb_create = i915_gem_dumb_create, .dumb_map_offset = i915_gem_mmap_gtt, - .ioctls = i915_ioctls, - .num_ioctls = ARRAY_SIZE(i915_ioctls), + .ioctl_register = drm_ioctl_register, + .ioctl_deregister = drm_ioctl_deregister, + .ioctl_get_registered = drm_ioctl_get_registered, .fops = &i915_driver_fops, .name = DRIVER_NAME, .desc = DRIVER_DESC,
On Mon, 2017-09-04 at 18:16 +0300, Marius Vlad wrote:
From: Marius Vlad marius.vlad0@gmail.com
Signed-off-by: Marius Vlad marius.vlad0@gmail.com Signed-off-by: Marius-Adrian Negreanu groleo@gmail.com
<SNIP>
@@ -1183,6 +1183,71 @@ static void i915_driver_cleanup_hw(struct drm_i915_private *dev_priv) i915_ggtt_cleanup_hw(dev_priv); }
+static int +i915_gem_reject_pin_ioctl(struct drm_device *dev, void *data,
struct drm_file *file)
+{
- return -ENODEV;
+}
+static struct drm_ioctl_desc i915_ioctls[] = {
This becomes non-const, with no obvious benefit?
Regards, Joonas
From: Marius Vlad marius.vlad0@gmail.com
Signed-off-by: Marius Vlad marius.vlad0@gmail.com Signed-off-by: Marius-Adrian Negreanu groleo@gmail.com --- drivers/gpu/drm/i915/i915_drv.c | 3 --- drivers/gpu/drm/i915/i915_perf.c | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 73be83d..09f8c6c 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1243,9 +1243,6 @@ static struct drm_ioctl_desc i915_ioctls[] = { DRM_IOCTL_DEF_DRV(I915_GEM_USERPTR, i915_gem_userptr_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_GETPARAM, i915_gem_context_getparam_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_SETPARAM, i915_gem_context_setparam_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_PERF_OPEN, i915_perf_open_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_PERF_ADD_CONFIG, i915_perf_add_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_PERF_REMOVE_CONFIG, i915_perf_remove_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), };
/** diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index 94185d6..0b2a9d5 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -3374,6 +3374,12 @@ static struct ctl_table dev_root[] = { {} };
+static struct drm_ioctl_desc i915_perf_ioctls[] = { + DRM_IOCTL_DEF_DRV(I915_PERF_OPEN, i915_perf_open_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_PERF_ADD_CONFIG, i915_perf_add_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_PERF_REMOVE_CONFIG, i915_perf_remove_config_ioctl, DRM_UNLOCKED|DRM_RENDER_ALLOW), +}; + /** * i915_perf_init - initialize i915-perf state on module load * @dev_priv: i915 device instance @@ -3385,6 +3391,8 @@ static struct ctl_table dev_root[] = { */ void i915_perf_init(struct drm_i915_private *dev_priv) { + unsigned int i; + struct drm_device *dev = &dev_priv->drm; dev_priv->perf.oa.timestamp_frequency = 0;
if (IS_HASWELL(dev_priv)) { @@ -3483,6 +3491,11 @@ void i915_perf_init(struct drm_i915_private *dev_priv)
dev_priv->perf.initialized = true; } + + /* register ioctls */ + for (i = 0; i < ARRAY_SIZE(i915_perf_ioctls); i++) + dev->driver->ioctl_register(dev, &i915_perf_ioctls[i]); + }
static int destroy_config(int id, void *p, void *data) @@ -3501,9 +3514,14 @@ static int destroy_config(int id, void *p, void *data) */ void i915_perf_fini(struct drm_i915_private *dev_priv) { + unsigned int i; + struct drm_device *dev = NULL; + if (!dev_priv->perf.initialized) return;
+ dev = &dev_priv->drm; + idr_for_each(&dev_priv->perf.metrics_idr, destroy_config, dev_priv); idr_destroy(&dev_priv->perf.metrics_idr);
@@ -3511,5 +3529,8 @@ void i915_perf_fini(struct drm_i915_private *dev_priv)
memset(&dev_priv->perf.oa.ops, 0, sizeof(dev_priv->perf.oa.ops));
+ for (i = 0; i < ARRAY_SIZE(i915_perf_ioctls); i++) + dev->driver->ioctl_deregister(dev, &i915_perf_ioctls[i]); + dev_priv->perf.initialized = false; }
From: Marius Vlad marius.vlad0@gmail.com
Signed-off-by: Marius Vlad marius.vlad0@gmail.com Signed-off-by: Marius-Adrian Negreanu groleo@gmail.com --- drivers/gpu/drm/i915/i915_drv.c | 35 --------------------------- drivers/gpu/drm/i915/i915_gem.c | 52 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 35 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 09f8c6c..e372eb9 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -1183,13 +1183,6 @@ static void i915_driver_cleanup_hw(struct drm_i915_private *dev_priv) i915_ggtt_cleanup_hw(dev_priv); }
-static int -i915_gem_reject_pin_ioctl(struct drm_device *dev, void *data, - struct drm_file *file) -{ - return -ENODEV; -} - static struct drm_ioctl_desc i915_ioctls[] = { DRM_IOCTL_DEF_DRV(I915_INIT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF_DRV(I915_FLUSH, drm_noop, DRM_AUTH), @@ -1208,41 +1201,13 @@ static struct drm_ioctl_desc i915_ioctls[] = { DRM_IOCTL_DEF_DRV(I915_GET_VBLANK_PIPE, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_VBLANK_SWAP, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_HWS_ADDR, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_INIT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER2_WR, i915_gem_execbuffer2, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_PIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_UNPIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_SET_CACHING, i915_gem_set_caching_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_GET_CACHING, i915_gem_get_caching_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_THROTTLE, i915_gem_throttle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_ENTERVT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_LEAVEVT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_CREATE, i915_gem_create_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_PREAD, i915_gem_pread_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_PWRITE, i915_gem_pwrite_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_MMAP, i915_gem_mmap_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_MMAP_GTT, i915_gem_mmap_gtt_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_SET_DOMAIN, i915_gem_set_domain_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_SW_FINISH, i915_gem_sw_finish_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_SET_TILING, i915_gem_set_tiling_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_GET_TILING, i915_gem_get_tiling_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_GET_APERTURE, i915_gem_get_aperture_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_GET_PIPE_FROM_CRTC_ID, intel_get_pipe_from_crtc_id, 0), - DRM_IOCTL_DEF_DRV(I915_GEM_MADVISE, i915_gem_madvise_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_OVERLAY_PUT_IMAGE, intel_overlay_put_image_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), DRM_IOCTL_DEF_DRV(I915_OVERLAY_ATTRS, intel_overlay_attrs_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), DRM_IOCTL_DEF_DRV(I915_SET_SPRITE_COLORKEY, intel_sprite_set_colorkey, DRM_MASTER|DRM_CONTROL_ALLOW), DRM_IOCTL_DEF_DRV(I915_GET_SPRITE_COLORKEY, drm_noop, DRM_MASTER|DRM_CONTROL_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_WAIT, i915_gem_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_CREATE, i915_gem_context_create_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_DESTROY, i915_gem_context_destroy_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_REG_READ, i915_reg_read_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_GET_RESET_STATS, i915_gem_context_reset_stats_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_USERPTR, i915_gem_userptr_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_GETPARAM, i915_gem_context_getparam_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_SETPARAM, i915_gem_context_setparam_ioctl, DRM_RENDER_ALLOW), };
/** diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index b9e8e0d..52bbdda 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -4779,8 +4779,49 @@ bool intel_sanitize_semaphores(struct drm_i915_private *dev_priv, int value) return true; }
+static int +i915_gem_reject_pin_ioctl(struct drm_device *dev, void *data, + struct drm_file *file) +{ + return -ENODEV; +} + +static struct drm_ioctl_desc i915_gem_ioctls[] = { + DRM_IOCTL_DEF_DRV(I915_GEM_INIT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER, i915_gem_execbuffer, DRM_AUTH), + DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER2_WR, i915_gem_execbuffer2, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_PIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GEM_UNPIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_SET_CACHING, i915_gem_set_caching_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_GET_CACHING, i915_gem_get_caching_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_THROTTLE, i915_gem_throttle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_ENTERVT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GEM_LEAVEVT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), + DRM_IOCTL_DEF_DRV(I915_GEM_CREATE, i915_gem_create_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_PREAD, i915_gem_pread_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_PWRITE, i915_gem_pwrite_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_MMAP, i915_gem_mmap_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_MMAP_GTT, i915_gem_mmap_gtt_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_SET_DOMAIN, i915_gem_set_domain_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_SW_FINISH, i915_gem_sw_finish_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_SET_TILING, i915_gem_set_tiling_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_GET_TILING, i915_gem_get_tiling_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_GET_APERTURE, i915_gem_get_aperture_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_MADVISE, i915_gem_madvise_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_WAIT, i915_gem_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_CREATE, i915_gem_context_create_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_DESTROY, i915_gem_context_destroy_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_USERPTR, i915_gem_userptr_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_GETPARAM, i915_gem_context_getparam_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_SETPARAM, i915_gem_context_setparam_ioctl, DRM_RENDER_ALLOW), +}; + + int i915_gem_init(struct drm_i915_private *dev_priv) { + unsigned int i; + struct drm_device *dev = &dev_priv->drm; int ret;
mutex_lock(&dev_priv->drm.struct_mutex); @@ -4830,6 +4871,10 @@ int i915_gem_init(struct drm_i915_private *dev_priv) ret = 0; }
+ DRM_DEBUG("Registering GEM ioctls\n"); + for (i = 0; i < ARRAY_SIZE(i915_gem_ioctls); i++) + dev->driver->ioctl_register(dev, &i915_gem_ioctls[i]); + out_unlock: intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL); mutex_unlock(&dev_priv->drm.struct_mutex); @@ -4845,11 +4890,18 @@ void i915_gem_init_mmio(struct drm_i915_private *i915) void i915_gem_cleanup_engines(struct drm_i915_private *dev_priv) { + unsigned int i; + struct drm_device *dev = &dev_priv->drm; struct intel_engine_cs *engine; enum intel_engine_id id;
for_each_engine(engine, dev_priv, id) dev_priv->gt.cleanup_engine(engine); + + /* also deregister ioctls */ + DRM_DEBUG("Deregistering GEM ioctls\n"); + for (i = 0; i < ARRAY_SIZE(i915_gem_ioctls); i++) + dev->driver->ioctl_deregister(dev, &i915_gem_ioctls[i]); }
void
On Mon, Sep 04, 2017 at 06:16:41PM +0300, Marius Vlad wrote:
From: Marius Vlad marius.vlad0@gmail.com
Currently driver-specific ioctls have to be declared static and are confined to DRM core driver. This patch series provides the means to remove those constrains and allow to register driver-specific ioctls dynamically by keeping a list of registered ioctls in struct drm_driver, then each component of the driver can then register its own specific ioctls using this interface.
The driver must assign ioctl_register/ioctl_deregister in its drm_driver structure in order to make use of it.
While SoC drivers benefit the most from this approach (by not polluting DRM core driver and allowing sub drivers to implement and register driver-specific ioctls dynamically), further patches shows how easy is to convert drm/i915 to this approach by registering GEM and perf ioctls separately.
What exactly is the problem you're trying to solve?
This awefully smells like some neat way to make loading driver modules for blob userspace easy ... And I can't think of any other thing you could use this for.
And even for the blob userspace use case: Create a separate drm driver instance, share buffers and fences with dma_buf and dma_fence, and you're all good. I really have no idea what this is good for, but maybe I'm missing something? -Daniel
Marius Vlad (4): drm/gpu: Support registering driver-specific ioctls dynamically drm/i915: Convert i915 to use ioctl_register/ioctl_deregister. drm/i915: Register perf_ ioctls directly in i915_perf file. drm/i915: Register GEM ioctls directly in i915_gem file.
drivers/gpu/drm/drm_drv.c | 1 + drivers/gpu/drm/drm_ioctl.c | 99 ++++++++++++++++++++++++++++++++++-- drivers/gpu/drm/i915/i915_drv.c | 107 +++++++++++++++------------------------ drivers/gpu/drm/i915/i915_gem.c | 52 +++++++++++++++++++ drivers/gpu/drm/i915/i915_perf.c | 21 ++++++++ include/drm/drm_drv.h | 34 +++++++++++++ include/drm/drm_ioctl.h | 6 +++ 7 files changed, 249 insertions(+), 71 deletions(-)
-- 2.9.3
There isn't any dark plot behind it.
For instance, in our use case, a DPU (Display Process Unit) which has a blit feature (using DRM_RENDER_ALLOW) can be implemented cleanly in a separate driver and not being dependent on the DRM core driver. If the blit feature is present/enabled, we can dynamically register the ioctls at run-time.
There are other means to mitigate this, but we thought this would beneficial to other drivers as well.
Other SoC drivers like Exynos (G2D) provide this feature by inventing it's own sub-driver system/layer and have all the sub-drivers built-in.
On Mon, Sep 4, 2017 at 6:25 PM, Daniel Vetter daniel@ffwll.ch wrote:
On Mon, Sep 04, 2017 at 06:16:41PM +0300, Marius Vlad wrote:
From: Marius Vlad marius.vlad0@gmail.com
Currently driver-specific ioctls have to be declared static and are
confined to
DRM core driver. This patch series provides the means to remove those
constrains
and allow to register driver-specific ioctls dynamically by keeping a
list of
registered ioctls in struct drm_driver, then each component of the
driver can
then register its own specific ioctls using this interface.
The driver must assign ioctl_register/ioctl_deregister in its drm_driver structure in order to make use of it.
While SoC drivers benefit the most from this approach (by not polluting
DRM core
driver and allowing sub drivers to implement and register driver-specific ioctls dynamically), further patches shows how easy is to convert
drm/i915 to
this approach by registering GEM and perf ioctls separately.
What exactly is the problem you're trying to solve?
This awefully smells like some neat way to make loading driver modules for blob userspace easy ... And I can't think of any other thing you could use this for.
And even for the blob userspace use case: Create a separate drm driver instance, share buffers and fences with dma_buf and dma_fence, and you're all good. I really have no idea what this is good for, but maybe I'm missing something? -Daniel
Marius Vlad (4): drm/gpu: Support registering driver-specific ioctls dynamically drm/i915: Convert i915 to use ioctl_register/ioctl_deregister. drm/i915: Register perf_ ioctls directly in i915_perf file. drm/i915: Register GEM ioctls directly in i915_gem file.
drivers/gpu/drm/drm_drv.c | 1 + drivers/gpu/drm/drm_ioctl.c | 99 ++++++++++++++++++++++++++++++
++++--
drivers/gpu/drm/i915/i915_drv.c | 107 +++++++++++++++---------------
drivers/gpu/drm/i915/i915_gem.c | 52 +++++++++++++++++++ drivers/gpu/drm/i915/i915_perf.c | 21 ++++++++ include/drm/drm_drv.h | 34 +++++++++++++ include/drm/drm_ioctl.h | 6 +++ 7 files changed, 249 insertions(+), 71 deletions(-)
-- 2.9.3
-- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
On Mon, Sep 04, 2017 at 07:06:54PM +0300, marius vlad wrote:
There isn't any dark plot behind it.
For instance, in our use case, a DPU (Display Process Unit) which has a blit feature (using DRM_RENDER_ALLOW) can be implemented cleanly in a separate driver and not being dependent on the DRM core driver. If the blit feature is present/enabled, we can dynamically register the ioctls at run-time.
There are other means to mitigate this, but we thought this would beneficial to other drivers as well.
Other SoC drivers like Exynos (G2D) provide this feature by inventing it's own sub-driver system/layer and have all the sub-drivers built-in.
With all the desktop drivers we simply have a feature flag that describes which engines are there, and use that to filter out invalid operations.
On arm-soc with it's love for a metric ton of DT tons for everything you should be able to do the same, it's just a bit more work to get all the of nodes you need.
If you want a separate driver, imo register a full separate drm_device instance with everything. But imo the arm-soc design love for heavily split up drivers really doesn't make much sense, at least for IP all designed by the same company. Imo look at msm or etnaviv for what I think are reasonable drm drivers for arm-soc platforms, don't look at exynos. -Daniel
On Mon, Sep 4, 2017 at 6:25 PM, Daniel Vetter daniel@ffwll.ch wrote:
On Mon, Sep 04, 2017 at 06:16:41PM +0300, Marius Vlad wrote:
From: Marius Vlad marius.vlad0@gmail.com
Currently driver-specific ioctls have to be declared static and are
confined to
DRM core driver. This patch series provides the means to remove those
constrains
and allow to register driver-specific ioctls dynamically by keeping a
list of
registered ioctls in struct drm_driver, then each component of the
driver can
then register its own specific ioctls using this interface.
The driver must assign ioctl_register/ioctl_deregister in its drm_driver structure in order to make use of it.
While SoC drivers benefit the most from this approach (by not polluting
DRM core
driver and allowing sub drivers to implement and register driver-specific ioctls dynamically), further patches shows how easy is to convert
drm/i915 to
this approach by registering GEM and perf ioctls separately.
What exactly is the problem you're trying to solve?
This awefully smells like some neat way to make loading driver modules for blob userspace easy ... And I can't think of any other thing you could use this for.
And even for the blob userspace use case: Create a separate drm driver instance, share buffers and fences with dma_buf and dma_fence, and you're all good. I really have no idea what this is good for, but maybe I'm missing something? -Daniel
Marius Vlad (4): drm/gpu: Support registering driver-specific ioctls dynamically drm/i915: Convert i915 to use ioctl_register/ioctl_deregister. drm/i915: Register perf_ ioctls directly in i915_perf file. drm/i915: Register GEM ioctls directly in i915_gem file.
drivers/gpu/drm/drm_drv.c | 1 + drivers/gpu/drm/drm_ioctl.c | 99 ++++++++++++++++++++++++++++++
++++--
drivers/gpu/drm/i915/i915_drv.c | 107 +++++++++++++++---------------
drivers/gpu/drm/i915/i915_gem.c | 52 +++++++++++++++++++ drivers/gpu/drm/i915/i915_perf.c | 21 ++++++++ include/drm/drm_drv.h | 34 +++++++++++++ include/drm/drm_ioctl.h | 6 +++ 7 files changed, 249 insertions(+), 71 deletions(-)
-- 2.9.3
-- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
-- Marius Vlad
Quoting Marius Vlad (2017-09-04 16:16:41)
From: Marius Vlad marius.vlad0@gmail.com
Currently driver-specific ioctls have to be declared static and are confined to DRM core driver. This patch series provides the means to remove those constrains and allow to register driver-specific ioctls dynamically by keeping a list of registered ioctls in struct drm_driver, then each component of the driver can then register its own specific ioctls using this interface.
The driver must assign ioctl_register/ioctl_deregister in its drm_driver structure in order to make use of it.
While SoC drivers benefit the most from this approach (by not polluting DRM core driver and allowing sub drivers to implement and register driver-specific ioctls dynamically), further patches shows how easy is to convert drm/i915 to this approach by registering GEM and perf ioctls separately.
Why?
You do not have to use drm_ioctl directly... Avoiding it would reduce our ioctl overhead considerably, for example reducing busy_ioctl from around 110ns to around 45ns. -Chris
Indeed, we argued at first to let the driver handle the ioctls directly, but we would like to use the DRM interface if possible.
On Mon, Sep 4, 2017 at 6:26 PM, Chris Wilson chris@chris-wilson.co.uk wrote:
Quoting Marius Vlad (2017-09-04 16:16:41)
From: Marius Vlad marius.vlad0@gmail.com
Currently driver-specific ioctls have to be declared static and are
confined to
DRM core driver. This patch series provides the means to remove those
constrains
and allow to register driver-specific ioctls dynamically by keeping a
list of
registered ioctls in struct drm_driver, then each component of the
driver can
then register its own specific ioctls using this interface.
The driver must assign ioctl_register/ioctl_deregister in its drm_driver structure in order to make use of it.
While SoC drivers benefit the most from this approach (by not polluting
DRM core
driver and allowing sub drivers to implement and register driver-specific ioctls dynamically), further patches shows how easy is to convert
drm/i915 to
this approach by registering GEM and perf ioctls separately.
Why?
You do not have to use drm_ioctl directly... Avoiding it would reduce our ioctl overhead considerably, for example reducing busy_ioctl from around 110ns to around 45ns. -Chris
dri-devel@lists.freedesktop.org