Commit Graph

7689 Commits

Author SHA1 Message Date
Chris Wilson 2814748b91 sna: Only discard CPU damage for an replacing region
When considering move-region-to-cpu, we need to take into account that
the region may not replace the whole drawable, in which case we cannot
simply dispose of an active CPU bo.

Reported-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reported-by: Conley Moorhous <conleymoorhous@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74327
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-01 17:46:14 +00:00
Chris Wilson 3e784832a5 glamor: Enable Xv support
In addition to the UXA texture paths (which in theory support VSync) and
direct overlay support, create a textured video paths that utilize the
glamor acceleration code.

Requested-by: Fabio Pedretti <fabio.ped@libero.it>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74311
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-01 16:59:13 +00:00
Chris Wilson 3f2e199b6b 2.99.908 snapshot 2014-02-01 09:07:13 +00:00
Chris Wilson 1f9a6156e9 sna: remove short-circuit for move-to-CPU when damage covers region
The short-circuit path missed translating the damage from drawable space
into the pixmap (for Composite setups) which may have resulted in
corruption. The path was also failing to consider the impact of reusing
an active CPU bo when it could be discarding the unwanted damage and
reallocating.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 20:42:51 +00:00
Chris Wilson 539b749416 sna: Use 24bpp rendering by default for gen2 again
Too many users where unhappy that their software was broken. Too bad the
same software is also broken at high bit depths as well.

References: https://bugs.freedesktop.org/show_bug.cgi?id=73877
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 20:42:51 +00:00
Chris Wilson bdb1a62ce2 sna: Balance memory accounting for buffer objects
A couple bugs ended up with CPU bo gradually accumulating whilst the
overall number of bo vanished.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 16:42:46 +00:00
Chris Wilson f934ee78a0 sna: Reorder assignments vs DBG
It helps reading the debug log if what we print is correct.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 15:39:23 +00:00
Chris Wilson bdbb928ea3 sna: Actually reuse pixmap headers for ordinary pixmaps
commit 3dbf17f00e [2.99.907]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Dec 3 12:10:01 2013 +0000

    sna: Mark up an ordinary pixmap for reuse

started to put the frequently allocated pixmaps into the object cache -
but as those frequent allocations themselves did not use the cache, the
cache kept growing.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1272338
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 15:20:11 +00:00
Chris Wilson dfac4650e6 sna: Tidy up pixmap header allocations
Refactor some more of the common code, and add some debug tracking.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 14:29:50 +00:00
Chris Wilson 098a1163e9 sna: Show the memory debug info again
This needs to be visible whenever we --enable-debug=memory. Make it so,
and trim it to a single line in the process.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-31 14:29:49 +00:00
Chris Wilson 166e8e9e5d sna: Silence a compiler warning for mismatching const strings
sna_display.c: In function 'preferred_mode':
sna_display.c:3393:7: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
  mode = xf86GetOptValString(output->options, OPTION_PREFERRED_MODE);

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-30 12:24:47 +00:00
Chris Wilson ca2d9e69d0 sna: Suppress warning for freeing a "constant" string
We allocated and own the string, so we can free it!

sna_display.c: In function 'sna_output_get_modes':
sna_display.c:2314:4: warning: passing argument 1 of 'free' discards 'const' qualifier from pointer target type [enabled by default]
    free(current->name);

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-30 12:24:47 +00:00
Chris Wilson 5ef675159f sna: Handle char *backlight_iface
The backlight_iface is a freeable string, in places we were assigning a
constant string and later freeing it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-30 12:24:47 +00:00
Chris Wilson 76e430e92c sna: Constify GCFunc to quieten the compiler.
We keep a pointer to the old funcs when wrapping, this now needs to be const.

sna_accel.c: In function 'sna_gc_move_to_cpu':
sna_accel.c:4008:17: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
  sgc->old_funcs = gc->funcs;

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-30 12:24:47 +00:00
Chris Wilson 57445e57d4 sna: Fix format specifier typo ('%D') in DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 16:48:21 +00:00
Chris Wilson 139fc76260 sna: Always clear the domain even only a potential sync
It helps to keep the domain-tracking bookkeeping consistent.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 13:42:50 +00:00
Chris Wilson d70620d978 sna: We can only retire a bo if is not referenced by the current batch
Fixes regression from
commit 8b0ebebcab
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jan 28 16:30:47 2014 +0000

    sna: Be a little more assertive in retiring after set-domain

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74176
Reported-by: Jan Alexander Steffens <jan.steffens@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 13:40:08 +00:00
Chris Wilson 971a5e64f5 sna: Add assertions for set/get binding
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 13:15:43 +00:00
Chris Wilson 7df3da10e7 sna/gen4+: Assert that the cached binding location is valid
We can at least check that it is in the right region (i.e. not past
where the current surface has been allocated from).

References: https://bugs.freedesktop.org/show_bug.cgi?id=74176
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 13:06:08 +00:00
Chris Wilson 001dd080e1 sna: Do not use color corrected pixel values for comparing against gc
Dashed zero-width lines devolve into two passes (first to draw the
foreground dashes, and then to draw the gaps). The code was using the
pixel value to decide which phase was being drawn -- however the color
on the gc is not always bit exact (e.g. alpha channel) with the pixel
value. As a result, we would oft miss drawing anything when rendering
into the scanout.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1059152
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 11:23:41 +00:00
Chris Wilson 872468a059 sna/gen6+: Encourage inplace uploads for Composite
First try using the blt path for a potential inplace upload for a
simple composite operation copying from a ShmPixmap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 05:40:00 +00:00
Chris Wilson 4b73a0ea22 sna: Skip undamaged TearFree redisplays
If we have not had cause to flush the wait_for_shadow buffer during the
course of the rendering, then we never wrote to the backbuffer and its
contents are still identical to the current frontbuffer. So if the
wait_for_shadow is still flagged as required on the scanout, we know we
can safely discard the redisplay request.

References: https://bugs.freedesktop.org/show_bug.cgi?id=70905
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-29 05:32:25 +00:00
Chris Wilson 9f3fc9ec49 Allow selection of glamor as the default acceleration method
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74162
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-28 21:56:23 +00:00
Chris Wilson 2425f03432 sna: Check for a hang after a spurious error return from set-domain-ioctl
set-domain-ioctl should only ever fail for invalid user input, beyond
the normal signal handling. As such if we do find a spurious error
return from the kernel, check for a GPU hang.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-28 19:22:55 +00:00
Chris Wilson 8b0ebebcab sna: Be a little more assertive in retiring after set-domain
After a successful set-domain for writing with the CPU, we know that the
buffer is idle so remove it from our request tracking. (External clients
complicate matters in that they may keep the bo active even after our
set-domain.) On the contrary, because of read-read optimisations a bo
may still be active after a set-domain for reading by the CPU, in which
we need to remain conservative in retiring the bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-28 16:40:45 +00:00
Chris Wilson b99c8cbefd sna: Cancel the backlight change if set-property(DPMS) fails
If the kernel reports an error from setting the DPMS property, we need
to undo the local changes and propagate back the error to the caller.
Although the latter is prevented by the RandR API, we can at least
restore the backlight.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-28 12:51:00 +00:00
Chris Wilson 47effa1854 sna: Rearrange damage allocation to handle malloc failure more gracefully
If we fail to allocate new damage boxes, first try collescing the
existing boxes to free up memory.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-27 21:48:33 +00:00
Chris Wilson ad7daf9aae sna: Use signal-safe DBG
Otherwise we end up confusing the core Xserver functions when called
from auxilliary threads.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-27 21:48:17 +00:00
Chris Wilson 294180b3bf sna/gen3+: Allow for spill when aligning vertices
We need to flush the batch if we run out of space aligning our vertex
buffer - but the test must anticipate the space required for the new
alignment.

Reported-by: Arkadiusz Miskiewicz
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-24 14:21:44 +00:00
Chris Wilson 4385724dc4 sna/gen2+: Inspect composite flags to discard unneeded CPU damage
We can now check whether the Composite operation will require existing
CPU damage and if not discard it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-24 11:32:43 +00:00
Chris Wilson c9e9c85fc7 sna/gen2,3: Don't set BLT_DST_TILED
This bit only exists for gen4+ so avoid setting it on gen2 and gen3,
whilst setting it doesn't seem to cause any harm, there is no reason to
risk it...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-23 19:14:49 +00:00
Chris Wilson 6914b3af7f sna: Protect against fake CRTCs during initial probe
Reported-by: Nick Bowler <nbowler@draconx.ca>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73981
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-23 17:38:27 +00:00
Chris Wilson e916c922ce sna: Avoid erroneous discarding operations for partial composites
Composite operations were presumed to cover their entire width x height
area. However, a few paths submit boxes that do not cover the clip
region and so the optimisation made during prepare to discard completely
overwritten data is incorrect (and leads to corruption - stale data is
seen which the client expected to have been overdrawn). So along these
more unusual paths, we must add a flag to prevent the overzealous
discard. Notably, xfce4 triggers this as it uses a lot of unantialiased
trapezoids in its theme drawing.

References: https://bugs.freedesktop.org/show_bug.cgi?id=69528
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-23 17:38:27 +00:00
Chris Wilson 59e769e1b1 glamor: Don't require the glamoregl module to be pre-loaded with xserver >= 1.15
Inspired by (ok, copied from):

xf86-video-ati commit f2a0a5cf6c5a21e2a02280e110a4eb8e6609dace
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Jan 22 11:04:42 2014 +0900

    Don't require the glamoregl module to be pre-loaded with xserver >= 1.15

    The issues with loading it on demand have been fixed in xserver 1.15.

    Inspired by Jérôme Glisse on IRC.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-23 17:37:04 +00:00
Chris Wilson 32010ed86b sna: Assert that the fill box is within bounds
References: https://bugs.freedesktop.org/show_bug.cgi?id=73811
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-22 16:31:22 +00:00
Chris Wilson 29e11e2e6f sna: Restore gc->serialNumber correctly after falling back
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73856
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 22:40:11 +00:00
Chris Wilson 2c441079cb sna: Initialise the TearFree shadow output from the current front buffer
Otherwise we may end up in a sitation where we show stale contents for a
(sometimes signification) fraction of a second before it is refreshed
with the correct contents.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73842
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 10:38:56 +00:00
Chris Wilson ac22dd4292 sna/gen4: Add an ALWAYS_FLUSH debugging option
Still gen4 is cursed. This should restore the plateau we reached with
2.99.907 by forcing a full GPU flush between every operation.

References: https://bugs.freedesktop.org/show_bug.cgi?id=55500
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 10:38:56 +00:00
Chris Wilson 720d131963 sna: Drop bogus assert added in recent patches
The intention was to detect if the gc->pCompositeClip still pointed to
the temporary region. However, the assert failed to accomplish that
goal.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 10:35:30 +00:00
Chris Wilson 36b743aa8e sna: Reduce zeal of new gc->pCompositeClip
gc->pCompositeClip starts off NULL, just like sna_gc->priv.

Reported-by: Arkadiusz Miskiewicz
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 10:00:07 +00:00
Chris Wilson 6a757eaa09 sna: Fix typo in assertion from previous commit
Sigh. It helps to remember to do compile testing with the right
configuration.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 09:25:45 +00:00
Chris Wilson b9ebb01683 sna: More assertions for tracking gc->pCompositeClip
Tracking down who leaves it modified...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-21 09:22:21 +00:00
Mark Kettenis f7121bf733 sna: build fix for OpenBSD
Commit 50a45a1cdd introduced the use of
"struct stat" but doesn't include <sys/stat.h>.  Presumably that leaks
in trough some other header on Linux, but on OpenBSD compilation fails
because the struct isn't known.
2014-01-20 22:33:16 +00:00
Chris Wilson 50f6701aa5 sna: Include serial numbers in ValidateGC DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 21:36:38 +00:00
Chris Wilson 4c7b183fd2 sna: Short-cut the fallback for XCopyArea with depth < 8
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 14:35:55 +00:00
Chris Wilson 671658499b sna: Add some more DBG output around the clipping in sna_do_copy()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 14:35:35 +00:00
Chris Wilson 55a933aa29 intel-virtual-output: Tidy some DBG for copying new modes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 13:29:22 +00:00
Chris Wilson 04ee452439 sna: Increase limit on number of possible outputs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 12:33:47 +00:00
Chris Wilson 637e7c2186 intel-virtual-output: Print error events for debugging
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 12:33:47 +00:00
Chris Wilson 92e9bf82b2 intel-virtual-output: Disable remote display if SetCrtcConfig fails
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-01-20 12:33:47 +00:00