Commit Graph

7199 Commits

Author SHA1 Message Date
Chris Wilson 7e9ff48ddb sna/gen8: Shrink 3DSTATE_SAMPLE_PATTERN packet
This is now smaller than originally specified.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-05 10:44:48 +01:00
Chris Wilson 878ed2d625 sna/gen8: w/a for NULL depth buffer
Instead of using a NULL type depth buffer, it is strongly suggested to
use a 1x1 16-bit depth buffer instead (with address 0).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-05 10:44:45 +01:00
Chris Wilson 02862faeae sna: Remove unitialized use of 'cursor'
The earlier query of cursor (simply to find out the hw size) was
replaced by an invariant determined when the cursor was first set.
However, not all uses of cursor->size were fixed.

Fixes regression from
commit f98b2e1646
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Apr 2 08:36:14 2014 +0100

    sna: Prevent signal re-entrancy into cursor update routines

Reported-by: Christoph Haag <haagch.christoph@googlemail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77053
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-04 16:05:23 +01:00
Chris Wilson 938eea6dee sna/gen2+: Beware the unattached ShmPixmap
When dereferences priv, make sure it exists first. ShmPixmaps for
example, may not have one, nor do very small buffers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-04 15:56:38 +01:00
Chris Wilson 564e4a9878 sna/gen7: Move constants MOCS into chipset specific info blocks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-04 14:04:38 +01:00
Chris Wilson 6e86e84da1 sna: Precompute OVER/ADD with solids to convert it into a BLT operation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-04 12:57:50 +01:00
Chris Wilson 31a4c7bc13 sna/gen2+: Replace composite sources with solids where possible
If the composite reads entirely from within a large pixmap which is a
clear color, just replace the source with a solid.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-04 11:45:53 +01:00
Chris Wilson f0565852b6 sna: Short-circuit repeated clearing to the same color
Spotted in amongst a KDE debug log was a series of clear; copy; repeat
using Composite().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-03 16:49:27 +01:00
Chris Wilson baef2201f7 sna: Silence compiler warning
Simplify the dependency logic so that even the compiler can understand
what is going on.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-02 11:37:17 +01:00
Chris Wilson f98b2e1646 sna: Prevent signal re-entrancy into cursor update routines
As we may need to allocate from within the cursor update, we are prone
to re-entrancy issues within malloc()/free(). To avoid these we need to
block SigIO (for pointer updates) whilst in the critical section.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-04-02 09:49:53 +01:00
Chris Wilson a926d9f682 sna: Update tiling flags after reusing inactive VMA
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-31 14:07:41 +01:00
Chris Wilson 644c274b2c sna: Fix predicate inversion for assertion
The assertion was checking that the invalid condition was true, rather
than that it never happened. Oops.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-31 14:03:49 +01:00
Chris Wilson 4b97bf7e6e sna: Use a cheaper check for a replacement operation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-31 13:37:38 +01:00
Chris Wilson 76380bcc3c sna: Allow reassignment of inactive VMA if not mapped into the GTT
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-31 13:37:38 +01:00
Chris Wilson c4c8a1b180 sna: Discard damage tracking for operations to the whole pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-31 11:23:45 +01:00
Chris Wilson 8f796d4586 sna: Promote to the GPU operations that cover the whole pixmap
If the pixmap is already partially on the GPU, and the next operation
touches the entire pixmap, promote that operation back to the whole GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-31 11:14:46 +01:00
Chris Wilson 27c086a89d sna: Regularly check that damage does exceed the pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-31 10:15:39 +01:00
Chris Wilson a8a5a5a587 sna: Search cursor cache first
We can reuse the current cursor size rather than determine it every
time.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-31 09:36:05 +01:00
Chris Wilson e892b789c4 sna: Suppress a compiler warning
sna_display.c: In function '__sna_get_cursor':
sna_display.c:3153:6: warning: assignment from incompatible pointer type [enabled by default]
  src = sna->cursor.ref->bits->argb;
      ^
sna_display.c:3209:10: warning: comparison of distinct pointer types lacks a cast [enabled by default]
  if (src != sna->cursor.ref->bits->argb)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-28 11:34:03 +00:00
Chris Wilson 5c0623b5f3 sna: Only transform the temporary cursor coordinates
As we need to recompute them for each CRTC, we need to reset the
computation each time or else we screw up the coordinates and hide
the cursors at random.

Breakage from commit 25ca8f136c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Mar 27 14:15:30 2014 +0000

    sna: Support variable sized cursors

Reported-by: Jan Alexander Steffens <jan.steffens@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76724
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-28 09:56:03 +00:00
Chris Wilson 80792a3f49 sna: Our cursors are always square.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-28 09:43:34 +00:00
Chris Wilson 35b03b3fe6 sna: Virtual CRTCs are last, so break loops early
We know that all the virtual CRTCs are at the end of the CRTC array, so
when we see the first one, we can stop the processing of real CRTCs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-28 09:14:59 +00:00
Chris Wilson 929ac66558 sna: Cursors are invariant
Once created, a Cursor has a fixed size and content, so avoid upload
unnecessarily.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-28 08:48:06 +00:00
Chris Wilson 26cc3cec98 sna: drmGetCap is too recent for our supported versions of libdrm
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-28 08:46:25 +00:00
Chris Wilson 78805163c5 sna: RefCursor is too recent
Replace RefCursor with the simple refcnt manipulation for compilation
against older stacks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-28 08:46:25 +00:00
Chris Wilson e07f8e2e62 sna: Fix 2-color to ARGB cursor conversion
It helps to remember to advance through the source/mask images after
each row.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-27 23:06:15 +00:00
Chris Wilson e501aa6676 sna: Cursors only need to be cleared when they are shrunk
If we completely overwrite the old contents, we do not need to clear it
first.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-27 21:59:08 +00:00
Chris Wilson 5c4d6d1ad7 sna: Reorder the cursor cache search
Search for an exact match first, before looking for a cursor we can
reuse. This should help reuse with multiple rotated screens not stealing
the others' cursor on every pass.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-27 21:39:58 +00:00
Chris Wilson e8be2a438d sna: Clear the surrounding areas of small cursors
If the cursor does not completely fill the size of the hardware cursor,
we will retain whatever contents already filled that area.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-27 21:09:45 +00:00
Chris Wilson 25ca8f136c sna: Support variable sized cursors
One of the downsides with supporting large cursors is that the full size
is very rarely used leading to a waste of permanently allocated
resources. Refactor our cursor handling so that we can allocate fresh
cursors on the fly that are appropriately sized.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-27 15:23:15 +00:00
Chris Wilson e3810cff42 sna: Move cursor reload into crtc notify
This only needs to be done once per-screen reconfiguration.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-27 14:26:54 +00:00
Chris Wilson 6bdd3b39bf sna: Tighten detection of GCs that translate to solid fills
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-27 14:26:54 +00:00
Chris Wilson e46c196ecc sna: Print probed maximum cursor size
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-26 12:18:39 +00:00
Chris Wilson 7addfcbf0f sna: Remove one conditional from rendering glyphs into a mask
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-24 16:56:10 +00:00
Chris Wilson d3050dbaf7 sna: Consolidate handling of uncacheable glyphs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-24 16:56:09 +00:00
Chris Wilson 79399ff926 sna: Eliminate a few conditionals in glyph fast path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-24 16:55:24 +00:00
Chris Wilson 220accd828 sna: Only enable cursor support if the hw cursor is supported
Under a host, we naturally will not setup the cursor capability, and
this provides a safeguard in case we have a machine that does not
support hardware cursors.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-20 09:03:31 +00:00
Chris Wilson 7cf0676ff8 intel: Do not close server fds
If we are given an fd by the Xserver, then it is not our responsibility
to close it during CloseScreen.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Hans de Goede <hdegoede@redhat.com>
2014-03-20 08:52:12 +00:00
Chris Wilson 9f4c121974 intel: Refactor finding device path if unknown
Since we already lookup the device path if we do not know it after
opening the fd, we can remove the special case along the legacy PCI
probe path.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-20 08:48:40 +00:00
Chris Wilson 6802ee00e5 sna: Assert after applying clipping that the draw rectangle is wholly contained
Otherwise we ignore the purpose of applying the clip!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-19 10:25:05 +00:00
Chris Wilson 15be6b7c9a uxa: Implement minimal flushing for bdw+
Based on the patch by Kenneth Graunke,
"Several places (such as intel_cache_expire) call intel_emit_batch_flush,
so it needs to work on Broadwell.  Sometimes the batch is empty, in
which case current_batch may not yet be BLT_RING.

The PIPE_CONTROL code has not been ported to work on Broadwell, so
trying to do a render ring flush will hang the GPU.  It also doesn't
make any sense to do a render ring flush, given that we never use the
render ring for UXA on Broadwell."

Cc: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-18 16:52:40 +00:00
Hans de Goede 6446bf96f0 intel: Don't close the fd on probe failure if it is server managed
I hit this corner case when testing a single X server spanning both intel
gfx + an usb display link adapter driven by xf86-video-modesetting.

In this scenario the intel driver gets its platformProbe method called first,
and if it then closes the server managed fd, the xf86-video-modesetting gets
EBADFD errors.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-03-18 15:55:54 +00:00
Chris Wilson 4a6e09c6cd uxa: Add support for server managed fds (via intel_device)
Based on the patch by Hans de Goede, this removes the handling of
drmOpen() and DRM_MASTER from within uxa and instead uses the common
routines. This reduces the duplicate code from within uxa, and enables
new features such as server managed fds.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-18 15:52:19 +00:00
Chris Wilson dc66e663a0 sna: Improve guard against loading palettes whilst headless
Whilst hosted, which is very similar to being headless, we do not even
have the kmode pointer and so checking kmode->count_crtcs is fatal.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-17 13:50:18 +00:00
Chris Wilson 28ebbe8fa9 sna: Fix logic inversion in use of imprecise transform conversion
An accidental drop of the if (!is_translation) broke composite copies
under a transform.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76244
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-17 07:56:39 +00:00
Chris Wilson c64d2572ba sna: Allow some leeway when deciding to discard common translations
Under PictFilterNearest, we can ignore fractional translations (not all
renderers discard those.) And if we are being approximate, we can loosen
our tolerance as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-14 13:40:55 +00:00
Chris Wilson b61e6398f0 sna: Ensure we flush SHM pixmaps if rendering to a GPU shadow
Normally, we try to render into the CPU bo of a SHM pixmap. However, under
the right circumstances we may try to do a series of rendering into the
GPU bo and then copy it back to the CPU bo. In that case, we need to be
sure to mark the pixmap as requiring the flush.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-14 11:38:19 +00:00
Kenneth Graunke cbcc1b6190 uxa: Enable BLT acceleration on Broadwell.
This supports solid, copy, put_image, and get_image acceleration via the
BLT engine.  RENDER acceleration (composite) and Xv would be piles of work,
which is not worth doing since SNA exists, and Glamor is coming.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2014-03-13 15:04:59 +00:00
Kenneth Graunke c1d7abadbb uxa: Remove implicit length from BLT command #defines.
These command packets grew on Gen8.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2014-03-13 14:52:59 +00:00
Chris Wilson 44fe210183 sna/gen6+: Simplify BLT vs RENDER decisions for fill ops
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-03-13 08:54:56 +00:00