Commit Graph

8534 Commits

Author SHA1 Message Date
Chris Wilson 12fc668794 sna/gen8: Update DBG output of surface offset
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-19 11:00:39 +01:00
Chris Wilson 5ddd106e8f uxa/glamor: Silence compiler warnings
Mark the stub intel_glamor_fd_from_pixmap() as inline to silence the
compiler warnings about unused function definitions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-18 10:34:36 +01:00
Chris Wilson 2a4855a633 sna: Constify argument to box_from_seg()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-16 20:26:28 +01:00
Chris Wilson 1cc9762b08 uxa: Fix conversion of Segments into Rectangles
The trick is to make sure we consider the CapLast setting in the
direction the line is being drawn and adjust the inked pixels
accordingly.

Testcase: DrawSegments/hv0
Reported-by: Russell King
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-16 12:37:23 +01:00
Chris Wilson db157b42aa test: Add DrawSegments
Compare fb/ddx for many DrawSegments operations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-16 12:10:57 +01:00
Chris Wilson e453f276da sna/io: Initialise return code to catch early segfaults
In case we are ever given an invalid buffer that we then attempt to read
past the end.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-15 12:08:59 +01:00
Chris Wilson d470f0f520 sna: Last ditch attempt to make extra large batches fit
If we have unfortunate fragmentation, e.g. a cursor is pinned in the
middle of an aperture, we can struggle to fit large objects, especially
fenced objects on gen2/gen3. We do have one last trick up our sleeves
that we can try: disable all of the outputs and cursors and try
submitting the batch in as pristine an aperture as we can arrange. We
can only hope that the subsequent restoration of the outputs is more
conducive to future batches (and so not lead us into continual flicker).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-15 11:41:38 +01:00
Chris Wilson 435fe185e3 sna: Update the list of outputs after a failed modeset
In case we have a hotplug at just the wrong time, we can fail a modeset
with a stale connector. Before attempting to recover, probe the kernel
for the current state.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-15 09:09:19 +01:00
Chris Wilson 067115a51b uxa: Stub out intel_sync_init|fini when not compiled in
In order to fix the build without DRI3, we need to stub out the
functions not compiled in, such as intel_sync_fini().

Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-15 08:46:46 +01:00
Chris Wilson 0d451ee389 configure: Require the presence of xorg/glamor.h for --enable-glamor
Check that we have the required Xorg headers for glamor if the user
requests --enable-glamor. There is a possiblity that the headers
mismatch as they don't have internal versioning, but this should catch
the majority of errors early on.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-15 08:46:46 +01:00
Keith Packard 1144461945 glamor: Do version check for fd <-> pixmap functions
glamor_pixmap_from_fd and glamor_fd_from_pixmap were added before
version 1.15.99.902, so check for that version before trying to use them.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Fabio Pedretti <fabio.ped@libero.it>
2014-09-13 10:53:02 -07:00
Keith Packard 48f6406a62 Use intel_uxa.h in all uxa-specific files
Instead of always including intel_uxa.h from intel.h, and including
uxa.h from some files directly, use intel_uxa.h directly from .c files
that have UXA-specific code in them.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:51:16 -07:00
Keith Packard 8b59a88c23 intel_present.c does not need to include uxa.h
There aren't any symbols from uxa.h used in this file, remove the #include.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:51:16 -07:00
Keith Packard d83b30b704 Move some UXA-specific code under #if USE_UXA.
This makes the UXA-specific elements of intel_screen_private and a bit
of code in intel_driver covered under #if USE_UXA

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:51:16 -07:00
Keith Packard e3c06746c7 Move UXA hardware initialization into intel_uxa_init
Pull this uxa-specific step out of I830ScreenInit

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:51:16 -07:00
Keith Packard 876185ccee Add intel_flush to abstract flushing pending acceleration operations
intel_flush flushes any pending acceleration operations to the
hardware, just like intel_uxa_batch_submit does today except that it is
not uxa-specific.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:51:16 -07:00
Keith Packard 616dea2c67 Rename uxa-specific functions and structs
This starts to separate uxa from the rest of the driver by renaming
uxa-specific functions and structs to make it clear which portions of
the driver are uxa-specific and which are common.

Signed-off-by: Keith Packard <keithp@keithp.com>
Acked-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:51:14 -07:00
Keith Packard 57c67199d0 Move intel_alloc_framebuffer to intel_memory.c
UXA and Glamor both share this function, so move it out of the UXA file.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:50:37 -07:00
Keith Packard ff67a8d885 Do more checks for proposed flip pixmaps
Make sure the pitch matches the current framebuffer.
Make sure there's a BO we can get at.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:50:37 -07:00
Keith Packard 61305740ef Eliminate pixmap private 'stride' field, which duplicates devKind
The pixmap private stride field is an exact duplicate of the devKind
field present in the core pixmap; eliminate the duplicate value and
replace references by calls to intel_pixmap_pitch.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:50:36 -07:00
Keith Packard 1ac76b47b3 Don't use GetScratchPixmapHeader for shadow pixmaps
GetScratchPixmapHeader should only be used for local memory pixmaps,
as used by PutImage and friends. That's because when you free the
scratch pixmap header, it doesn't actually free the pixmap; instead,
it gets stuffed in pScreen->pScratchPixmap and any private data stored
on it will be left hanging around forever.

In the case of glamor, that private data includes all of the GL
state. Using that scratch pixmap later results in glamor getting
mightily confused as the pixmap and underlying objects do not match.

Avoid this by allocating pixmap headers explicitly for this purpose.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:50:36 -07:00
Keith Packard 4f5a568397 Declare variable holding option value as 'const char *'
This matches the type of xf86GetOptValString.

Signed-off-by: Keith Packard <keithp@keithp.com>
2014-09-12 13:50:36 -07:00
Keith Packard 4e77993e99 Remove redundant calls to drm_intel_bo_disable_reuse
intel_allocate_framebuffer has already made the call in each of these
code paths.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:50:36 -07:00
Keith Packard c2f214fb54 Fix present debug output
Was using 'low_msc', which isn't defined anymore.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:50:36 -07:00
Keith Packard 9ca7b8771c glamor: Add DRI3 support to glamor code paths
This creates wrappers to invoke glamor functions for pixmap_from_fd
and fd_from_pixmap when the driver is using glamor.

Signed-off-by: Keith Packard <keithp@keithp.com>
2014-09-12 13:50:33 -07:00
Keith Packard fa6f6839dc Correct BO allocation alignment
BO allocations for pixmaps must be aligned to the tile height, but at
some point the code was changed to align them to twice the tile
height. This overallocates pixmaps, wasting memory, but more
importantly, for buffers allocated by DRM and shared through DRI3, the
stricter alignment check causes sharing to fail.

From reading through the history of the code and related bugs, it
seems like this change was part of a set of changes trying to address
what turned out to be a kernel regression. Reverting this change
solves the DRI3 problem and saves a bit of memory for pixmap
allocations.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
2014-09-12 13:49:23 -07:00
Keith Packard c2a8346891 Do not clear pending kernel events on mode switch
Let the kernel send these back to us so that DIX hears about them in
the usual way.

Mode setting while Present has a flip active will trigger an unflip
before the mode is changed. The event from that unflip will not get
processed before the mode switch is executed. Clearing the driver
queue at mode switch time will discard the connection between the
kernel event and the present callback so that DIX will never know that
the flip pixmap is idle.

Signed-off-by: Keith Packard <keithp@keithp.com>
Tested-by: Kenneth Graunke <kenneth@whitecape.org>
2014-09-12 13:49:23 -07:00
Chris Wilson 7ed66ca0fd sna: Remvoe unused code
sna_trapezoids_precise.c:566:1: warning: unused function
'polygon_add_line' [-Wunused-function]

gen4_vertex.c:3093:1: warning: unused function
'gen4_choose_spans_vertex_buffer' [-Wunused-function]

Reported-by: Zdenek Kabelac <zkabelac@redhat.com
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12 21:17:04 +01:00
Chris Wilson f0d5dbe9bf sna: Fix include guard
./xassert.h:24:9: warning: '__XASSERT_H___' is used as a header guard
here, followed by #define of a different macro [-Wheader-guard]
        ^~~~~~~~~~~~~~
./xassert.h:25:9: note: '__XASSERT_H__' is defined here; did you mean
'__XASSERT_H___'?
        ^~~~~~~~~~~~~
        __XASSERT_H___

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12 21:16:12 +01:00
Chris Wilson 7548f77fff intel-virtual-output: Initialise width/height for a disabled output
virtual.c:1081:6: warning: variable 'width' is used uninitialized
whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (clone->dst.mode.id == 0) {
            ^~~~~~~~~~~~~~~~~~~~~~~
virtual.c:1092:6: note: uninitialized use occurs here
        if (width == clone->width && height == clone->height)
            ^~~~~
virtual.c:1081:2: note: remove the 'if' if its condition is always false
        if (clone->dst.mode.id == 0) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual.c:1079:11: note: initialize the variable 'width' to silence this warning
        int width, height;

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12 21:15:18 +01:00
Chris Wilson a5a51b55ec sna: Mark the CRTC as disabled when hiding the plane
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12 16:57:16 +01:00
Chris Wilson 5ce4b344e4 sna: Avoid stalls when promoting to the GPU before an operation
In particular, the promotion of an active snooped bo into an uncached
linear GPU bo was being performed on a busy buffer and forcing a stall.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12 16:57:16 +01:00
Chris Wilson fc4bc3cde9 sna: Initialise remaining batch space
Another missed gcc warning resulting in a crash due to a missing
kgem_batch_space() initialisation.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12 16:11:25 +01:00
Chris Wilson 9fb399aee9 sna/blt: Fix computation of remainaing boxes on gen8+
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12 08:24:06 +01:00
Chris Wilson e3edf29484 sna: DBG compile fix
Dereference the right output for the name in the new backlight
functions.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12 07:53:12 +01:00
Chris Wilson 1aefd16964 sna: Use default monitor options on the first output
commit 6554cf0a69
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Aug 11 12:22:17 2014 +0100

    sna: Parse output options early during initialisation

rearranged the monitor query to before the num_outputs increment. The
result was that it choose the second output as the default and not the
intended first.

Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=522500
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-12 07:46:43 +01:00
Chris Wilson 9e397830f5 sna/gen8: Re-enable userptr
Current testing says that it is stable now... Let's see how long that
holds.

References: https://bugs.freedesktop.org/show_bug.cgi?id=79053
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-11 17:03:39 +01:00
Chris Wilson 797369449b sna: Do not mark the pixmap as cleared in the middle of a miSpans decomposition
As the miSpans will continue to overdraw the Pixmap, it's final state
will no longer be that clear value. We need to be much more careful when
allowing that optimisation.

Reported-by: Tyler Foo <tftylerfoo@gmail.com>
References: https://bugs.freedesktop.org/show_bug.cgi?id=77074
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-11 09:37:11 +01:00
Chris Wilson fda1ffb07e sna: Request the backlight to be disabled along with DPMS off
When we turn off the screen, either at the user request or when
disabling an output, request that the associated backlight (which may
only be known to userspace) also be disabled.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-11 08:11:34 +01:00
Chris Wilson 08921e4bda backlight: Expose interface to switch backlight on/off entirely
A feature in recent kernels is to disambiguate between the meaning of
brightness=0, between disabling the the backlight entirely or setting
the lowest valid brightness. As such, we now have an extra knob in sysfs
to explicitly request that the backlight be turned off.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-11 08:09:39 +01:00
Chris Wilson f2b62ab38f sna: Prune damage that covers the entire target Pixmap
Reduce it early and mark it complete.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-10 16:55:14 +01:00
Chris Wilson 9b25eeee85 sna: Do apply damage twice for miSpans.PolyFillRect
As the caller will apply the damage afterwards, we do not need to do the
accumulation in the miSpans callbacks and it presumes that its damage is
unaltered.

References: https://bugs.freedesktop.org/show_bug.cgi?id=77074
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-10 16:37:16 +01:00
Chris Wilson 224af800f6 sna: Emit assertions with FatalError
The intention is to be able to capture the assertion in the Xorg.0.log
(journald equivalent). At the moment, it is emitted to stderr which is
difficult to capture and defeats the goal of only asking the reporter to
upload one log file.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-10 11:58:11 +01:00
Chris Wilson 0d1df4762f sna: Relax early failure to set KMS modes
Under the new world order, we may not have KMS rights until we are given
a VT.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-10 08:37:02 +01:00
Chris Wilson f39e1d19c1 sna: Fix use of GETBLOB ioctl for grabbing the MST path
Unlike the other drm getters, GETBLOB insists on the exact length rather
than being told the buffer size.

Reported-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-10 07:17:18 +01:00
Chris Wilson 07fe45b84b sna/glyphs: Prevent NULL vfunc deref with glyphs
Requires running a PRIME setup with Intel loaded as the secondary GPU
and attempting to execute an empty glyph string.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-09 08:12:45 +01:00
Chris Wilson faf0bdd477 sna: Add some DBG spam for BLT boxes
References: https://bugs.freedesktop.org/show_bug.cgi?id=77074
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-09 07:36:40 +01:00
Chris Wilson e0f7e9fc2f sna: Initialise and check for batch space
commit 30932a7b9d
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Sep 8 12:41:06 2014 +0100

    sna: Avoid u16 underflow when computing reserved batch space

relied on gcc a little to much to warn me when I missed initialising 'rem'

References: https://bugs.freedesktop.org/show_bug.cgi?id=77074
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-08 16:49:29 +01:00
Chris Wilson 30932a7b9d sna: Avoid u16 underflow when computing reserved batch space
If we filled the batch exactly, then subtract -1 for the reserved
BATCH_BUFFER_END, it would underflow to a large value - convincing us
that we had sufficient room to stuff many, many more commands in.

However, all the callsites should be guarded by checking already that
they had sufficient space to emit at least one operation...

References: https://bugs.freedesktop.org/show_bug.cgi?id=77074
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-09-08 12:50:29 +01:00
Chris Wilson 692c14d405 2.99.916 snapshot 2014-09-08 08:53:32 +01:00