summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@linux.intel.com>2012-04-06 11:02:36 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2012-04-12 15:53:06 +0800
commita65ea430b68354ba8521e7abd4aacdfc995e297f (patch)
tree79dcccf39350d27f2dc1d9c2666ff73452ed0255
parente5a5621c4849f6b7cbceaa5aeb525bc5cc1ec4ba (diff)
glamor_set_alu: Fallback for non GXcopy ops with GLES2.
As GLES2 doesn't support LogiOps, we have to fallback here. GLES2 programing guide's statement is as below: "In addition, LogicOp is removed as it is very infrequently used by applications and the OpenGL ES working group did not get requests from independent software vendors (ISVs) to support this feature in OpenGL ES 2.0." So, I think, fallback here may not a big deal ;). Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--src/glamor_copyarea.c6
-rw-r--r--src/glamor_fill.c5
-rw-r--r--src/glamor_pixmap.c16
-rw-r--r--src/glamor_priv.h2
-rw-r--r--src/glamor_putimage.c6
-rw-r--r--src/glamor_setspans.c6
-rw-r--r--src/glamor_tile.c5
7 files changed, 33 insertions, 13 deletions
diff --git a/src/glamor_copyarea.c b/src/glamor_copyarea.c
index b488037..a373d3d 100644
--- a/src/glamor_copyarea.c
+++ b/src/glamor_copyarea.c
@@ -194,7 +194,11 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
dispatch = glamor_get_dispatch(glamor_priv);
- glamor_set_alu(dispatch, alu);
+ if (!glamor_set_alu(dispatch, alu)) {
+ glamor_put_dispatch(glamor_priv);
+ return FALSE;
+ }
+
if (alu != GXcopy) {
glamor_set_destination_pixmap_priv_nc (src_pixmap_priv);
glamor_validate_pixmap(src_pixmap);
diff --git a/src/glamor_fill.c b/src/glamor_fill.c
index e8419c6..53c750a 100644
--- a/src/glamor_fill.c
+++ b/src/glamor_fill.c
@@ -189,7 +189,10 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
glamor_validate_pixmap(pixmap);
dispatch = glamor_get_dispatch(glamor_priv);
- glamor_set_alu(dispatch, alu);
+ if (!glamor_set_alu(dispatch, alu)) {
+ glamor_put_dispatch(glamor_priv);
+ return FALSE;
+ }
dispatch->glUseProgram(glamor_priv->solid_prog);
dispatch->glUniform4fv(glamor_priv->solid_color_uniform_location,
diff --git a/src/glamor_pixmap.c b/src/glamor_pixmap.c
index 4e8d6b8..35b2d56 100644
--- a/src/glamor_pixmap.c
+++ b/src/glamor_pixmap.c
@@ -144,15 +144,13 @@ glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask)
return GL_FALSE;
}
-
-
-void
+Bool
glamor_set_alu(struct glamor_gl_dispatch *dispatch, unsigned char alu)
{
#ifndef GLAMOR_GLES2
if (alu == GXcopy) {
dispatch->glDisable(GL_COLOR_LOGIC_OP);
- return;
+ return TRUE;
}
dispatch->glEnable(GL_COLOR_LOGIC_OP);
switch (alu) {
@@ -202,12 +200,16 @@ glamor_set_alu(struct glamor_gl_dispatch *dispatch, unsigned char alu)
dispatch->glLogicOp(GL_SET);
break;
default:
- FatalError("unknown logic op\n");
+ glamor_fallback("unsupported alu %x\n", alu);
+ return FALSE;
}
#else
- if (alu != GXcopy)
- ErrorF("unsupported alu %x \n", alu);
+ if (alu != GXcopy) {
+ glamor_fallback("unsupported alu %x\n", alu);
+ return FALSE;
+ }
#endif
+ return TRUE;
}
void *
diff --git a/src/glamor_priv.h b/src/glamor_priv.h
index 71d5bf0..bea4f66 100644
--- a/src/glamor_priv.h
+++ b/src/glamor_priv.h
@@ -468,7 +468,7 @@ glamor_pixmap_fbo *
glamor_es2_pixmap_read_prepare(PixmapPtr source, GLenum format,
GLenum type, int no_alpha, int revert, int swap_rb);
-void glamor_set_alu(struct glamor_gl_dispatch *dispatch,
+Bool glamor_set_alu(struct glamor_gl_dispatch *dispatch,
unsigned char alu);
Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask);
Bool glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
diff --git a/src/glamor_putimage.c b/src/glamor_putimage.c
index d270cae..010950e 100644
--- a/src/glamor_putimage.c
+++ b/src/glamor_putimage.c
@@ -321,7 +321,11 @@ _glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
dispatch = glamor_get_dispatch(glamor_priv);
- glamor_set_alu(dispatch, gc->alu);
+ if (!glamor_set_alu(dispatch, gc->alu)) {
+ glamor_put_dispatch(glamor_priv);
+ goto fail;
+ }
+
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
glamor_validate_pixmap(pixmap);
dispatch->glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
diff --git a/src/glamor_setspans.c b/src/glamor_setspans.c
index b6847a9..c5ecf85 100644
--- a/src/glamor_setspans.c
+++ b/src/glamor_setspans.c
@@ -75,7 +75,11 @@ _glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
glamor_get_drawable_deltas(drawable, dest_pixmap, &x_off, &y_off);
dispatch = glamor_get_dispatch(glamor_priv);
- glamor_set_alu(dispatch, gc->alu);
+ if (!glamor_set_alu(dispatch, gc->alu)) {
+ glamor_put_dispatch(glamor_priv);
+ goto fail;
+ }
+
for (i = 0; i < n; i++) {
n = REGION_NUM_RECTS(clip);
diff --git a/src/glamor_tile.c b/src/glamor_tile.c
index aa62d09..be873cc 100644
--- a/src/glamor_tile.c
+++ b/src/glamor_tile.c
@@ -162,7 +162,10 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
pixmap_priv_get_scale(dst_pixmap_priv, &dst_xscale, &dst_yscale);
dispatch = glamor_get_dispatch(glamor_priv);
- glamor_set_alu(dispatch, alu);
+ if (!glamor_set_alu(dispatch, alu)) {
+ glamor_put_dispatch(glamor_priv);
+ goto fail;
+ }
if (GLAMOR_PIXMAP_PRIV_NO_PENDING(src_pixmap_priv)) {
pixmap_priv_get_scale(src_pixmap_priv, &src_xscale,