1. 06 8月, 2014 2 次提交
  2. 05 8月, 2014 4 次提交
    • D
      drm: make sysfs device always available for minors · e1728075
      David Herrmann 提交于
      For each minor we allocate a sysfs device as minor->kdev. Currently, this
      is allocated and registered in drm_minor_register(). This makes it
      impossible to add sysfs-attributes to the device before it is registered.
      Therefore, they are not added atomically, nor can we move device_add()
      *after* ->load() is called.
      
      This patch makes minor->kdev available early, but only adds the device
      during minor-registration. Note that the registration is still called
      before ->load() as debugfs needs to be split, too. This will be fixed in
      follow-ups.
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      e1728075
    • D
      drm: make minor->index available early · f1b85962
      David Herrmann 提交于
      Instead of allocating the minor-index during registration, we now do this
      during allocation. This way, debug-messages between minor-allocation and
      minor-registration will now use the correct minor instead of 0. Same is
      done for unregistration vs. free, so debug-messages between
      device-shutdown and device-destruction show proper indices.
      
      Even though minor-indices are allocated early, we don't enable minor
      lookup early. Instead, we keep the entry set to NULL and replace it during
      registration / unregistration. This way, the index is allocated but lookup
      only works if registered.
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      f1b85962
    • D
      drm: move module initialization to drm_stub.c · 1b7199fe
      David Herrmann 提交于
      Most of the new DRM management functions are nowadays in drm_stub.c. By
      moving the core module initialization to drm_stub.c we can make several
      global variables static and keep the stub-open helper local.
      
      The core files now look like this:
        drm_stub.c: Core management
         drm_drv.c: Ioctl dispatcher
       drm_ioctl.c: Actual ioctl backends
        drm_fops.c: Char-dev file-operations
      
      A follow-up patch will move what is left from drm_drv.c into drm_ioctl.c.
      Acked-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      1b7199fe
    • D
      drm: drop redundant drm_file->is_master · 48ba8137
      David Herrmann 提交于
      The drm_file->is_master field is redundant as it's equivalent to:
          drm_file->master && drm_file->master == drm_file->minor->master
      
      1) "=>"
        Whenever we set drm_file->is_master, we also set:
            drm_file->minor->master = drm_file->master;
      
        Whenever we clear drm_file->is_master, we also call:
            drm_master_put(&drm_file->minor->master);
        which implicitly clears it to NULL.
      
      2) "<="
        minor->master cannot be set if it is non-NULL. Therefore, it stays as
        is unless a file drops it.
      
        If minor->master is NULL, it is only set by places that also adjust
        drm_file->is_master.
      
      Therefore, we can safely drop is_master and replace it by an inline helper
      that matches:
          drm_file->master && drm_file->master == drm_file->minor->master
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      48ba8137
  3. 08 7月, 2014 2 次提交
  4. 18 6月, 2014 1 次提交
    • D
      drm: Don't export internal module variables · a1bc07c5
      Daniel Vetter 提交于
      Drivers really have no business touching these. Noticed because
      exynose _did_ touch the vblank off delay, which could potentially
      affect other drivers.
      
      drm_debug is an exception since it's used in macros and inline
      functions.
      
      Note that this reduces the timeout on exynos from 50s to 5s.
      Apparently this was done to paper over a vblank get/put race in
      exynos, but really should be fixed properly somewhere else. Spotted by
      David.
      
      v2: Drop bonghits changes. Note to self: Don't submit patches
      before first coffee.
      
      Cc: Inki Dae <inki.dae@samsung.com>
      Reviewed-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a1bc07c5
  5. 06 6月, 2014 2 次提交
  6. 16 5月, 2014 1 次提交
  7. 23 4月, 2014 2 次提交
  8. 22 4月, 2014 1 次提交
  9. 02 4月, 2014 1 次提交
  10. 28 3月, 2014 6 次提交
  11. 16 3月, 2014 12 次提交
    • D
      drm: make minors independent of global lock · 0d639883
      David Herrmann 提交于
      We used to protect minor-lookup and setup by the global drm lock. To
      continue our attempts of dropping drm_global_mutex, this patch makes the
      minor management independent of it. Furthermore, we make it all atomic and
      switch to spin-locks instead of a mutex.
      
      Now that minor-lookup is independent, we also move the
      "drm_is_unplugged()" test into the minor-lookup path. There is no reason
      to ever return a minor for unplugged objects, so keep that logic internal.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      0d639883
    • D
      drm: inline drm_minor_get_id() · 7d86cf1a
      David Herrmann 提交于
      We can significantly simplify this helper by using plain multiplication.
      Note that we converted the minor-type to an enum earlier so this didn't
      work before.
      
      We also fix a minor range-bug here: the limit argument of idr_alloc() is
      *exclusive*, not inclusive, so we should use 64 instead of 63 as offset.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      7d86cf1a
    • D
      drm: coding-style fixes in minor handling · 1abbc437
      David Herrmann 提交于
      Properly name goto-labels, remove empty lines and use DRM_ERROR if
      possible.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      1abbc437
    • D
      drm: remove redundant minor->device field · 5817878c
      David Herrmann 提交于
      Whenever we access minor->device, we are in a minor->kdev->...->fops
      callback so the minor->kdev pointer *must* be valid. Thus, simply use
      minor->kdev->devt instead of minor->device and remove the redundant field.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      5817878c
    • D
      drm: remove unneeded #ifdef CONFIG_DEBUGFS · cb0f9323
      David Herrmann 提交于
      No need to check for DEBUGFS, we already have dummy-fallbacks in our
      headers.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      cb0f9323
    • D
      drm: rename drm_unplug/get_minor() to drm_minor_register/unregister() · afcdbc86
      David Herrmann 提交于
      drm_get_minor() no longer allocates objects, and drm_unplug_minor() is now
      the exact reverse of it. Rename it to _register/unregister() so their
      name actually says what they do.
      
      Furthermore, remove the direct minor-ptr and instead pass the minor-type.
      This way we know the actual slot of the minor and can reset it if
      required.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      afcdbc86
    • D
      drm: move drm_put_minor() to drm_minor_free() · bd9dfa98
      David Herrmann 提交于
      _put/get() are used for ref-counting, which we clearly don't do here.
      Rename it to _free() and also use the common drm_minor_* prefix.
      Furthermore, avoid passing the minor directly but instead use the type
      like the other functions do, this allows us to reset the slot.
      
      We also drop the redundant call to drm_unplug_minor() as drm_minor_free()
      is only used from paths were that has already be called.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      bd9dfa98
    • D
      drm: allocate minors early · 05b701f6
      David Herrmann 提交于
      Instead of waiting for device-registration, we now allocate minor-objects
      during device allocation. The minors are not registered or assigned an ID.
      This is still postponed to device-registration.
      
      While at it, remove the superfluous output-parameter in drm_get_minor().
      
      The reason for this early allocation is to make
      dev->primary/control/render available atomically. So once the device is
      alive, all of them are already set and we never have the situation where
      one of them is set after another (they're either NULL or set, but never
      changed). This will eventually allow us to reduce minor-ID allocation to
      one base-ID instead of a single ID for each.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      05b701f6
    • D
      drm: add minor-lookup/release helpers · 1616c525
      David Herrmann 提交于
      Instead of accessing drm_minors_idr directly, this adds a small helper to
      hide the internals. This will help us later to remove the drm_global_mutex
      requirement for minor-lookup.
      
      Furthermore, this also makes sure that minor->dev is always valid and
      takes a reference-count to the device as long as the minor is used in an
      open-file. This way, "struct file*"->private_data->dev is guaranteed to be
      valid (which it has to, as we cannot reset it).
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      1616c525
    • D
      drm: provide device-refcount · 099d1c29
      David Herrmann 提交于
      Lets not trick ourselves into thinking "drm_device" objects are not
      ref-counted. That's just utterly stupid. We manage "drm_minor" objects on
      each drm-device and each minor can have an unlimited number of open
      handles. Each of these handles has the drm_minor (and thus the drm_device)
      as private-data in the file-handle. Therefore, we may not destroy
      "drm_device" until all these handles are closed.
      
      It is *not* possible to reset all these pointers atomically and restrict
      access to them, and this is *not* how this is done! Instead, we use
      ref-counts to make sure the object is valid and not freed.
      
      Note that we currently use "dev->open_count" for that, which is *exactly*
      the same as a reference-count, just open coded. So this patch doesn't
      change any semantics on DRM devices (well, this patch just introduces the
      ref-count, anyway. Follow-up patches will replace open_count by it).
      
      Also note that generic VFS revoke support could allow us to drop this
      ref-count again. We could then just synchronously disable any fops->xy()
      calls. However, this is not the case, yet, and no such patches are
      in sight (and I seriously question the idea of dropping the ref-cnt
      again).
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      099d1c29
    • D
      drm: use anon-inode instead of relying on cdevs · 6796cb16
      David Herrmann 提交于
      DRM drivers share a common address_space across all character-devices of a
      single DRM device. This allows simple buffer eviction and mapping-control.
      However, DRM core currently waits for the first ->open() on any char-dev
      to mark the underlying inode as backing inode of the device. This delayed
      initialization causes ugly conditions all over the place:
        if (dev->dev_mapping)
          do_sth();
      
      To avoid delayed initialization and to stop reusing the inode of the
      char-dev, we allocate an anonymous inode for each DRM device and reset
      filp->f_mapping to it on ->open().
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      6796cb16
    • D
      drm: add pseudo filesystem for shared inodes · 31bbe16f
      David Herrmann 提交于
      Our current DRM design uses a single address_space for all users of the
      same DRM device. However, there is no way to create an anonymous
      address_space without an underlying inode. Therefore, we wait for the
      first ->open() callback on a registered char-dev and take-over the inode
      of the char-dev. This worked well so far, but has several drawbacks:
       - We screw with FS internals and rely on some non-obvious invariants like
         inode->i_mapping being the same as inode->i_data for char-devs.
       - We don't have any address_space prior to the first ->open() from
         user-space. This leads to ugly fallback code and we cannot allocate
         global objects early.
      
      As pointed out by Al-Viro, fs/anon_inode.c is *not* supposed to be used by
      drivers for anonymous inode-allocation. Therefore, this patch follows the
      proposed alternative solution and adds a pseudo filesystem mount-point to
      DRM. We can then allocate private inodes including a private address_space
      for each DRM device at initialization time.
      
      Note that we could use:
        sysfs_get_inode(sysfs_mnt->mnt_sb, drm_device->dev->kobj.sd);
      to get access to the underlying sysfs-inode of a "struct device" object.
      However, most of this information is currently hidden and it's not clear
      whether this address_space is suitable for driver access. Thus, unless
      linux allows anonymous address_space objects or driver-core provides a
      public inode per device, we're left with our own private internal mount
      point.
      
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      31bbe16f
  12. 18 12月, 2013 5 次提交
  13. 13 12月, 2013 1 次提交