summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-09-10 13:19:12 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-10 13:19:12 +0100
commitae160d7fbfc79e78dad8702efcc55d9c0c25ff67 (patch)
tree169904e555bc74d8995f8f68ae0726978d110a3c /src
parent0515256490d5bcd55f85af83b84918d1bfe7f8f8 (diff)
shadow: Simply modify the Screen pixmap header
This is a slightly less risky strategy than having to remember to update all pointers to the old Screen pixmap. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/intel.h5
-rw-r--r--src/intel_driver.c25
-rw-r--r--src/intel_uxa.c65
3 files changed, 46 insertions, 49 deletions
diff --git a/src/intel.h b/src/intel.h
index c258a87e..b816aeb8 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -282,9 +282,10 @@ typedef struct intel_screen_private {
long GTTMapSize;
void *modes;
- drm_intel_bo *front_buffer, *shadow_buffer;
+ drm_intel_bo *front_buffer;
long front_pitch, front_tiling;
- PixmapPtr shadow_pixmap;
+ void *shadow_buffer;
+ int shadow_stride;
DamagePtr shadow_damage;
dri_bufmgr *bufmgr;
diff --git a/src/intel_driver.c b/src/intel_driver.c
index eab5c2c7..6087f55b 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -1140,22 +1140,19 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen)
intel->front_buffer = NULL;
}
- if (intel->shadow_pixmap) {
- PixmapPtr pixmap = intel->shadow_pixmap;
-
- if (intel->shadow_damage) {
- DamageUnregister(&pixmap->drawable,
- intel->shadow_damage);
- DamageDestroy(intel->shadow_damage);
- intel->shadow_damage = NULL;
- }
-
- if (intel->shadow_buffer) {
+ if (intel->shadow_buffer) {
+ if (IS_I8XX(intel))
drm_intel_bo_unreference(intel->shadow_buffer);
- intel->shadow_buffer = NULL;
- }
+ else
+ free(intel->shadow_buffer);
+ intel->shadow_buffer = NULL;
+ }
- intel->shadow_pixmap = NULL;
+ if (intel->shadow_damage) {
+ DamageUnregister(&screen->GetScreenPixmap(screen)->drawable,
+ intel->shadow_damage);
+ DamageDestroy(intel->shadow_damage);
+ intel->shadow_damage = NULL;
}
intel_batch_teardown(scrn);
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index 706d6341..0dcd5d32 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -904,8 +904,8 @@ intel_shadow_create_bo(intel_screen_private *intel,
bo = drm_intel_bo_alloc(intel->bufmgr, "shadow", size, 0);
if (bo && drm_intel_gem_bo_map_gtt(bo) == 0) {
char *dst = bo->virtual;
- char *src = intel->shadow_pixmap->devPrivate.ptr;
- int src_pitch = intel->shadow_pixmap->devKind;
+ char *src = intel->shadow_buffer;
+ int src_pitch = intel->shadow_stride;
int row_length = w * intel->cpp;
int num_rows = h;
src += y1 * src_pitch + x1 * intel->cpp;
@@ -961,10 +961,10 @@ intel_shadow_blt(intel_screen_private *intel)
dri_bo *bo;
int offset;
- if (intel->shadow_buffer) {
+ if (IS_I8XX(intel)) {
bo = intel->shadow_buffer;
offset = box->x1 | box->y1 << 16;
- pitch = intel->shadow_pixmap->devKind;
+ pitch = intel->shadow_stride;
} else {
bo = intel_shadow_create_bo(intel,
box->x1, box->y1,
@@ -1004,16 +1004,7 @@ static void intel_shadow_create(struct intel_screen_private *intel)
PixmapPtr pixmap;
int stride;
- if (IS_I8XX(intel))
- pixmap = screen->GetScreenPixmap(screen);
- else
- pixmap = intel->shadow_pixmap;
-
- if (intel->shadow_damage) {
- DamageUnregister(&pixmap->drawable, intel->shadow_damage);
- DamageDestroy(intel->shadow_damage);
- }
-
+ pixmap = screen->GetScreenPixmap(screen);
if (IS_I8XX(intel)) {
dri_bo *bo;
int size;
@@ -1043,29 +1034,37 @@ static void intel_shadow_create(struct intel_screen_private *intel)
intel->shadow_buffer = bo;
}
} else {
- if (intel->shadow_pixmap)
- fbDestroyPixmap(intel->shadow_pixmap);
-
- pixmap = fbCreatePixmap(screen,
- scrn->virtualX,
- scrn->virtualY,
- scrn->depth,
- 0);
-
- screen->SetScreenPixmap(pixmap);
- stride = pixmap->devKind;
+ void *buffer;
+
+ stride = intel->cpp*scrn->virtualX;
+ buffer = malloc(stride * scrn->virtualY);
+
+ if (buffer && screen->ModifyPixmapHeader(pixmap,
+ scrn->virtualX,
+ scrn->virtualY,
+ -1, -1,
+ stride,
+ buffer)) {
+ if (intel->shadow_buffer)
+ free(intel->shadow_buffer);
+
+ intel->shadow_buffer = buffer;
+ } else
+ stride = intel->shadow_stride;
}
- intel->shadow_pixmap = pixmap;
- intel->shadow_damage = DamageCreate(NULL, NULL,
- DamageReportNone,
- TRUE,
- screen,
- intel);
- DamageRegister(&pixmap->drawable, intel->shadow_damage);
- DamageSetReportAfterOp(intel->shadow_damage, TRUE);
+ if (!intel->shadow_damage) {
+ intel->shadow_damage = DamageCreate(NULL, NULL,
+ DamageReportNone,
+ TRUE,
+ screen,
+ intel);
+ DamageRegister(&pixmap->drawable, intel->shadow_damage);
+ DamageSetReportAfterOp(intel->shadow_damage, TRUE);
+ }
scrn->displayWidth = stride / intel->cpp;
+ intel->shadow_stride = stride;
}
void intel_uxa_block_handler(intel_screen_private *intel)