path: root/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
AgeCommit message (Collapse)AuthorFilesLines
2018-03-14drm/vmwgfx: replace drm_*_unreference with drm_*_putHaneen Mohammed1-2/+2
This patch replace instances of drm_framebuffer_unreference with _put() suffix, because it is shorter and consistent with the kernel use of *_get/put() suffixes. This was done with the following Coccinelle script: @r@ expression e; @@ ( -drm_framebuffer_reference(e); +drm_framebuffer_get(e); | -drm_framebuffer_unreference(e); +drm_framebuffer_put(e); ) Signed-off-by: Haneen Mohammed <> Acked-by: Sinclair Yeh <> Signed-off-by: Daniel Vetter <> Link:
2017-11-28the rest of drivers/*: annotate ->poll() instancesAl Viro1-1/+1
Signed-off-by: Al Viro <>
2017-10-12drm: Pass struct drm_file * to __drm_mode_object_find [v2]Keith Packard1-2/+2
This will allow __drm_mode_object_file to be extended to perform access control checks based on the file in use. v2: Also fix up vboxvideo driver in staging [airlied: merging early as this is an API change] Suggested-by: Daniel Vetter <> Signed-off-by: Keith Packard <> Signed-off-by: Dave Airlie <>
2017-03-30drm/vmwgfx: Remove getparam error messageThomas Hellstrom1-2/+0
The mesa winsys sometimes uses unimplemented parameter requests to check for features. Remove the error message to avoid bloating the kernel log. Cc: <> Signed-off-by: Thomas Hellstrom <> Reviewed-by: Brian Paul <> Reviewed-by: Sinclair Yeh <>
2017-03-30drm/vmwgfx: avoid calling vzalloc with a 0 size in vmw_get_cap_3d_ioctl()Murray McAllister1-1/+1
In vmw_get_cap_3d_ioctl(), a user can supply 0 for a size that is used in vzalloc(). This eventually calls dump_stack() (in warn_alloc()), which can leak useful addresses to dmesg. Add check to avoid a size of 0. Cc: <> Signed-off-by: Murray McAllister <> Reviewed-by: Sinclair Yeh <>
2015-11-02drm/vmwgfx: Replace iowrite/ioread with volatile memory accessesThomas Hellstrom1-8/+8
Now that we use memremap instead of ioremap, Use WRITE_ONCE / READ_ONCE instead of iowrite / ioread. Signed-off-by: Thomas Hellstrom <> Reviewed-by: Sinclair Yeh <>
2015-11-02drm/vmwgfx: Turn off support for multisample count != 0 v2Thomas Hellstrom1-2/+20
Do this until we know how much MOB memory to allocate for these surfaces. v2: Mask also non-DX multisample. Signed-off-by: Thomas Hellstrom <> Reviewed-by: Brian Paul <>
2015-08-12drm/vmwgfx: Fix copyright headersSinclair Yeh1-1/+1
Updating and fixing copyright headers. Bump version minor to signal vgpu10 support. Signed-off-by: Sinclair Yeh <> Signed-off-by: Thomas Hellstrom <> Reviewed-by: Brian Paul <>
2015-08-12drm/vmwgfx: Command parser fixes for DXCharmaine Lee1-2/+2
Implement support for a couple of missing commands and fix a command parser error path. Also fix uninitialized devcaps and surface size computation. Signed-off-by: Charmaine Lee <> Signed-off-by: Sinclair Yeh <> Signed-off-by: Thomas Hellstrom <>
2015-08-12drm/vmwgfx: Initial DX supportThomas Hellstrom1-2/+5
Initial DX support. Co-authored with Sinclair Yeh, Charmaine Lee and Jakob Bornecrantz. Signed-off-by: Thomas Hellstrom <> Signed-off-by: Sinclair Yeh <> Signed-off-by: Charmaine Lee <>
2015-08-12drm/vmwgfx: Update device includes for DX device functionalitySinclair Yeh1-0/+1
Add DX includes and move all device includes to a separate directory. Co-authored with Thomas Hellstrom, Charmaine Lee and above all, the VMware device team. Signed-off-by: Sinclair Yeh <> Signed-off-by: Thomas Hellstrom <> Signed-off-by: Charmaine Lee <>
2015-08-05drm/vmwgfx: Kill a bunch of sparse warningsThomas Hellstrom1-4/+4
We're giving up all attempts to keep cpu- and device byte ordering separate. This silences sparse when compiled using make C=2 CF="-D__CHECK_ENDIAN__" Signed-off-by: Thomas Hellstrom <>
2015-08-05drm/vmwgfx: Implement screen targetsSinclair Yeh1-0/+4
Add support for the screen target device interface. Add a getparam parameter and bump minor to signal availability. Signed-off-by: Sinclair Yeh <> Signed-off-by: Thomas Hellstrom <>
2015-01-19drm/vmwgfx: Replace the hw mutex with a hw spinlockThomas Hellstrom1-4/+4
Fixes a case where we call vmw_fifo_idle() from within a wait function with task state !TASK_RUNNING, which is illegal. In addition, make the locking fine-grained, so that it is performed once for every read- and write operation. This is of course more costly, but we don't perform much register access in the timing critical paths anyway. Instead we have the extra benefit of being sure that we don't forget the hw lock around register accesses. I think currently the kms code was quite buggy w r t this. This fixes Red Hat Bugzilla Bug 1180796 Cc: Signed-off-by: Thomas Hellstrom <> Reviewed-by: Jakob Bornecrantz <>
2014-03-28drm/vmwgfx: Use a per-device semaphore for reservation protectionThomas Hellstrom1-6/+4
Don't use a per-master semaphore (ttm lock) for reservation protection, but rather a per-device semaphore. This is needed since clients connecting using render nodes aren't master aware. The ttm lock used should probably be replaced with a reader-write semaphore once the function down_xx_interruptible() is available. Signed-off-by: Thomas Hellstrom <> Reviewed-by: Brian Paul <>
2014-02-12drm/vmwgfx: Get maximum mob size from register SVGA_REG_MOB_MAX_SIZECharmaine Lee1-0/+3
This patch queries the register SVGA_REG_MOB_MAX_SIZE for the maximum size of a single mob. Signed-off-by: Charmaine Lee <> Reviewed-by: Thomas Hellstrom <>
2014-02-05drm/vmwgfx: Detect old user-space drivers and set up legacy emulation v2Thomas Hellstrom1-16/+77
GB aware mesa userspace drivers are detected by the fact that they are calling the vmw getparam ioctl querying DRM_VMW_PARAM_HW_CAPS to detect whether the device is Guest-backed object capable. For other drivers, lie about hardware version and send the 3D capabilities in a format they expect. v2: Use DRM_VMW_PARAM_MAX_MOB_MEMORY to detect gb awareness, Make sure we don't ovwerwrite bounce buffer or write past user-space buffer indicated size. Signed-off-by: Thomas Hellstrom <> Reviewed-by: Jakob Bornecrantz <>
2014-01-17drm/vmwgfx: Add a parameter to get max MOB memory sizeThomas Hellstrom1-0/+3
Also bump minor to signal a GB-aware kernel module Signed-off-by: Thomas Hellstrom <> Reviewed-by: Zack Rusin <>
2014-01-17drm/vmwgfx: Adapt capability reporting to new hardware versionThomas Hellstrom1-3/+34
Signed-off-by: Thomas Hellstrom <> Reviewed-by: Brian Paul <> Reviewed-by: Zack Rusin <> Conflicts: drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
2014-01-17drm/vmwgfx: Replace vram_size with prim_bb_mem for calculation of max resolutionThomas Hellstrom1-1/+1
In the future, Scanout buffers need not be backed by VRAM and the two definitions will differ. Signed-off-by: Thomas Hellstrom <> Reviewed-by: Brian Paul <> Reviewed-by: Zack Rusin <>
2013-11-06drm/vmwgfx: Return -ENOENT when a framebuffer can't be foundVille Syrjälä1-2/+2
Let's be a bit more consistent with our error values. Signed-off-by: Ville Syrjälä <> Signed-off-by: Dave Airlie <>
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 <>
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 <> Signed-off-by: Daniel Vetter <>
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 <> Signed-off-by: Daniel Vetter <>
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 <>
2012-12-10Merge branch 'drm-next-3.8' of git:// ↵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:// (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 <> Reviewed-by: Brian Paul <> Reviewed-by: Dmitry Torokhov <> Signed-off-by: Dave Airlie <>
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 <> Reviewed-by: Thomas Hellstrom <> Signed-off-by: Dave Airlie <>
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 <> Acked-by: Dave Airlie <> Acked-by: Arnd Bergmann <> Acked-by: Thomas Gleixner <> Acked-by: Paul E. McKenney <> Acked-by: Dave Jones <>
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 <> Reviewed-by: Thomas Hellstrom <> Signed-off-by: Dave Airlie <>
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 <> Reviewed-by: Jakob Bornecrantz <> Signed-off-by: Dave Airlie <>
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 Signed-off-by: Thomas Meyer <> Reviewed-by: Jakob Bornecrantz <> Signed-off-by: Dave Airlie <>
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 <> Reviewed-by: Thomas Hellstrom <> Signed-off-by: Dave Airlie <>
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 <> Signed-off-by: Dave Airlie <>
2011-10-05vmwgfx: Add present and readback ioctlsJakob Bornecrantz1-0/+172
Signed-off-by: Jakob Bornecrantz <> Signed-off-by: Thomas Hellstrom <> Signed-off-by: Dave Airlie <>
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 <> Reviewed-by: Jakob Bornecranz <> Signed-off-by: Dave Airlie <>
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 <> Reviewed-by: Jakob Bornecrantz <> Signed-off-by: Dave Airlie <>
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 <> Reviewed-by: Jakob Bornecrantz <> Signed-off-by: Dave Airlie <>
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 <> Signed-off-by: Dave Airlie <>
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 <> Signed-off-by: Jakob Bornecrantz <> Signed-off-by: Dave Airlie <>
2010-02-01drm/vmwgfx: Correctly detect 3DJakob Bornecrantz1-1/+1
Signed-off-by: Jakob Bornecrantz <> Signed-off-by: Dave Airlie <>
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 <> Signed-off-by: Jakob Bornecrantz <> Signed-off-by: Dave Airlie <>