diff --git a/src/radeon_exa.c b/src/radeon_exa.c index 99a93a4..37dba09 100644 --- a/src/radeon_exa.c +++ b/src/radeon_exa.c @@ -384,6 +384,18 @@ void RADEONFinishAccess_CS(PixmapPtr pPix, int index) pPix->devPrivate.ptr = NULL; } +/* If BO creation in VRAM fails, retry without specific domain */ +static struct radeon_bo* +RADEONCreatePixmapBO(RADEONInfoPtr info, int size, int align) +{ + struct radeon_bo *bo = radeon_bo_open(info->bufmgr, 0, size, align, + RADEON_GEM_DOMAIN_VRAM, 0); + + if (bo) + return bo; + + return radeon_bo_open(info->bufmgr, 0, size, align, 0, 0); +} void *RADEONEXACreatePixmap(ScreenPtr pScreen, int size, int align) { @@ -398,8 +410,7 @@ void *RADEONEXACreatePixmap(ScreenPtr pScreen, int size, int align) if (size == 0) return new_priv; - new_priv->bo = radeon_bo_open(info->bufmgr, 0, size, align, - RADEON_GEM_DOMAIN_VRAM, 0); + new_priv->bo = RADEONCreatePixmapBO(info, size, align); if (!new_priv->bo) { xfree(new_priv); ErrorF("Failed to alloc memory\n"); @@ -450,8 +461,7 @@ void *RADEONEXACreatePixmap2(ScreenPtr pScreen, int width, int height, *new_pitch = padded_width; - new_priv->bo = radeon_bo_open(info->bufmgr, 0, size, 0, - RADEON_GEM_DOMAIN_VRAM, 0); + new_priv->bo = RADEONCreatePixmapBO(info, size, 0); if (!new_priv->bo) { xfree(new_priv); ErrorF("Failed to alloc memory\n");