#include "util/u_rect.h"
#define DEBUG_PRINT 0
-#define ACCEL_ENABLED TRUE
/*
* Helper functions
*/
-#if DEBUG_PRINT
struct render_format_str {
int format;
const char *name;
};
static const struct render_format_str formats_info[] =
{
- {PICT_a2r10g10b10, "PICT_a2r10g10b10"},
- {PICT_x2r10g10b10, "PICT_x2r10g10b10"},
- {PICT_a2b10g10r10, "PICT_a2b10g10r10"},
- {PICT_x2b10g10r10, "PICT_x2b10g10r10"},
{PICT_a8r8g8b8, "PICT_a8r8g8b8"},
{PICT_x8r8g8b8, "PICT_x8r8g8b8"},
{PICT_a8b8g8r8, "PICT_a8b8g8r8"},
{PICT_x8b8g8r8, "PICT_x8b8g8r8"},
+#ifdef PICT_TYPE_BGRA
{PICT_b8g8r8a8, "PICT_b8g8r8a8"},
{PICT_b8g8r8x8, "PICT_b8g8r8x8"},
+ {PICT_a2r10g10b10, "PICT_a2r10g10b10"},
+ {PICT_x2r10g10b10, "PICT_x2r10g10b10"},
+ {PICT_a2b10g10r10, "PICT_a2b10g10r10"},
+ {PICT_x2b10g10r10, "PICT_x2b10g10r10"},
+#endif
{PICT_r8g8b8, "PICT_r8g8b8"},
{PICT_b8g8r8, "PICT_b8g8r8"},
{PICT_r5g6b5, "PICT_r5g6b5"},
}
return NULL;
}
-#endif
static void
exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp, int *picture_format)
static void
ExaWaitMarker(ScreenPtr pScreen, int marker)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- modesettingPtr ms = modesettingPTR(pScrn);
- struct exa_context *exa = ms->exa;
-
-#if 0
- xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, NULL);
-#else
- xorg_exa_finish(exa);
-#endif
+ /* Nothing to do, handled in the PrepareAccess hook */
}
static int
if (!priv || !priv->tex)
return FALSE;
+ /* make sure that any pending operations are flushed to hardware */
+ if (exa->pipe->is_texture_referenced(exa->pipe, priv->tex, 0, 0) &
+ (PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE))
+ xorg_exa_flush(exa, 0, NULL);
+
transfer = exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0,
PIPE_TRANSFER_WRITE, x, y, w, h);
if (!transfer)
XORG_FALLBACK("format %s", pf_name(priv->tex->format));
}
- return ACCEL_ENABLED && xorg_solid_bind_state(exa, priv, fg);
+ return exa->accel && xorg_solid_bind_state(exa, priv, fg);
}
static void
exa->copy.src = src_priv;
exa->copy.dst = priv;
- return ACCEL_ENABLED;
+ return exa->accel;
}
static void
width, height);
}
+static Bool
+picture_check_formats(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture)
+{
+ if (pSrc->picture_format == pSrcPicture->format)
+ return TRUE;
+
+ if (pSrc->picture_format != PICT_a8r8g8b8)
+ return FALSE;
+
+ /* pSrc->picture_format == PICT_a8r8g8b8 */
+ switch (pSrcPicture->format) {
+ case PICT_a8r8g8b8:
+ case PICT_x8r8g8b8:
+ case PICT_a8b8g8r8:
+ case PICT_x8b8g8r8:
+ /* just treat these two as x8... */
+ case PICT_r8g8b8:
+ case PICT_b8g8r8:
+ return TRUE;
+#ifdef PICT_TYPE_BGRA
+ case PICT_b8g8r8a8:
+ case PICT_b8g8r8x8:
+ return FALSE; /* does not support swizzleing the alpha channel yet */
+ case PICT_a2r10g10b10:
+ case PICT_x2r10g10b10:
+ case PICT_a2b10g10r10:
+ case PICT_x2b10g10r10:
+ return FALSE;
+#endif
+ default:
+ return FALSE;
+ }
+ return FALSE;
+}
+
static Bool
ExaPrepareComposite(int op, PicturePtr pSrcPicture,
PicturePtr pMaskPicture, PicturePtr pDstPicture,
PIPE_TEXTURE_USAGE_SAMPLER, 0))
XORG_FALLBACK("pSrc format: %s", pf_name(priv->tex->format));
- if (priv->picture_format != pSrcPicture->format)
+ if (!picture_check_formats(priv, pSrcPicture))
XORG_FALLBACK("pSrc pic_format: %s != %s",
render_format_name(priv->picture_format),
render_format_name(pSrcPicture->format));
+
+ if (priv->picture_format == PICT_a8)
+ XORG_FALLBACK("pSrc pic_format == PICT_a8");
}
if (pMask) {
PIPE_TEXTURE_USAGE_SAMPLER, 0))
XORG_FALLBACK("pMask format: %s", pf_name(priv->tex->format));
- if (priv->picture_format != pMaskPicture->format)
+ if (!picture_check_formats(priv, pMaskPicture))
XORG_FALLBACK("pMask pic_format: %s != %s",
render_format_name(priv->picture_format),
render_format_name(pMaskPicture->format));
}
- return ACCEL_ENABLED &&
+ return exa->accel &&
xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture,
pDstPicture,
pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL,
PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
+ ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum];
+ modesettingPtr ms = modesettingPTR(pScrn);
+ struct exa_context *exa = ms->exa;
boolean accelerated = xorg_composite_accelerated(op,
pSrcPicture,
pMaskPicture,
debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n",
op, pSrcPicture, pMaskPicture, pDstPicture, accelerated);
#endif
- return ACCEL_ENABLED && accelerated;
+ return exa->accel && accelerated;
}
static void *
bitsPerPixel, devKind, NULL);
/* Deal with screen resize */
- if (!priv->tex ||
- (priv->tex->width[0] != width ||
- priv->tex->height[0] != height ||
- priv->tex_flags != priv->flags)) {
+ if ((exa->accel || priv->flags) &&
+ (!priv->tex ||
+ (priv->tex->width[0] != width ||
+ priv->tex->height[0] != height ||
+ priv->tex_flags != priv->flags))) {
struct pipe_texture *texture = NULL;
struct pipe_texture template;
}
void *
-xorg_exa_init(ScrnInfoPtr pScrn)
+xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
{
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa;
ms->ctx = exa->pipe;
exa->renderer = renderer_create(exa->pipe);
+ exa->accel = accel;
return (void *)exa;