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>
This commit is contained in:
Chris Wilson 2011-12-05 10:11:04 +00:00
parent b424b10e77
commit 101942d41d
2 changed files with 19 additions and 5 deletions

View File

@ -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])

View File

@ -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;