From: Simon Shields Date: Fri, 15 Apr 2016 12:44:30 +0000 (+1000) Subject: exynos4: gralloc: we have an ALIGN macro, use it X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=05326f499d5ce79a04eb58fdc2a5de80be34ace5;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung.git exynos4: gralloc: we have an ALIGN macro, use it Change-Id: I1ef089b004d1d1e3f2ae525638954536ca881c7a --- diff --git a/exynos4/hal/libgralloc_ump/alloc_device.cpp b/exynos4/hal/libgralloc_ump/alloc_device.cpp index 467e6f7..9c9c7b4 100644 --- a/exynos4/hal/libgralloc_ump/alloc_device.cpp +++ b/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) { /* FIXME: there is no way to return the vstride */ int vstride; - stride = (w + 15) & ~15; - vstride = (h + 15) & ~15; + stride = EXYNOS4_ALIGN(w, 16); + vstride = EXYNOS4_ALIGN(h, 16); switch (format) { case HAL_PIXEL_FORMAT_YCbCr_420_SP: 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; } } else { - int align = 8; int bpp = 0; switch (format) { 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: return -EINVAL; } - size_t bpr = (w*bpp + (align-1)) & ~(align-1); + size_t bpr = EXYNOS4_ALIGN((w*bpp), 8); size = bpr * h; stride = bpr / bpp; stride_raw = bpr;