summaryrefslogtreecommitdiff
path: root/src/intel_uxa.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-05 10:11:04 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-05 10:30:06 +0000
commit101942d41df7efaa6103e31e738775fafdb63159 (patch)
tree809915981142f6b26679bd4eda48e0b288ed0613 /src/intel_uxa.c
parentb424b10e771b1d3d041efdd2b77f576251364744 (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>
Diffstat (limited to 'src/intel_uxa.c')
-rw-r--r--src/intel_uxa.c22
1 files changed, 18 insertions, 4 deletions
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;