[PATCH 05/15] glamor: Add a screen argument to drop an ifdef from glamor_set_alu().

Eric Anholt eric at anholt.net
Mon Feb 3 11:03:30 PST 2014


Signed-off-by: Eric Anholt <eric at anholt.net>
---
 glamor/glamor_copyarea.c |  7 ++++---
 glamor/glamor_fill.c     |  4 ++--
 glamor/glamor_pixmap.c   | 17 +++++++++++------
 glamor/glamor_priv.h     |  2 +-
 glamor/glamor_tile.c     |  4 ++--
 5 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/glamor/glamor_copyarea.c b/glamor/glamor_copyarea.c
index 8cc7cad..d6bcacd 100644
--- a/glamor/glamor_copyarea.c
+++ b/glamor/glamor_copyarea.c
@@ -338,6 +338,7 @@ _glamor_copy_n_to_n(DrawablePtr src,
                     Bool upsidedown, Pixel bitplane,
                     void *closure, Bool fallback)
 {
+    ScreenPtr screen = dst->pScreen;
     PixmapPtr dst_pixmap, src_pixmap;
     glamor_pixmap_private *dst_pixmap_priv, *src_pixmap_priv;
     glamor_screen_private *glamor_priv;
@@ -354,7 +355,7 @@ _glamor_copy_n_to_n(DrawablePtr src,
     src_pixmap = glamor_get_drawable_pixmap(src);
     src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
 
-    glamor_priv = glamor_get_screen_private(dst->pScreen);
+    glamor_priv = glamor_get_screen_private(screen);
 
     DEBUGF("Copy %d %d %dx%d dx %d dy %d from %p to %p \n",
            box[0].x1, box[0].y1,
@@ -368,7 +369,7 @@ _glamor_copy_n_to_n(DrawablePtr src,
         if (!glamor_set_planemask(dst_pixmap, gc->planemask))
             goto fall_back;
         glamor_get_context(glamor_priv);
-        if (!glamor_set_alu(gc->alu)) {
+        if (!glamor_set_alu(screen, gc->alu)) {
             glamor_put_context(glamor_priv);
             goto fail;
         }
@@ -546,7 +547,7 @@ _glamor_copy_n_to_n(DrawablePtr src,
 
  fail:
     glamor_get_context(glamor_priv);
-    glamor_set_alu(GXcopy);
+    glamor_set_alu(screen, GXcopy);
     glamor_put_context(glamor_priv);
 
     if (ok)
diff --git a/glamor/glamor_fill.c b/glamor/glamor_fill.c
index d1c16ad..dda55ea 100644
--- a/glamor/glamor_fill.c
+++ b/glamor/glamor_fill.c
@@ -330,7 +330,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
     }
 
     glamor_get_context(glamor_priv);
-    if (!glamor_set_alu(alu)) {
+    if (!glamor_set_alu(screen, alu)) {
         if (alu == GXclear)
             fg_pixel = 0;
         else {
@@ -345,7 +345,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
     box.y2 = y + height;
     glamor_solid_boxes(pixmap, &box, 1, fg_pixel);
 
-    glamor_set_alu(GXcopy);
+    glamor_set_alu(screen, GXcopy);
     glamor_put_context(glamor_priv);
 
     return TRUE;
diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
index 41d5f5a..5442c90 100644
--- a/glamor/glamor_pixmap.c
+++ b/glamor/glamor_pixmap.c
@@ -115,9 +115,17 @@ glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask)
 }
 
 Bool
-glamor_set_alu(unsigned char alu)
+glamor_set_alu(ScreenPtr screen, unsigned char alu)
 {
-#ifndef GLAMOR_GLES2
+    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
+
+    if (glamor_priv->gl_flavor == GLAMOR_GL_ES2) {
+        if (alu != GXcopy)
+            return FALSE;
+        else
+            return TRUE;
+    }
+
     if (alu == GXcopy) {
         glDisable(GL_COLOR_LOGIC_OP);
         return TRUE;
@@ -173,10 +181,7 @@ glamor_set_alu(unsigned char alu)
         glamor_fallback("unsupported alu %x\n", alu);
         return FALSE;
     }
-#else
-    if (alu != GXcopy)
-        return FALSE;
-#endif
+
     return TRUE;
 }
 
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 53af353..a6cdf64 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -599,7 +599,7 @@ glamor_pixmap_fbo *glamor_es2_pixmap_read_prepare(PixmapPtr source, int x,
                                                   int no_alpha, int revert,
                                                   int swap_rb);
 
-Bool glamor_set_alu(unsigned char alu);
+Bool glamor_set_alu(ScreenPtr screen, unsigned char alu);
 Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask);
 Bool glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
 RegionPtr glamor_bitmap_to_region(PixmapPtr pixmap);
diff --git a/glamor/glamor_tile.c b/glamor/glamor_tile.c
index 9abb95d..7288af3 100644
--- a/glamor/glamor_tile.c
+++ b/glamor/glamor_tile.c
@@ -196,7 +196,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
     }
 
     glamor_get_context(glamor_priv);
-    if (!glamor_set_alu(alu)) {
+    if (!glamor_set_alu(screen, alu)) {
         glamor_fallback("unsupported alu %x\n", alu);
         glamor_put_context(glamor_priv);
         goto fail;
@@ -291,7 +291,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
     else
         _glamor_tile(pixmap, tile, x, y, width, height, tile_x, tile_y);
 
-    glamor_set_alu(GXcopy);
+    glamor_set_alu(screen, GXcopy);
     glamor_put_context(glamor_priv);
     return TRUE;
  fail:
-- 
1.9.rc1



More information about the xorg-devel mailing list