diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-05 10:11:04 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-12-05 10:30:06 +0000 |
commit | 101942d41df7efaa6103e31e738775fafdb63159 (patch) | |
tree | 809915981142f6b26679bd4eda48e0b288ed0613 | |
parent | b424b10e771b1d3d041efdd2b77f576251364744 (diff) |
uxa: Unmap the buffer after swrast
Otherwise we may exhaust the per-process vma limit and cause
applications to stop rendering and eventually crash the X server.
Will only work in conjunction with a new libdrm (2.4.28) and commit
c549a77c (intel: Unmap buffers during drm_intel_gem_bo_unmap)
in particular.
Reported-by: nobled@dreamwidth.org
References: https://bugs.freedesktop.org/show_bug.cgi?id=43075
References: https://bugs.freedesktop.org/show_bug.cgi?id=40066
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/intel_uxa.c | 22 |
2 files changed, 19 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 2b25ee59..a675a933 100644 --- a/configure.ac +++ b/configure.ac @@ -187,7 +187,7 @@ XORG_DRIVER_CHECK_EXT(DPMSExtension, xextproto) # Obtain compiler/linker options for the driver dependencies PKG_CHECK_MODULES(XORG, [xorg-server >= $required_xorg_xserver_version xproto fontsproto pixman-1 >= $required_pixman_version $REQUIRED_MODULES]) -PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.23]) +PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.28]) PKG_CHECK_MODULES(DRI, [xf86driproto], , DRI=no) PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6],, DRI2=no) PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) diff --git a/src/intel_uxa.c b/src/intel_uxa.c index 1aedae04..5f2959b4 100644 --- a/src/intel_uxa.c +++ b/src/intel_uxa.c @@ -720,10 +720,8 @@ static Bool intel_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access) (access == UXA_ACCESS_RW || priv->batch_write)) intel_batch_submit(scrn); - if (priv->tiling || bo->size <= intel->max_gtt_map_size) - ret = drm_intel_gem_bo_map_gtt(bo); - else - ret = dri_bo_map(bo, access == UXA_ACCESS_RW); + assert(bo->size <= intel->max_gtt_map_size); + ret = drm_intel_gem_bo_map_gtt(bo); if (ret) { xf86DrvMsg(scrn->scrnIndex, X_WARNING, "%s: bo map (use gtt? %d, access %d) failed: %s\n", @@ -740,6 +738,21 @@ static Bool intel_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access) return TRUE; } +static void intel_uxa_finish_access(PixmapPtr pixmap, uxa_access_t access) +{ + struct intel_pixmap *priv; + + if (access == UXA_GLAMOR_ACCESS_RW || access == UXA_GLAMOR_ACCESS_RO) + return; + + priv = intel_get_pixmap_private(pixmap); + if (priv == NULL) + return; + + drm_intel_gem_bo_unmap_gtt(priv->bo); + pixmap->devPrivate.ptr = NULL; +} + static Bool intel_uxa_pixmap_put_image(PixmapPtr pixmap, char *src, int src_pitch, int x, int y, int w, int h) @@ -1305,6 +1318,7 @@ Bool intel_uxa_init(ScreenPtr screen) intel->uxa_driver->get_image = intel_uxa_get_image; intel->uxa_driver->prepare_access = intel_uxa_prepare_access; + intel->uxa_driver->finish_access = intel_uxa_finish_access; intel->uxa_driver->pixmap_is_offscreen = intel_uxa_pixmap_is_offscreen; screen->CreatePixmap = intel_uxa_create_pixmap; |