aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
AgeCommit message (Collapse)AuthorFilesLines
2016-04-28drm/vmwgfx: Enable SVGA_3D_CMD_DX_SET_PREDICATIONCharmaine Lee1-1/+1
Fixes piglit tests nv_conditional_render-* crashes. Signed-off-by: Charmaine Lee <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
2016-03-14drm/vmwgfx: Add DXGenMips supportCharmaine Lee1-1/+21
Add support for DXGenMips command. Signed-off-by: Charmaine Lee <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]>
2015-09-14drm/vmwgfx: Fix up user_dmabuf refcountingThomas Hellstrom1-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: <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
2015-08-12drm/vmwgfx: Add DX query support. Various fixes.Sinclair Yeh1-18/+191
Add support for vgpu10 queries. Functional- and formatting fixes. Signed-off-by: Sinclair Yeh <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]>
2015-08-12drm/vmwgfx: Add command parser support for a couple of DX commandsNeha Bhende1-2/+48
Add support for SVGA_3D_CMD_DX_BUFFER_COPY and SVGA_3D_CMD_DX_PRED_COPY_REGION Signed-off-by: Neha Bhende <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]>
2015-08-12drm/vmwgfx: Command parser fixes for DXCharmaine Lee1-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 <[email protected]> Signed-off-by: Sinclair Yeh <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]>
2015-08-12drm/vmwgfx: Initial DX supportThomas Hellstrom1-116/+1232
Initial DX support. Co-authored with Sinclair Yeh, Charmaine Lee and Jakob Bornecrantz. Signed-off-by: Thomas Hellstrom <[email protected]> Signed-off-by: Sinclair Yeh <[email protected]> Signed-off-by: Charmaine Lee <[email protected]>
2015-08-12drm/vmwgfx: Update device includes for DX device functionalitySinclair Yeh1-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 <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Signed-off-by: Charmaine Lee <[email protected]>
2015-08-05drm/vmwgfx: Kill a bunch of sparse warningsThomas Hellstrom1-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 <[email protected]>
2015-08-05drm/vmwgfx: Convert screen targets to new helpers v3Thomas Hellstrom1-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 <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
2015-08-05drm/vmwgfx: Add kms helpers for dirty- and readback functionsThomas Hellstrom1-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 <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
2015-08-05drm/vmwgfx: Introduce a pin count to allow for recursive pinning v2Thomas Hellstrom1-41/+40
v2: Fix dma buffer validation on resource pinning. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
2015-08-05drm/vmwgfx: Replace SurfaceDMA usage with SurfaceCopy in 2D VMsSinclair Yeh1-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 <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]>
2015-08-05drm/vmwgfx: Add "quirk" to handling command verification exceptionsThomas Hellstrom1-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 <[email protected]> Signed-off-by: Sinclair Yeh <[email protected]>
2015-08-05drm/vmwgfx: Add command buffer support v3Thomas Hellstrom1-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 <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
2015-03-11drm/vmwgfx: Correctly NULLify dma buffer pointer on failureColin Ian King1-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 <[email protected]> Signed-off-by: Colin Ian King <[email protected]>
2015-03-11drm/vmwgfx: Fix a couple of lock dependency violationsThomas Hellstrom1-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: <[email protected]> Acked-by: Sinclair Yeh <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]>
2014-12-03drm/ttm: optionally move duplicates to a separate listChristian König1-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 <[email protected]> Signed-off-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2014-09-16drm: backmerge tag 'v3.17-rc5' into drm-nextDave Airlie1-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.
2014-09-11drm/ttm: allow fence to be added as sharedChristian König1-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 <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
2014-09-02drm/vmwgfx: rework to new fence interface, v2Maarten Lankhorst1-1/+1
Use the new fence interface on vmwgfx too. Signed-off-by: Maarten Lankhorst <[email protected]> --- Changes since v1: Fix a sleeping function called from invalid context in enable_signaling.
2014-09-02drm/vmwgfx: get rid of different types of fence_flags entirelyMaarten Lankhorst1-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 <[email protected]>
2014-09-01drm/vmwgfx: Fix an incorrect OOM return valueThomas Hellstrom1-6/+5
At the same time, make error paths return early for clarity. Signed-off-by: Thomas Hellstrom <[email protected]> Reported-by: Dan Carpenter <[email protected]> Reviewed-by: jakob Bornecrantz <[email protected]> Cc: <[email protected]>
2014-09-01drm/ttm: kill off some members to ttm_validate_bufferMaarten Lankhorst1-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 <[email protected]>
2014-09-01drm/ttm: add interruptible parameter to ttm_eu_reserve_buffersMaarten Lankhorst1-5/+2
It seems some drivers really want this as a parameter, like vmwgfx. Signed-off-by: Maarten Lankhorst <[email protected]>
2014-07-04drm/vmwgfx: Fix compat shader namespaceThomas Hellstrom1-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 <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-04-24drm/vmwgfx: Make sure user-space can't DMA across buffer object boundaries v2Thomas Hellstrom1-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: [email protected] Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-03-28drm/vmwgfx: Use a per-device semaphore for reservation protectionThomas Hellstrom1-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 <[email protected]> Reviewed-by: Brian Paul <[email protected]>
2014-02-12drm/vmwgfx: Fix command defines and checksThomas Hellstrom1-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 <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-02-12drm/vmwgfx: Remove stray constThomas Hellstrom1-1/+1
Reported-by: Fengguang Wu <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-02-12drm/vmwgfx: unlock on error path in vmw_execbuf_process()Dan Carpenter1-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 <[email protected]> Reviewed-by: Thomas Hellstrom <[email protected]>
2014-02-12drm/vmwgfx: Fix a couple of sparse warnings and errorsThomas Hellstrom1-1/+1
Introduced with 3.14-rc1 Reported-by: Fengguang Wu <[email protected]> Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-02-05drm/vmwgfx: Reemit context bindings when necessary v2Thomas Hellstrom1-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 <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-02-05drm/vmwgfx: Emulate legacy shaders on guest-backed devices v2Thomas Hellstrom1-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 <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-02-05drm/vmwgfx: Fix SET_SHADER_CONST emulation on guest-backed devicesThomas Hellstrom1-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 <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-02-05drm/vmwgfx: Fix regression caused by "drm/ttm: make ttm reservation calls ↵Thomas Hellstrom1-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 <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]> Cc: [email protected] Cc: Maarten Lankhorst <[email protected]> Cc: Jerome Glisse <[email protected]> Cc: Dave Airlie <[email protected]>
2014-02-05drm/vmwgfx: Don't commit staged bindings if execbuf failsThomas Hellstrom1-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 <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-01-17drm/vmwgfx: Implement 64-bit Otable- and MOB binding v2Thomas Hellstrom1-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 <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-01-17drm/vmwgfx: Persistent tracking of context bindingsThomas Hellstrom1-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 <[email protected]> Reviewed-by: Zack Rusin <[email protected]>
2014-01-17drm/vmwgfx: Track context bindings and scrub them upon exiting execbufThomas Hellstrom1-11/+84
The device is no longer capable of scrubbing context bindings of resources that are bound when destroyed. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-01-17drm/vmwgfx: Block the BIND_SHADERCONSTS commandThomas Hellstrom1-34/+2
It's been deprecated. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Jakob Bornecrantz <[email protected]>
2014-01-17drm/vmwgfx: Extend the command verifier to handle guest-backed on / offThomas Hellstrom1-107/+208
Make sure we disallow commands if the device doesn't support them. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Zack Rusin <[email protected]>
2014-01-17drm/vmwgfx: Add new unused (by user-space) commands to the verifierThomas Hellstrom1-0/+26
Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Zack Rusin <[email protected]>
2014-01-17drm/vmwgfx: Validate guest-backed shader const commandsThomas Hellstrom1-0/+35
Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Zack Rusin <[email protected]>
2014-01-17drm/vmwgfx: Add guest-backed shadersThomas Hellstrom1-0/+35
Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Zack Rusin <[email protected]>
2014-01-17drm/vmwgfx: Hook up guest-backed surfacesThomas Hellstrom1-0/+231
Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Zack Rusin <[email protected]>
2014-01-17drm/vmwgfx: Hook up guest-backed contextsThomas Hellstrom1-0/+5
Contexts are managed by the kernel only, so disable access to GB context commands from user-space Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Zack Ruzin <[email protected]>
2014-01-17drm/vmwgfx: Hook up guest-backed queriesThomas Hellstrom1-1/+214
Perform a translation of legacy query commands should they occur in the command stream. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Zack Rusin <[email protected]>
2014-01-17drm/vmwgfx: Add the possibility to validate a buffer as a MOBThomas Hellstrom1-7/+19
Also do basic consistency checking. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Zack Rusin <[email protected]>
2013-06-28drm/ttm: make ttm reservation calls behave like reservation callsMaarten Lankhorst1-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 <[email protected]> Reviewed-by: Jerome Glisse <[email protected]> Signed-off-by: Dave Airlie <[email protected]>