[Intel-gfx] [PATCH] Fix up i915 composite and common solid/copy code to use check_aperture.

Eric Anholt eric at anholt.net
Wed Feb 25 07:42:42 CET 2009


This could fix complaints about binding BOs and resulting failure to render.
---
 src/i830.h        |    2 ++
 src/i830_exa.c    |   30 ++++++++++++++++++++++++++++++
 src/i915_render.c |    9 +++++++++
 3 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/src/i830.h b/src/i830.h
index 7904b9f..8d3f0a3 100644
--- a/src/i830.h
+++ b/src/i830.h
@@ -87,6 +87,8 @@ unsigned long long I830TexOffsetStart(PixmapPtr pPix);
 Bool i830_uxa_init(ScreenPtr pScreen);
 void i830_uxa_create_screen_resources(ScreenPtr pScreen);
 void i830_uxa_block_handler (ScreenPtr pScreen);
+Bool i830_get_aperture_space(ScrnInfoPtr pScrn, drm_intel_bo **bo_table,
+			     int num_bos);
 #endif
 
 #if defined(I830_USE_UXA) || defined(I830_USE_EXA)
diff --git a/src/i830_exa.c b/src/i830_exa.c
index b878402..d691f3d 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -121,6 +121,21 @@ i830_pixmap_tiled(PixmapPtr pPixmap)
     return FALSE;
 }
 
+Bool
+i830_get_aperture_space(ScrnInfoPtr pScrn, drm_intel_bo **bo_table, int num_bos)
+{
+    I830Ptr pI830 = I830PTR(pScrn);
+
+    bo_table[0] = pI830->batch_bo;
+    if (drm_intel_bufmgr_check_aperture_space(bo_table, num_bos) != 0) {
+	intel_batch_flush(pScrn, FALSE);
+	bo_table[0] = pI830->batch_bo;
+	if (drm_intel_bufmgr_check_aperture_space(bo_table, num_bos) != 0)
+	    I830FALLBACK("Couldn't get aperture space for BOs\n");
+    }
+    return TRUE;
+}
+
 static unsigned long
 i830_pixmap_pitch(PixmapPtr pixmap)
 {
@@ -178,6 +193,10 @@ I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
     ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
     unsigned long pitch;
+    drm_intel_bo *bo_table[] = {
+	NULL, /* batch_bo */
+	i830_get_pixmap_bo(pPixmap),
+    };
 
     if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planemask))
 	I830FALLBACK("planemask is not solid");
@@ -195,6 +214,9 @@ I830EXAPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planemask, Pixel fg)
     if (!i830_pixmap_pitch_is_aligned(pPixmap))
 	I830FALLBACK("pixmap pitch not aligned");
 
+    if (!i830_get_aperture_space(pScrn, bo_table, ARRAY_SIZE(bo_table)))
+	return FALSE;
+
     pI830->BR[13] = (I830PatternROP[alu] & 0xff) << 16 ;
     switch (pPixmap->drawable.bitsPerPixel) {
 	case 8:
@@ -272,6 +294,11 @@ I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
 {
     ScrnInfoPtr pScrn = xf86Screens[pDstPixmap->drawable.pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
+    drm_intel_bo *bo_table[] = {
+	NULL, /* batch_bo */
+	i830_get_pixmap_bo(pSrcPixmap),
+	i830_get_pixmap_bo(pDstPixmap),
+    };
 
     if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planemask))
 	I830FALLBACK("planemask is not solid");
@@ -279,6 +306,9 @@ I830EXAPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
     if (pDstPixmap->drawable.bitsPerPixel < 8)
 	I830FALLBACK("under 8bpp pixmaps unsupported\n");
 
+    if (!i830_get_aperture_space(pScrn, bo_table, ARRAY_SIZE(bo_table)))
+	return FALSE;
+
     i830_exa_check_pitch_2d(pSrcPixmap);
     i830_exa_check_pitch_2d(pDstPixmap);
 
diff --git a/src/i915_render.c b/src/i915_render.c
index 5dd97e6..4190808 100644
--- a/src/i915_render.c
+++ b/src/i915_render.c
@@ -315,6 +315,12 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
 {
     ScrnInfoPtr pScrn = xf86Screens[pSrcPicture->pDrawable->pScreen->myNum];
     I830Ptr pI830 = I830PTR(pScrn);
+    drm_intel_bo *bo_table[] = {
+	NULL, /* batch_bo */
+	i830_get_pixmap_bo(pSrc),
+	pMask ? i830_get_pixmap_bo(pMask) : NULL,
+	i830_get_pixmap_bo(pDst),
+    };
 
     i830_exa_check_pitch_3d(pSrc);
     if (pMask)
@@ -325,6 +331,9 @@ i915_prepare_composite(int op, PicturePtr pSrcPicture,
 			      &pI830->i915_render_state.dst_format))
 	return FALSE;
 
+    if (!i830_get_aperture_space(pScrn, bo_table, ARRAY_SIZE(bo_table)))
+	return FALSE;
+
     pI830->i915_render_state.is_nearest = FALSE;
     if (!i915_texture_setup(pSrcPicture, pSrc, 0))
 	I830FALLBACK("fail to setup src texture\n");
-- 
1.5.6.5




More information about the Intel-gfx mailing list