diff --git a/src/i830_display.c b/src/i830_display.c index 6fe7be7..83ae08d 100644 --- a/src/i830_display.c +++ b/src/i830_display.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "xf86.h" #include "i830.h" @@ -498,6 +499,51 @@ i830_pipe_a_require_deactivate (ScrnInfoPtr scrn) return; } +#define FBC_TAG0 0x3300 +#define FBC_NUM_TAGS 49 +#define FBC_TAG_MODIFIED 0 +#define FBC_TAG_UNCOMPRESSED 1 +#define FBC_TAG_UNCOMPRESSIBLE 2 +#define FBC_TAG_COMPRESSED 3 +static void i830_fbc_dump_tags(void) +{ + ScrnInfoPtr pScrn = xf86Screens[0]; + I830Ptr pI830 = I830PTR(pScrn); + uint32_t tag[FBC_NUM_TAGS]; + int modified = 0, uncompressed = 0, uncompressible = 0, compressed = 0; + int i, j; + + for (i = 0; i < FBC_NUM_TAGS; i++) { + tag[i] = INREG(FBC_TAG0 + i); + for (j = 0; j < 32; j += 2) { + uint32_t val = (tag[i] >> j) & 3; + /* Each value corresponds to a status for two lines */ + if (val == FBC_TAG_MODIFIED) + modified += 2; + else if (val == FBC_TAG_UNCOMPRESSED) + uncompressed += 2; + else if (val == FBC_TAG_UNCOMPRESSIBLE) + uncompressible += 2; + else if (val == FBC_TAG_COMPRESSED) + compressed += 2; + } + } + + ErrorF("FBC_CONTROL: 0x%08x\n", INREG(FBC_CONTROL)); + ErrorF("FBC_STATUS: 0x%08x\n", INREG(FBC_STATUS)); + ErrorF("FBC TAG status:\n"); + ErrorF("\tmodified: %d\n", modified); + ErrorF("\tuncompressed: %d\n", uncompressed); + ErrorF("\tuncompressible: %d\n", uncompressible); + ErrorF("\tcompressed: %d\n", compressed); +} + +static void fbc_debug(int signo) +{ + i830_fbc_dump_tags(); + alarm(5); +} + static Bool i830_use_fb_compression(xf86CrtcPtr crtc) { @@ -595,6 +641,11 @@ i830_enable_fb_compression(xf86CrtcPtr crtc) xf86DrvMsg(pScrn->scrnIndex, X_INFO, "fbc enabled on plane %c\n", pipe ? 'b' : 'a'); + { + struct sigaction debug = { .sa_handler = fbc_debug }; + sigaction(SIGALRM, &debug, NULL); + alarm(5); + } } static void diff --git a/src/i830_exa.c b/src/i830_exa.c index 88853a7..4ae235b 100644 --- a/src/i830_exa.c +++ b/src/i830_exa.c @@ -98,9 +98,14 @@ const int I830PatternROP[16] = }; static Bool -exaPixmapInFrontbuffer(PixmapPtr p) +exaPixmapTiled(PixmapPtr p) { ScreenPtr pScreen = p->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + I830Ptr pI830 = I830PTR(pScrn); + + if (!pI830->tiling) + return FALSE; if (p == pScreen->GetScreenPixmap(pScreen)) return TRUE; @@ -147,7 +152,7 @@ I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg) I830FALLBACK("pixmap offset not aligned"); if ( pitch % pI830->EXADriverPtr->pixmapPitchAlign != 0) I830FALLBACK("pixmap pitch not aligned"); - if ( pI830->tiling && offset > 4096) + if ( exaPixmapTiled(pPixmap) && offset > 4096) I830FALLBACK("offset limited to 4k for tiled targets"); pI830->BR[13] = (pitch & 0xffff); @@ -186,7 +191,7 @@ I830EXASolid(PixmapPtr pPixmap, int x1, int y1, int x2, int y2) if (pPixmap->drawable.bitsPerPixel == 32) cmd |= XY_COLOR_BLT_WRITE_ALPHA | XY_COLOR_BLT_WRITE_RGB; - if (pI830->tiling && exaPixmapInFrontbuffer(pPixmap)) { + if (exaPixmapTiled(pPixmap)) { /* Fixup pitch for destination if tiled */ pI830->BR[13] = (ROUND_TO(pI830->BR[13] & 0xffff, 512) >> 2) | (pI830->BR[13] & 0xffff0000); @@ -230,12 +235,11 @@ I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, pI830->copy_src_pitch = exaGetPixmapPitch(pSrcPixmap); pI830->copy_src_off = exaGetPixmapOffset(pSrcPixmap); - pI830->copy_src_tiled = (pI830->tiling && - exaPixmapInFrontbuffer(pSrcPixmap)); + pI830->copy_src_tiled = exaPixmapTiled(pSrcPixmap); if (pI830->copy_src_tiled && pI830->copy_src_off > 4096) I830FALLBACK("offset limited to 4k for tiled targets"); - if (pI830->tiling && exaPixmapInFrontbuffer(pDstPixmap) && + if (exaPixmapTiled(pDstPixmap) && exaGetPixmapOffset(pDstPixmap) > 4096) I830FALLBACK("offset limited to 4k for tiled targets"); @@ -278,7 +282,7 @@ I830EXACopy(PixmapPtr pDstPixmap, int src_x1, int src_y1, int dst_x1, if (pDstPixmap->drawable.bitsPerPixel == 32) cmd |= XY_SRC_COPY_BLT_WRITE_ALPHA | XY_SRC_COPY_BLT_WRITE_RGB; - if (pI830->tiling && exaPixmapInFrontbuffer(pDstPixmap)) { + if (exaPixmapTiled(pDstPixmap)) { /* Fixup pitch for destination if tiled */ pI830->BR[13] = (ROUND_TO(pI830->BR[13] & 0xffff, 512) >> 2) | (pI830->BR[13] & 0xffff0000); @@ -538,7 +542,7 @@ I830EXAInit(ScreenPtr pScreen) pI830->EXADriverPtr->PrepareComposite = i915_prepare_composite; pI830->EXADriverPtr->Composite = i830_composite; pI830->EXADriverPtr->DoneComposite = i830_done_composite; - } else { + } else if (!pI830->tiling) { pI830->EXADriverPtr->CheckComposite = i965_check_composite; pI830->EXADriverPtr->PrepareComposite = i965_prepare_composite; pI830->EXADriverPtr->Composite = i965_composite; diff --git a/src/i830_memory.c b/src/i830_memory.c