History log of /drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
Revision Date Author Comments
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>
f166e6dcb7225c4193bcda68c9346583ed78b186 16-Jul-2014 Thomas Gleixner <tglx@linutronix.de> drm: vmwgfx: Use nsec based interfaces

No point in converting timespecs back and forth.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
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>
03c5b8f077218bec50f1355b76dea405a7112878 20-Mar-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Bump driver minor and date

Signal availability of prime fd reference ioctls and render nodes.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@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>
a34417f6be521d1027b803f0b550ce622c971f41 28-Feb-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Make sure backing mobs are cleared when allocated. Update driver date.

Backing mob contents is propagated to user-space, so make sure backing
mobs are cleared when allocated. This also accidently fix rendering errors
with celestia when emulating legacy mode.

Also update driver date.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
857aea1c5769386b1905bb38fbb4464c800b2df6 12-Feb-2014 Charmaine Lee <charmainel@vmware.com> drm/vmwgfx: Get maximum mob size from register SVGA_REG_MOB_MAX_SIZE

This patch queries the register SVGA_REG_MOB_MAX_SIZE for the
maximum size of a single mob.

Signed-off-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@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>
7cba9062e689441ac68bde63104517aa0d3bae1b 09-Jan-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Update otable definitions

Update otable definitions and modify the otable setup code
accordingly.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
0fd53cfb09108c33b924b069fe2c62fa4e7b11a0 24-Oct-2013 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Use the linux DMA api also for MOBs

Signed-off-by: Thomas Hellstrom <thellstrom@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>
311474dbdc6ab0ad366fbec040dbe669edd30a35 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Add a parameter to get max MOB memory size

Also bump minor to signal a GB-aware kernel module

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
1d7a5cbf8f74edee0b1d9ee479367b5d876bf627 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Implement a buffer object synccpu ioctl.

This ioctl enables inter-process synchronization of buffer objects,
which is needed for mesa Guest-Backed objects.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
7086d0995cef6b9bbd46bd590f43bb9e3a1233e1 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix up the vmwgfx_drv.h header for new files

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>
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>
6da768aa66d2df9067b0bb694a6106bee3cb191f 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Hook up MOBs to TTM as a separate memory type

To bind a buffer object as a MOB, just validate it as a MOB
memory type. We are reusing the GMRID manager, although we create a new
instance of it to manage MOB ids and tomake sure we don't exceed
the maximum amount of MOB pages.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
3530bdc35e99c3823bc98deb09baed89c51d9f46 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Add MOB management

Implement MOB setup, binding and unbinding, but don't hook up to
TTM yet.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
bc2d6508abefb3d6f3a2188dece555ce4108d3d3 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Replace vram_size with prim_bb_mem for calculation of max resolution

In the future, Scanout buffers need not be backed by VRAM and
the two definitions will differ.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
0d00c488f3de59d19784d5ce774528acaa194525 15-Jan-2014 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix the driver for large dma addresses

With dma compliance / IOMMU support added to the driver in kernel 3.13,
the dma addresses can exceed 44 bits, which is what we support in
32-bit mode and with GMR1.
So in 32-bit mode and optionally in 64-bit mode, restrict the dma
addresses to 44 bits, and strip the old GMR1 code.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Cc: stable@vger.kernel.org
e9f0d76f3bcd4dda7136baaaaf45bda3b13ff40f 11-Dec-2013 Daniel Vetter <daniel.vetter@ffwll.ch> drm: Kill DRM_IRQ_ARGS

I've killed them a long time ago in drm/i915, let's get rid of this
remnant of shared drm core days for good.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
308d17ef9530f236466a31a7855fc3d5176292d4 28-Nov-2013 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix dma buffer memory size accounting

Also request kernel ttm_buffer objects for buffer objects that obviously
aren't visible to user-space, and save some device address space.

The accounting was broken in a couple of ways:
1) We did not differentiate between user dma buffers and kernel dma buffers.
2) The ttm_bo_acc_size function is broken in that it
a) Doesn't take into account the size of the optional dma address array,
b) Doesn't take into account the fact that drivers typically embed the
ttm_tt structure.

This needs to be fixed in ttm, but meanwhile provide a vmwgfx-specific
function to do the job.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
69977ff55eac7fc26fb78de5ec1d9a9ab802d9fd 13-Nov-2013 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Hook up the prime ioctls

Also provide a completely dumb dma-buf ops implementation.
Once we have other virtual dma-buf aware devices, we need to provide
something better.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
d92d985177c495aab53c7167f310a7efb1853918 24-Oct-2013 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Use the linux DMA api to get valid device addresses of pages

The code handles three different cases:
1) physical page addresses. The ttm page array is used.
2) DMA subsystem addresses. A scatter-gather list is used.
3) Coherent pages. The ttm dma pool is used, together with the dma_ttm
array os dma_addr_t

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
0faa4a877765a4855dd570d6d391f77c5c37abc3 08-Aug-2013 Daniel Vetter <daniel.vetter@ffwll.ch> drm/vmwgfx: remove ->firstopen callback

So if we survey kms drivers there's a bunch of things they commonly do
in ->lastclose
- delayed processing of vga switcheroo requests (i915, nouveau,
radeon)
- force-restoring the fbcon (most)
- resetting a bunch properties to make fbcon work better (omap)
- disabling all outputs (vmwgfx)

In short besides the semantically important vga switcheroo stuff they
all try very hard to keep fbcon working in case X dies.

But none of them try to not do this at driver unload time safe for
vmwgfx, and digging through logs I couldn't find any reason for why
vmwgfx is special.

Since ->firstopen has lots of potential for abuse with kms drivers
(like delaying driver setup to pamper over races in the load sequence)
it's imo very much worth it to remove this logic so that we can
stop using the ->firstopen callback for kms drivers.

Also module unloading is rather a debug feature and developers should
know how to restore the display to a sane configuration.

Cc: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
d08a9b9cd82f668a5437c23e59063387ca3ecec5 21-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Tighten the security around buffer maps

Make sure that other DRM clients can't map the contents of
non-shareable buffer objects.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@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>
bf6f036848ab2151c2498f11cb7d31a52a95dd5c 09-Nov-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Make vmw_dmabuf_unreference handle NULL objects

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>
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>
5e1782d224c79b26ab7d5c31e3f87657000714fb 28-Aug-2012 Dave Airlie <airlied@redhat.com> vmwgfx: add dumb ioctl support

Testing and works with the -modesetting driver,

Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Cc: stable@vger.kernel.org
Signed-off-by: Dave Airlie <airlied@redhat.com>
0a240ec43667c6e1005a566dde60863b9c16cc21 09-Feb-2012 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Bump driver minor

Bump driver minor to signal availability of the page-flip ioctl.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
f9cd8ec34f240884cf7ec44e1a4cac12c167ecb2 09-Feb-2012 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Move function declaration to correct header

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
eb4f923b1ceac8a618469c51ff249bd89bc0dfa4 09-Feb-2012 Jakob Bornecrantz <jakob@vmware.com> vmwgfx: Pick up the initial size from the width and height regs

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@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>
6b82ef50d8617f3fcd51dda9d89d973fe3bc65b8 09-Feb-2012 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Clean up pending event references to struct drm_file objects on close

Pending events may have stale pointer references to struct drm_file objects
after a file has been closed, but before the event is supposed to be
attached to the drm file. Remove such events on file close.

Tested with "modetest".

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8b7de6aa84682a3396544fd88cd457f95484573a 09-Feb-2012 Jakob Bornecrantz <jakob@vmware.com> vmwgfx: Rework fence event action

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
551a6697d08f92a311d6adbf8d03af2bc7f9e2ee 28-Nov-2011 Jakob Bornecrantz <jakob@vmware.com> vmwgfx: Add helper function to get surface or dmabuf

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
cd2b89e7e8c036903e7fa0c3dceca25e755fe78d 25-Oct-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Reinstate the update_layout ioctl

We need to redefine a connector as "connected" if it matches a window
in the host preferred GUI layout.
Otherwise "smart" window managers would turn on Xorg outputs that we don't
want to be on.

This reinstates the update_layout and adds the following information to
the modesetting system.
a) Connection status <-> Equivalent to real hardware connection status
b) Preferred mode <-> Equivalent to real hardware reading EDID
c) Host window position <-> Equivalent to a real hardware scanout address
dynamic register.

It should be noted that there is no assumption here about what should be
displayed and where. Only how to access the host windows.

This also bumps minor to signal availability of the new IOCTL.

Based on code originally written by Jakob Bornecrantz

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
1c482ab3596b8ee4c635926b35ee88ad56ba2f9c 17-Oct-2011 Jakob Bornecrantz <jakob@vmware.com> vmwgfx: Add vblank stubs

This fixes kernel panics when running the vbltest from the drm repo. We
can't just skip initializing the vblank system since it sets up certain
state for us, see: "vmwgfx: Enable use of the vblank system."

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
5438ae88d098c086cfb94be5327c49a04fc6bfd7 10-Oct-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Wrap drm_read and drm_poll

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 <thellstrom@vmware.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>
e5ed157d93861f30977913e95f7b5dc60ccc3318 04-Oct-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Bump driver minor to advertise support for new ioctls.

Signed-off-by: Thomas Hellstrom <thellstrom@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>
b37a6b9ad002a6c123a6924668dfef5c5fb0b700 04-Oct-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: minor dmabuf utilities cleanup

Add / fix some function comments.
Don't move out an fbdev framebuffer when unused. Just unpin.
Only have a single function that computes a SVGAGuestPtr from the buffer's
current placement, and make it more versatile by accepting a
struct ttm_buffer_object

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2fcd5a73bfd5341876f9ea6b5adcc1dd814226d4 04-Oct-2011 Jakob Bornecrantz <jakob@vmware.com> vmwgfx: Add present and readback ioctls

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
56d1c78df52323cdcd937505dccaa5d665dfab97 04-Oct-2011 Jakob Bornecrantz <jakob@vmware.com> vmwgfx: Add screen object support

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
d991ef0395596c4aeabcded322011d3f5fa9e74e 04-Oct-2011 Jakob Bornecrantz <jakob@vmware.com> vmwgfx: Add dmabuf helper functions for pinning

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>
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>
4f73a96bd76914009682432842ac04a32ab9115b 01-Sep-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Make vmw_wait_seqno a bit more readable

Break out on-demand enabling and disabling of fence irqs to make
the function more readable. Also make dev_priv->fence_queue_waiters an int
instead of an atomic_t since we only manipulate it with dev_priv->hw_mutex
held.

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>
f63f6a59d3905ac73aeeb617b27ac31516549ed9 01-Sep-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Add functionality to get 3D caps

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 <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecranz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
07999a7e0e409891cb27f34fa1da851d8484a5c5 01-Sep-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Remove the possibility to map the fifo from user-space

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 <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
fe0f5c657601c28d295b1d60691cce40e8b42d92 01-Sep-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Remove the update layout IOCTL.

It doesn't seem like its needed. If this turns out to be an incorrect
assumption, we can reinstate it.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
781b8bdb2dde76ebd52c26954c09c4500f02522c 01-Sep-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Remove the fifo debug ioctl

It was only used for bringup debugging, and probably doesn't work
anymore. Remove it.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
fb17f18993071cc230ec8ddb6dd3dd9932d2dba2 31-Aug-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Restrict number of GMR pages to device limit

When GMR2 is available, make sure we restrict the number of used GMR pages
to the limit indicated by the device.
This is done by failing a GMRID allocation if the total number of GMR pages
exceeds the limit.
As a result TTM will then start evicting buffers in GMR memory on a
LRU basis until the allocation succeeds.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
05730b32a78dab4bed8fb7ccc64c53d9fcf31e9d 31-Aug-2011 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Switch to VGA when we drop master and vmwgfx fbdev is not active

Previously this was not done when any 3D resource was active,
since that meant disabling the fifo with all 3D state lost.
Now, if there are still 3D resources active, we use the svga hide feature.

This fixes X server VT switching with 3D enabled.

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>
0bef23f9180b43e805ce4dabb90b24a0b558721c 31-Aug-2011 Michel Dänzer <daenzer@vmware.com> vmwgfx: Print error diagnostics if depth doesn't match the host expectation

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6558429bc4c7351cc3d80fc9055f1204a9adf060 31-Aug-2011 Michel Dänzer <daenzer@vmware.com> vmwgfx: Fix 'bbp' typo

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
e666d66b427b0ddebda890d4d60013c925332266 31-Aug-2011 Michel Dänzer <daenzer@vmware.com> vmwgfx: Don't write to read-only registers

Signed-off-by: Michel Dänzer <daenzer@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.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>
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>
8aea528736bf83ba0cdde67a3c0ca0250581eade 05-Oct-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Bump minor and driver date

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
30f47fc85d524d25d63da9e6d77e55ab99c6cc4a 05-Oct-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Add a parameter to get the max fb size

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 <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
e133e7371231e49c3e7d626e2251cb6f7c3ca1ad 05-Oct-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Prune modes based on available VRAM size

This needs to be reviewed once we support screen objects and don't rely
on VRAM for the frame-buffer.

Also fix some integer overflow issues pointed out by Michel Daenzer.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
3a939a5ece3030e60c966a885c8e9bd329c4faf7 05-Oct-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Take the ttm lock around the dirty ioctl

This makes sure noone accesses the fifo while it's taken down using the
dirty ioctl.
Also make sure all workqueues are idled before the fifo is taken down.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
094e0fa8b96c9fab5df9597e728d82f3d87ee471 05-Oct-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix ACPI S3 & S4 functionality.

Don't suspend or hibernate when there are 3D resources active since we
can't restore the device's 3D state. Instead fail with an error message.

In other cases, make sure we re-enable the fifo and unlock ttm on resume.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7a1c2f6c8d8485af5ac6c2a313f6a7162207a4af 01-Oct-2010 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: Enable use of the vblank system

This is to avoid accessing uninitialized data during
drm_irq_uninstall and vblank ioctls. At the same time, enable error check from
drm_kms_init which previously appeared to ignore all errors.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
30c78bb838b26ec7997515844c0c734e454b3cba 01-Oct-2010 Thomas Hellstrom <thellstrom@vmware.com> vmwgfx: vt-switch (master drop) fixes

We add an option not to enable fbdev, this option is off (0) by default.
Not enabling fbdev at load time makes it possible to co-operate with
vga16fb and vga text mode when VT switching.

However, if 3D resources are active when VT switching, we're currently
not able to switch over to vga, due to device limitations.
This fixes a bug where we previously lost 3D state during VT switch.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
ba4420c224c2808f2661cf8428f43ceef7a73a4a 09-Mar-2010 Dave Airlie <airlied@redhat.com> drm: move ttm global code to core drm

I wrote this for the prime sharing work, but I also noticed other external
non-upstream drivers from a large company carrying a similiar patch, so I
may as well ship it in master.

Signed-off-by: Dave Airlie <airlied@redhat.com>
d8bd19d2aff95e52c7f356cc2fc722584a656065 01-Jun-2010 Jakob Bornecrantz <jakob@vmware.com> drm/vmwgfx: Allow userspace to change default layout. Bump minor.

The host may change the layout and, since the change is
communicated to the master, the master needs a way to
communicate the change to the kernel driver.

The minor version number is bumped to advertize the
availability of this feature.

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7c4f77801f103c9eb0465bf42313d5e1721d2991 01-Jun-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix vga save / restore with display topology.

vga save / restore previously didn't handle the display topology case.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
d7e1958dbe4a7b81d4cab5fab545a068501b967e 28-May-2010 Jakob Bornecrantz <jakob@vmware.com> drm/vmwgfx: Support older hardware.

V2: Fix a couple of typos.

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.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>
85b9e4878f3b16993fba871c0c68d0948ec9c7c6 08-Feb-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Fix a circular locking dependency bug.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
a87897edbae2d60db7bcb6bb0a75e82013d68305 09-Feb-2010 Jakob Bornecrantz <jakob@vmware.com> drm/vmwgfx: Drop scanout flag compat and add execbuf ioctl parameter members. Bumps major.

Even if this bumps the version to 1 it does not mean the driver is
out of staging. From what we know this is the last backwards
incompatible change to the driver.

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
f77cef3db357aeea22d82a2aa4f0ef8fbae41d47 09-Feb-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Update the user-space interface.

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 <thellstrom@vmware.com>
Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
5ffdb658f605cbc420944e7c7eeec9fbb8a73772 30-Jan-2010 Jakob Bornecrantz <jakob@vmware.com> drm/vmwgfx: Don't send bad flags to the host

Signed-off-by: Jakob Bornecrantz <jakob@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8e19a951774a16cf2626292ae06fd2b62630e67e 30-Jan-2010 Jakob Bornecrantz <jakob@vmware.com> drm/vmwgfx: Correctly detect 3D

Signed-off-by: Jakob Bornecrantz <jakob@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>
d9f36a0051b7c0382107cb0342af1126a6eb627d 13-Jan-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Implement basic pm operations.

Currently we really only support S3, since the device doesn't support
saving of the 3D state.

On S3/S4, move all buffer objects to swappable memory and take down
GMR bindings. We need to do that from a PM notifier since we can't
do persistant memory allocations from the standard PM callbacks.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
effe1105bef07f42366c20eac41b80ff9fcf675e 13-Jan-2010 Thomas Hellstrom <thellstrom@vmware.com> drm/vmwgfx: Use bo_driver::move_notify to unbind GMRs.

This was previously done explicitly for overlay- and fb buffers.
Now it's done for any buffer leaving the SYSTEM memory region.

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>
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>