exynos4: gralloc: we have an ALIGN macro, use it

Change-Id: I1ef089b004d1d1e3f2ae525638954536ca881c7a
tirimbino
Simon Shields 9 years ago committed by Gerrit Code Review
parent fb599edb50
commit 05326f499d
  1. 7
      exynos4/hal/libgralloc_ump/alloc_device.cpp

@ -372,8 +372,8 @@ static int alloc_device_alloc(alloc_device_t* dev, int w, int h, int format,
format == OMX_COLOR_FormatYUV420SemiPlanar) { format == OMX_COLOR_FormatYUV420SemiPlanar) {
/* FIXME: there is no way to return the vstride */ /* FIXME: there is no way to return the vstride */
int vstride; int vstride;
stride = (w + 15) & ~15; stride = EXYNOS4_ALIGN(w, 16);
vstride = (h + 15) & ~15; vstride = EXYNOS4_ALIGN(h, 16);
switch (format) { switch (format) {
case HAL_PIXEL_FORMAT_YCbCr_420_SP: case HAL_PIXEL_FORMAT_YCbCr_420_SP:
case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED: case HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED:
@ -403,7 +403,6 @@ static int alloc_device_alloc(alloc_device_t* dev, int w, int h, int format,
return -EINVAL; return -EINVAL;
} }
} else { } else {
int align = 8;
int bpp = 0; int bpp = 0;
switch (format) { switch (format) {
case HAL_PIXEL_FORMAT_RGBA_8888: case HAL_PIXEL_FORMAT_RGBA_8888:
@ -422,7 +421,7 @@ static int alloc_device_alloc(alloc_device_t* dev, int w, int h, int format,
default: default:
return -EINVAL; return -EINVAL;
} }
size_t bpr = (w*bpp + (align-1)) & ~(align-1); size_t bpr = EXYNOS4_ALIGN((w*bpp), 8);
size = bpr * h; size = bpr * h;
stride = bpr / bpp; stride = bpr / bpp;
stride_raw = bpr; stride_raw = bpr;

Loading…
Cancel
Save