summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_stub.c
Commit message (Collapse)AuthorAgeFilesLines
* drm: Remove command line guard for universal planesMatt Roper2014-07-081-4/+0Star
| | | | | | | | | | | Universal planes are ready to leave 'experimental' state so drop the kernel command line parameter that we've been hiding them behind. Userspace clients that wish to receive universal planes will still need to opt-in by setting the appropriate capability bit, so this should have no impact on existing userspace. Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* Merge branch 'drm-next' of git://people.freedesktop.org/~dvdhrm/linux into ↵Dave Airlie2014-07-081-5/+1Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | drm-next * 'drm-next' of git://people.freedesktop.org/~dvdhrm/linux: drm/omap: remove null test before kfree drm/bochs: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN drm/ttm: recognize ARM arch in ioprot handler drm: enable render-nodes by default drm/ttm: remove declaration of ttm_tt_cache_flush drm/gem: remove misleading gfp parameter to get_pages() drm/omap: use __GFP_DMA32 for shmem-backed gem drm/i915: use shmem helpers if possible Conflicts: drivers/gpu/drm/drm_stub.c
| * drm: enable render-nodes by defaultDavid Herrmann2014-07-081-6/+1Star
| | | | | | | | | | | | | | | | | | We introduced render-nodes about 1/2 year ago and no problems showed up. Remove the drm_rnodes argument and enable them by default now. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
* | drm: Don't export internal module variablesDaniel Vetter2014-06-181-4/+0Star
|/ | | | | | | | | | | | | | | | | | | | | 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: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
* drm: Add device registration documentationThierry Reding2014-06-051-11/+11
| | | | | | | | | | | | | Describe how devices are registered using the drm_*_init() functions. Adding this to docbook requires a largish set of changes to the comments in drm_{pci,usb,platform}.c since they are doxygen-style rather than proper kernel-doc and therefore mess with the docbook generation. While at it, mark usage of drm_put_dev() as discouraged in favour of calling drm_dev_unregister() and drm_dev_unref() directly. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Thierry Reding <treding@nvidia.com>
* drm: Introduce drm_dev_set_unique()Thierry Reding2014-06-051-0/+26
| | | | | | | | | | | Add a helper function that allows drivers to statically set the unique name of the device. This will allow platform and USB drivers to get rid of their DRM bus implementations and directly use drm_dev_alloc() and drm_dev_register(). Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
* drm: fix memory leak around mode_group (v2)Dave Airlie2014-05-161-0/+1
| | | | | | | | This mode group id_list was never being freed. v2: take David's suggestion to free in minor_free. Signed-off-by: Dave Airlie <airlied@redhat.com>
* Merge branch 'drm-init-cleanup' of git://people.freedesktop.org/~danvet/drm ↵Dave Airlie2014-05-011-6/+1Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into drm-next Next pull request, this time more of the drm de-midlayering work. The big thing is that his patch series here removes everything from drm_bus except the set_busid callback. Thierry has a few more patches on top of this to make that one optional to. With that we can ditch all the non-pci drm_bus implementations, which Thierry has already done for the fake tegra host1x drm_bus. Reviewed by Thierry, Laurent and David and now also survived some testing on my intel boxes to make sure the irq fumble is fixed correctly ;-) The last minute rebase was just to add the r-b tags from Thierry for the 2 patches I've redone. * 'drm-init-cleanup' of git://people.freedesktop.org/~danvet/drm: drm/<drivers>: don't set driver->dev_priv_size to 0 drm: Remove dev->kdriver drm: remove drm_bus->get_name drm: rip out dev->devname drm: inline drm_pci_set_unique drm: remove bus->get_irq implementations drm: pass the irq explicitly to drm_irq_install drm/irq: Look up the pci irq directly in the drm_control ioctl drm/irq: track the irq installed in drm_irq_install in dev->irq drm: rename dev->count_lock to dev->buf_lock drm: Rip out totally bogus vga_switcheroo->can_switch locking drm: kill drm_bus->bus_type drm: remove drm_dev_to_irq from drivers drm/irq: remove cargo-culted locking from irq_install/uninstall drm/irq: drm_control is a legacy ioctl, so pci devices only drm/pci: fold in irq_by_busid support drm/irq: simplify irq checks in drm_wait_vblank
| * drm: rip out dev->devnameDaniel Vetter2014-04-231-5/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was only ever used to pretty-print the irq driver name. And on kms systems due to set_version bonghits we never set up the prettier name, ever. Which make this a bit pointless. Also, we can always dig out the driver-instance/irq relationship through other means, so this isn't that useful. So just rip it out to simplify the set_version/set_busid insanity a bit. Also delete the temporary busname from drm_pci_set_busid, it's now unused. v2: Rebase on top of the new host1x drm_bus for tegra. Reviewed-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
| * drm: rename dev->count_lock to dev->buf_lockDaniel Vetter2014-04-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Since really that's all it protects - legacy horror stories in drm_bufs.c. Since I don't want to waste any more time on this I didn't bother to actually look at what it protects in there, but it's at least contained now. v2: Move the spurious hunk to the right patch (Thierry). Cc: Thierry Reding <thierry.reding@gmail.com> Reviewed-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
* | drm: Fix error handling in drm_master_createDaniel Vetter2014-04-221-1/+4
|/ | | | | | | | | | We need to check whether drm_ht_create succeed and clean up if not. Spotted by coverity. Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
* drm: Allow userspace to ask for universal plane list (v2)Matt Roper2014-04-021-0/+5
| | | | | | | | | | | | Userspace clients which wish to receive all DRM planes (primary and cursor planes in addition to the traditional overlay planes) may set the DRM_CLIENT_CAP_UNIVERSAL_PLANES capability. v2: Hide behind drm.universal_planes module option [suggested by Daniel Vetter] Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Reviewed-by: Rob Clark <robdclark@gmail.com>
* drm: Protect the master management with a drm_device::master_mutex v3Thomas Hellstrom2014-03-281-15/+28
| | | | | | | | | | | | | | | | | | The master management was previously protected by the drm_device::struct_mutex. In order to avoid locking order violations in a reworked dropped master security check in the vmwgfx driver, break it out into a separate master_mutex. Locking order is master_mutex -> struct_mutex. Also remove drm_master::blocked since it's not used. v2: Add an inline comment about what drm_device::master_mutex is protecting. v3: Remove unneeded struct_mutex locks. Fix error returns in drm_setmaster_ioctl(). Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Acked-by: Daniel Vetter <daniel@ffwll.ch>
* drm: Remove the minor master listThomas Hellstrom2014-03-281-5/+0Star
| | | | | | | It doesn't appear to be used anywhere. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
* drm: Remove the ', ' after the function name in debug logsLespiau, Damien2014-03-281-1/+1
| | | | | | | | | | | | | | | | Right now a debug message looks like: [drm:drm_ioctl], pid=860, dev=0xe200, auth=1, DRM_IOCTL_MODE_GETCRTC That first comma looks weird as we already have ']' as a separator. Remove it. If anyone sees this commit message and also thinks that auth=1 isn't the most useful info to have here, let's just say I'd happily review a patch removing it. If I don't get annoyed enough to submit a patch, that is. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Remove the prefix argument of drm_ut_debug_printk()Lespiau, Damien2014-03-281-4/+2Star
| | | | | | | | This is always DRM_NAME, so we can just make it part of the format string instead of asking prink to do it for us. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: drm_ut_debug_printk() isn't called with NULL anywmoreLespiau, Damien2014-03-281-5/+1Star
| | | | | | | | | The DRM_LOG* macros where the only sites where drm_ut_debug_printk was called with NULL arguments for prefix and function_name. Now that they are gone, we can remove that case. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Pull the test on drm_debug in the logging macrosLespiau, Damien2014-03-281-14/+12Star
| | | | | | | | | | | | | | | | | | | | | | | | | | In the logging code, we are currently checking is we need to output in drm_ut_debug_printk(). This is too late. The problem is that when we write something like: DRM_DEBUG_DRIVER("ELD on [CONNECTOR:%d:%s], [ENCODER:%d:%s]\n", connector->base.id, drm_get_connector_name(connector), connector->encoder->base.id, drm_get_encoder_name(connector->encoder)); We start by evaluating the arguments (so call drm_get_connector_name() and drm_get_connector_name()) before ending up in drm_ut_debug_printk() which will then does nothing. This means we execute a lot of instructions (drm_get_connector_name(), in turn, calls snprintf() for example) to happily discard them in the normal case, drm.debug=0. So, let's put the test on drm_debug earlier, in the macros themselves. Sprinkle an unlikely() as well for good measure. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* Merge branch 'drm-minor' into drm-nextDavid Herrmann2014-03-161-132/+216
|\ | | | | | | | | | | Fix minor conflicts with drm-anon: - allocation/free order - drm_device header cleanups
| * drm: make minors independent of global lockDavid Herrmann2014-03-161-6/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: David Herrmann <dh.herrmann@gmail.com>
| * drm: inline drm_minor_get_id()David Herrmann2014-03-161-21/+6Star
| | | | | | | | | | | | | | | | | | | | | | 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: David Herrmann <dh.herrmann@gmail.com>
| * drm: coding-style fixes in minor handlingDavid Herrmann2014-03-161-5/+3Star
| | | | | | | | | | | | | | Properly name goto-labels, remove empty lines and use DRM_ERROR if possible. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
| * drm: remove redundant minor->device fieldDavid Herrmann2014-03-161-1/+0Star
| | | | | | | | | | | | | | | | | | 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: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
| * drm: remove unneeded #ifdef CONFIG_DEBUGFSDavid Herrmann2014-03-161-7/+0Star
| | | | | | | | | | | | | | | | No need to check for DEBUGFS, we already have dummy-fallbacks in our headers. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
| * drm: rename drm_unplug/get_minor() to drm_minor_register/unregister()David Herrmann2014-03-161-37/+17Star
| | | | | | | | | | | | | | | | | | | | | | | | | | 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: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
| * drm: move drm_put_minor() to drm_minor_free()David Herrmann2014-03-161-27/+18Star
| | | | | | | | | | | | | | | | | | | | | | | | | | _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: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
| * drm: allocate minors earlyDavid Herrmann2014-03-161-39/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
| * drm: add minor-lookup/release helpersDavid Herrmann2014-03-161-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
| * drm: provide device-refcountDavid Herrmann2014-03-161-14/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: David Herrmann <dh.herrmann@gmail.com>
* | drm: use anon-inode instead of relying on cdevsDavid Herrmann2014-03-161-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: David Herrmann <dh.herrmann@gmail.com>
* | drm: add pseudo filesystem for shared inodesDavid Herrmann2014-03-161-0/+74
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: David Herrmann <dh.herrmann@gmail.com>
* Merge branch 'drm-intel-next' of ↵Dave Airlie2014-01-201-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://people.freedesktop.org/~danvet/drm-intel into drm-next drm-intel-next-2014-01-10: - final bits for runtime D3 on Haswell from Paul (now enabled fully) - parse the backlight modulation freq information in the VBT from Jani (but not yet used) - more watermark improvements from Ville for ilk-ivb and bdw - bugfixes for fastboot from Jesse - watermark fix for i830M (but not yet everything) - vlv vga hotplug w/a (Imre) - piles of other small improvements, cleanups and fixes all over Note that the pull request includes a backmerge of the last drm-fixes pulled into Linus' tree - things where getting a bit too messy. So the shortlog also contains a bunch of patches from Linus tree. Please yell if you want me to frob it for you a bit. * 'drm-intel-next' of git://people.freedesktop.org/~danvet/drm-intel: (609 commits) drm/i915/bdw: make sure south port interrupts are enabled properly v2 drm/i915: Include more information in disabled hotplug interrupt warning drm/i915: Only complain about a rogue hotplug IRQ after disabling drm/i915: Only WARN about a stuck hotplug irq ONCE drm/i915: s/hotplugt_status_gen4/hotplug_status_g4x/
| * drm: don't double-free on driver load errorIlia Mirkin2013-12-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | All instances of drm_dev_register are followed by drm_dev_free on failure. Don't free dev->control/render/primary on failure, as they will be freed by drm_dev_free since commit 8f6599da8e (drm: delay minor destruction to drm_dev_free()). Instead unplug them. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reported-and-tested-by: Bruno Prémont <bonbons@linux-vserver.org> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | drm: kill the ->agp_destroy callbackDaniel Vetter2013-12-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Call drm_pci_agp_destroy directly, there's no point in the indirection. Long term we want to shuffle this into each driver's unload logic, but that needs cleared-up drm lifetime rules first. v2: Add a dummy function for !CONFIG_PCI, spotted my David Herrmann. v3: Fixup for the coding style police. Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Cc: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | drm: remove agp_init() bus callbackDaniel Vetter2013-12-181-7/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PCI bus helper is the only user of it. Call it directly before device-registration to get rid of the callback. Note that all drm_agp_*() calls are locked with the drm-global-mutex so we need to explicitly lock it during initialization. It's not really clear why it's needed, but lets be safe. v2: Rebase on top of the agp_init interface change. v3: Remove the rebase-fail where I've accidentally killed the ->irq_by_busid callback a bit too early. Cc: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: David Herrmann <dh.herrmann@gmail.com> (v1) Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | drm: ->agp_init can't failDaniel Vetter2013-12-181-5/+2Star
| | | | | | | | | | | | | | | | | | Thanks to the removal of REQUIRE_AGP we can use a void return value and shed a bit of complexity. Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | drm: restrict the device list for shadow attached driversDaniel Vetter2013-12-181-4/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's really no need for the drm core to keep a list of all devices of a given driver - the linux device model keeps perfect track of this already for us. The exception is old legacy ums drivers using pci shadow attaching. So rename the lists to make the use case clearer and rip out everything else. v2: Rebase on top of David Herrmann's drm device register changes. Also drop the bogus dev_set_drvdata for platform drivers that somehow crept into the original version - drivers really should be in full control of that field. v3: Initialize driver->legacy_dev_list outside of the loop, spotted by David Herrmann. v4: Rebase on top of the newly created host1x drm_bus for tegra. Cc: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
* | drm: Don't split up debug outputDaniel Vetter2013-12-181-3/+9
|/ | | | | | | | | | | | | Otherwise we risk that the 2nd part of the line ends up on a line of it's own, which means a kernel dmesg line without a log level. This then upsets the dmesg checker in piglit. Only really happens in some of the truly nasty igt testcases which race cache dropping (through debugfs) with other gem operations. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: check for !kdev in drm_unplug_minor()David Herrmann2013-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We moved minor deallocation to drm_dev_free() in: commit 8f6599da8e772fa8de54cdf98e9e03cbaf3946da Author: David Herrmann <dh.herrmann@gmail.com> Date: Sun Oct 20 18:55:45 2013 +0200 drm: delay minor destruction to drm_dev_free() However, this causes a call to drm_unplug_minor(), which should just do nothing as drm_dev_unregister() already called this. But a separate patch caused kdev lifetime changes: commit 5bdebb183c9702a8c57a01dff09337be3de337a6 Author: Dave Airlie <airlied@redhat.com> Date: Fri Oct 11 14:07:25 2013 +1000 drm/sysfs: sort out minor and connector device object lifetimes. Thus making our dev_is_registered() call useles (and even segfault if it is NULL). Replace it with a simple !kdev test and we're fine. Reported-by: Huax Lu <huax.lu@intel.com> Reported-by: Daniel Vetter <daniel@ffwll.ch> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71208 Tested-by: lu hua <huax.lu@intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@gmail.com>
* drm: delay minor destruction to drm_dev_free()David Herrmann2013-11-061-3/+7
| | | | | | | | | | | | | | | Instead of freeing minors in drm_dev_unregister(), we only unplug them and delay the free to drm_dev_free(). Note that if drm_dev_register() has never been called, minors are NULL and this has no effect. This change is needed to allow early device unregistration. If we want to call drm_dev_unregister() on live devices, we need to guarantee that minors are still valid (but unplugged). This way, any open file can still access file_priv->minor->dev to get the DRM device. However, the minor is unplugged so no new users can occur. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: remove minor-id during unplugDavid Herrmann2013-11-061-3/+1Star
| | | | | | | | | | | | Don't delay minor removal to drm_put_minor(). Otherwise, user-space can still open the minor and cause the kernel to oops. Instead, remove the minor during unplug so any new open() will fail to access this minor. Note that open() and drm_unplug_minor() are both protected by the global DRM mutex so we're fine. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: cleanup debugfs in drm_unplug_minor()David Herrmann2013-11-061-4/+4
| | | | | | | | | There is no reason to delay debugfs-cleanup to drm_put_minor(). We should forbid any access to debugfs files once the device is dead. Chances they oops once a card was unplugged are very high, anyway. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: make drm_get_minor() staticDavid Herrmann2013-11-061-8/+11
| | | | | | | | drm_get_minor() is only used in one file. Make it static and add a kernel-doc comment which documents the current semantics. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: simplify drm_put_minor()David Herrmann2013-11-061-18/+13Star
| | | | | | | | | | | | | Allow passing NULL as minor to simplify DRM destruction paths. Also remove the double-pointer reset as it is no longer needed. drm_put_minor() is only called when the underlying object is destroyed. Hence, resetting minors to NULL is not necessary. As drm_put_minor() is no longer used by other DRM files, we can make it static, too. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: call drm_unplug_minor() from drm_put_minor()David Herrmann2013-11-061-9/+24
| | | | | | | | | | | | This protects drm_unplug_minor() against repeated calls so we can use it in drm_put_minor(). This allows us to further simplify it in follow-ups as we no longer do minor-destruction in both functions but only in drm_unplug_minor(). Also add kernel-doc comments about what these calls do. [airlied: fixup for changes to kdev stuff] Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: Kill drm perf counter leftoversVille Syrjälä2013-10-091-9/+0Star
| | | | | | | | | | | | | | | | | The user of these counters was killed in commit d79cdc8312689b39c6d83718c1c196af4b3cd18c Author: Daniel Vetter <daniel.vetter@ffwll.ch> Date: Thu Aug 8 15:41:32 2013 +0200 drm: no-op out GET_STATS ioctl so clean up the leftovers as well. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: move device unregistration into drm_dev_unregister()David Herrmann2013-10-091-25/+36
| | | | | | | | | | | | | | | Analog to drm_dev_register(), we now provide drm_dev_unregister() which does the reverse. drm_dev_put() is still in place and combines the calls to drm_dev_unregister() and drm_dev_free() so buses don't have to change. *_get() and *_put() are used for reference-counting in the kernel. However, drm_dev_put() definitely does not do any kind of ref-counting. Hence, use the more appropriate *_register(), *_unregister(), *_alloc() and *_free() names. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: introduce drm_dev_free() to fix error pathsDavid Herrmann2013-10-091-10/+25
| | | | | | | | | | | | | The error paths in DRM bus drivers currently leak memory as they don't correctly revert drm_dev_alloc(). Introduce drm_dev_free() to free DRM devices which haven't been registered, yet. We must be careful not to introduce any side-effects with cleanups done in drm_dev_free(). drm_ht_remove(), drm_ctxbitmap_cleanup() and drm_gem_destroy() are all fine in that regard. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: merge device setup into drm_dev_register()David Herrmann2013-10-091-19/+82
| | | | | | | | | | | | | | | | | | All bus drivers do device setup themselves. This requires us to adjust all of them if we introduce new core features. Thus, merge all these into a uniform drm_dev_register() helper. Note that this removes the drm_lastclose() error path for AGP as it is horribly broken. Moreover, no bus driver called this in any other error path either. Instead, we use the recently introduced AGP cleanup helpers. We also keep a DRIVER_MODESET condition around pci_set_drvdata() to keep semantics. [airlied: keep passing flags through so drivers don't oops on load] Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm: add drm_dev_alloc() helperDavid Herrmann2013-10-091-47/+74
| | | | | | | | | | | | | Instead of managing device allocation+initialization in each bus-driver, we should do that in a central place. drm_fill_in_dev() already does most of it, but also requires the global drm lock for partial AGP device registration. Split both apart so we have a clean device initialization/allocation phase, and a registration phase. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>