Commit Graph

8085 Commits

Author SHA1 Message Date
Chris Wilson 9566fc0ccc sna: Curry parameters to sna_damage_all()
It is far easily to pass the PixmapPtr into the function and have it
pluck out the width and height than do so in all callers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 13:58:27 +01:00
Chris Wilson 1327918f91 sna: Mark CPU as all damaged when discarding a busy GPU bo
When we discard a GPU bo, we need to make sure that the remaining
content is marked as only accessible via the CPU shadow pointer.

Regression from commit 65301412ec
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sat May 17 20:59:38 2014 +0100

    sna: Discard active GPU buffers before uploading into them

Reported-by: Jan Alexander Steffens <jan.steffens@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79517
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 13:58:04 +01:00
Chris Wilson 8369166349 sna/dri2: Enable immediate buffer exchanges
The primary benefit of this is avoid the extra blit when using a
compositor and instead propagate the compositor flip on the frontbuffer
to the scanout, or equivalently allows a fullscreen game to flip onto
the scanout without intervention by TearFree.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-05 12:28:22 +01:00
Chris Wilson 0814889619 configure: XORG_DRIVER_CHECK_EXT does not create CFLAGS/LIBS variables
XORG_DRIVER_CHECK_EXT only adds the package name to the list of
REQUIRED_MODULES (which is later passed to pkg-config). For our optional
dependencies, we must do a later call to pkg-config to verify the
package is available and then remember to include the includes with the
CFLAGS.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-03 15:52:02 +01:00
Chris Wilson 0c81041e9b configure: Remove xf86driproto from REQUIRED_MODULES
We only depend upon the original DRI1 infrastructure when building i810
with DRI support. So unless that is true, do not throw an error if the
legacy protocol is absent.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-03 15:52:02 +01:00
Adam Jackson 689ee76a14 configure: Don't link the driver against libX11
78dc0c0474 added REQUIRED_MODULES to the
driver link line for... some reason.  That pulled in the libs from the
XF86DRI check, which near as I can tell has always been wrong, all of
the other extension checks just look for the protocol module and
xextproto doesn't define dri1 protocol in any case.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2014-06-03 15:52:02 +01:00
Chris Wilson 8297c969ae sna: Replace the bo for tiled uploads if not suitable and being replaced
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-03 13:48:58 +01:00
Chris Wilson 1c55d0447d sna: Allow replacements to cancel operations between both bo under a Pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-03 13:48:58 +01:00
Chris Wilson a82bfb0334 sna: Discard unwanted damage when promoting to a full CPU migration
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-03 13:48:58 +01:00
Chris Wilson 4cafd1fbb1 sna: Fix early return in download using the GPU
In commit 961139f587
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri May 30 09:45:15 2014 +0100

    sna: Use manual detiling for downloads

the code for deciding when to use the GPU was refactored into a new
function that also performed the transfer, but failed to notice the
early return.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 16:04:51 +01:00
Chris Wilson d6a412812c sna: Use CPU mmappings for linear uploads
The other half of the commit that accidentally got included with

commit bb49222a51
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Jun 2 08:25:52 2014 +0100

    sna: Add DBG hints for using inplace CPU mmappings

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 10:34:03 +01:00
Chris Wilson 454367f594 Only enable the new Cursor API for the next pre-release of Xorg
Make sure we can compile against the pre-release tarballs at the expense
of an innocuous compile warning if compiled against xserver.git

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 09:26:05 +01:00
Keith Packard ff36e1f754 uxa: Add Present extension support
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>

Conflicts:
	configure.ac
	src/uxa/intel.h
	src/uxa/intel_driver.c
2014-06-02 08:32:11 +01:00
Keith Packard 14ff08c282 uxa: Restructure DRM event handling.
This refactors the drm interrupt handling logic quite a bit, both to
allow for either DRI2 or Present handlers, but also to eliminate
passing pointers through the kernel. Passing pointers left the kernel
holding the only reference to some internal X server data structures.

After a server reset, the X server would end up using stale pointers
stored in those structures. Using simple integers makes it possible to
empty the queue of pending interrupt data and then ignore the stale
kernel data.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-06-02 08:32:11 +01:00
Keith Packard 7f28b1cfa2 uxa: Support 64-bit MSC values. Handle kernel vageries about MSC reporting
The kernel sometimes reports bogus MSC values, especially when
suspending and resuming the machine. Deal with this by tracking an
offset to ensure that the MSC seen by applications increases
monotonically, and at a reasonable pace.

Also, provide a full 64 bits of MSC value by noticing wrapping and
tracking the high 32-bits of MSC separately.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>

Conflicts:
	src/uxa/intel_dri.c
2014-06-02 08:32:11 +01:00
Chris Wilson dd6db82680 uxa: Add DRI3 and miSyncShm support
Based on a patch by Keith Packard.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 975b9798be sna: Add support for Present
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson d8eb87f84f sna: Add support for DRI3
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 0fbe8995d5 sna: Relax tiling height restrictions
Only force the even-tile-row alignment if we have an old GPU with an old
kernel that doesn't perform conservative alignment for us (as required).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 67b37332bd intel-virtual-output: Add DRI3 xfer path
Just as proof-of-principle.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 9cf6cd9726 Add rudimentary tests for Present
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 6ab6734369 Add rudimentary tests for DRI3
This is a simple little test to create a pixmap from a local bo, copy it
to a normal pixmap, then read it back by importing it into anther local
bo. It tests the fundamental mechanisms of opening a DRI3 render device,
importing into pixmaps, exporting into /buffers and a read-barrier.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson d6240d197b intel: Clear structs for valgrind
When probing the module, clear structs passed into unknown ioctls to
keep valgrind quiet.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson d27c948a43 intel: Add common routines and configure probing for DRI3
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson 8a02886a24 sna/dri2: Use real async flips
Presuming that we have both kernel support and Xorg support, of course.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson c17d704a5b sna: Enable kernel support for asynchronous flips
If a flip fails, attempt to restore the previous working configuration
(using a modeset) then disable further flipping.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson c95a4002d1 sna/dri2: Hide MSC reported as going backwards
OML_sync_control mandates that MSC must be monotonic, so if the kernel
reports that they go backwards, lie.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:11 +01:00
Chris Wilson b1c07c20a3 sna/dri2: Always force the async blits to be immediate
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:10 +01:00
Chris Wilson 1b5f91e142 sna/dri2: Decouple spent flip
If the flip is already completed before we finish the previous flip, the
drawable has been replaced already and we can unchain the flip queue.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:10 +01:00
Chris Wilson 0ee1940a4f sna/dri2: Mark queued flip MSC as the one after next
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:10 +01:00
Chris Wilson 2df4466ada sna/gen8: Clear all URB push constant allocations
A little paranoia to clear the unused portion of the URB and dedicate it
to VS entries.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:10 +01:00
Chris Wilson 1618d6cfa6 sna/gen8: Set GT level
We use the GT level to decide how favourable it is to use the GPU in
various circumstances, now set it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:10 +01:00
Chris Wilson bb49222a51 sna: Add DBG hints for using inplace CPU mmappings
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:10 +01:00
Chris Wilson 487df2e7b1 sna: Silence a DBG compiler warning
kgem.c: In function '_kgem_submit':
kgem.c:3243:12: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
       write(fd, kgem->batch, batch_end*sizeof(uint32_t));

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-06-02 08:32:10 +01:00
Chris Wilson ffbe0aa185 sna: Reuse the first scanout bo
The path of last resort is meant to reuse the first scanout bo if they
all busy (since it will be the oldest). It chased a dangling pointer
instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:49:27 +01:00
Chris Wilson 40fe1f2c09 sna: Do not allow imported buffers to be cached
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:49:27 +01:00
Chris Wilson fc1f9b91ae sna: Mark all caches for expiration
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:14:15 +01:00
Chris Wilson 3dac734bb0 test: Only compute the masked pixel value if depth!=32
Minor saving for when we use a8r8g8b8.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:14:15 +01:00
Chris Wilson 961139f587 sna: Use manual detiling for downloads
If we can CPU mmap the GPU bo, prefer to do so for migration to the CPU
as this saves an extra serialisation step.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:14:15 +01:00
Chris Wilson 93d3df493d sna: Unexport kgem_get_unique_id()
This should always be set during bo creation

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-30 23:14:15 +01:00
Chris Wilson 792584fa74 sna/dri2: Reorder declarations to compile on old Xorg
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-28 19:43:47 +01:00
Chris Wilson 562c47fc21 Silence CLang (almost)
Fix up all the warnings about implicit enum conversions. The
container_of() macro remains defunct.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-28 13:34:53 +01:00
Chris Wilson 6282fc9d0d sna/dri2: Fix the continuation mode for old style triple buffering
Otherwise we end up sending too many SwapCompletes back to the client
and confusing ourselves.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-28 11:05:49 +01:00
Chris Wilson 916354164b sna: Fix the depth/format on the temporary shadow Pictures
When scaling the output, we re-render onto the scanout using a call to
Composite, for which we create temporary Pictures. In most cases, the
mismatching depth/format goes unnoticed, but along one particular
fallback path, we use those to create a new Picture but the mismatching
format results in a segfault.

Reported-by: Matti Hämäläinen <ccr@tnsp.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79320
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-27 20:19:55 +01:00
Chris Wilson d8360bd74f sna: Handle bad picture format/depth mismatches
Scaling the output feed in an invalid picture->format/depth combination
which causes the fallback downsampling function to explode. Whilst this
is a bug in the higher layer, we can handle the error anyway.

References: https://bugs.freedesktop.org/show_bug.cgi?id=79320
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-27 20:19:49 +01:00
Chris Wilson 93b319cf9a uxa: Silence the compiler over a couple of unused variables
intel_driver.c: In function 'I830LeaveVT':
intel_driver.c:1085:24: warning: unused variable 'intel' [-Wunused-variable]
  intel_screen_private *intel = intel_get_screen_private(scrn);
                        ^
intel_driver.c: In function 'I830EnterVT':
intel_driver.c:1102:24: warning: unused variable 'intel' [-Wunused-variable]
  intel_screen_private *intel = intel_get_screen_private(scrn);

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 20:45:05 +01:00
Chris Wilson e6ee067937 uxa: Silence compiler for warnings in Cursor API changes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 20:45:05 +01:00
Chris Wilson 4321e8decd sna: Silence compiler for warnings in Cursor API changes
The API changed again in the RC, so update to keep the compiler quiet.
At the same time, protect against the ARGB_CURSOR struct changes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 20:45:05 +01:00
Chris Wilson 2a0dc7ed49 sna/dri2: Move scanout processing from frame event to global
The scanout is a global property, track it as so. The primary benefit to
this is it strengthens our assertions that we never hand out an active
scanout for use as a back buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 20:44:59 +01:00
Chris Wilson 05f149285b sna/dri2: Defer reallocation of backbuffer until request
If we defer the reallocation of the backbuffer until the client requests
the set of current buffers (with GetBuffers), then we can often avoid
allocating the fresh backbuffer as the flip often retires before the
client is ready.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-05-26 07:56:55 +01:00