summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-02-24 20:34:10 -0800
committerEric Anholt <eric@anholt.net>2009-02-26 14:20:42 -0800
commitd7aa330db31100b7cb54d8165f9a4b94329ece32 (patch)
treef9da09e7ec9fbfdfeeb302ee4f6d02a7da2b1081
parenta625a07022ea7f6757b288fcc2ffb9e27c7f8341 (diff)
Fix up i915 composite and common solid/copy code to use check_aperture.
This could fix complaints about binding BOs and resulting failure to render.
-rw-r--r--src/i830.h2
-rw-r--r--src/i830_exa.c30
-rw-r--r--src/i915_render.c9
3 files changed, 41 insertions, 0 deletions
diff --git a/src/i830.h b/src/i830.h
index eb686ae8..3f108926 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 b8784026..d691f3d8 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 5dd97e6e..4190808f 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");