Commit Graph

6166 Commits

Author SHA1 Message Date
Chris Wilson 4a43aa81e2 sna: Restore bo->flush status for large bo
Since we started discarding the flush flags on cached bo (in order to
prevent DRI flush states leaking), we failed to preserve the flush flag
for large bo (which uses it to keep batches trim and other hints).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-04-04 10:53:55 +01:00
Chris Wilson ed3dab44a7 sna: Adjust userptr structure for implicit padding
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-04-02 15:21:17 +01:00
Chris Wilson 4e2fc5aee0 sna: Relax scanline waits on HSW to be emittable from either ring
My overzealous reading of the bspec lead me to the conclusion that the
MI_LOAD_SCANLINES command was only available on the blitter ring. This
is false, thankfully, and allows us to do vsync'ed Xv.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-04-02 14:29:29 +01:00
Chris Wilson 5a36fdcee7 sna/gen4: Kill stray debugging ErrorF from previous commit
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-04-02 11:01:53 +01:00
Chris Wilson 3d7e16addb sna/gen4: Break the Video rendering loop into 16 rectangle chunks
If we feed more than 16 rectangles into the video rendering pipeline,
the GPU goes crazy and starts emitting corruption. Lalalala.

Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1162046
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-04-02 10:58:52 +01:00
Chris Wilson f09aa788d7 DRI2GetMSC: Do not send a bogus ust for when the drawable is not displayed
According to the opengl glx_sync_control spec, the Unadjusted System Time
(or UST) is a 64-bit monotonically increasing counter that is available
throughout the system:
http://www.opengl.org/registry/specs/OML/glx_sync_control.txt

Therefore, sending 0, even in this corner case, is out of spec. However,
we cannot just return FALSE here as that triggers a BadDrawable error to
be sent, and as is often the case mishandled, to the client. This results
in a certain compositor terminating, for example.

As an alternative we can use the monotonic system timestamp which in
theory should also be monotonic with the previous and subsequent vblank
times.

Based on a patch by Daniel Kurtz.

Reported-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-04-02 10:06:55 +01:00
Chris Wilson 4af622edfc sna: Try to eliminate pending operations to the bo being replaced
When we are replacing a bo with fresh data, we can drop pending
operations to it and thereby reduce the complexity of the replacement.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-04-01 23:04:29 +01:00
Chris Wilson ef0038d358 sna: Allow the compiler to inline memcpy for the bitblt routines
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-04-01 23:04:29 +01:00
Chris Wilson 43181692f7 sna/gen7: Refine is_gt2() for Haswell versus Ivybridge
The two similar chipsets do not use the same PCI-ID encoding schema.

Fixes regression from
commit 235a3981ea
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Mar 26 20:37:14 2013 +0000

    sna/gen7: Use GT2 values for GT2 variants

Reported-by: zaverel@free.fr
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-28 15:44:01 +00:00
Chris Wilson 96c10bdff9 sna/gen7: Resist the temptation to overprogram the number of PS threads for HSW
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-27 22:10:37 +00:00
Chris Wilson 19dfa72c28 sna/gen4+: Set read-write allocation mode for the target render cache
As we often first clear the destination before performing a blend, we
get a performance boost if that first write populates the render cache.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-27 16:58:41 +00:00
Chris Wilson d9b8c2039d sna/gen7: Fix MOCS for Haswell
The memory attributes changed slightly, and in particular there is now
an explicit uncached setting - which of course happened to be the value
currently selected.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-27 16:58:41 +00:00
Chris Wilson 04b2802140 sna/gen7: Restore render acceleration for VLV power-on board
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-27 11:57:18 +00:00
Chris Wilson 2054f43e43 sna/gen7: Prefer spans for GT2 desktop variants
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-27 11:57:18 +00:00
Chris Wilson 235a3981ea sna/gen7: Use GT2 values for GT2 variants
The check was only testing for GT2+ and excluding the normal GT2
devices. See also

commit ce9f044836
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Feb 8 16:01:54 2013 +0000

    sna/gen6: Use GT2 settings for both GT2 and GT2+

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-27 11:57:10 +00:00
Mark Kettenis 3dddb01005 sna: Use a more portable way to determine total RAM size
The sysinfo function is Linux-specific.  sysconf(_SC_PHYS_PAGES), while
not truly portable, is available on many more systems, including Linux,
Solaris, NetBSD, FreeBSD and OpenBSD.  So use that instead.  Verified
that this results in the same value as the sysinfo call on a handful of
Linux systems.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2013-03-26 20:18:10 +00:00
Chris Wilson e63390df52 sna: Add extra '()' around bitwise &/&& for CPU feature detection
By popular demand.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-26 16:32:13 +00:00
Chris Wilson 1d6f4078c1 sna/gen4+: Reorder code to compile on squeeze
Remember to only use sse4_2, avx2 in their restricted sections that
check for compiler support.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-26 16:28:26 +00:00
Chris Wilson 0b479504c8 sna: Check for OS support of AVX/AVX2 before use
If the OS has not initialised support for the extended instructions,
then their use may result in general protection faults.

Based on code by Thiago Macieira.

Reported-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-26 16:17:34 +00:00
Chris Wilson 9620f41907 sna: Fix AVX2 detection
It requires use of the cpuid feature eax=7:ecx=0, so it requires the
extended version of __cpuid  to pass in the subfeature.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-26 15:44:42 +00:00
Chris Wilson da2bd82b0e sna/gen4+: Add a couple more advanced SSE variants for composite vertices
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-26 15:13:32 +00:00
Chris Wilson 86bcf4a9f5 sna: AVX2 is in the ebx result of cpuid
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-26 15:13:28 +00:00
Chris Wilson a5be4210b7 sna: Trim removed fields from execbuffer2 for OpenBSD support
Reported-by: Mark Kettenis <kettenis@openbsd.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-26 09:05:48 +00:00
Mark Kettenis 761ab4124e sna: Fix OpenBSD backlight control implementation
Fix cut'n'paste error such that this actually compiles.

Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2013-03-26 09:03:58 +00:00
Chris Wilson 0a9b136ec4 Remove the GeneralSocket upon CloseScreen
Be neat and tidy in case we are shutdown but the server is not
regenerated (e.g. a hot-unplug).

Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-25 15:38:58 +00:00
Chris Wilson 6b20924f22 sna: Convert out-of-bounds sample to CLEAR
If asked to perform pixelformat conversion of a sample that resides
outside the valid area, we can simply substitute CLEAR.

Bugzila: http://bugs.freedesktop.org/show_bug.cgi?id=62681
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-23 23:10:50 +00:00
Chris Wilson f6582387e7 sna: Fix an assertion to check the correct bo
After syncing the GPU bo for use, that's what we should test as well.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-23 10:22:41 +00:00
Chris Wilson 88b6b80c2a sna: Fix assertions that the pixmap points into the CPU bo for fallbacks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-22 13:36:16 +00:00
Chris Wilson ccd6b7e402 sna: Add backlight control implementation
Based on the previous patch by Mark Kettenis <kettenis@openbsd.org>
2013-03-22 11:29:53 +00:00
Mark Kettenis 364e02c799 uxa: Add OpenBSD backlight control implementation
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
2013-03-22 11:27:43 +00:00
Chris Wilson 8d75b2ece1 sna: Fix computation of clip extents for stippling
The clip extents for the stippled BLT missed applying the drawable
offset to the lower-right corner, so inevitably every operation ended up
being clipped.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62618
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-22 09:51:46 +00:00
Chris Wilson 9f8e868003 sna/dri: Disable assertion and associated bookkeeping
Due to long standing ignored bugs in DRI2, we have to accept breakage
in the driver.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62614
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-21 22:54:02 +00:00
Chris Wilson 1aca872ee5 sna: Haswell reintroduces MI_LOAD_SCAN_LINES
Better late than never? Interestingly only available from the BLT ring,
which makes accurate waiting for XVideo (which must use the render ring)
impossible in the current form - we need to render to a temporary then
do a vsynced blit in this case.

References: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1156679
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-19 08:26:01 +00:00
Chris Wilson f132452da1 sna: Ignore vsync waits on tiny scanline ranges
If the update is only a couple of lines tall, any tear will not be
visible - so just ignore programming the wait into the GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-19 07:57:30 +00:00
Chris Wilson 308f0208de sna: Reset operation state between glyphs
We are not resetting sufficient state between operations as we presume
that all callers of Composite() currently pass in a blank state. In the
long run, we want to remove that burden and do a minimal initialisation.

References: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1156387
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-18 15:11:24 +00:00
Chris Wilson 4a37d57f96 sna: Add a pair of sanity checks before creating the redirection target
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-18 15:11:24 +00:00
Chris Wilson 28371a34fa sna: Skip processing an all-clipped-out glyph
Along the slow path, skip all processing of glyphs that are not visible.
This is important as the slow path handles the per-glyph redirection
case, which is much more expensive.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-18 15:11:24 +00:00
Chris Wilson 16dac417c8 sna/dri: Fix stale Pixmap detection
NB the back buffer is not associated with the Drawable and so has no
pixmap field set. Hence comparing the front->pixmap against the
back->pixmap was always rejecting the blit. All we can check is that
front->pixmap corresponds with the current Drawable and so reject stale
configuration.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=47597
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-17 21:56:56 +00:00
Chris Wilson 85213d5d45 sna: Don't remove the flush flag for userptr bo
This flag is far too overload with meaning, but for now this prevents us
attempting to call free() on a SHM segment.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-17 21:42:48 +00:00
Chris Wilson c5b901a635 sna/dri: Clear flush flag upon bo destroy
Fixes sanity checks that we do not leak the flushing status, nor
invoke an operation upon an unflushed bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-16 10:54:51 +00:00
Chris Wilson 45d20e9a65 sna: Add an LLC path for creating snoopable buffers
As with LLC we do not actually need to track snoopable as a separate
cache state.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-14 22:12:56 +00:00
Chris Wilson 94cb10c3f2 sna/gen5+: Add missing float casts in computation of scaled src offsets
Without the casts, the division ends up as 0 rather than the fractional
offset into the texture.

The casts were missed in the claimed fix:

commit 89038ddb96
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Feb 28 14:35:54 2013 +0000

    sna/video: Correct scaling of source offsets

Reported-by: Roman Elshin <roman.elshin@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62343
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-14 22:03:58 +00:00
Chris Wilson dad50881d5 sna: Consider placement hints when choosing userptr read path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-14 15:17:35 +00:00
Chris Wilson 11e2802528 sna: Add handle info to sync DBG
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-14 14:42:25 +00:00
Chris Wilson 20832494be sna: Use userptr downloads for incomplete GPU damaged pixmaps
If the pixmap is not wholly damaged, but still contains the region to be
read, then use userptr (if available).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-14 14:20:15 +00:00
Chris Wilson 92023f39a9 sna: Add a few more assertions to track userptr through the caches
i.e. make sure they don't end up in any caches.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-14 10:12:46 +00:00
Chris Wilson 80401f4fe5 sna/trapezoids: Minimally replace points for TriFan
The realisation dawns that it wasn't the ordering of points within the
triangle, but simply that I was replacing the wrong one.
2013-03-13 11:02:30 +00:00
Chris Wilson 716723d655 sna/trapezoids: Correct ordering of points within TriFran
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-13 10:51:03 +00:00
Chris Wilson 49374f2155 sna/gen4: Tweak compilation flags to avoid mixed settings across functions
Confusing gcc with different flags for supposedly inlined functions is
not a good idea.

References: https://bugs.freedesktop.org/show_bug.cgi?id=62198
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-03-12 20:23:02 +00:00
Aaron Plattner ee0ed88a09 uxa: don't crash when freeing an uninitialized screen
When intel_scrn_create creates a screen, it sets scrn->driverPrivate to
(void *)(match_data | 1).  Normally, this is read by I830PreInit and then
replaced with a pointer to the intel_screen_private structure.  However, it's
possible for the server to delete the screen before initializing it, which leads
to a crash in I830FreeScreen when it tries to interpret the unaligned match_data
pointer as a pointer to a intel_screen_private.

Fix this by checking the low bit of the pointer and skipping the teardown code
if it's set.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2013-03-12 20:20:51 +00:00