summaryrefslogtreecommitdiffstats
path: root/gralloc_drm.h
diff options
context:
space:
mode:
Diffstat (limited to 'gralloc_drm.h')
-rw-r--r--gralloc_drm.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/gralloc_drm.h b/gralloc_drm.h
index dcc6a66..4c57296 100644
--- a/gralloc_drm.h
+++ b/gralloc_drm.h
@@ -31,6 +31,8 @@
extern "C" {
#endif
+#define ALIGN(val, align) (((val) + (align) - 1) & ~((align) - 1))
+
struct gralloc_drm_t;
struct gralloc_drm_bo_t;
@@ -109,8 +111,8 @@ static inline void gralloc_drm_align_geometry(int format, int *width, int *heigh
break;
}
- *width = (*width + align_w - 1) & ~(align_w - 1);
- *height = (*height + align_h - 1) & ~(align_h - 1);
+ *width = ALIGN(*width, align_w);
+ *height = ALIGN(*height, align_h);
if (extra_height_div)
*height += *height / extra_height_div;