sna: Check picture format on destination before beginning a GPU operation
This is more important in the multiple stage operations like glyph rendering where we do not want to initiate an operation on the GPU only then to fallback due to an incompatible destination. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
parent
e96520327b
commit
9ea242c275
|
|
@ -696,8 +696,8 @@ sna_composite(CARD8 op,
|
|||
goto fallback;
|
||||
}
|
||||
|
||||
if (dst->alphaMap) {
|
||||
DBG(("%s: fallback due to unhandled alpha-map\n", __FUNCTION__));
|
||||
if (!can_render_to_picture(dst)) {
|
||||
DBG(("%s: fallback due to unhandled picture\n", __FUNCTION__));
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
|
|
@ -956,8 +956,8 @@ sna_composite_rectangles(CARD8 op,
|
|||
if (wedged(sna))
|
||||
goto fallback;
|
||||
|
||||
if (dst->alphaMap) {
|
||||
DBG(("%s: fallback, dst has an alpha-map\n", __FUNCTION__));
|
||||
if (!can_render_to_picture(dst)) {
|
||||
DBG(("%s: fallback, dst has an incompatible picture\n", __FUNCTION__));
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1971,8 +1971,8 @@ sna_glyphs(CARD8 op,
|
|||
goto fallback;
|
||||
}
|
||||
|
||||
if (dst->alphaMap) {
|
||||
DBG(("%s: fallback -- dst alpha map\n", __FUNCTION__));
|
||||
if (!can_render_to_picture(dst)) {
|
||||
DBG(("%s: fallback -- dst incompatible picture\n", __FUNCTION__));
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
|
|
@ -2301,8 +2301,8 @@ sna_glyphs__shared(CARD8 op,
|
|||
goto fallback;
|
||||
}
|
||||
|
||||
if (dst->alphaMap) {
|
||||
DBG(("%s: fallback -- dst alpha map\n", __FUNCTION__));
|
||||
if (!can_render_to_picture(dst)) {
|
||||
DBG(("%s: fallback -- incompatible picture\n", __FUNCTION__));
|
||||
goto fallback;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,30 @@ too_small(struct sna_pixmap *priv)
|
|||
return (priv->create & KGEM_CAN_CREATE_GPU) == 0;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
can_render_to_picture(PicturePtr dst)
|
||||
{
|
||||
if (dst->alphaMap) {
|
||||
DBG(("%s(pixmap=%ld) -- no, has alphamap\n", __FUNCTION__,
|
||||
get_drawable_pixmap(dst->pDrawable)->drawable.serialNumber));
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (PICT_FORMAT_TYPE(dst->format)) {
|
||||
case PICT_TYPE_COLOR:
|
||||
case PICT_TYPE_GRAY:
|
||||
case PICT_TYPE_OTHER:
|
||||
DBG(("%s(pixmap=%ld) -- no, has palette\n", __FUNCTION__,
|
||||
get_drawable_pixmap(dst->pDrawable)->drawable.serialNumber));
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static inline bool
|
||||
is_gpu_dst(struct sna_pixmap *priv)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue