Commit Graph

7340 Commits

Author SHA1 Message Date
Chris Wilson 951f969fa6 sna: Update DPMS on attached outputs before disabling the CRTC
We may want to take action such as preserving the current user value of
the backlight before disabling it whilst forcing a CRTC off. This
requires us to record that value first.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-13 12:47:20 +01:00
Chris Wilson 8e7d6ddb9b sna: Cleanup allocation of sna_output after late syscall fail
If the second syscall fails (presumably as a deferred allocation failure
check), cleanup the allocations made so far before reporting the
failure.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-13 11:04:02 +01:00
Chris Wilson f9a18c9f38 uxa: Check for allocation failure in i915 video
For a large screen, we have to create a temporary surface for rendering
the textured video. If this pixmap creation fails we may be left with a
system memory only pixmap leading to a segfault.

Reported-by: Bas Wijnen <wijnen@debian.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-13 10:40:21 +01:00
Chris Wilson 978b93a20b uxa: Abort CreateScreenResources after allocation failure
One of UXA's invarients is that the ScreenPixmap is complete (i.e. has
an intel_pixmap private with a bo attached). If we fail to create that
private during CreateScreenResources we will die very soon afterwards,
so just report the failure and shutdown gracefully.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-13 10:40:21 +01:00
Chris Wilson e914dada55 configure: Allow manual specification of intel-gen4asm path
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-11 10:51:35 +01:00
Chris Wilson 3e3af6936e sna: Populate bo->size from dma-buf
Recent kernels gained the ability to report the actual size of the
dma-buf through an lseek. We can use this to set the correct size of the
bo when available, overriding the guess provided by the caller.

Suggested-by: Kristian Høgsberg <krh@bitplanet.net>
Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-10 22:19:44 +01:00
Chris Wilson f0bd716425 sna: Sanitize output->crtc before falling back oto xf86InitialConfiguration
During initialisation, we stash the currently attached CRTC id in
output->crtc. This is fine as ordinarily we would not dereference
output->crtc until after it had been assigned a real CRTC. However,

commit 6fda305e2f
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Oct 9 15:59:42 2013 +0100

    sna: Append the current mode to the output list if not found

introduces such an early dereference and causes a crash if we fail to
probe the KMS configuration (usually due to a user override).

Reported-by: Łukasz Maśko <ed@yen.ipipan.waw.pl>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-10 16:27:22 +01:00
Daniel Martin 700a845cc6 configure: Add xfixes to X11 pkg check
Add xfixes to the list of PKG_CHECK_MODULES for X11. '-lXfixes' was
hardcoded in test/Makefile.am before. This could lead to a broken build
in very rare cases where the build environment has all specified X
libraries but Xfixes.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
2013-10-10 14:36:37 +01:00
Chris Wilson 79f8ff4bbb sna/gen4+: Share a few common routines
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-10 13:24:46 +01:00
Chris Wilson 8bd9d63a86 sna/gen6+: Share the common routines for ring preferrence
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-10 13:24:46 +01:00
Chris Wilson ddcd860702 sna/gen6+: Only allow switching to BLT for fills if we have semaphores
An extra caveat to these generations for

commit 97d809c26b
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Oct 10 00:15:55 2013 +0100

    sna: Pass usage hint down to render fill routines

is that we don't want to incur ring switch overheads that may overwhelm
any advantages from using the BLT.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-10 12:19:20 +01:00
Chris Wilson c99d44d7f0 sna: Prevent changes in tiling/pitch of existing framebuffers
Reported-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-10 08:32:51 +01:00
Chris Wilson 97d809c26b sna: Pass usage hint down to render fill routines
For the scanlines emitted for rendering Core drawing primitives, it is
preferable to use the BLT engine, so pass those hints down.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-10 00:16:58 +01:00
Chris Wilson b16999da21 sna: Upon unwinding operations, also check for exec objects to clear
If we cancel an operation after partially committing it, we may leave
the batch bookkeeping in an inconsistent state with an exec object with
a zero-length batch. Ordinarily, this would not be an issue as we could
pass the extra object to the next batch. However, if we switch rings, we
need to clear the extra objects as they are currently flagged as being
on the wrong ring, leading to hilarity.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-10 00:00:46 +01:00
Chris Wilson b9ad5b625e 2.99.904 snapshot 2013-10-09 17:18:43 +01:00
Chris Wilson d1aa2ac5dd sna: Steal the current mode name
Rather than duplicating a string, we can simply transfer ownership from
the temporary mode to the mode list.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-09 16:22:59 +01:00
Chris Wilson 6fda305e2f sna: Append the current mode to the output list if not found
If for some reason the current mode on the CRTC (inherited most likely
from fastboot) doesn't match any of the modes reported by the output, we
end up with a stray mode that the client cannot control.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70132
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-09 16:10:17 +01:00
Chris Wilson d1cb39d0a8 sna/gen3+: Flush vertex buffer after computing resize
Upon aligning the buffer, we may enlarge the vbo to accomodate the
vertex alignment and push the current index past the end of the buffer.
Move the space check from before the alignment computation to
afterwards.

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-10-09 11:15:24 +01:00
Chris Wilson 38333443b8 sna: Emit DBG for when we fallback to xf86InitialConfig detection
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-08 16:12:06 +01:00
Chris Wilson 082c08789c sna: Rework the num_threads refinement to avoid the division
We can replace the division by a multiplication.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-08 09:40:34 +01:00
Chris Wilson 06a8ad9690 sna/trapezoids: Recompute num_threads to match range
We need to be careful not to execute threads past the end of the alloted
buffer by making sure the clip extents correctly align.

Reported-by: Joseph Yasi <joe.yasi@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70204
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-08 00:04:54 +01:00
Chris Wilson 1fb4f60671 sna: Trim color cache allocation to a single page
Instead trying to allocate 4100 bytes, fix the logic to only require a
maximum of 4096 bytes in the cache buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-07 22:06:32 +01:00
Chris Wilson 55cd67485f sna/trapezoids: Only use a single thread to emit rectilinear spans
If the trapezoids are rectilinear, they should hit a fast path through
the span compositors and so threading them seems pointless. Expect
possibily for inplace pixman operations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-07 21:39:43 +01:00
Chris Wilson 55e0f45026 sna/gen7: Rename debug option ALWAYS_FLUSH to ALWAYS_INVALIDATE
This allows us to distinguish between the texture cache invalidation
stage versus the opportunistic flushing, and test either.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-07 11:56:23 +01:00
Chris Wilson eda8725493 sna/gen7: Tweak flushing
We pre-emptively flush the render cache before reads as that seems to
improve performance. Now try not flushing if we don't subsequently need
to read from the render cache.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-07 11:54:59 +01:00
Chris Wilson 1c651848cc sna/trapezoids: Restore overflow check
The range can indeed overflow, so promote the assertion back into a
check.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-07 10:30:20 +01:00
Chris Wilson d462475b7e sna/trapezoids: Fix overstepping vertical edges
Regression from

commit c98b770a87
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Oct 4 18:37:01 2013 +0100

    sna/trapezoids: Add a precise scan converter

Reported-by: Joseph Yasi <joe.yasi@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70204
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-07 10:07:40 +01:00
Chris Wilson c3fe60c157 sna/gen7: Add a always-stall debug option
References: https://bugs.freedesktop.org/show_bug.cgi?id=68410
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-06 17:27:22 +01:00
Chris Wilson 7284e7f48b intel: Filter out the control bit from the device minor
When computing the render node for the device, filter out the potential
control node.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-05 23:00:49 +01:00
Chris Wilson 524a45da56 compat-api: Map changes of DamageUnregister API in 1.14.99.2
Reported-by: Emmanuel Benisty <benisty.e@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-05 19:00:32 +01:00
Chris Wilson 43d616066f sna/trapezoids: Do not pass invalid trapezoids to pixman
Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/1197921
Link: http://lists.x.org/archives/xorg-devel/2013-October/037996.html
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-05 18:52:56 +01:00
Chris Wilson c98b770a87 sna/trapezoids: Add a precise scan converter
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-05 18:52:56 +01:00
Chris Wilson 27ad2fc1dc sna: Start splitting the trapezoids megafile into parseable blocks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 21:57:26 +01:00
Chris Wilson 898087014c sna: Fix FillRectangles intersection with complex clip
Lesson 2: Use the right variables.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70137
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 16:28:29 +01:00
Chris Wilson 20afd7263f sna: Tidy up FillRectangles intersection with complex clip
Lesson 1: do not accidentally overwrite the loop count inside the loop.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70137
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 16:15:04 +01:00
Chris Wilson 22557b88d3 sna/dri: Only move the scanout to the flip cache if destroyed
Under certain circumstances, we can retire the pageflip before the
client has updated its back buffers. This leads us to pre-emptively
moving the scanout to the cache, when all we need to do (and will do) is
report the same back buffer back to the client.

Reported-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 14:15:53 +01:00
Chris Wilson 394b2ce51d sna: Add a few more DBG to track refcnts
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 14:13:50 +01:00
Chris Wilson dbf98d8963 sna/gen5: Replace pipe-control with full MI_FLUSH for required CS stall
It appears that we need top-of-pipe synchronisation for changing of
certain state, and that the gen5 pipecontrol instruction is
insufficient. So we have to fall back on the good old MI_FLUSH in order
to make sure that the GPU invalidates its state correctly.

Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51422
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 09:36:49 +01:00
Chris Wilson aa439ffee4 sna: The device fd is marked as non-blocking so beware the busy-wait
During redisplay we wait for the pageflip result. If the fd is marked as
non-blocking this results in a busy-wait, so insert a poll first to
remove the busy-wait.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 09:07:30 +01:00
Chris Wilson be17746549 intel-virtual-overlay: Error out if no X11 SHM header is defined
Make the error explicit rather than dieing later with unknown constants.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 08:40:49 +01:00
Chris Wilson b8aed26619 configure: Disable building tools if prerequisite headers not found
After the pkg-config checks, we then probe the headers. If those probes
fail, we obviously wish to prevent building the tools as the build will
fail.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-04 08:37:48 +01:00
Chris Wilson a0476ee6d0 intel: Allow opening the device only through platform information
Only fail to open the device based on the PCI address, if and only if we
do not have sufficient platform information to find the correct system
device.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 16:15:22 +01:00
Chris Wilson a47f8683fe intel: Handle fallback probing without match_data
One extreme fallback path through the xf86PlatformProbe results in a
call without any match data. As we have a device by this point, we can
simply do a reverse match.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 16:15:22 +01:00
Chris Wilson 6c157a925f intel: Remove dependence upon having PciInfo
After some probing mechanisms, we may end up with a valid device without
knowing its PCI address a priori. Having a valid device, we can just
query it for the correct device id, and can safely abort any path that
requires PCI information that we don't have. (Those paths are not valid
under such hosting anyway - if it may be required, we could reconstruct
the address.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 16:13:38 +01:00
Chris Wilson 4685e79d11 intel: And restore PlatformProbe to working order
In the saga of the untested WIP patches for hosted device probing, was
the failure in logic to detect a valid device during probing. Yikes.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 14:42:45 +01:00
Chris Wilson 58b26055f4 intel: Querying device attributes must be non-NULL
Check first for a NULL platform device before querying the attributes or
else suffer a segfault during PCI probing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 14:09:26 +01:00
Chris Wilson b7d5292e01 intel: Fix fallout from accident push of ODEV_ATTRIB_FD
This is WIP for passing along a hosted fd. It wasn't meant to be pushed
along with the bug fix this morning.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 13:38:06 +01:00
Chris Wilson adbf01306a sna: Restart timer evaluations if the BlockHandler takes too long
Rather than passing a negative timeout to select, if we detect that we
expired our timeout during the processing of the BlockHandler, restart.

More worrying is that something in the BlockHandler took longer than 3ms
to process.

Reported-by: Felipe Contreras <felipe.contreras@gmail.com>
Link: http://article.gmane.org/gmane.comp.freedesktop.xorg.devel/37388
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-03 08:30:48 +01:00
Chris Wilson 3b3a5ca603 intel: Query platform fd
Under a compositor, we wish to use the pre-authorized fd passed to us by
the host, stashed away in the platform device.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-02 18:29:38 +01:00
Chris Wilson 7978592048 intel: Pass the platform device along to the open routines
This allows us to pass along more metadata along with the platform
device in future. Currently we pass the device path, but in a hosted
environment we should be passing along the authorized fd from the host.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-10-02 18:24:47 +01:00