aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
AgeCommit message (Collapse)AuthorFilesLines
2013-01-20drm/vmwgfx: add proper framebuffer refcountingDaniel Vetter1-5/+3
Afact vmwgfx already has all the right refcounting implemented on the backing storage, and we only need to ensure that the drm fb doesn't disappear untimely. So holding onto the fb reference from _lookup until vmw_kms_present has completed should be enough. Signed-off-by: Daniel Vetter <[email protected]>
2013-01-20drm: create drm_framebuffer_lookupDaniel Vetter1-12/+12
And replace all fb lookups with it. Also add a WARN to drm_mode_object_find since that is now no longer the blessed interface to look up an fb. And add kerneldoc to both functions. This only updates all callsites, but immediately drops the acquired refence again. Hence all callers still rely on the fact that a mode fb can't disappear while they're holding the struct mutex. Subsequent patches will instate proper use of refcounts, and then rework the rmfb and unref code to no longer serialize fb destruction with the mode_config lock. We don't want that since otherwise a compositor might end up stalling for a few frames in rmfb. v2: Don't use kref_get_unless_zero - Greg KH doesn't like that kind of interface. Reviewed-by: Rob Clark <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
2013-01-20drm: revamp locking around fb creation/destructionDaniel Vetter1-0/+4
Well, at least step 1. The goal here is that framebuffer objects can survive outside of the mode_config lock, with just a reference held as protection. The first step to get there is to introduce a special fb_lock which protects fb lookup, creation and destruction, to make them appear atomic. This new fb_lock can nest within the mode_config lock. But the idea is (once the reference counting part is completed) that we only quickly take that fb_lock to lookup a framebuffer and grab a reference, without any other locks involved. vmwgfx is the only driver which does framebuffer lookups itself, also wrap those calls to drm_mode_object_find with the new lock. Also protect the fb_list walking in i915 and omapdrm with the new lock. As a slight complication there's also the list of user-created fbs attached to the file private. The problem now is that at fclose() time we need to walk that list, eventually do a modeset call to remove the fb from active usage (and are required to be able to take the mode_config lock), but in the end we need to grab the new fb_lock to remove the fb from the list. The easiest solution is to add another mutex to protect this per-file list. Currently that new fbs_lock nests within the modeset locks and so appears redudant. But later patches will switch around this sequence so that taking the modeset locks in the fb destruction path is optional in the fastpath. Ultimately the goal is that addfb and rmfb do not require the mode_config lock, since otherwise they have the potential to introduce stalls in the pageflip sequence of a compositor (if the compositor e.g. switches to a fullscreen client or if it enables a plane). But that requires a few more steps and hoops to jump through. Note that framebuffer creation/destruction is now double-protected - once by the fb_lock and in parts by the idr_lock. The later would be unnecessariy if framebuffers would have their own idr allocator. But that's material for another patch (series). v2: Properly initialize the fb->filp_head list in _init, otherwise the newly added WARN to check whether the fb isn't on a fpriv list any more will fail for driver-private objects. v3: Fixup two error-case unlock bugs spotted by Richard Wilbur. Reviewed-by: Rob Clark <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
2013-01-20drm/vmwgfx: use drm_modeset_lock_allDaniel Vetter1-14/+4
Ok, this one here is a bit more complicated, and I can't really claim to fully understand the locking and lifetime rules of the vmwgfx driver. So just convert ever mutex_lock call, including the interruptible one. Since other places (e.g. in the execbuf ioctl) take the mode_config.mutex without bothering with interruptible handling, I've figured I should be able to get away with this in a few more places ... Signed-off-by: Daniel Vetter <[email protected]>
2012-12-10Merge branch 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux ↵Dave Airlie1-0/+2
into drm-next Alex writes: Pretty minor -next pull request. We some additional new bits waiting internally for release. Hopefully Monday we can get at least some of them out. The others will probably take a few more weeks. Highlights of the current request: - ELD registers for passing audio information to the sound hardware - Handle GPUVM page faults more gracefully - Misc fixes Merge radeon test * 'drm-next-3.8' of git://people.freedesktop.org/~agd5f/linux: (483 commits) drm/radeon: bump driver version for new info ioctl requests drm/radeon: fix eDP clk and lane setup for scaled modes drm/radeon: add new INFO ioctl requests drm/radeon/dce32+: use fractional fb dividers for high clocks drm/radeon: use cached memory when evicting for vram on non agp drm/radeon: add a CS flag END_OF_FRAME drm/radeon: stop page faults from hanging the system (v2) drm/radeon/dce4/5: add registers for ELD handling drm/radeon/dce3.2: add registers for ELD handling radeon: fix pll/ctrc mapping on dce2 and dce3 hardware Linux 3.7-rc7 powerpc/eeh: Do not invalidate PE properly Revert "drm/i915: enable rc6 on ilk again" ALSA: hda - Fix build without CONFIG_PM of/address: sparc: Declare of_iomap as an extern function for sparc again PM / QoS: fix wrong error-checking condition bnx2x: remove redundant warning log vxlan: fix command usage in its doc 8139cp: revert "set ring address before enabling receiver" MPI: Fix compilation on MIPS with GCC 4.4 and newer ... Conflicts: drivers/gpu/drm/exynos/exynos_drm_encoder.c drivers/gpu/drm/exynos/exynos_drm_fbdev.c drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
2012-11-21drm/vmwgfx: Refactor resource managementThomas Hellstrom1-2/+5
Refactor resource management to make it easy to hook up resources that are backed up by buffers. In particular, resources and their backing buffers can be evicted and rebound, if supported by the device. To avoid query deadlocks, the query code is also modified somewhat. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Dmitry Torokhov <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2012-11-16vmwgfx: return an -EFAULT if copy_to_user() failsDan Carpenter1-0/+2
copy_to_user() returns the number of bytes remaining to be copied, but we want to return a negative error code here. I fixed a couple of these last year, but I missed this one. Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2012-10-02UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/David Howells1-1/+1
Convert #include "..." to #include <path/...> in drivers/gpu/. Signed-off-by: David Howells <[email protected]> Acked-by: Dave Airlie <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Acked-by: Thomas Gleixner <[email protected]> Acked-by: Paul E. McKenney <[email protected]> Acked-by: Dave Jones <[email protected]>
2011-12-19vmwgfx: Remove dmabuf check in present ioctlJakob Bornecrantz1-6/+0
Doesn't protect any error code and only gets in the way of debugging. Signed-off-by: Jakob Bornecrantz <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2011-12-19vmwgfx: Use the revised fifo hw version register when presentThomas Hellstrom1-2/+8
The driver implements the needed resource management required to use that register. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2011-12-07vmwgfx: Use kcalloc instead of kzalloc to allocate arrayThomas Meyer1-2/+2
The advantage of kcalloc is, that will prevent integer overflows which could result from the multiplication of number of elements and size and it is also a bit nicer to read. The semantic patch that makes this change is available in https://lkml.org/lkml/2011/11/25/107 Signed-off-by: Thomas Meyer <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2011-10-18vmwgfx: return -EFAULT instead of number of bytes remainingDan Carpenter1-0/+2
The intent here was to return an error code, but instead the code returns the number of bytes remaining (that weren't copied). Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2011-10-10vmwgfx: Wrap drm_read and drm_pollThomas Hellstrom1-0/+43
Make sure the device is processing the fifo when these functions are called in case they might sleep waiting for an event. Signed-off-by: Thomas Hellstrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2011-10-05vmwgfx: Add present and readback ioctlsJakob Bornecrantz1-0/+172
Signed-off-by: Jakob Bornecrantz <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2011-09-06vmwgfx: Add functionality to get 3D capsThomas Hellstrom1-0/+48
Since we don't allow user-space to map the fifo anymore, add a parameter to get fifo hw version and an ioctl to copy the 3D capabilities. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecranz <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2011-09-06vmwgfx: Remove the possibility to map the fifo from user-spaceThomas Hellstrom1-3/+0
This was previously used by user-space to check whether a fence sequence had passed or not. With fence objects that's not needed anymore. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2011-09-06vmwgfx: Remove the fifo debug ioctlThomas Hellstrom1-23/+0
It was only used for bringup debugging, and probably doesn't work anymore. Remove it. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2010-10-06drm/vmwgfx: Add a parameter to get the max fb sizeThomas Hellstrom1-0/+3
This can be used by the X server to restrict mode resolutions and size of root pixmap. Bump minor to announce this availability. Bump driver date. Signed-off-by: Thomas Hellstrom <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2010-02-11drm/vmwgfx: Update the user-space interface.Thomas Hellstrom1-0/+6
When time-based throttling is implemented, we need to bump minor. When the old way of detecting scanout is removed, we need to bump major. In the meantime, this change should not break existing user-space. Signed-off-by: Thomas Hellstrom <[email protected]> Signed-off-by: Jakob Bornecrantz <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2010-02-01drm/vmwgfx: Correctly detect 3DJakob Bornecrantz1-1/+1
Signed-off-by: Jakob Bornecrantz <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2009-12-15drm/vmwgfx: Add DRM driver for VMware Virtual GPUJakob Bornecrantz1-0/+81
This commit adds the vmwgfx driver for the VWware Virtual GPU aka SVGA. The driver is under staging the same as Nouveau and Radeon KMS. Hopefully the 2D ioctls are bug free and don't need changing, so that part of the API should be stable. But there there is a pretty big chance that the 3D API will change in the future. Signed-off-by: Thomas Hellström <[email protected]> Signed-off-by: Jakob Bornecrantz <[email protected]> Signed-off-by: Dave Airlie <[email protected]>