History log of /drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
Revision Date Author Comments
ae9c0af2c0ea92e57013ab2dd7271ba7d6b2a833 04-Sep-2014 Christian König <christian.koenig@amd.com> drm/ttm: allow fence to be added as shared

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>
2298e804e96eb3635c39519c8287befd92460303 26-Mar-2014 Maarten Lankhorst <maarten.lankhorst@canonical.com> drm/vmwgfx: rework to new fence interface, v2

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.
c060a4e135fdd8a35276f2e318f1e9b3bc2450a9 26-Mar-2014 Maarten Lankhorst <maarten.lankhorst@canonical.com> drm/vmwgfx: get rid of different types of fence_flags entirely

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>
9f9cb84f416f07f57d75789d77e7d47d6141f44e 28-Aug-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix an incorrect OOM return value

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>
1f0dc9a59afeccb96a35ebec36661266260f5eee 09-Jan-2014 Maarten Lankhorst <maarten.lankhorst@canonical.com> drm/ttm: kill off some members to ttm_validate_buffer

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>
58b4d720c1620bbf09e42b4f218dcb2d0d8cdf3e 09-Jan-2014 Maarten Lankhorst <maarten.lankhorst@canonical.com> drm/ttm: add interruptible parameter to ttm_eu_reserve_buffers

It seems some drivers really want this as a parameter,
like vmwgfx.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
18e4a4669c5023eb1157f2a3f1bf6ca2b8535572 09-Jun-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix compat shader namespace

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>
cbd75e97a525e3819c02dc18bc2d67aa544c9e45 15-Apr-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Make sure user-space can't DMA across buffer object boundaries v2

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>
294adf7d86226c0e6abeb4475159b03aa315d56f 27-Feb-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Use a per-device semaphore for reservation protection

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>
36e952c1ed8ca44bca245c465c8293e175dd9222 12-Feb-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix command defines and checks

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>
4fbd9d2ec2f12ffb292c1489d1402e8b956afc01 12-Feb-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Remove stray const

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
b2ad9881d6aeec4f3ee527c00fce34442d6d02d3 11-Feb-2014 Dan Carpenter <dan.carpenter@oracle.com> drm/vmwgfx: unlock on error path in vmw_execbuf_process()

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>
8e67bbbc51dbeaba480e83fe2162eb08083a0459 06-Feb-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix a couple of sparse warnings and errors

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>
30f82d816d2dccfdc2063ac8cca994904c9b612c 05-Feb-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Reemit context bindings when necessary v2

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>
d5bde956630b86462ee22055f5816a04290aed57 31-Jan-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Emulate legacy shaders on guest-backed devices v2

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>
0ccbbae43c2dfe45ded1d7ed59b8fc7ac8214fb0 30-Jan-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix SET_SHADER_CONST emulation on guest-backed devices

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>
cf5e3413337309050c05e13dcebe85b7194a21e5 30-Jan-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix regression caused by "drm/ttm: make ttm reservation calls 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>
76c7d18bcddc9794f898ebdee44a3160c636da9c 30-Jan-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Don't commit staged bindings if execbuf fails

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>
f2a0dcb1aa23eea8f186b4773a653e61d509b17a 15-Jan-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Implement 64-bit Otable- and MOB binding v2

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>
173fb7d4e26705a9e8b8e9d197a18ff39bfdad0a 08-Oct-2013 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Persistent tracking of context bindings

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>
b5c3b1a6bfaf71895d656162f29e979c5c904888 08-Oct-2013 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Track context bindings and scrub them upon exiting execbuf

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>
8ba07315d3ffcb7dfbb5143a3be03fe4af079969 08-Oct-2013 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Block the BIND_SHADERCONSTS command

It's been deprecated.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
c373d4eac4a29b04ec036a0ead75e4a796c911c2 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Extend the command verifier to handle guest-backed on / off

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>
74c10d1cd55a3a6b49556a524230e7a97b6de145 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Add new unused (by user-space) commands to the verifier

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
a21aa6143fb53311654255b25ee1a2f124bc8e27 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Validate guest-backed shader const commands

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
c74c162fd99fbe204fe67acd5ba40589c236df6c 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Add guest-backed shaders

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
a97e21923b421993258e8487f2a5700c1ba3897f 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Hook up guest-backed surfaces

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
58a0c5f036464bd891880b30bde196320e904b81 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Hook up guest-backed contexts

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>
ddcda24e3bec1d4c8bcc37e85d1b1b37bf0fecac 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Hook up guest-backed queries

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>
96c5f0df22aaf1f20075bc6ad3bdd7656e49cf4d 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Add the possibility to validate a buffer as a MOB

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>
ecff665f5e3f1c6909353e00b9420e45ae23d995 27-Jun-2013 Maarten Lankhorst <m.b.lankhorst@gmail.com> drm/ttm: make ttm reservation calls behave like reservation calls

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>
97a875cbdf89a4638eea57c2b456c7cc4e3e8b21 28-Nov-2012 Maarten Lankhorst <m.b.lankhorst@gmail.com> drm/ttm: remove no_wait_reserve, v3

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>
c0951b797e7d0f2c6b0df2c0e18185c72d0cf1a1 20-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Refactor resource management

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>
be013367fd6fbab52ddf6f76c243f4109090c890 12-Oct-2012 Maarten Lankhorst <maarten.lankhorst@canonical.com> drm/vmwgfx: remove use of fence_obj_args

It's always hardcoded to the same value.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-By: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
760285e7e7ab282c25b5e90816f7c47000557f4f 02-Oct-2012 David Howells <dhowells@redhat.com> UAPI: (Scripted) Convert #include "..." to #include <path/...> in drivers/gpu/

Convert #include "..." to #include <path/...> in drivers/gpu/.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Dave Jones <davej@redhat.com>
bb1bd2f43ee15386a1c3f96cbcbb9302a9994443 09-Feb-2012 Jakob Bornecrantz <jakob@vmware.com> vmwgfx: Make it possible to get fence from execbuf

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
1717c0e23f411147490c7a3312b894f0ea9a5fb1 27-Oct-2011 Dave Airlie <airlied@redhat.com> Revert "drm/ttm: add a way to bo_wait for either the last read or last write"

This reverts commit dfadbbdb57b3f2bb33e14f129a43047c6f0caefa.

Further upstream discussion between Marek and Thomas decided this wasn't
fully baked and needed further work, so revert it before it hits mainline.

Signed-off-by: Dave Airlie <airlied@redhat.com>
80d9b24a658c83602aea66e45e2347c5bb3cbd47 18-Oct-2011 Dan Carpenter <dan.carpenter@oracle.com> vmwgfx: information leak in vmw_execbuf_copy_fence_user()

If ret is non-zero then we don't initialize the struct which leaks
stack information to user space.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Vasiliy Kulikov <segoon@openwall.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
57c5ee79acba9582762c09c269e0e2ae1adf1b31 10-Oct-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Add fence events

Add a way to send DRM events down the gpu fifo by attaching them to
fence objects. This may be useful for Xserver swapbuffer throttling and
page-flip done notifications.

Bump version to 2.2 to signal the availability of the FENCE_EVENT ioctl.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8bf445cee3127de3779a395d08d1ada2ad70161e 10-Oct-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Break out and comment vmw_execbuf_copy_fence_user

This function will be used also by the upcoming fence event code,
so break it out and add a comment about the functionality.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
5bb39e818169783ee17ddbbefbd7bd16a4383fec 04-Oct-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Handle device surface memory limit

Make surfaces swappable. Make sure we honor the maximum amount of surface
memory the device accepts. This is done by potentially reading back surface
contents not used by the current command submission and storing it
locally in buffer objects.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
f18c8840bef4195e6f35298b7746563f10d2d502 04-Oct-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Optimize the command submission resource list

Use a list for resources referenced during command submission, instead of
an array.
As long as we don't implement parallell command submission this works fine
and simplifies things a bit.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
e2fa3a76839ada0d788549607263a036aa654243 04-Oct-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Fix up query processing

Previously, query results could be placed in any buffer object, but since
we didn't allow pinned buffer objects, query results could be written when
that buffer was evicted, corrupting data in other buffers.

Now, require that buffers holding query results are no more than two pages
large, and allow one single pinned such buffer. When the command submission
code encounters query result structures in other buffers, the queries in the
pinned buffer will be finished using a query barrier for the last hardware
context using the buffer. Also if the command submission code detects
that a new hardware context is used for queries, all queries of the previous
hardware context is also flushed. Currently we use waiting for a no-op
occlusion query as a query barrier for a specific context.

The query buffer is also flushed and unpinned on context destructions,
master drops and before scanout bo placement.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
0cff60c625131c64847debc2b4cee33ba33e8d8f 04-Oct-2011 Jakob Bornecrantz <jakob@vmware.com> vmwgfx: Disallow user space to send present and readback commands

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
4084fb89e6b463686219a2369d1d35e6b78f785d 04-Oct-2011 Jakob Bornecrantz <jakob@vmware.com> vmwgfx: Expand the command checker to cover screen object commands

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
922ade0d16d24be2040be7d55dbb734af779a1dd 04-Oct-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Break out execbuf command processing

This will make it easier to execute commands operating on user-space
resources but generated by the kernel.

JB: Added tracking if the sw_context was called from the kernel or userspace.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6070e9fa6d12d465c65a172a2b1c752ebedc5937 04-Oct-2011 Jakob Bornecrantz <jakob@vmware.com> vmwgfx: Some comments and BUG_ON

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2ae7b03c26948eddf7c0dd80e1f4eb09140f2698 01-Sep-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Bump major

This bumps driver major version as a result of previous incompatible
interface changes.

In addition, a leftover command definition is removed from the
vmwgfx_drm.h header.

Also a strict version check is enforced on the exebuf ioctl.

This is intended to be the last major bump before exiting staging.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
ae2a104058e217548215bfe6c6c8a98752139c29 01-Sep-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Implement fence objects

Will be needed for queries and drm event-driven throttling.

As a benefit, they help avoid stale user-space fence handles.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6bcd8d3c782b7b2c98c8f414a6bb43cf6b84e53c 01-Sep-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Fix confusion caused by using "fence" in various places

This is needed before we introduce the fence objects.
Otherwise this will be even more confusing. The plan is to use the following:

seqno: A 32-bit sequence number that may be passed in the fifo.
marker: Objects, carrying a seqno, that track fifo submission time. They
are used for fifo lag based throttling.
fence objects: Kernel space objects, possibly accessible from user-space and
carrying a 32-bit seqno together with signaled status.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
be38ab6ea7b0de0542a0ff78690d63bb22f66a4d 31-Aug-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Fix potential execbuf deadlocks

Perform all command stream validation in a bounce buffer separate from the
fifo. This makes the fifo available to all validation-generated commands,
which would otherwise attempt to grab the fifo recursively, causing a
deadlock. This is in preparation for GMR2 and swappable surfaces.

Also maintain references to all surfaces in the command stream until the
command stream has been fired in order to avoid racing with surface
destruction taking place after validation but before submission.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
dfadbbdb57b3f2bb33e14f129a43047c6f0caefa 13-Aug-2011 Marek Olšák <maraeo@gmail.com> drm/ttm: add a way to bo_wait for either the last read or last write

Sometimes we want to know whether a buffer is busy and wait for it (bo_wait).
However, sometimes it would be more useful to be able to query whether
a buffer is busy and being either read or written, and wait until it's stopped
being either read or written. The point of this is to be able to avoid
unnecessary waiting, e.g. if a GPU has written something to a buffer and is now
reading that buffer, and a CPU wants to map that buffer for read, it needs to
only wait for the last write. If there were no write, there wouldn't be any
waiting needed.

This, or course, requires user space drivers to send read/write flags
with each relocation (like we have read/write domains in radeon, so we can
actually use those for something useful now).

Now how this patch works:

The read/write flags should passed to ttm_validate_buffer. TTM maintains
separate sync objects of the last read and write for each buffer, in addition
to the sync object of the last use of a buffer. ttm_bo_wait then operates
with one the sync objects.

Signed-off-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
65705962025df490d13df59ec57c5329d1bd0a16 17-Nov-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/ttm/vmwgfx: Have TTM manage the validation sequence.

Rather than having the driver supply the validation sequence, leave that
responsibility to TTM. This saves some confusion and a function argument.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
dccb2a952b1f0b51978fcb3f9899c7f46ffd4b28 06-Nov-2010 Kulikov Vasiliy <segooon@gmail.com> drm: vmwgfx: fix information leak to userland

Structure drm_vmw_fence_rep is copied to userland with field "pad64"
uninitialized. It leads to leaking of contents of kernel stack memory.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
135cba0dc399fdd47bd3ae305c1db75fcd77243f 26-Oct-2010 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Implement a proper GMR eviction mechanism

Use Ben's new range manager hooks to implement a manager for
GMRs that manages ids rather than ranges.
This means we can use the standard TTM code for binding, unbinding and
eviction.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9b8eb4d14767209c83087063352cd04266ecdfd1 04-Jun-2010 Dan Carpenter <error27@gmail.com> drm/vmwgfx: return -EFAULT for copy_to_user errors

copy_to/from_user() returns the number of bytes remaining to be copied
but we want to return a negative error code here. This gets returned to
userspace.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
1925d4565888eb313cc923372da6a08bbfb3a859 28-May-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Add kernel throttling support. Bump minor.

The throttle_us member in the execbuf argument is now honored.
If the member is 0, no waiting for lag will occur, which
guarantees backwards compatibility with well-behaved clients.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9d87fa2138d06ff400551800d67d522625033e35 07-Apr-2010 Jerome Glisse <jglisse@redhat.com> drm/ttm: split no_wait argument in 2 GPU or reserve wait

There is case where we want to be able to wait only for the
GPU while not waiting for other buffer to be unreserved. This
patch split the no_wait argument all the way down in the whole
ttm path so that upper level can decide on what to wait on or
not.

[airlied: squashed these 4 for bisectability reasons.]
drm/radeon/kms: update to TTM no_wait splitted argument
drm/nouveau: update to TTM no_wait splitted argument
drm/vmwgfx: update to TTM no_wait splitted argument
[vmwgfx patch: Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>]

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Acked-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
4e4ddd47774313accc86b233d6ca2c6a9037a671 21-Feb-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix queries if no dma buffer thrashing is occuring.

Intercept query commands and apply relocations to their guest pointers.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8ba5152a3acd5914cade42a1c8c9dc58ad8d1a89 16-Jan-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Optimize memory footprint for DMA buffers.

Use VRAM whenever there is free space for DMA buffers,
but use system GMR memory if using VRAM would cause an eviction.

This significantly reduces the guest system memory usage for
VMs with a large amount of VRAM allocated.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7a73ba7469cbea631050094fd14f73acebb97cf9 22-Dec-2009 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Use TTM handles instead of SIDs as user-space surface handles.

Improve the command verifier to catch all occurences of surface handles,
and translate to SIDs.

This way DMA buffers and 3D surfaces share a common handle space,
which makes it possible for the kms code to differentiate.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
3d3a5b3290043618e8409f3fb68a63de6156fdd4 08-Dec-2009 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Return -ERESTARTSYS when interrupted by a signal.

Fixes for TTM API change.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
fb1d9738ca053ea8afa5e86af6463155f983b01c 10-Dec-2009 Jakob Bornecrantz <jakob@vmware.com> drm/vmwgfx: Add DRM driver for VMware Virtual GPU

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 <thellstrom@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>