diff options
Diffstat (limited to 'src/i830_uxa.c')
-rw-r--r-- | src/i830_uxa.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/i830_uxa.c b/src/i830_uxa.c index eb35014e..ef7ac84a 100644 --- a/src/i830_uxa.c +++ b/src/i830_uxa.c @@ -627,6 +627,22 @@ i830_uxa_create_pixmap (ScreenPtr screen, int w, int h, int depth, unsigned usag * with drm_intel_bufmgr_check_aperture(). */ size = i830_get_fence_size(i830, stride * h); + assert(size >= stride * h); + } + + /* Fail very large allocations on 32-bit systems. Large BOs will + * tend to hit SW fallbacks frequently, and also will tend to fail + * to successfully map when doing SW fallbacks because we overcommit + * address space for BO access. + * + * Note that size should fit in 32 bits. We throw out >32767x32767x4, + * and pitch alignment could get us up to 32768x32767x4. + */ + if (sizeof(unsigned int) == 4 && + size > (unsigned int)(1024 * 1024 * 1024)) + { + fbDestroyPixmap (pixmap); + return NullPixmap; } bo = drm_intel_bo_alloc_for_render(i830->bufmgr, "pixmap", size, 0); |