Commit Graph

3154 Commits

Author SHA1 Message Date
Chris Wilson 00e8b4bec6 sna/dri: For offscreen, swaps just exchange the buffers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-11 09:00:16 +01:00
Chris Wilson e9397b28ef sna: Process dri wakeups first
The goal is to minimise the latency in receiving the event from the
kernel and acting upon it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-11 08:54:04 +01:00
Chris Wilson bcad5b21fe sna: Unbreak configure after last commit
I went a step too far... I still need some define in order to switch
between uxa/sna at compile time.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 21:29:59 +01:00
Chris Wilson d0d65940b4 sna: Remove the ability to disable chipset specific code
This was a fun little, but pointless, exercise.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 19:51:12 +01:00
Chris Wilson 6f035e80b9 sna/dri: Keep reference on swap buffers until the end of the pageflip
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 19:44:24 +01:00
Chris Wilson cf6c790182 sna: Use the ScreenPixmap->serialNumber as a generation count
DRI2 presumes that the pixmap->serialNumber can be used as unique id.
If it changes revokes *all* the buffers, it presumes a new pixmap has
been attached to the window, for example after a reconfiguration event
(resizing of a window, or a mode switch). However, as we updated the
root pixmap upon a pageflip, we were triggering revocations everytime,
causing further revocations and massive aperture thrashing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 19:41:16 +01:00
Chris Wilson 3f19270d67 sna/dri: Actually restrict pageflipping to properly aligned fs windows
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 19:12:58 +01:00
Chris Wilson 9e9c628708 sna/dri: Create pixmap suitable for the framebuffer for fullscreen buffers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 19:12:58 +01:00
Chris Wilson b22de0b014 sna/blt: Suppress overwriting boxes through fill_boxes()
As the introduction of the unrolled fill_boxes() was bypassing the
effective optimisation in fill_one().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 19:12:58 +01:00
Chris Wilson ebeebc2044 sna: Use temporary for storing the current crtc box when computing best crtc
... as the caller may be reusing an input parameter for the result.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 19:12:58 +01:00
Chris Wilson b3949d0d74 sna/kgem: remove erroneous assert during submit
This was only valid for gen6+ with the multiple rings.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 19:12:58 +01:00
Chris Wilson 33abb68da2 sna/kgem: remove redundant clears upon initialisation
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 19:12:58 +01:00
Chris Wilson cfde920a2e sna: Remember to decouple the fb on closing
... so that we actually attach a new one after regen!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 11:29:06 +01:00
Chris Wilson b6192ce95a sna/gen4: Tweak calculation of required batch space for CA
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 11:05:41 +01:00
Chris Wilson c9b89fc87f sna: Drain the event queues before CloseScreen
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 10:53:29 +01:00
Chris Wilson ea560e25df sna: Workaround the random free of the ScreenPixmap in fbCloseScreen
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 10:53:23 +01:00
Chris Wilson 1f364c6d24 sna: Reset the kgem state on server regen
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 10:37:37 +01:00
Chris Wilson 95ae39a934 sna: Add some debug statements to the core DDX interface
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 09:57:22 +01:00
Chris Wilson 0594724dc4 sna/gen4: Restore normal state after CA pass and FLUSH_EVERY_VERTEX
By working around the broken shaders, we emitted the CA rectangle in the
middle of a sequence of glyphs and left the state setup for CA. So we
need to reset the pipeline state at the start of every composite blt.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 08:24:27 +01:00
Chris Wilson 2dff681efe sna/blt: Remove a couple of unused members from its op-state
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 08:24:27 +01:00
Chris Wilson fbbd1c9dde sna/glyphs: Fix glyphs to dst fallback path 2011-06-10 08:24:27 +01:00
Chris Wilson 3f46c34d53 sna/composite: Tweak setup for the minimal composite extents
Clip the operation extents before passing to the backend to setup the
operation, so that we only need to upload the minimum amount of data
necessary, or avoid tiling etc.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 08:24:27 +01:00
Chris Wilson a34caf1e3d sna/gradient: Check solid busy status not current domain
We can write into the bo if it has no outstanding requests, whereas we
were checking to see it was last on the gpu instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-10 08:17:26 +01:00
Chris Wilson 1638a0a6c0 sna/dri: Add a comment to warn about a potential race between DRI clients
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 16:00:30 +01:00
Chris Wilson 4b54c89fbd sna: Place the pixmap on the DRI dirty list after damaging the shadow copy
In order that we remember to flush the contents back to the GPU
before we wake up the DRI clients, we need to add those dirty
pixmaps to the flushing list. I caught the obvious place, the
central move-to-cpu, but I missed a couple of paths were we
optimise the copy onto the shadow.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 15:53:11 +01:00
Chris Wilson 190a678656 sna: Periodically reduce the gpu damage (after migrating any cpu damage)
This will prevent the gpu damage list from growing unbounded.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 15:13:17 +01:00
Chris Wilson 38d084ee62 sna: Move !kgem->wedged check down into kgem_can_create_2d
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 14:54:12 +01:00
Chris Wilson d1a3bb1467 sna: Prefer inactive buffers when creating a bo for a dirty pixmap
As we will immediately attempt to replace it with an inactive when
moving the data to the GPU, short-circuit that replacement.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 14:51:49 +01:00
Chris Wilson 8ee53cc744 sna: Debugging compile fix
Still not enough coffee this morning.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 13:05:19 +01:00
Chris Wilson 6f59d7d190 sna: Use --enable-debug=full to enable extremely verbose debugging
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 12:59:59 +01:00
Chris Wilson 021209d5d3 sna: Remove the stubs from sna_render.c
These only existed to work around an include order problem, when kgem
was intended to be entirely separable from sna. Moving the function
pointer into kgem simplifies matters.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 10:32:48 +01:00
Chris Wilson 6141b1aea1 sna: Warn after detecting a hung GPU
...and include the instructional error message from uxa.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 10:12:08 +01:00
Chris Wilson 1786d2ee03 sna/accel: Add debug messages for falling back due to a wedged GPU
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 09:48:57 +01:00
Chris Wilson 4d509d501b sna: Tweak retiring old bo
As we check for retirement everytime we wakeup, it is seldom useful to
check again until we know we have invoked an operation that may block.
But when we do check, we do not want to scan the entire active list
looking for flushing candidates, so track those on a separate list.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 09:45:13 +01:00
Chris Wilson 17be5e2eb4 sna: Reduce the frequency of the timer interrupts
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-09 00:38:29 +01:00
Chris Wilson d0b09f1024 sna: Make the device fd non-blocking
So that we can simply query it from each of the Zaphod instances without
blocking. Requires a fixed kernel...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-08 20:37:22 +01:00
Chris Wilson 67ed14c536 sna/dri: Set bo=NULL to actually detect unknown dri attachment points.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-08 19:42:02 +01:00
Chad Versace 68755bc5ff sna/dri: Add support for DRI2BufferStencil and DRI2BufferHiz
Based on Chad's commits 2662db5b and 3daba7e6:

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-08 19:27:33 +01:00
Chris Wilson 0030c3aab6 sna/dri: Drop support for old dri2 versions with incompatible ABI
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-08 19:27:33 +01:00
Chris Wilson 715d466ad4 sna/dri: valgrindify
Lots of scary warnings found by valgrind.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-08 19:27:33 +01:00
Chad Versace a62db5b050 dri: Add support for DRI2BufferStencil and DRI2BufferHiz
And bump configure.ac to require dri2proto >= 2.6, because
DRI2BufferStencil and DRI2BufferHiz were introduced in that version.

When a client requests DRI2BufferHiz or DRI2BufferStencil,
I830DRI2CreateBuffer() now returns a Y-tiled buffer. The stencil buffer is
handled as a special case due its quirky pitch requirements.

CC: Eric Anholt <eric@anholt.net>
CC: Ian Romanick <idr@freedesktop.org>
CC: Kristian Høgsberg <krh@bitplanet.net
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-06-08 10:08:58 -07:00
Chad Versace 263daba7e6 dri: Do not create DRI2 buffers for unrecognized DRI2 buffer tokens
Before this commit, if a client were to request an unrecognized DRI2
buffer, such as DRI2BufferStencil, then I830DRI2CreateBuffer() allocated
and returned an X-tiled buffer by accident. The problem was that
unrecognized tokens were caught by the default case of a switch statement.

Now, when given unrecognized DRI2 tokens, I830DRI2CreateBuffers() returns
null.

This shouldn't break older Mesa versions, because they never query (via
DRI2GetBuffersWithFormat) for the drawable's DRI2BufferStencil.

CC: Eric Anholt <eric@anholt.net>
CC: Ian Romanick <idr@freedesktop.org>
CC: Kenneth Graunke <kenneth@whitecape.org>
CC: Kristian Høgsberg <krh@bitplanet.net
Signed-off-by: Chad Versace <chad@chad-versace.us>
2011-06-08 10:08:33 -07:00
Chris Wilson 038f29c259 sna/blt: Flush batch before overwrite surface data
A left-over from before the surface was embedded into the tail of the
batch, we were only checking for room against the total size of the
batch buffer. So under the wrong set of circumstances we ended up
overwriting surface data with batch and triggering a GPU hang on gen4+.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-07 19:16:01 +01:00
Chris Wilson 265d94e0aa sna: Add zaphod support
Zaphod support is a rudimentary method for creating an Xserver with
multiple screens from a single device. The Device is instantiated, with
a duplication of its resources, as many as required up to a maximum of
the number of its outputs, and each instance is attached to a Screen
and added to the ServerLayout. A Device can be bound to a selection of
outputs using a comma separated list of RandR names.

Note: in general, this is not the preferred solution! And will be
superseded by per-crtc-pixmaps in RandR-1.4.

For example, the following xorg.conf fragment creates an XServer with
two screens, one attached to the LVDS panel on the laptop, and the other
to any external output:

Section "Device"
	Identifier "Intel0"
	Driver     "intel"
	BusID	   "PCI:0:2:0"
	Option     "ZaphodHeads" "LVDS1"
	Screen     0
EndSection

Section "Device"
	Identifier "Intel1"
	Driver     "intel"
	BusID	   "PCI:0:2:0"
	Option     "ZaphodHeads" "DVI1,VGA1"
	Screen     1
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Intel0"
EndSection

Section "Screen"
	Identifier "Screen1"
	Device     "Intel1"
EndSection

Section "ServerLayout"
	Identifier "default"
	Screen     "Screen0"
	Screen     "Screen1"
EndSection

Based on a patch by Ben Skegs <bskeggs@redhat.com>

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-07 16:54:57 +01:00
Chris Wilson ad5ead8257 sna/gen2: Support covered xrgb sources on 830/845
830/845 cannot directly sample from an x8r8g8b8 source, but if we know
that we are only sampling from within the confines of the source then we
force the alpha channel to one. (Outside of the source we require the
sampler to return a==0.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-07 11:16:54 +01:00
Chris Wilson 790f90a277 sna/gen6: Initialise a couple more composite op members for copy_boxes
Valgrind detected that I missed initialised a couple of fields for
use with the generic state emission paths:

==28683== Conditional jump or move depends on uninitialised value(s)
==28683==    at 0x83BE646: gen6_get_blend (gen6_render.c:251)
==28683==    by 0x83BF769: gen6_emit_state (gen6_render.c:818)
==28683==    by 0x83C38ED: gen6_emit_copy_state (gen6_render.c:2280)
==28683==    by 0x83C3C89: gen6_render_copy_boxes (gen6_render.c:2356)
==28683== Conditional jump or move depends on uninitialised value(s)
==28683==    at 0x83C15C3: gen6_rectangle_begin (gen6_render.c:1458)
==28683==    by 0x83C177D: gen6_get_rectangles (gen6_render.c:1502)
==28683==    by 0x83C3D16: gen6_render_copy_boxes (gen6_render.c:2363)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-07 08:58:59 +01:00
Chris Wilson 4e443cbef5 sna: Add some more debug commentary to render picture source migration
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-07 00:24:17 +01:00
Chris Wilson 367298c510 sna: Subtract the Solid RenderFillRectangles from CPU damage
... and so avoid having to move it the GPU, as seen in the wild. It
looks like I will actually need to handle mixed Render/Core operations
on the frontbuffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-06 23:21:09 +01:00
Chris Wilson 62e4266b4d sna/gen5: Only emit the non-pipelined op after BLT commands
We were always terminating the batch with the non-pipelined op, and not
just at the end of a BLT sequence.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-06 16:20:38 +01:00
Chris Wilson 8f97157d2e sna/gen2: Replicate alpha for non-CA masks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-06 10:21:17 +01:00