diff --git a/src/i830_memory.c b/src/i830_memory.c index 0a2faeb..a332386 100644 --- a/src/i830_memory.c +++ b/src/i830_memory.c @@ -154,6 +154,24 @@ i830_get_fence_size(ScrnInfoPtr pScrn, unsigned long size) } static Bool +i830_display_stride_ok(ScrnInfoPtr pScrn, int stride, Bool tiling) +{ + I830Ptr pI830 = I830PTR(pScrn); + int limit = KB(32); + + if (IS_845G(pI830) || IS_I85X(pI830)) + limit = KB(12); /* this is from testing, spec has 8K limit */ + + if (IS_I915(pI830) && tiling) + limit = KB(8); + + if (stride <= limit) + return TRUE; + else + return FALSE; +} + +static Bool i830_bind_memory(ScrnInfoPtr pScrn, i830_memory *mem) { I830Ptr pI830 = I830PTR(pScrn); @@ -1189,6 +1207,12 @@ i830_allocate_framebuffer(ScrnInfoPtr pScrn, I830Ptr pI830, BoxPtr FbMemBox, else tiling = pI830->tiling; + if (!i830_display_stride_ok(pScrn, pitch, tiling)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Front buffer stride %d kB " + "exceed display limit\n", pitch/1024); + return NULL; + } + /* Attempt to allocate it tiled first if we have page flipping on. */ if (tiling && IsTileable(pScrn, pitch)) { /* XXX: probably not the case on 965 */