[PATCH 1/5] glamor: Change SET_PIXMAP_FBO_CURRENT from macro to static inline

Keith Packard keithp at keithp.com
Tue Aug 19 13:00:09 PDT 2014


This is the last function-like macro in glamor_priv.h; change to
static inline like all of the other functions there.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 glamor/glamor_largepixmap.c | 10 +++++-----
 glamor/glamor_pixmap.c      |  2 +-
 glamor/glamor_priv.h        | 17 +++++++++--------
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/glamor/glamor_largepixmap.c b/glamor/glamor_largepixmap.c
index 5a4bec5..4c82a8d 100644
--- a/glamor/glamor_largepixmap.c
+++ b/glamor/glamor_largepixmap.c
@@ -970,7 +970,7 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
                                      need_clean_fbo);
     }
     else {
-        SET_PIXMAP_FBO_CURRENT(priv, clipped_regions[0].block_idx);
+        glamor_set_pixmap_fbo_current(priv, clipped_regions[0].block_idx);
         if (repeat_type == RepeatReflect || repeat_type == RepeatNormal) {
             /* The required source areas are in one region,
              * we need to shift the corresponding box's coords to proper position,
@@ -1140,7 +1140,7 @@ glamor_composite_largepixmap_region(CARD8 op,
         DEBUGF("dest region %d  idx %d\n", i,
                clipped_dest_regions[i].block_idx);
         DEBUGRegionPrint(clipped_dest_regions[i].region);
-        SET_PIXMAP_FBO_CURRENT(dest_pixmap_priv,
+        glamor_set_pixmap_fbo_current(dest_pixmap_priv,
                                clipped_dest_regions[i].block_idx);
         if (source_pixmap_priv &&
             source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
@@ -1180,7 +1180,7 @@ glamor_composite_largepixmap_region(CARD8 op,
             DEBUGF("source clipped result %d region: \n", n_source_regions);
             for (j = 0; j < n_source_regions; j++) {
                 if (is_normal_source_fbo)
-                    SET_PIXMAP_FBO_CURRENT(source_pixmap_priv,
+                    glamor_set_pixmap_fbo_current(source_pixmap_priv,
                                            clipped_source_regions[j].block_idx);
 
                 if (mask_pixmap_priv &&
@@ -1267,7 +1267,7 @@ glamor_composite_largepixmap_region(CARD8 op,
                                clipped_mask_regions[k].block_idx);
                         DEBUGRegionPrint(clipped_mask_regions[k].region);
                         if (is_normal_mask_fbo) {
-                            SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv,
+                            glamor_set_pixmap_fbo_current(mask_pixmap_priv,
                                                    clipped_mask_regions[k].
                                                    block_idx);
                             DEBUGF("mask fbo off %d %d \n",
@@ -1378,7 +1378,7 @@ glamor_composite_largepixmap_region(CARD8 op,
                            clipped_mask_regions[k].block_idx);
                     DEBUGRegionPrint(clipped_mask_regions[k].region);
                     if (is_normal_mask_fbo) {
-                        SET_PIXMAP_FBO_CURRENT(mask_pixmap_priv,
+                        glamor_set_pixmap_fbo_current(mask_pixmap_priv,
                                                clipped_mask_regions[k].
                                                block_idx);
                         RegionTranslate(clipped_mask_regions[k].region,
diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c
index ccb49f3..11e9ebb 100644
--- a/glamor/glamor_pixmap.c
+++ b/glamor/glamor_pixmap.c
@@ -985,7 +985,7 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
 
             assert(pbo == 0);
 
-            SET_PIXMAP_FBO_CURRENT(pixmap_priv, clipped_regions[i].block_idx);
+            glamor_set_pixmap_fbo_current(pixmap_priv, clipped_regions[i].block_idx);
 
             boxes = RegionRects(clipped_regions[i].region);
             nbox = RegionNumRects(clipped_regions[i].region);
diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h
index 385c027..a947098 100644
--- a/glamor/glamor_priv.h
+++ b/glamor/glamor_priv.h
@@ -413,14 +413,6 @@ typedef struct glamor_pixmap_clipped_regions {
     RegionPtr region;
 } glamor_pixmap_clipped_regions;
 
-#define SET_PIXMAP_FBO_CURRENT(priv, idx) 				\
-  do {									\
-	if (priv->type == GLAMOR_TEXTURE_LARGE) {			\
-		(priv)->large.base.fbo = priv->large.fbo_array[idx]; 	\
-		(priv)->large.box = priv->large.box_array[idx]; 	\
-	}								\
-  } while(0)
-
 typedef struct glamor_pixmap_private_base {
     glamor_pixmap_type_t type;
     enum glamor_fbo_state gl_fbo;
@@ -493,6 +485,15 @@ typedef struct glamor_pixmap_private {
     };
 } glamor_pixmap_private;
 
+static inline void
+glamor_set_pixmap_fbo_current(glamor_pixmap_private *priv, int idx)
+{
+    if (priv->type == GLAMOR_TEXTURE_LARGE) {
+        priv->large.base.fbo = priv->large.fbo_array[idx];
+        priv->large.box = priv->large.box_array[idx];
+    }
+}
+
 static inline glamor_pixmap_fbo *
 glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int x, int y)
 {
-- 
2.0.1



More information about the xorg-devel mailing list