Commit Graph

6416 Commits

Author SHA1 Message Date
Chris Wilson ccf0fdd56d sna: Only flush after the BLT operation if we have more than 2 distinct bo
In order to preserve the optimisation of discarding incomplete batches,
we don't always want to immediately submit the batch after inserting the
first command. As we currently only cancel a batch if it only touches
the bo being discarded, we can skip the immediate flush if it only
accesses one bo and maybe be able to use the undo optimisation later.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-09 20:41:51 +01:00
Chris Wilson d935912d9c sna: Free the source reference after performing a BLT composite
Fixes regression from
commit 8751c0f5ad
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jul 5 17:55:10 2013 +0100

    sna: Flush blt copies if no operations pending

Reported-by: Andreas Reis <andreas.reis@gmail.com>
Reported-by: Mike Lothian <mike@fireburn.co.uk>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66742
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-09 20:38:32 +01:00
Chris Wilson b202008f8f sna: Experiment with a new ioctl to create buffers from stolen memory
If there is stolen memory reserved by the BIOS, we want to utilize it in
preference to regular system memory. However, given the caveat that it
is not suitable for CPU access, rules out most use cases - but it is a
good match for framebuffers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-07 09:31:27 +01:00
Chris Wilson dbb585b9d2 sna/gen4: Remove custom max flush vertices w/a from video path
This should now be superseded by using the common w/a.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-07 09:17:58 +01:00
Chris Wilson 2a59eadf81 sna/gen4: Remove the glyph mask hack and tune the flush w/a
Remove the hack from the glyph path to force the use of an auxiliary
channel, and reduce the maximum amount of inflight vertices until we can
then render glyphs with no corruption (at least in my test case).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-07 09:13:49 +01:00
Chris Wilson c9c1833c30 sna/gen4: Tighten FORCE_FLUSH w/a to spot amalgamation of primitives
Inspect whether this rectangle will be added to the previous primitive
and so charge it against the current number of inflight rectangles.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-07 08:58:52 +01:00
Chris Wilson 368c909b29 sna/gen4: Restore the flush-every-vertex w/a
This is an abhorrent workaround for some internal GPU brokenness. A
slight refinement since earlier times is the recognition that 16 is a
magic number limiting the maximum number of inflight rectangles through
the GPU.

References: https://bugs.freedesktop.org/show_bug.cgi?id=55500
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-06 22:54:02 +01:00
Chris Wilson 1fbf47ec1b sna: Tune inplace hints for CPU operations with GPU targets
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-06 22:54:02 +01:00
Chris Wilson 5aaab9ea03 sna: Relax assertion that the source of the cloned pixmap cannot be mapped
I was being overzealous at the time of making the COW and trying to be
sure that we would never write through a mapping. Then I started to
allow clones to be mapped (for reads) and missed relaxing this assertion.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-06 16:03:15 +01:00
Chris Wilson 8751c0f5ad sna: Flush blt copies if no operations pending
More work to try and keep the GPU busy.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-06 16:03:15 +01:00
Chris Wilson f5529ea61b sna: Use a stack allocated PixmapRec for the fbcon copy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-04 21:39:33 +01:00
Chris Wilson ea508c177c sna: Set 1024x768 fb in absence of any connected devices
No actual initial configration magic is required, all we need to do is
set the initial framebuffer size with no connected outputs and leave it
to the core to select CompatOutput() the like.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-04 20:19:20 +01:00
Chris Wilson d36c9542d2 sna: Fix gamma query to not request uninitialized values
Oops, surprising that ebf4517a0b had any positive effect.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-04 10:45:09 +01:00
Chris Wilson 59fa53707e sna: Set the initial gamma from the attached monitor configuration
Fixes a missed configuration option from
commit 8a6a21bff8 [2.21.11]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 26 13:29:48 2013 +0100

    sna: Use the existing configuration for initial modes

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-04 08:54:04 +01:00
Chris Wilson ebf4517a0b sna: Always read back the gamma, even for a inactive CRTC
Even if the CRTC is inactive, we still need to initialise the gamma
tables.

Reported-and-tested-by: Timo Kamph <timo@kamph.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66563
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-03 22:56:41 +01:00
Chris Wilson 4def5ecf6e sna: Tidy up the user override enums
Since we have a second place dependent upon the hidden ordering of the
output options, simplify by copying the complete enum block from
hw/xfree86/modes/xf86Crtc.c

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-03 21:58:16 +01:00
Chris Wilson 5adca344b2 sna: Fix configuration user overrides on xorg-server < 1.14.99.1
Marty Jack found that the enums for the user overrides were off by one
(his xorg conf was no longer being applied). This is because I had
missed the introduction of ZoomModes in 1.14.99 increasing all the
important enum values by one.

Reported-by: Marty Jack <marty19@comcast.net>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-03 21:45:11 +01:00
Chris Wilson 1445a62da8 intel: Add an option for forced rediscovery of output status on startup
Specifying
  Section "Device"
    Option "ReprobeOutputs" "true"
  EndSection
will restore the old behaviour of scanning each output on startup and
picking a spanning mode.

The behaviour was changed in
commit 8a6a21bff8 [2.21.11]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Jun 26 13:29:48 2013 +0100

    sna: Use the existing configuration for initial modes

Please do notify us of any circumstances that force you to use this
flag.

References: https://bugs.freedesktop.org/show_bug.cgi?id=66494
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-03 13:05:49 +01:00
Chris Wilson 2ecff61d36 intel: Retire Option "RelaxedFencing"
The kernel bugs have long since been fixed and should have been
propagated to all stable kernels long ago. Now there should be no need
to workaround those bugs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-03 12:45:10 +01:00
Chris Wilson c957f41717 sna: Try harder to do the BLT upload along the fallback path
Only in the !fallback path will we try using the render pipeline after
the blt, in which case we can try using render rather than forcing a
stall. In the fallback path, we are going to incur stalls and readbacks,
anyway so ignore them when considering blt.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 23:59:02 +01:00
Chris Wilson 158095ff2b sna/gen2: Fix alpha replication in the copy pipeline
When copying into an a8 surface we need to replicate the result into the
green channel. It helps to tell the GPU from where to source the value
to be replicated.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 23:17:32 +01:00
Chris Wilson 2b0d36c638 sna: Assorted DBG
This DBG was useful for narrowing down the issue in the next patch...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 23:16:54 +01:00
Chris Wilson 103672869c sna: Add the condition that 855gm cannot GTT map Y-tiled surfaces
We had the check in a couple of places, but missed a key one that
decided whether or not to perform a GTT mapping of a bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 20:52:23 +01:00
Chris Wilson 9aa665ae33 sna: Only preserve the real fbcon upon first starting X
We only want to preserve the plymouthd splash screen for flicker free
start up, a subsequent regeneration should be cleared instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 15:56:03 +01:00
Chris Wilson 21e29e9526 sna: Simplify validation of active CRTCs
Atter a modeset or KMS takeover, we do a quick readback of the kernel
state in order to verify that it matches our expectations. If we find
that a foreign framebuffer is attached, or no mode if set on the output,
we then turn off that connection and release any resources associated
with that pipe. This patch tries to reduce the number of superfluous
requests to turn off a connection.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 15:44:10 +01:00
Chris Wilson 67a6a4bfd9 sna: Hook into crtc_notify rather than ModeSet
ModeSet is called after updating each CRTC, unlike crtc_notify which is
called after applying all changes. The last is what we need as if we are
called too early we detect that the next CRTC doesn't match our
expectations and so we disable it, right before applying the desired
mode.

References: https://bugs.freedesktop.org/show_bug.cgi?id=66494
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 14:30:17 +01:00
Chris Wilson c361b449cc sna: Include connector status in the initial probe
We cannot simply rely on connector->encoder->crtc status as with the
introduction of Haswell or SDVO we may have multiple connectors using the
same encoder. So we need to explictly check the connector status first,
before determining if the output is connected to an active encoder and
CRTC.

References: https://bugs.freedesktop.org/show_bug.cgi?id=66488
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 10:00:51 +01:00
Chris Wilson 282507af8e intel: Move the validation of the KMS device into the open routine
Currently we leak the fd should we open the device node and decide that
is not a GEM/KMS kernel driver. The simplest way to perform the cleanup
upon failure is to move the checking for GEM/KMS into the device open
routine.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-02 09:38:07 +01:00
Chris Wilson 24a7bec7fa sna: Minor tweaks to make DBG compile again
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 22:51:22 +01:00
Chris Wilson ad0afda3fe sna: Fix checking the dirty boxes
I forgot how insane the data structure for the list of dirty boxes
attached to the damage is. It is neither a simple list, nor does not store
the count of boxes within each chunk.

Fixes regression from
commit 9026bb9546 [2.21.11]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jun 28 15:59:17 2013 +0100

    sna: Inspect the dirty boxes when querying whether damage contains a rectangle

A side effect is that we now make sure that there is an upper bound to
the amount of searching we do for the no-reduce fast path.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66430
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 22:51:22 +01:00
Chris Wilson 1c8a33a72e sna: Allow scanouts to be untiled if need be
Fixes regression from
commit 77fa8ab08b [2.21.11]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jun 25 22:25:25 2013 +0100

    sna: Free just-allocated bo if we fail to set-tiling on CREATE_EXACT

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:11:03 +01:00
Chris Wilson 9cb6756ce1 sna: Always create the clear Picture
As we unconditionally use it irrespective of whether we then call
accelerated code paths or not.

Fixes regression from
commit dc18eaa585 [2.20.10]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Sun Aug 12 10:34:10 2012 +0100

    sna: Make the failure to create render caches non-fatal

in the event we need to start with a hung GPU.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:10:07 +01:00
Chris Wilson c6c6ae71be sna: Make sure we are consistent in applying USE_INPLACE debug option
A few new paths were missing the debug check, and clarify a few indirect
uses by performing the explicit check.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:07:23 +01:00
Chris Wilson cce2351056 sna: Debug options for forcing mmap syncs
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:07:23 +01:00
Chris Wilson 7aff6beb37 sna: Improve the message about where to find the hang state
Search the few canonical locations for our hang state so that we can be
more explicit to the user about what to include.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:07:23 +01:00
Chris Wilson e0e84e6686 sna: Mark an inplace getimage as preferring the CPU mapping afterwards
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:05:17 +01:00
Chris Wilson e648c1f39c sna: Assert that we do not have overlapping damage
Double check that the results of the box query match with the slow
queries.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:05:17 +01:00
Chris Wilson 7c6cc0c9ed sna: Check whether the query box is contained within the damage
We can improve our query for whether the rectangle of interest is within
the damage by checking whether the damage extents contains the entire
box rather than just checking for an overlap.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:05:17 +01:00
Chris Wilson 64cb923588 sna: Experiment with cpu mappings for migration
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 18:05:17 +01:00
Chris Wilson 12c013d25e sna: Do not use userptr for GetImage on unsupported architectures
If the system cannot blt to a CPU buffer, we should even attempt to do
so for GetImage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-01 13:28:57 +01:00
Chris Wilson 5005bd2d52 intel: Fix failure code for reporting !drmCheckModesetingSupported
The new function returns the fd, not a Bool, so the error code must now
be -1.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-30 15:02:19 +01:00
Jonathan Gray f8738d7b4c intel: replace direct ioctl use with drm{Set, Drop}Master
Use drmSetMaster/drmDropMaster instead of calling the ioctls
directly.  Fixes compilation on OpenBSD where these ioctls
aren't defined.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2013-06-30 11:32:24 +01:00
Chris Wilson 40301e6d03 sna: Store the path used to open the device and pass to DRI
Avoid having to search the device tree once again in order to simply
recover the path we used to open the device.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-30 11:32:24 +01:00
Chris Wilson 17da58f904 sna: Replace conflicting drmDropMaster
Calling drmDropMaster twice along the CloseScreen path is not a good
idea.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-30 11:32:24 +01:00
Chris Wilson 3a787da7e8 sna: Allow tiled memcpy on i386
With the split into per-swizzle functions, and with the forced
optimisation levels, it appears that i386 doesn't suffer so badly and
the tiled memcpy are a viable method.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 21:57:20 +01:00
Chris Wilson 1d9941a7c0 sna: Add the Ofast option to the critical memcpy routines
Always enable gcc to fully optimize the core memcpy routines (provided
that optimisations are not entirely disabled, for instance for
debugging).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 21:56:13 +01:00
Chris Wilson 84c190db33 sna: Fix get_image_inplace to use the pixmap offset
The inplace routine assumed that the region to be read was already in
pixmap coordinates. Making it so makes the code easier, so do it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 19:37:51 +01:00
Chris Wilson c7d246ba6f sna: Move the clone discard into free-gpu
Rather than peppering the discard manually before the call to free the
GPU bo, always discard the COW when we actually free the GPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 16:50:54 +01:00
Chris Wilson 6ab2a3acf7 sna: Improve checks for coherent access through CPU mappings
Refactor the CPU mapping tests to a single function, and remember to
test for a pending GPU write (i.e. bo->exec).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 16:08:30 +01:00
Chris Wilson 9026bb9546 sna: Inspect the dirty boxes when querying whether damage contains a rectangle
This helps in the cases where we have subtracted a small number of
rectangles from an all-damage pixmap (such as a number of successive
GetImage, PutImage operations). The danger is that we end up searching a
long list of dirty boxes - maybe just search the first chunk if that
becomes noticeable?

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-29 16:08:30 +01:00