Commit Graph

7705 Commits

Author SHA1 Message Date
Chris Wilson 02eceefa29 sna: Pass read hints from move-to-cpu to wait_for_shadow
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-05 11:44:01 +00:00
Chris Wilson de73c5fd1c sna: Tweak assert_bo_retired() to be callable on cached bo
References: https://bugs.freedesktop.org/show_bug.cgi?id=73406
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-04 20:57:24 +00:00
Chris Wilson 0906769c1b sna: Rearrange assertion to ease use of substitute cached bo
Since we call kgem_bo_submit() along one path when synchronising a
cached bo (which is known to be inactive) but still want to keep the
assertion on the refcnt, simply rearrange the code to only assert on the
active path.

References: https://bugs.freedesktop.org/show_bug.cgi?id=73406
Reported-by: Matti Hamalainen <ccr@tnsp.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-04 18:03:06 +00:00
Chris Wilson fc001615ff sna/gen4: Disable use of pipecontrol invalidates again
One day, just not today, we may make gen4 work correctly, efficiently and
fast. Today, we can barely pick one.

References: https://bugs.freedesktop.org/show_bug.cgi?id=55500
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-04 10:36:21 +00:00
Chris Wilson c6a21f0355 sna/glyphs: Reset composite state between switching glyph formats
One path uses the mask channel, the other does not. We cannot rely on
overwriting all reused state in this case, and so we must clear the
composite state prior to use each time.

Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74494
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Arkadiusz Miskiewicz <arekm@maven.pl>
2014-02-04 09:56:44 +00:00
Edward Sheldrake 1cbc59a917 sna/gen4,5: Fix setting pipe control cache flush bits
Cache flush bits are on dword 0, not 1, on gen4 and gen5. Also texture
cache invalidate is only available from Cantiga onwards.
2014-02-03 10:04:15 +00:00
Chris Wilson 7f08250a89 sna: Reconstruct damage for the partially replaced discarded CPU bo
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-02 03:52:11 +00:00
Chris Wilson 853588ad5b sna: If IGNORE_CPU is not set we must mark the move as MOVE_READ
Logic reversal in discarding CPU damage. An old bug revealed by the more
aggressive attempts to discard CPU damage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-01 21:55:09 +00:00
Chris Wilson 8b0748c57e sna: Add some more DBG for choosing render targets
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-01 21:54:43 +00:00
Chris Wilson ed8d4f0ce3 sna: Skip discarding CPU bo when using as a render target
The issue with unwanted serialisation does not affect the async
move-to-cpu of a render target.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-01 21:43:02 +00:00
Chris Wilson 26613b0460 sna: Allow more inplace promotions of CPU to GPU bo
If the CPU bo is wholly damaged, then it makes an ideal candidate for
simply converting into the GPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-01 21:40:54 +00:00
Chris Wilson 699b4fd313 sna: Undo region translation before returning
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-01 20:14:07 +00:00
Chris Wilson 2c4b2ed558 2.99.909 snapshot 2014-02-01 18:57:29 +00:00
Chris Wilson 495bf89496 sna: Apply drawable offsets to partial CPU damage being replaced
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-01 18:57:29 +00:00
Chris Wilson 2ba8d40bf7 sna: Don't discard the GPU prior to using it for stashing CPU damage
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-01 18:13:37 +00:00
Chris Wilson 534f19dc5a sna: Remark the region as damaged after uploading the rest to the GPU
If we upload outside of the replaced region to the GPU, we need to
remark the region of operation as dirty.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-01 17:56:58 +00:00
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