summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-09-25 20:38:49 +0200
committerMichel Dänzer <daenzer@vmware.com>2009-09-25 20:38:49 +0200
commitac2e0ddcd8f33505aee20e94dd64a804812f07fb (patch)
tree07100e01773de8533aa4165982360b0dd6eb3207 /src/gallium
parentb97547027e0f049d1ceef7863815d53e471fb18c (diff)
st/xorg: Flesh out EXA PrepareComposite hook a little.
Check that the formats are supported, and don't crash with source-only pictures.
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 94f4ea2c386..c3fff954665 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -438,17 +438,43 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa = ms->exa;
+ struct exa_pixmap_priv *priv;
debug_printf("ExaPrepareComposite\n");
+ priv = exaGetPixmapDriverPrivate(pDst);
+ if (!priv || !priv->tex ||
+ !exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
+ priv->tex->target,
+ PIPE_TEXTURE_USAGE_RENDER_TARGET, 0))
+ return FALSE;
+
+ if (pSrc) {
+ priv = exaGetPixmapDriverPrivate(pSrc);
+ if (!priv || !priv->tex ||
+ !exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
+ priv->tex->target,
+ PIPE_TEXTURE_USAGE_SAMPLER, 0))
+ return FALSE;
+ }
+
+ if (pMask) {
+ priv = exaGetPixmapDriverPrivate(pMask);
+ if (!priv || !priv->tex ||
+ !exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
+ priv->tex->target,
+ PIPE_TEXTURE_USAGE_SAMPLER, 0))
+ return FALSE;
+ }
+
#if DISABLE_ACCEL
(void) exa;
return FALSE;
#else
return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture,
pDstPicture,
- exaGetPixmapDriverPrivate(pSrc),
- exaGetPixmapDriverPrivate(pMask),
+ pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL,
+ pMask ? exaGetPixmapDriverPrivate(pMask) : NULL,
exaGetPixmapDriverPrivate(pDst));
#endif
}