summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2013-04-22 08:20:39 +0300
committerTapani Pälli <tapani.palli@intel.com>2013-05-03 09:38:41 +0300
commitdf57ea903b701669b315a48311c1535f64f5d37a (patch)
tree418a913a9393066ae0b68fa3fff5513c8728a5ec
parent0bf69ed26eaffe5bbf58b9548063144c96e8ac64 (diff)
downloadexternal_drm_gralloc-df57ea903b701669b315a48311c1535f64f5d37a.zip
external_drm_gralloc-df57ea903b701669b315a48311c1535f64f5d37a.tar.gz
external_drm_gralloc-df57ea903b701669b315a48311c1535f64f5d37a.tar.bz2
gralloc: cleanup, use ALIGN macro
Change-Id: I029aafe5a99393a4c0f7ff87f422317621fada12 Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
-rw-r--r--gralloc_drm.h6
-rw-r--r--gralloc_drm_intel.c6
-rw-r--r--gralloc_drm_nouveau.c1
-rw-r--r--gralloc_drm_radeon.c1
4 files changed, 7 insertions, 7 deletions
diff --git a/gralloc_drm.h b/gralloc_drm.h
index 8554cf7..4694185 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;
diff --git a/gralloc_drm_intel.c b/gralloc_drm_intel.c
index 50293b9..645339b 100644
--- a/gralloc_drm_intel.c
+++ b/gralloc_drm_intel.c
@@ -393,7 +393,7 @@ static drm_intel_bo *alloc_ibo(struct intel_info *info,
max_stride /= 2;
name = "gralloc-fb";
- aligned_width = (aligned_width + 63) & ~63;
+ aligned_width = ALIGN(aligned_width, 64);
flags = BO_ALLOC_FOR_RENDER;
*tiling = I915_TILING_X;
@@ -441,8 +441,8 @@ static drm_intel_bo *alloc_ibo(struct intel_info *info,
if (handle->usage & GRALLOC_USAGE_HW_TEXTURE) {
name = "gralloc-texture";
/* see 2D texture layout of DRI drivers */
- aligned_width = (aligned_width + 3) & ~3;
- aligned_height = (aligned_height + 1) & ~1;
+ aligned_width = ALIGN(aligned_width, 4);
+ aligned_height = ALIGN(aligned_height, 2);
}
else {
name = "gralloc-buffer";
diff --git a/gralloc_drm_nouveau.c b/gralloc_drm_nouveau.c
index 4536e7e..576966e 100644
--- a/gralloc_drm_nouveau.c
+++ b/gralloc_drm_nouveau.c
@@ -40,7 +40,6 @@
#include "gralloc_drm_priv.h"
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#define ALIGN(val, align) (((val) + (align) - 1) & ~((align) - 1))
#define NVC0_TILE_HEIGHT(m) (8 << ((m) >> 4))
diff --git a/gralloc_drm_radeon.c b/gralloc_drm_radeon.c
index 94dc2ed..5c77bc8 100644
--- a/gralloc_drm_radeon.c
+++ b/gralloc_drm_radeon.c
@@ -46,7 +46,6 @@
#define RADEON_GPU_PAGE_SIZE 4096
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#define ALIGN(val, align) (((val) + (align) - 1) & ~((align) - 1))
struct radeon_info {
struct gralloc_drm_drv_t base;