Commit Graph

186 Commits

Author SHA1 Message Date
Chris Wilson 45d4e8dcf9 uxa: Clear up the common intel directory
Move all the UXA backend specifc files into their own subdirectory.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-07-28 14:49:07 +01:00
Chris Wilson ca5c028c2b glamor: Release the drawable after passing to glamor_push_pixels
An unlikely path, but a double prepare instead of a prepare/finish.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-12-20 19:31:44 +00:00
Chris Wilson 65d530b59b Revert "uxa: Refactor early-exit paths of uxa_try_driver_composite()."
This reverts commit fa5c573455 as it
causes a SIGSEGV.

Reported-by: lu hua <huax.lu@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57389
2012-11-22 08:18:38 +00:00
Eric Anholt fa5c573455 uxa: Refactor early-exit paths of uxa_try_driver_composite().
Saves 200b of code at -O2.
2012-11-20 11:39:47 +00:00
Eric Anholt edefb64d2b uxa: Work around uninitialized-value warning.
The compiler isn't noticing that localDst only diverges from pDst when
the _copy variables have also been set.
2012-11-20 11:39:47 +00:00
Chris Wilson 5120279886 uxa: Remove USE_GLAMOR check from unrealize glyph caches
In an interesting twist during teardown, the driver info structure is
freed long before the caches. However, the glyph cache teardown was
checking to see if glamor was enabled to see if it could skip the
teardown. In fact, since we won't have created the glyph caches in that
circumstances it was safe any way.

Reported-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-10-01 13:06:42 +01:00
Chris Wilson 83990c649c Remove the last couple of references to mibstore
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-27 14:58:57 +01:00
Chris Wilson 182581edde uxa/glamor: Check for failed prepares
Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-16 20:59:09 +01:00
Zhigang Gong fa89e06145 uxa/glyphs: Bypass uxa glyphs operations if using glamor.
glamor_glyphs will never fallback. We don't need to keep a
uxa glyphs cache picture here. Thus simply bypass the
corresponding operations.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-07-12 12:46:06 +01:00
Chris Wilson 38f06a351f uxa: Fix second regression in glyph fallback from 64a4bc
To complete my show of incompetence for the evening, not only do we have
to restore the original source when compositing the mask onto the
destination, we also need to restore the original dst (rather than
composite the mask onto the mask!).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-19 22:22:12 +01:00
Chris Wilson fda9faee75 uxa: Use the original src for fallback glyph compositing
In 64a4bcb8ce, I introduced a WHITE source for the purposes of
accumulating the glyph mask correctly. Unfortunately I neglected to
restore the original source picture for compositing the glyph mask on
the destination, resulting in a use-after-free and then corruption.

Reported-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-19 21:01:47 +01:00
Chris Wilson 0a43d42567 uxa: Implement glyphs-to-dst to avoid fallbacks
An earlier version was buggy and introduced corruption as it failed to
fallback gracefully with ComponentAlpha glpyhs. This is a much simpler
implementation that composites each glyph individually, leaving it to the
backend to optimise away state changes. It should still be many times
faster than incurring the fallback...

Reported-by: Oleksandr Natalenko <pfactum@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50508
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-19 15:21:43 +01:00
Chris Wilson 64a4bcb8ce uxa: Use (white IN glyph) ADD mask to compose the glyph mask
As pointed out by Soren Sandmann and Behdad Esfahbod, it is essential to
use white IN glyph when adding to the mask so that the channel expansion
is correctly performed when adding to an incompatible mask format.

For example, loading alpha as the source results in the value 000a being
added to the rgba glyph mask (for mixed subpixel rendering with
grayscale glyphs), whereas the desired value is aaaa.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-19 14:05:12 +01:00
Chris Wilson 902391bd79 uxa: Remove dead-code for SourcePictures
All SourcePictures are now converted into Drawables, which had been
assumed by the driver backend. However, the code still existed to
attempt to pass procedural pictures onwards and so set pSrcPix to NULL
which was being flagged by the static analyser as a potential NULL
dereference.

Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-06 17:20:39 +01:00
Dave Airlie 8f5001493e intel: port legacy and uxa to new API.
This ports the legacy and uxa driver to the new server API.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-05 11:31:45 +01:00
Dave Airlie d9850a0500 uxa: drop enable disable access hook
This looks to be unused.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-06-05 11:31:45 +01:00
Dave Airlie 54fde5bf05 intel: convert sna/uxa to using new glyph picture accessors.
The compat-api.h takes care of old/new servers.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-23 11:02:20 +01:00
Dave Airlie 43a34186d1 intel: convert to new screen conversion APIs
The compat header takes care of the old server vs new server.

this commit was autogenerated from util/modular/x-driver-screen-scrn-conv.sh

Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-23 11:02:20 +01:00
Dave Airlie 9aabc04d76 intel: add compat header file for conversion fns
Signed-off-by: Dave Airlie <airlied@redhat.com>
2012-05-23 11:00:29 +01:00
Chris Wilson a16616209b uxa: Fix leak of glyph mask for unhandled glyph composition
==1401== 7,344 bytes in 34 blocks are possibly lost in loss record 570 of 587
==1401==    at 0x4027034: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==1401==    by 0x8BE5150: drm_intel_gem_bo_alloc_internal (intel_bufmgr_gem.c:689)
==1401==    by 0x899FC04: intel_uxa_create_pixmap (intel_uxa.c:1077)
==1401==    by 0x89C2C41: uxa_glyphs (uxa-glyphs.c:254)
==1401==    by 0x21F05E: damageGlyphs (damage.c:647)
==1401==    by 0x218E06: ProcRenderCompositeGlyphs (render.c:1434)
==1401==    by 0x15AA40: Dispatch (dispatch.c:439)
==1401==    by 0x1499E9: main (main.c:287)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-04-14 20:45:29 +01:00
Chris Wilson fde8a010b3 uxa: Remove broken render glyphs-to-dst
Reported-by: Vincent Untz <vuntz@gnome.org>
Reported-by: Robert Bradford <robert.bradford@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48045
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-03-30 12:47:21 +01:00
Chris Wilson 25807f472d uxa: Remove hook for CompositeRectangles
It was broken and not flushing damage correctly. With the
improvements made to the kernel, it is no longer a significant advantage
per se and not worth its additional complexity.

Reported-by: Tilman Sauerbeck <tilman@code-monkey.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32547
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-03-23 15:00:53 +00:00
Zhigang Gong 70092bfbc5 uxa/glamor: Refine CloseScreen and InitScreen process.
The previous version calls glamor_egl_close_screen and
glamor_egl_free_screen manually which is not align with
standard process. Now glamor change the way to follow
standard method:

glamor layer and glamor egl layer both have their internal
CloseScreens. The correct sequence is after the I830CloseScreen
is registered, then register glamor_egl_close_screen and
the last one is glamor_close_screen. So we move out the
intel_glamor_init from the intel_uxa_init to I830ScreenInit
and just after the registration of I830CloseScreen.

As the glamor interfaces changed, we need to check the
glamor version when load the glamor egl module to make
sure we are loading the right glamor module. If
failed, it will switch back to UXA path.

This depends upon glamor commit 1bc8bf tagged with version 0.3.0.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-08 09:07:42 +00:00
Zhigang Gong feb75c55d6 uxa/glamor: Route some missing drawing function to glamor
We have to route all the drawing function to glamor first, when
glamor is enabled. This adds a few more functions that were previously
just falling back to swrast and passes them to glamor instead.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-03 21:35:04 +00:00
Zhigang Gong f4ea732d71 uxa/glamor: Let glamor do the GC validation
If we are using GLAMOR, then a tile pixmap or stipple pixmap
may be pure glamor pixmap and thus UXA will not know how to
render to them, and we need to let glamor do the validation.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-03 21:35:04 +00:00
Chris Wilson a5583165da uxa: Remove concept of global FB ownership made obsolete by GEM and KMS
With the introduction of GEM, we can continue to submit batch buffers
irrespective of ownership of the console, so do so.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-28 13:57:09 +00:00
Chris Wilson e68a8748f3 uxa: Move the region creation beyond the call into glamor
So that we avoid leaking the region if hooking into glamor.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-15 09:48:08 +00:00
Chris Wilson 232fa93a4b uxa/glamor: Always notify glamor that the glyph has been unrealized
The danger of the early return when UXA is not using glyphs is evident
in the eventual crash when glamor begins evicting and reusing its glyph
cache slots.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 20:11:39 +00:00
Zhigang Gong f8b9a2a547 uxa/glamor: Enable the rest of the glamor rendering routines
This commit hooks up all the remaining rendering routines to call into
glamor; the takeover is nearly complete! When tested with the latest
glamor master branch, it passes rendercheck.

One thing need to be pointed out is the picture's handling.
Pictures support many different color formats, but glamor's
texture only support a few color formats. And the most common
scenario is that we create a pixmap with a color depth and
then attach it to a picture which has a specific color format
with the same color depth. But there is no way to change a
texture's internal format after the texture was allocated.
If you do that, the OpenGL will allocate a new texture. And
then the glamor side and UXA side will be inconsitent. So
for all the picture related operations, we can't fallback to
UXA path directly, even it is rather a straight forward
operation. So for the get_image, Addtraps.., we have to add
wrappers function for them to jump into glamor firstly.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
[ickle: prefer access; ok = glamor(); finish; if (!ok) goto fallback; return; ]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 11:29:29 +00:00
Chris Wilson 429a36f748 uxa: Fix clip processing for uxa_fill_spans()
Fixes regression from e0066e77e0
(uxa: Simplify Composite solid acceleration for spans by only clipping
once) [2.15.901]

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43649
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-09 09:54:22 +00:00
Chris Wilson f938cd1599 glamor: Include glamor cflags and libs for atypical builds
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-17 13:43:37 +00:00
Zhigang Gong eb6148a36a uxa/glamor: Turn on glamor for fill spans and rects
This commit only enables two glamor functions for
uxa_fill_spans and uxa_poly_fill_rects.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-17 01:10:21 +00:00
Zhigang Gong c4c2eb1fae uxa/glamor: Introduce additional access modes to wrap glamor acceleration
Integrate glamor acceleration into UXA framework. Add
necessary flushing at the following points:

1. Flush UXA batch buffer before call into glamor.
2. Flush GL operations after return from a glamor function.
3. The point we need to flush UXA batch buffer, we also
   need to flush GL operations, for example, in
   intel_flush_callback and couple of places in intel_display.c.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-16 23:57:57 +00:00
Chris Wilson a26c5d44cc uxa: Ensure that alphaMaps are mapped into the CPU for fallbacks
Reported-by: Hans-Peter Budek <peter.budek@gmx.de>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-11-04 13:11:14 +00:00
Chris Wilson 5c45622b88 uxa/glyphs: Fallback rather than fail to render with a non-solid Source
Reported-by: Uli Schlachter <psychon@znc.in>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31819
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-30 17:49:19 +00:00
Chris Wilson 18d08e49d2 uxa/glyphs: Fallback instead of crashing on large strings
Not ideal, but being slow is a major improvement over losing data.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36860
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-28 20:26:48 +01:00
Chris Wilson 855ced5a4e uxa: Remove the attempt to use the 3D pipeline for core rendering
The attempt was still ridden with bugs, such as

http://bugs.freedesktop.org/show_bug.cgi?id=28768
http://bugs.freedesktop.org/show_bug.cgi?id=28798
http://bugs.freedesktop.org/show_bug.cgi?id=28908
http://bugs.freedesktop.org/show_bug.cgi?id=29401

A fresh approach was taken with SNA, but in the mean time before that
can be enabled downstream, restore correct behaviour.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-06-16 13:36:26 +01:00
Eric Anholt 91424d4937 uxa: Simplify uxa_poly_fill_rect by only clipping once.
Reviewed-by: Keith Packard <keithp@keithp.com>
2011-06-05 21:13:49 -07:00
Eric Anholt e0066e77e0 uxa: Simplify Composite solid acceleration for spans by only clipping once.
Unlike the previous commit removing this style of code, the code in
this one was originally wrong, and would fail to clip in the second
pass of clipping when y was > pbox->y2.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37233
Reviewed-by: Keith Packard <keithp@keithp.com>
2011-06-05 21:13:36 -07:00
Eric Anholt ace324e4aa uxa: Simplify BLT solid acceleration for spans filling by only clipping once.
We were clipping each span against the bounds of the clip, throwing
out the span early if it was all clipped, and then walked the clip box
clipping against each of the cliprects.  We would expect spans to
typically be clipped against one box, and not thrown out, so we were
not saving any work there.  For multiple cliprects, we were adding
work.  Only for many spans clipped entirely out of a complicated clip
region would it have saved work, and it clearly didn't save bugs as
evidenced by the many fix attempts here.

Reviewed-by: Keith Packard <keithp@keithp.com>
2011-06-05 21:13:32 -07:00
Chris Wilson 4c66b28870 uxa: Fallback if the temporary is too large
If the render operation requires a temporary source Picture and the
operation is large, larger than the maximum permitted bo, then we will
fail to allocate the bo. In this case, we need to fallback and perform
the operation on the CPU rather than dereference a NULL bo.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34399
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-02-17 16:52:58 +00:00
Bryce Harrington 6e721e098b Check return value of uxa_acquire_solid() since it can return NULL
uxa_acquire_solid returns NULL under OOM.  Thus the value of solid
must be checked before dereferencing it in the uxa_get_offscreen()
call.

Signed-off-by: Bryce Harrington <bryce@canonical.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-02-04 08:57:11 +00:00
Chris Wilson da990536ec uxa: Undo damage translation before appending
The region is used to paint onto the backing pixmap (and thus
translated) prior to being passed to the damage layer (wrt to the
drawable). So the local translation needs to be undone first.

Identified by Christopher James Halse Rogers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33650
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-02-03 09:41:48 +00:00
Chris Wilson c6dc27562a uxa: Only recreate the glyph cache on *generational* updates
The screen resources are recreated when the screen is rotated as well,
without being finalized. In this case, we do not need to reconstuct the
cache (or if we did, we would need to tear it down first).

Reported-by: Till Matthiesen <entropy@everymail.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33412
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-01-24 20:29:57 +00:00
Chris Wilson 1ba983034b uxa: Emit the damage after the render for the workaround in uxa_solid_rects
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-12-07 12:27:29 +00:00
Chris Wilson 81d355a8dc uxa: Fix crash after allocation failure
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31487
Reported-by: Thomas Fjellstrom <tfjellstrom@shaw.ca>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-11-09 09:30:12 +00:00
Chris Wilson 23ee926bcd uxa: Skip a pixmap lookup if there is no driver finish access function
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-06 12:17:14 +01:00
Chris Wilson 7c7294ec00 shadow+dri2: Allow dri2 to be independently enabled with shadow
To enable DRI we create GEM buffers for the client to render into with
hardware acceleration. In order to maintain coherency between any 2D
render operations with the independent 3D clients (this includes the
reading of 2D rasterisation by the direct rendering client, e.g.
compiz using texture_from_pixmap) we need to replace the shadow pixmap
with the GTT mapping. Therefore 2D rendering to a DRI buffer will be to
uncached memory and thus penalised -- but the direct rendering clients
will have full hardware acceleration.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-04 20:24:36 +01:00
Matthias Hopf b84925b9c0 Make driver compile for 1.6 Xserver series again.
Signed-off-by: Matthias Hopf <mhopf@suse.de>
2010-09-22 17:45:06 +02:00
Chris Wilson 2b96c18165 Enable a shadow buffer and disable GPU acceleration.
An attempt to workaround the incoherency in gen2 chipsets, we avoid
using dynamic reallocation as much as possible.

The first step is to disable allocation of pixmaps using GEM and simply
create them in system memory without a backing buffer object. This
forces all rendering to use S/W fallbacks.

The second step is to allocate a shadow front buffer and assign that to
the Screen pixmap. This ensure that the front buffer remains in the GTT
and pinned for scanout. The shadow buffer will be rendered to in the
normal fashion via the Screen pixmap, and be marked dirty. In the block
handler, the dirty shadow buffer is then blitted (using the GPU) over
the front buffer. This should completely avoid having to move pages
around in the GTT and avoid incurring the wrath of those early chipsets.
Secondly, performance should be reasonable as we avoid the ping-pong
caused by the small aperture and weak GPU forcing software fallbacks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-09-08 13:33:37 +01:00