summaryrefslogtreecommitdiff
path: root/src/intel_uxa.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-10-06 08:47:20 +0100
committerOwain G. Ainsworth <oga@openbsd.org>2011-03-16 18:44:28 +0000
commitb7947ea70042a657ef48e145ce9265b1c6b8a4bd (patch)
tree7258c61a067e43d23fbd3c970b6443f828ca9f65 /src/intel_uxa.c
parent5e78d10b7f25e200d891bdaddc2b9d140b8c6d37 (diff)
uxa: Re-enable acceleration.
A side-effect of discriminating offscreen based on the devPrivate.ptr was that it broke uxa_finish_access and so after any fallback to s/w on a Pixmap, it remained in software for the reminder of its life. Introduce an explicit boolean to mark whether or not hardware acceleration is enabled for a pixmap (with a GEM buffer). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> (cherry picked from commit 707901bf98073fb56179a0b61c806f85ef8f413c) Signed-off-by: Owain G. Ainsworth <oga@openbsd.org>
Diffstat (limited to 'src/intel_uxa.c')
-rw-r--r--src/intel_uxa.c64
1 files changed, 26 insertions, 38 deletions
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index cfa30ab0..9bc7aa67 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -654,6 +654,7 @@ void intel_set_pixmap_bo(PixmapPtr pixmap, dri_bo * bo)
priv->tiling = tiling;
priv->busy = -1;
+ priv->offscreen = 1;
} else {
if (priv != NULL) {
free(priv);
@@ -665,6 +666,12 @@ void intel_set_pixmap_bo(PixmapPtr pixmap, dri_bo * bo)
intel_set_pixmap_private(pixmap, priv);
}
+static Bool intel_uxa_pixmap_is_offscreen(PixmapPtr pixmap)
+{
+ struct intel_pixmap *priv = intel_get_pixmap_private(pixmap);
+ return priv && priv->offscreen;
+}
+
static Bool intel_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access)
{
ScrnInfoPtr scrn = xf86Screens[pixmap->drawable.pScreen->myNum];
@@ -694,22 +701,6 @@ static Bool intel_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access)
return TRUE;
}
-static void intel_uxa_finish_access(PixmapPtr pixmap)
-{
- ScreenPtr screen = pixmap->drawable.pScreen;
- ScrnInfoPtr scrn = xf86Screens[screen->myNum];
- intel_screen_private *intel = intel_get_screen_private(scrn);
- struct intel_pixmap *priv = intel_get_pixmap_private(pixmap);
- dri_bo *bo = priv->bo;
-
- if (priv->tiling || bo->size <= intel->max_gtt_map_size)
- drm_intel_gem_bo_unmap_gtt(bo);
- else
- dri_bo_unmap(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)
@@ -800,6 +791,11 @@ static Bool intel_uxa_put_image(PixmapPtr pixmap,
if (!scratch)
return FALSE;
+ if (!intel_uxa_pixmap_is_offscreen(scratch)) {
+ screen->DestroyPixmap(scratch);
+ return FALSE;
+ }
+
ret = intel_uxa_pixmap_put_image(scratch, src, src_pitch, 0, 0, w, h);
if (ret) {
GCPtr gc = GetScratchGC(pixmap->drawable.depth, screen);
@@ -880,7 +876,7 @@ static Bool intel_uxa_get_image(PixmapPtr pixmap,
if (!scratch)
return FALSE;
- if (!intel_get_pixmap_bo(scratch)) {
+ if (!intel_uxa_pixmap_is_offscreen(scratch)) {
screen->DestroyPixmap(scratch);
return FALSE;
}
@@ -928,14 +924,6 @@ void intel_uxa_block_handler(intel_screen_private *intel)
}
}
-static Bool intel_uxa_pixmap_is_offscreen(PixmapPtr pixmap)
-{
- if (pixmap->devPrivate.ptr)
- return FALSE;
-
- return intel_get_pixmap_bo(pixmap) != NULL;
-}
-
static PixmapPtr
intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
unsigned usage)
@@ -1059,6 +1047,7 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
drm_intel_bo_set_tiling(priv->bo, &tiling, stride);
priv->stride = stride;
priv->tiling = tiling;
+ priv->offscreen = 1;
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL);
@@ -1082,22 +1071,22 @@ void intel_uxa_create_screen_resources(ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
intel_screen_private *intel = intel_get_screen_private(scrn);
+ dri_bo *bo = intel->front_buffer;
+
+ drm_intel_gem_bo_map_gtt(bo);
if (intel->use_shadow) {
intel_shadow_create(intel);
} else {
- dri_bo *bo = intel->front_buffer;
- if (bo != NULL) {
- PixmapPtr pixmap = screen->GetScreenPixmap(screen);
- intel_set_pixmap_bo(pixmap, bo);
- intel_get_pixmap_private(pixmap)->busy = 1;
- screen->ModifyPixmapHeader(pixmap,
- scrn->virtualX,
- scrn->virtualY,
- -1, -1,
- intel->front_pitch,
- NULL);
- }
+ PixmapPtr pixmap = screen->GetScreenPixmap(screen);
+ intel_set_pixmap_bo(pixmap, bo);
+ intel_get_pixmap_private(pixmap)->busy = 1;
+ screen->ModifyPixmapHeader(pixmap,
+ scrn->virtualX,
+ scrn->virtualY,
+ -1, -1,
+ intel->front_pitch,
+ NULL);
scrn->displayWidth = intel->front_pitch / intel->cpp;
}
}
@@ -1233,7 +1222,6 @@ 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;