summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
Commit message (Collapse)AuthorAgeFilesLines
* drm/vmwgfx: Fix up user_dmabuf refcountingThomas Hellstrom2015-09-141-2/+4
| | | | | | | | | | | | | | | | | | | If user space calls unreference on a user_dmabuf it will typically kill the struct ttm_base_object member which is responsible for the user-space visibility. However the dmabuf part may still be alive and refcounted. In some situations, like for shared guest-backed surface referencing/opening, the driver may try to reference the struct ttm_base_object member again, causing an immediate kernel warning and a later kernel NULL pointer dereference. Fix this by always maintaining a reference on the struct ttm_base_object member, in situations where it might subsequently be referenced. Cc: <stable@vger.kernel.org> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
* drm/vmwgfx: Add DX query support. Various fixes.Sinclair Yeh2015-08-121-18/+191
| | | | | | | Add support for vgpu10 queries. Functional- and formatting fixes. Signed-off-by: Sinclair Yeh <syeh@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
* drm/vmwgfx: Add command parser support for a couple of DX commandsNeha Bhende2015-08-121-2/+48
| | | | | | | | Add support for SVGA_3D_CMD_DX_BUFFER_COPY and SVGA_3D_CMD_DX_PRED_COPY_REGION Signed-off-by: Neha Bhende <nbhende@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
* drm/vmwgfx: Command parser fixes for DXCharmaine Lee2015-08-121-13/+85
| | | | | | | | | 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 <charmainel@vmware.com> Signed-off-by: Sinclair Yeh <syeh@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
* drm/vmwgfx: Initial DX supportThomas Hellstrom2015-08-121-116/+1232
| | | | | | | | | Initial DX support. Co-authored with Sinclair Yeh, Charmaine Lee and Jakob Bornecrantz. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Sinclair Yeh <syeh@vmware.com> Signed-off-by: Charmaine Lee <charmainel@vmware.com>
* drm/vmwgfx: Update device includes for DX device functionalitySinclair Yeh2015-08-121-2/+0
| | | | | | | | | | | 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 <syeh@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Charmaine Lee <charmainel@vmware.com>
* drm/vmwgfx: Kill a bunch of sparse warningsThomas Hellstrom2015-08-051-9/+9
| | | | | | | | | 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 <thellstrom@vmware.com>
* drm/vmwgfx: Convert screen targets to new helpers v3Thomas Hellstrom2015-08-051-19/+5
| | | | | | | | | | | | | | | | Also implements the missing readback function and fixes page flip in case of no event. v2: - Adapt to the work done for screen targets for 2d, in particular Handle proxy surface updates. - Remove execbuf quirks since we now use fifo reserve / commit. - Revert the initial placement of vmw dma buffers. v3: Address review comments. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
* drm/vmwgfx: Add kms helpers for dirty- and readback functionsThomas Hellstrom2015-08-051-8/+11
| | | | | | | | | | We need to make the dirty- and readback functions callable without a struct drm_file pointer. We also need to unify the handling of dirty- and readback cliprects that are now implemented in various places across the kms system, som add helpers to facilitate this. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
* drm/vmwgfx: Introduce a pin count to allow for recursive pinning v2Thomas Hellstrom2015-08-051-41/+40
| | | | | | | v2: Fix dma buffer validation on resource pinning. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
* drm/vmwgfx: Replace SurfaceDMA usage with SurfaceCopy in 2D VMsSinclair Yeh2015-08-051-7/+13
| | | | | | | | | | | | | | | | | | | | | | | This patch address the following underlying issues with SurfaceDMA * SurfaceDMA command does not work in a 2D VM, but we can wrap a proxy surface around the same DMA buffer and use the SurfaceCopy command which does work in a 2D VM. * Wrapping a DMA buffer with a proxy surface also gives us an added optimization path for the case when the DMA buf dimensions match the mode. In this case, the DMA buf can be pinned as the display surface, saving an extra copy. This only works in a 2D VM because we won't be doing any rendering operations directly to the display surface. v2 * Moved is_dmabuf_proxy field to vmw_framebuffer_surface * Undone coding style changes * Addressed other issues from review Signed-off-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
* drm/vmwgfx: Add "quirk" to handling command verification exceptionsThomas Hellstrom2015-08-051-0/+10
| | | | | | | | | | | | For certain surface copies, we don't have a user space handle for the destination surface. In such cases, we are going to trust that our caller is giving us the right surface ID. To do this case, we created a quirk flag that may be useful in the future for handling other cases. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Sinclair Yeh <syeh@vmware.com>
* drm/vmwgfx: Add command buffer support v3Thomas Hellstrom2015-08-051-28/+152
| | | | | | | | | | | | | | | | | | Add command buffer support. Currently we don't implement preemption or fancy error handling. Tested with a couple of mesa-demos, compiz/unity and viewperf maya-03. v2: - Synchronize with pending work at command buffer manager takedown. - Add an interface to flush the current command buffer for latency-critical command batches and apply it to framebuffer dirtying. v3: - Minor fixes of definitions and typos to address reviews. - Removed new or moved branch predictor hints. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com>
* drm/vmwgfx: Correctly NULLify dma buffer pointer on failureColin Ian King2015-03-111-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | cppcheck on lines 917 and 977 show an ineffective assignment to the dma buffer pointer: [drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c:917]: [drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c:977]: (warning) Assignment of function parameter has no effect outside the function. Did you forget dereferencing it? On a successful DMA buffer lookup, the dma buffer pointer is assigned, however, on failure it currently is left in an undefined state. The original intention in the error exit path was to nullify the pointer on an error (which the original code failed to do properly). This patch fixes this also ensures all failure paths nullify the buffer pointer on the error return. Fortunately the callers to vmw_translate_mob_ptr and vmw_translate_guest_ptr are checking on a return status and not on the dma buffer pointer, so the original code worked. Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Colin Ian King <colin.king@canonical.com>
* drm/vmwgfx: Fix a couple of lock dependency violationsThomas Hellstrom2015-03-111-5/+3
| | | | | | | | | | | Experimental lockdep annotation added to the TTM lock has unveiled a couple of lock dependency violations in the vmwgfx driver. In both cases it turns out that the device_private::reservation_sem is not needed so the offending code is moved out of that lock. Cc: <stable@vger.kernel.org> Acked-by: Sinclair Yeh <syeh@vmware.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
* drm/ttm: optionally move duplicates to a separate listChristian König2014-12-031-2/+4
| | | | | | | | | | This patch adds an optional list_head parameter to ttm_eu_reserve_buffers. If specified duplicates in the execbuf list are no longer reported as errors, but moved to this list instead. Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* drm: backmerge tag 'v3.17-rc5' into drm-nextDave Airlie2014-09-161-6/+5
|\ | | | | | | | | | | | | This is requested to get the fixes for intel and radeon into the same tree for future development work. i915_display.c: fix missing dev_priv conflict.
| * drm/vmwgfx: Fix an incorrect OOM return valueThomas Hellstrom2014-09-011-6/+5
| | | | | | | | | | | | | | | | | | At the same time, make error paths return early for clarity. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: jakob Bornecrantz <jakob@vmware.com> Cc: <stable@vger.kernel.org>
* | drm/ttm: allow fence to be added as sharedChristian König2014-09-111-0/+3
| | | | | | | | | | | | | | | | This patch adds a new flag to the ttm_validate_buffer list to add the fence as shared to the reservation object. Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
* | drm/vmwgfx: rework to new fence interface, v2Maarten Lankhorst2014-09-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | Use the new fence interface on vmwgfx too. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> --- Changes since v1: Fix a sleeping function called from invalid context in enable_signaling.
* | drm/vmwgfx: get rid of different types of fence_flags entirelyMaarten Lankhorst2014-09-021-11/+3
| | | | | | | | | | | | | | Only one type was ever used. This is needed to simplify the fence support in the next commit. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
* | drm/ttm: kill off some members to ttm_validate_bufferMaarten Lankhorst2014-09-011-1/+0
| | | | | | | | | | | | | | | | | | | | This reorders the list to keep track of what buffers are reserved, so previous members are always unreserved. This gets rid of some bookkeeping that's no longer needed, while simplifying the code some. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
* | drm/ttm: add interruptible parameter to ttm_eu_reserve_buffersMaarten Lankhorst2014-09-011-5/+2
|/ | | | | | | It seems some drivers really want this as a parameter, like vmwgfx. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
* drm/vmwgfx: Fix compat shader namespaceThomas Hellstrom2014-07-041-99/+128
| | | | | | | | | | | Contrary to the host-backed shader interface that has a per-context name-space for shaders, the compat shader namespace was per client (or rather, per file). Fix this so that the compat shader namespace is per context, and at the same time, make command buffer managed context resource management generic. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: Make sure user-space can't DMA across buffer object boundaries v2Thomas Hellstrom2014-04-241-0/+22
| | | | | | | | | | | We already check that the buffer object we're accessing is registered with the file. Now also make sure that we can't DMA across buffer object boundaries. v2: Code commenting update. Cc: stable@vger.kernel.org Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: Use a per-device semaphore for reservation protectionThomas Hellstrom2014-03-281-3/+2
| | | | | | | | | | | | 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 <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* drm/vmwgfx: Fix command defines and checksThomas Hellstrom2014-02-121-0/+3
| | | | | | | | | Make sure all guest-backed object commands are properly packed. Have the command verifier treat uninitialized command entries as invalid rather than dereferencing NULL pointers. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: Remove stray constThomas Hellstrom2014-02-121-1/+1
| | | | | | Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: unlock on error path in vmw_execbuf_process()Dan Carpenter2014-02-121-1/+1
| | | | | | | | There is a missing unlock on error here. Fixes: 30f82d816d2d ('drm/vmwgfx: Reemit context bindings when necessary v2') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
* drm/vmwgfx: Fix a couple of sparse warnings and errorsThomas Hellstrom2014-02-121-1/+1
| | | | | | | | Introduced with 3.14-rc1 Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: Reemit context bindings when necessary v2Thomas Hellstrom2014-02-051-4/+81
| | | | | | | | | | | | | | | | | | When a context is first referenced in the command stream, make sure that all scrubbed (as a result of eviction) bindings are re-emitted. Also make sure that all bound resources are put on the resource validate list. This is needed for legacy emulation, since legacy user-space drivers will typically not re-emit shader bindings. It also removes the requirement for user-space drivers to re-emit render-target- and texture bindings. Makes suspend and hibernate now also work with legacy user-space drivers on guest-backed devices. v2: Don't rebind on legacy devices. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: Emulate legacy shaders on guest-backed devices v2Thomas Hellstrom2014-02-051-29/+168
| | | | | | | | | | | Command stream legacy shader creation and destruction is replaced by NOPs in the command stream, and instead guest-backed shaders are created and destroyed as part of the command validation process. v2: Removed some stray debug messages. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: Fix SET_SHADER_CONST emulation on guest-backed devicesThomas Hellstrom2014-02-051-2/+35
| | | | | | | | Emulate the SET_SHADER_CONST legacy command on guest-backed devices by issuing a SET_GB_SHADERCONSTS_INLINE command. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: Fix regression caused by "drm/ttm: make ttm reservation calls ↵Thomas Hellstrom2014-02-051-4/+5
| | | | | | | | | | | | | | | behave like reservation calls" The call to ttm_eu_backoff_reservation() as part of an error path would cause a lock imbalance if the reservation ticket was not initialized. This error is easily triggered from user-space by submitting a bogus command stream. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Cc: stable@vger.kernel.org Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com> Cc: Jerome Glisse <jglisse@redhat.com> Cc: Dave Airlie <airlied@redhat.com>
* drm/vmwgfx: Don't commit staged bindings if execbuf failsThomas Hellstrom2014-02-051-2/+4
| | | | | | | | If execbuf fails and binding commands are never sent to the device, don't commit the staged context bindings to the tracker. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: Implement 64-bit Otable- and MOB binding v2Thomas Hellstrom2014-01-171-1/+1
| | | | | | | | | | Adds the relevant commands to the device interface header and implements 64-bit binding for 64 bit VMs. v2: Uppercase command IDs, Correctly use also 64 bit page tables. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: Persistent tracking of context bindingsThomas Hellstrom2014-01-171-5/+26
| | | | | | | | Only scrub context bindings when a bound resource is destroyed, or when the MOB backing the context is unbound. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com>
* drm/vmwgfx: Track context bindings and scrub them upon exiting execbufThomas Hellstrom2014-01-171-11/+84
| | | | | | | | The device is no longer capable of scrubbing context bindings of resources that are bound when destroyed. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: Block the BIND_SHADERCONSTS commandThomas Hellstrom2014-01-171-34/+2
| | | | | | | It's been deprecated. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
* drm/vmwgfx: Extend the command verifier to handle guest-backed on / offThomas Hellstrom2014-01-171-107/+208
| | | | | | | | Make sure we disallow commands if the device doesn't support them. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com>
* drm/vmwgfx: Add new unused (by user-space) commands to the verifierThomas Hellstrom2014-01-171-0/+26
| | | | | | Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com>
* drm/vmwgfx: Validate guest-backed shader const commandsThomas Hellstrom2014-01-171-0/+35
| | | | | | Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com>
* drm/vmwgfx: Add guest-backed shadersThomas Hellstrom2014-01-171-0/+35
| | | | | | Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com>
* drm/vmwgfx: Hook up guest-backed surfacesThomas Hellstrom2014-01-171-0/+231
| | | | | | Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com>
* drm/vmwgfx: Hook up guest-backed contextsThomas Hellstrom2014-01-171-0/+5
| | | | | | | | | Contexts are managed by the kernel only, so disable access to GB context commands from user-space Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Zack Ruzin <zackr@vmware.com>
* drm/vmwgfx: Hook up guest-backed queriesThomas Hellstrom2014-01-171-1/+214
| | | | | | | | | Perform a translation of legacy query commands should they occur in the command stream. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com>
* drm/vmwgfx: Add the possibility to validate a buffer as a MOBThomas Hellstrom2014-01-171-7/+19
| | | | | | | | Also do basic consistency checking. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com>
* drm/ttm: make ttm reservation calls behave like reservation callsMaarten Lankhorst2013-06-281-6/+8
| | | | | | | | | | | This commit converts the source of the val_seq counter to the ww_mutex api. The reservation objects are converted later, because there is still a lockdep splat in nouveau that has to resolved first. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Reviewed-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/ttm: remove no_wait_reserve, v3Maarten Lankhorst2012-12-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | All items on the lru list are always reservable, so this is a stupid thing to keep. Not only that, it is used in a way which would guarantee deadlocks if it were ever to be set to block on reserve. This is a lot of churn, but mostly because of the removal of the argument which can be nested arbitrarily deeply in many places. No change of code in this patch except removal of the no_wait_reserve argument, the previous patch removed the use of no_wait_reserve. v2: - Warn if -EBUSY is returned on reservation, all objects on the list should be reservable. Adjusted patch slightly due to conflicts. v3: - Focus on no_wait_reserve removal only. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
* drm/vmwgfx: Refactor resource managementThomas Hellstrom2012-11-211-248/+650
| | | | | | | | | | | | 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 <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Dmitry Torokhov <dtor@vmware.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
OpenPOWER on IntegriCloud