Commit Graph

4231 Commits

Author SHA1 Message Date
Zhigang Gong e2c8bac972 uxa/glamor: Fallback to new glamor pixmap if failed to create textured pixmap.
If we failed to create textured pixmap from BO's handle, we
turn to create a new glamor pixmap by call glamor_create_pixmap
rather than fallback to in-memory pixmap. Have to introduce
a new wrapper function intel_glamor_create_pixmap.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
2011-12-16 20:23:09 +08:00
Chris Wilson 19c184b7e4 sna/gen3: Check for upload failure of video bo
And propagate that failure back to the client.

Reported-by: Paul Neumann <paul104x@yahoo.de>
References: https://bugs.freedesktop.org/show_bug.cgi?id=43716
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-15 18:19:18 +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 e3153a779e sna: cap the number of times we attempt to resubmit the batch upon EBUSY
Just in case the kernel gets stuck in a loop and we fail to make any
progress at all.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-15 09:31:42 +00:00
Chris Wilson 1cc43dc97b sna: More missing move-to-cpu allocation checks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-15 00:05:49 +00:00
Chris Wilson 12448b5606 sna: silence warning for unused 'priv'
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-15 00:05:44 +00:00
Chris Wilson eb8e979b4d uxa/glamor: Allocate a fbPixmap with storage for fallbacks
When we try to create a glamor pixmap and fail we need to create a real
pixmap along with its pixel allocation, instead of detaching ourselves
and returning the fake pixmap header.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 23:08:34 +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
Chris Wilson 95cceb5ae5 sna: Fix DBG crash whilst pruning inactive GPU buffers
Don't attempt to dereference the NULL gpu_bo after having just freed it.
Here in lies the folly of trying to blindly silence the compiler.

Instead we should heed the error return as it means that we didn't
decouple the pixmap from the inactive list and so we choose to place it
back on the active list to purge again in the near future.

Reported-by: Paul Neumann <paul104x@yahoo.de
References: https://bugs.freedesktop.org/show_bug.cgi?id=43716
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 19:38:36 +00:00
Chris Wilson e7f4b7fd91 sna: Add some DBG() around Y-to-X fallbacks
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 18:21:22 +00:00
Chris Wilson 32bb2c89b8 sna: Check allocation of pixman_image_t
And just fail to perform the copy, clearing the dst instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 16:29:50 +00:00
Chris Wilson 37c525a11c sna: Skip glyphs if we fail to allocate pixel data for them
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 16:26:46 +00:00
Chris Wilson 6a8188bb4d sna: Close any handles after bo allocation failures
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 16:24:54 +00:00
Chris Wilson 43a2274312 sna: Use the provided bo for blitting rather than assume priv->gpu_bo
Reported-by: nkalkhof@web.de
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43802
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 13:26:05 +00:00
Chris Wilson 30f5ee11f8 sna: Use a static request and synchronous rendering in case of malloc failure
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 13:06:35 +00:00
Chris Wilson 23fb2cebbe sna/blt: Add a missing allocation check upon the source CPU pixmap
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 12:50:35 +00:00
Chris Wilson 5b0f3ff9a8 sna/damage: Guard against malloc failures
In the event of failure, we choose to loose track of the damage and
choose rendering corruption over crashing.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 12:23:04 +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 d5456e40d9 uxa/glamor: Silence a compiler warning for some unused code
intel_glamor.c: In function 'intel_glamor_create_screen_image':
intel_glamor.c:192:12: warning: variable 'pixmap' set but not used
[-Wunused-but-set-variable]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 10:41:33 +00:00
Chris Wilson 4f1a99a70e sna: Protect against deferred malloc failures for pixel data
As we now defer the allocation of pixel data until first use, it can
fail in the middle of a rendering routine. In order to prevent chasing
us passing a NULL pointer into the fallback routines, we need to propagate
the failure from the malloc and suppress the failure, discarding the
operation, which is less than ideal.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 10:35:04 +00:00
Chris Wilson d2c6d950ed sna: Mark upload buffers as unaccessible upon submission
Use valgrind to catch use-after-finish bugs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-14 08:58:31 +00:00
Chris Wilson e39ea29bcc sna: Allow the debugger to map bo from the batch during kgem_submit()
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 13:18:56 +00:00
Chris Wilson 2fabb5068d sna: Debug fixup for non-LLC systems
The cpu bo is only allocated on LLC systems, so do avoid the NULL deref on
debugging for others.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 13:15:51 +00:00
Chris Wilson e037379c8e sna: Fix a debugging assert
The bo is allowed to be NULL, so defer the assert until after it is
known to be non-NULL.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 13:14:15 +00:00
Chris Wilson 5d5b2b8ee2 uxa: Cap the maximum number of VMA cached
Since we can not keep an unlimited number of vma cached due to the hard
per-process limits on the number of mappings and recreating mappings is
slow due to excruciatingly slow GTT pagefaults, we need to compromise
and keep a small MRU cache of inactive mmaps.

This uses the new API in libdrm-2.4.29 to specify the limit upon the VMA
cache maintained by libdrm.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 11:30:05 +00:00
Chris Wilson 1128825efb uxa: Wakeup 3s after the last rendering to reap the bo-cache
libdrm expires its bo 2s after entry into the cache, but we need to free
a buffer to trigger the reaper. So schedule a timer event to trigger 3s
after the last rendering is submitted to free any resident bo during
long periods of idleness.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 11:27:17 +00:00
Chris Wilson db7c9e8561 configure: Link the extra valgrind debugging to --enable-debug
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 10:05:25 +00:00
Chris Wilson d02dc0fd84 sna: Set the refcnt on the replacement bo
The paranoia wasn't in vain.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 01:38:09 +00:00
Chris Wilson 7472db8c8c sna: Double-check that the submitted buffers were not purged
More paranoia is good for the soul.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 01:38:09 +00:00
Chris Wilson 0bbd6a08fe sna/gen2: Tidy checking against too large pixmaps for the 3D pipeline
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 01:38:09 +00:00
Chris Wilson b392474f3a sna: Force a suitable minimum stride for 3D temporaries
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 01:38:09 +00:00
Chris Wilson 3c22baaba9 sna/gen2: Check for unhandled pitches in the render pipeline
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 01:38:09 +00:00
Chris Wilson f6a30df8dc sna: Enable memcpy uploads to SHM pixmaps
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 01:38:09 +00:00
Chris Wilson 3c163d105e sna: Use the CPU bo as a render source if compatible and no GPU bo
This is principally to catch the cases of compositing after a fresh
PutImage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 01:38:09 +00:00
Chris Wilson c481bec356 sna: Experiment with creating the CPU pixmap using an LLC BO
A poor cousin to vmap is to instead allocate snooped bo and use a CPU
mapping for zero-copy uploads into GPU resident memory. For maximum
performance, we still need tiled GPU buffers so CPU bo are only useful
in situations where we are frequently migrating data.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-13 01:38:09 +00:00
Chris Wilson 6c9aa6f9cf sna: Defer allocation of memory for larger pixmap until first use
In the happy scenario where the pixmap only resides upon the GPU we can
forgo the CPU allocation entirely. The goal is to reduce the number of
needless mmaps performed by the system memory allocator and reduce
overall memory consumption.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-12 16:03:11 +00:00
Chris Wilson 4b48d28f6e sna: Fix a typo, end statements with semi-colons
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-12 10:52:34 +00:00
Chris Wilson 4d20798c78 sna: We need to remap the gpu_only mmap prior to every use
Since the VMA may be reaped at any time whilst the mapping is idle.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-12 10:13:20 +00:00
Chris Wilson 2682308c10 sna: Remove bo transference for whole XCopyArea
In benchmarking firefox this performs whose - it would appear the
sources are indeed used more often than not.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-12 09:24:11 +00:00
Chris Wilson 7703424222 sna/gen6: Only use CPU bo for a render target if untiled
For large render targets, we prefer to use tiled bo in order to avoid
severe performance degradation. However, if we don't have a GPU bo but
do have a CPU bo and the operation would be untiled, then simply use the
CPU bo.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-12 00:15:10 +00:00
Chris Wilson a92a41ba32 sna/gen6: Tidy the usage of the max pipeline size
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-11 19:03:54 +00:00
Chris Wilson e9e6d6f7c8 sna/gen3: Move the video dst_bo to make the conditional clearer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-11 17:25:46 +00:00
Chris Wilson 118ef0781c sna/composite: Make the check for a no-op earlier and clearer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-11 16:56:53 +00:00
Chris Wilson 2674ef864c sna: Enable hooking up of valgrind during debugging
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-11 16:23:13 +00:00
Chris Wilson c83fd4e24d sna: Add some more debug messages for VMA caching
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-11 16:14:38 +00:00
Chris Wilson 3ae7fb918a sna: Restrict pitch alignment on 945gm to 64 bytes
In theory we should be able to disable dual-stream mode and so be
subject to much looser restrictions (such as the pitch need only be
dword aligned). However, achieving single-stream mode seems quite
difficult!

Reported-by: Paul Neumann <paul104x@yahoo.de>
References: https://bugs.freedesktop.org/show_bug.cgi?id=43706
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-11 13:52:42 +00:00
Chris Wilson 2f35d77cd0 sna: Update computation of untiled pitch to cater for CREATE_SCANOUT
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-11 13:37:18 +00:00
Chris Wilson 5a0139487f sna/gen3: Ensure that depth read/writes are disabled before first use
Our goal is to achieve "single-stream" rendering where the entire
RenderCache is allocated to the colour buffer (rather than split between
colour and depth). In theory all that is required is for the pipeline
not to reference the depth buffer at all, however it is not made clear
when that evaluation is made.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-11 12:37:22 +00:00
Chris Wilson a02bbd8700 sna: Only transfer the bo if the src/dst are of matching size
If the src replaces the dst, it could just be a much larger pixmap!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-11 10:34:37 +00:00
Chris Wilson 43a9964863 sna: Only transfer unpinned buffers
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-12-11 10:30:48 +00:00