diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-05 19:26:48 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-15 20:56:58 +0100 |
commit | 0c32be15b06ad63c1fc1371de879f2d879080f6b (patch) | |
tree | a86f39daf524a54d1a54999df98462487d39e3b4 /src | |
parent | 6a18a0936eafc45ab920ab0eecf2fc2a601c41a7 (diff) |
uxa: Remove Shadow hack
This was an incomplete hack so deprecate in favour of Shadow-on-Steriods,
SNA.
References: https://bugs.freedesktop.org/show_bug.cgi?id=47324
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/intel.h | 9 | ||||
-rw-r--r-- | src/intel_display.c | 2 | ||||
-rw-r--r-- | src/intel_dri.c | 146 | ||||
-rw-r--r-- | src/intel_driver.c | 34 | ||||
-rw-r--r-- | src/intel_options.c | 1 | ||||
-rw-r--r-- | src/intel_options.h | 1 | ||||
-rw-r--r-- | src/intel_shadow.c | 200 | ||||
-rw-r--r-- | src/intel_uxa.c | 34 | ||||
-rw-r--r-- | src/intel_video.c | 3 |
10 files changed, 29 insertions, 402 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index a7043d1d..feed4cec 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -64,7 +64,6 @@ intel_drv_la_SOURCES += \ intel_driver.h \ intel_glamor.h \ intel_memory.c \ - intel_shadow.c \ intel_uxa.c \ intel_video.c \ intel_video.h \ diff --git a/src/intel.h b/src/intel.h index 1555acd0..2076b2f6 100644 --- a/src/intel.h +++ b/src/intel.h @@ -170,9 +170,6 @@ typedef struct intel_screen_private { PixmapPtr back_pixmap; unsigned int back_name; long front_pitch, front_tiling; - void *shadow_buffer; - int shadow_stride; - DamagePtr shadow_damage; dri_bufmgr *bufmgr; @@ -328,10 +325,8 @@ typedef struct intel_screen_private { Bool use_pageflipping; Bool use_triple_buffer; Bool force_fallback; - Bool can_blt; Bool has_kernel_flush; Bool needs_flush; - Bool use_shadow; struct _DRI2FrameEvent *pending_flip[2]; @@ -640,10 +635,6 @@ void intel_uxa_block_handler(intel_screen_private *intel); Bool intel_get_aperture_space(ScrnInfoPtr scrn, drm_intel_bo ** bo_table, int num_bos); -/* intel_shadow.c */ -void intel_shadow_blt(intel_screen_private *intel); -void intel_shadow_create(struct intel_screen_private *intel); - static inline Bool intel_pixmap_is_offscreen(PixmapPtr pixmap) { struct intel_pixmap *priv = intel_get_pixmap_private(pixmap); diff --git a/src/intel_display.c b/src/intel_display.c index 0a80aa84..bfe59184 100644 --- a/src/intel_display.c +++ b/src/intel_display.c @@ -634,7 +634,7 @@ intel_crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) intel_crtc->rotate_bo = NULL; } - intel->shadow_present = intel->use_shadow; + intel->shadow_present = FALSE; } static void diff --git a/src/intel_dri.c b/src/intel_dri.c index 0405937f..d027a643 100644 --- a/src/intel_dri.c +++ b/src/intel_dri.c @@ -96,34 +96,13 @@ static uint32_t pixmap_flink(PixmapPtr pixmap) static PixmapPtr get_front_buffer(DrawablePtr drawable) { - ScreenPtr screen = drawable->pScreen; - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - intel_screen_private *intel = intel_get_screen_private(scrn); PixmapPtr pixmap; pixmap = get_drawable_pixmap(drawable); - if (!intel->use_shadow) { - pixmap->refcnt++; - } else if (pixmap_is_scanout(pixmap)) { - pixmap = fbCreatePixmap(screen, 0, 0, drawable->depth, 0); - if (pixmap) { - screen->ModifyPixmapHeader(pixmap, - drawable->width, - drawable->height, - 0, 0, - intel->front_pitch, - intel->front_buffer->virtual); - - intel_set_pixmap_bo(pixmap, intel->front_buffer); - intel_get_pixmap_private(pixmap)->offscreen = 0; - if (WindowDrawable(drawable->type)) - screen->SetWindowPixmap((WindowPtr)drawable, - pixmap); - } - } else if (intel_get_pixmap_bo(pixmap)) { - pixmap->refcnt++; - } else - pixmap = NULL; + if (!intel_get_pixmap_bo(pixmap)) + return NULL; + + pixmap->refcnt++; return pixmap; } @@ -186,72 +165,6 @@ static PixmapPtr fixup_glamor(DrawablePtr drawable, PixmapPtr pixmap) return old; } -static PixmapPtr fixup_shadow(DrawablePtr drawable, PixmapPtr pixmap) -{ - ScreenPtr screen = drawable->pScreen; - PixmapPtr old = get_drawable_pixmap(drawable); - struct intel_pixmap *priv = intel_get_pixmap_private(pixmap); - GCPtr gc; - - /* With an active shadow buffer, 2D pixmaps are created in - * system memory and GPU acceleration of 2D render operations - * is *disabled*. As DRI is still enabled, we create hardware - * buffers for the clients, and need to mix this with the - * 2D rendering. So we replace the system pixmap with a GTT - * mapping (with the kernel enforcing coherency between - * CPU and GPU) for 2D and provide the bo so that clients - * can write directly to it (or read from it in the case - * of TextureFromPixmap) using the GPU. - * - * So for a compositor with a GL backend (i.e. compiz) we have - * smooth wobbly windows but incur the cost of uncached 2D rendering, - * however 3D applications (games and clutter) are still fully - * accelerated. - */ - - if (drm_intel_gem_bo_map_gtt(priv->bo)) - return pixmap; - - screen->ModifyPixmapHeader(pixmap, - drawable->width, - drawable->height, - 0, 0, - priv->stride, - priv->bo->virtual); - priv->offscreen = 0; - - /* Copy the current contents of the pixmap to the bo. */ - gc = GetScratchGC(drawable->depth, screen); - if (gc) { - ValidateGC(&pixmap->drawable, gc); - gc->ops->CopyArea(drawable, &pixmap->drawable, - gc, - 0, 0, - drawable->width, - drawable->height, - 0, 0); - FreeScratchGC(gc); - } - - intel_set_pixmap_private(pixmap, NULL); - screen->DestroyPixmap(pixmap); - - /* Redirect 2D rendering to the uncached GTT map of the bo */ - screen->ModifyPixmapHeader(old, - drawable->width, - drawable->height, - 0, 0, - priv->stride, - priv->bo->virtual); - - /* And redirect the pixmap to the new bo (for 3D). */ - intel_set_pixmap_private(old, priv); - old->refcnt++; - - intel_get_screen_private(xf86ScreenToScrn(screen))->needs_flush = TRUE; - return old; -} - #if DRI2INFOREC_VERSION < 2 static DRI2BufferPtr I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments, @@ -324,12 +237,8 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments, goto unwind; } - if (attachment == DRI2BufferFrontLeft) { - if (!is_glamor_pixmap) - pixmap = fixup_shadow(drawable, pixmap); - else - pixmap = fixup_glamor(drawable, pixmap); - } + if (attachment == DRI2BufferFrontLeft) + pixmap = fixup_glamor(drawable, pixmap); } if (attachments[i] == DRI2BufferDepth) @@ -482,12 +391,8 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment, free(buffer); return NULL; } - if (attachment == DRI2BufferFrontLeft) { - if (!is_glamor_pixmap) - pixmap = fixup_shadow(drawable, pixmap); - else - pixmap = fixup_glamor(drawable, pixmap); - } + if (attachment == DRI2BufferFrontLeft) + pixmap = fixup_glamor(drawable, pixmap); } buffer->attachment = attachment; @@ -638,38 +543,11 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion, * that will happen before the client tries to render * again. */ - /* Re-enable 2D acceleration... */ - if (intel->use_shadow) { - struct intel_pixmap *src_pixmap, *dst_pixmap; - - src_pixmap = intel_get_pixmap_private(get_drawable_pixmap(src)); - if (src_pixmap) { - src_pixmap->offscreen = 1; - src_pixmap->busy = 1; - } + gc->ops->CopyArea(src, dst, gc, + 0, 0, + drawable->width, drawable->height, + 0, 0); - dst_pixmap = intel_get_pixmap_private(get_drawable_pixmap(dst)); - if (dst_pixmap) { - dst_pixmap->offscreen = 1; - dst_pixmap->busy = 1; - } - - gc->ops->CopyArea(src, dst, gc, - 0, 0, - drawable->width, drawable->height, - 0, 0); - - /* and restore 2D/3D coherency */ - if (src_pixmap) - src_pixmap->offscreen = 0; - if (dst_pixmap) - dst_pixmap->offscreen = 0; - } else { - gc->ops->CopyArea(src, dst, gc, - 0, 0, - drawable->width, drawable->height, - 0, 0); - } FreeScratchGC(gc); } diff --git a/src/intel_driver.c b/src/intel_driver.c index 78f7ce39..89b72d89 100644 --- a/src/intel_driver.c +++ b/src/intel_driver.c @@ -569,23 +569,12 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags) intel->tiling &= ~INTEL_TILING_2D; if (xf86ReturnOptValBool(intel->Options, OPTION_TILING_FB, FALSE)) intel->tiling &= ~INTEL_TILING_FB; - - intel->can_blt = can_accelerate_blt(intel); - intel->has_kernel_flush = has_kernel_flush(intel); - intel->use_shadow = !intel->can_blt; - - if (xf86IsOptionSet(intel->Options, OPTION_SHADOW)) { - intel->use_shadow = - xf86ReturnOptValBool(intel->Options, - OPTION_SHADOW, - FALSE); + if (!can_accelerate_blt(intel)) { + intel->force_fallback = true; + intel->tiling &= ~INTEL_TILING_FB; } - if (intel->use_shadow) { - xf86DrvMsg(scrn->scrnIndex, X_CONFIG, - "Shadow buffer enabled," - " 2D GPU acceleration disabled.\n"); - } + intel->has_kernel_flush = has_kernel_flush(intel); intel->has_relaxed_fencing = xf86ReturnOptValBool(intel->Options, @@ -1126,26 +1115,11 @@ static Bool I830CloseScreen(CLOSE_SCREEN_ARGS_DECL) } if (intel->front_buffer) { - if (!intel->use_shadow) - intel_set_pixmap_bo(screen->GetScreenPixmap(screen), - NULL); intel_mode_remove_fb(intel); drm_intel_bo_unreference(intel->front_buffer); intel->front_buffer = NULL; } - if (intel->shadow_buffer) { - free(intel->shadow_buffer); - intel->shadow_buffer = 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); if (INTEL_INFO(intel)->gen >= 40) diff --git a/src/intel_options.c b/src/intel_options.c index 2e112f9a..77832aad 100644 --- a/src/intel_options.c +++ b/src/intel_options.c @@ -31,7 +31,6 @@ const OptionInfoRec intel_options[] = { {OPTION_DEBUG_FLUSH_CACHES, "DebugFlushCaches", OPTV_BOOLEAN, {0}, 0}, {OPTION_DEBUG_WAIT, "DebugWait", OPTV_BOOLEAN, {0}, 0}, {OPTION_BUFFER_CACHE, "BufferCache", OPTV_BOOLEAN, {0}, 1}, - {OPTION_SHADOW, "Shadow", OPTV_BOOLEAN, {0}, 0}, {OPTION_TRIPLE_BUFFER, "TripleBuffer", OPTV_BOOLEAN, {0}, 1}, #endif {-1, NULL, OPTV_NONE, {0}, 0} diff --git a/src/intel_options.h b/src/intel_options.h index 8d0312c4..233908c3 100644 --- a/src/intel_options.h +++ b/src/intel_options.h @@ -37,7 +37,6 @@ enum intel_options { OPTION_DEBUG_FLUSH_CACHES, OPTION_DEBUG_WAIT, OPTION_BUFFER_CACHE, - OPTION_SHADOW, OPTION_TRIPLE_BUFFER, #endif NUM_OPTIONS, diff --git a/src/intel_shadow.c b/src/intel_shadow.c deleted file mode 100644 index 6892567d..00000000 --- a/src/intel_shadow.c +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************** - -Copyright 2010 Intel Corporation -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -*/ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "xf86.h" -#include "intel.h" -#include "i830_reg.h" - -static dri_bo * -intel_shadow_create_bo(intel_screen_private *intel, - int16_t x1, int16_t y1, - int16_t x2, int16_t y2, - int *pitch) -{ - int w = x2 - x1, h = y2 - y1; - int size = h * w * intel->cpp; - dri_bo *bo; - - 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_buffer; - int src_pitch = intel->shadow_stride; - int row_length = w * intel->cpp; - int num_rows = h; - src += y1 * src_pitch + x1 * intel->cpp; - do { - memcpy (dst, src, row_length); - src += src_pitch; - dst += row_length; - } while (--num_rows); - drm_intel_gem_bo_unmap_gtt(bo); - } - - *pitch = w * intel->cpp; - return bo; -} - -static void intel_shadow_memcpy(intel_screen_private *intel) -{ - char *src_data, *dst_data; - unsigned int src_pitch, dst_pitch; - RegionPtr region; - BoxPtr box; - int n; - - if (drm_intel_gem_bo_map_gtt(intel->front_buffer)) - return; - - src_data = intel->shadow_buffer; - dst_data = intel->front_buffer->virtual; - - src_pitch = intel->shadow_stride; - dst_pitch = intel->front_pitch; - - region = DamageRegion(intel->shadow_damage); - box = REGION_RECTS(region); - n = REGION_NUM_RECTS(region); - while (n--) { - char *src = src_data + box->y1*src_pitch + box->x1*intel->cpp; - char *dst = dst_data + box->y1*dst_pitch + box->x1*intel->cpp; - int len = (box->x2 - box->x1)*intel->cpp; - int row = box->y2 - box->y1; - while (row--) { - memcpy(dst, src, len); - src += src_pitch; - dst += dst_pitch; - } - box++; - } -} - -void intel_shadow_blt(intel_screen_private *intel) -{ - ScrnInfoPtr scrn = intel->scrn; - uint32_t blt, br13; - RegionPtr region; - BoxPtr box; - int n; - - /* Can we trust the BLT? Otherwise do an uncached mmecy. */ - if (!intel->can_blt || IS_GEN2(intel)) { - intel_shadow_memcpy(intel); - return; - } - - - blt = XY_SRC_COPY_BLT_CMD; - - br13 = intel->front_pitch; - if (intel->front_tiling && INTEL_INFO(intel)->gen >= 40) { - br13 >>= 2; - blt |= XY_SRC_COPY_BLT_DST_TILED; - } - switch (intel->cpp) { - default: - case 4: blt |= - XY_SRC_COPY_BLT_WRITE_ALPHA | XY_SRC_COPY_BLT_WRITE_RGB; - br13 |= 1 << 25; /* RGB8888 */ - case 2: br13 |= 1 << 24; /* RGB565 */ - case 1: break; - } - br13 |= 0xcc << 16; /* copy */ - - region = DamageRegion(intel->shadow_damage); - box = REGION_RECTS(region); - n = REGION_NUM_RECTS(region); - while (n--) { - int pitch; - dri_bo *bo; - - bo = intel_shadow_create_bo(intel, - box->x1, box->y1, - box->x2, box->y2, - &pitch); - if (bo == NULL) - return; - - BEGIN_BATCH_BLT(8); - OUT_BATCH(blt); - OUT_BATCH(br13); - OUT_BATCH(box->y1 << 16 | box->x1); - OUT_BATCH(box->y2 << 16 | box->x2); - OUT_RELOC_FENCED(intel->front_buffer, - I915_GEM_DOMAIN_RENDER, - I915_GEM_DOMAIN_RENDER, - 0); - OUT_BATCH(0); - OUT_BATCH(pitch); - OUT_RELOC(bo, I915_GEM_DOMAIN_RENDER, 0, 0); - - ADVANCE_BATCH(); - - drm_intel_bo_unreference(bo); - box++; - } -} - -void intel_shadow_create(struct intel_screen_private *intel) -{ - ScrnInfoPtr scrn = intel->scrn; - ScreenPtr screen = scrn->pScreen; - PixmapPtr pixmap; - int stride; - void *buffer; - - pixmap = screen->GetScreenPixmap(screen); - stride = intel->cpp*scrn->virtualX; - buffer = malloc(stride * scrn->virtualY); - if (buffer && - screen->ModifyPixmapHeader(pixmap, - scrn->virtualX, scrn->virtualY, - -1, -1, - stride, buffer)) { - free(intel->shadow_buffer); - intel->shadow_buffer = buffer; - } else { - free(buffer); - stride = intel->shadow_stride; - } - - 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; -} diff --git a/src/intel_uxa.c b/src/intel_uxa.c index 383efc56..5aad062c 100644 --- a/src/intel_uxa.c +++ b/src/intel_uxa.c @@ -989,12 +989,6 @@ static void intel_throttle(intel_screen_private *intel) void intel_uxa_block_handler(intel_screen_private *intel) { - if (intel->shadow_damage && - pixman_region_not_empty(DamageRegion(intel->shadow_damage))) { - intel_shadow_blt(intel); - DamageEmpty(intel->shadow_damage); - } - /* Emit a flush of the rendering cache, or on the 965 * and beyond rendering results may not hit the * framebuffer until significantly later. @@ -1025,9 +1019,6 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth, if (depth == 1 || intel->force_fallback) return fbCreatePixmap(screen, w, h, depth, usage); - if (intel->use_shadow && (usage & INTEL_CREATE_PIXMAP_DRI2) == 0) - return fbCreatePixmap(screen, w, h, depth, usage); - if (usage == CREATE_PIXMAP_USAGE_GLYPH_PICTURE && w <= 32 && h <= 32) return fbCreatePixmap(screen, w, h, depth, usage); @@ -1147,6 +1138,7 @@ static Bool intel_uxa_destroy_pixmap(PixmapPtr pixmap) Bool intel_uxa_create_screen_resources(ScreenPtr screen) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + PixmapPtr pixmap = screen->GetScreenPixmap(screen); intel_screen_private *intel = intel_get_screen_private(scrn); dri_bo *bo = intel->front_buffer; @@ -1155,20 +1147,16 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen) drm_intel_gem_bo_map_gtt(bo); - if (intel->use_shadow) { - intel_shadow_create(intel); - } else { - PixmapPtr pixmap = screen->GetScreenPixmap(screen); - intel_set_pixmap_bo(pixmap, bo); - intel_get_pixmap_private(pixmap)->pinned = 1; - screen->ModifyPixmapHeader(pixmap, - scrn->virtualX, - scrn->virtualY, - -1, -1, - intel->front_pitch, - NULL); - scrn->displayWidth = intel->front_pitch / intel->cpp; - } + pixmap = screen->GetScreenPixmap(screen); + intel_set_pixmap_bo(pixmap, bo); + intel_get_pixmap_private(pixmap)->pinned = 1; + screen->ModifyPixmapHeader(pixmap, + scrn->virtualX, + scrn->virtualY, + -1, -1, + intel->front_pitch, + NULL); + scrn->displayWidth = intel->front_pitch / intel->cpp; if (!intel_glamor_create_screen_resources(screen)) return FALSE; diff --git a/src/intel_video.c b/src/intel_video.c index 0e9845d7..c8a9a924 100644 --- a/src/intel_video.c +++ b/src/intel_video.c @@ -353,8 +353,7 @@ void I830InitVideo(ScreenPtr screen) * supported hardware. */ if (scrn->bitsPerPixel >= 16 && - INTEL_INFO(intel)->gen >= 30 && - !intel->use_shadow) { + INTEL_INFO(intel)->gen >= 30) { texturedAdaptor = I830SetupImageVideoTextured(screen); if (texturedAdaptor != NULL) { xf86DrvMsg(scrn->scrnIndex, X_INFO, |