summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Goyal <layog@google.com>2021-04-08 01:52:52 +0800
committerAnkit Goyal <layog@google.com>2021-04-12 13:20:57 +0800
commit69927b61e4a923b124711209f68b4a5008a20e89 (patch)
treeb48193bf80419a30d32ac3d0cad67cd488e0bcbd
parent3a6604de94c09fa76540ad3ffded7058cef101d3 (diff)
downloadgchips-69927b61e4a923b124711209f68b4a5008a20e89.tar.gz
gralloc4: use UAPI for SBWC size macros
This is a port of ag/13246326 for gralloc4 Bug: 175341085 Test: Video playback Test: gfx-gralloc-nv12-sbwc-test (no new failures) Change-Id: I7dcb7ce4c6e45d3ae5fcae9c2aa6c339cc57761e
-rw-r--r--gralloc4/src/Android.bp1
-rw-r--r--gralloc4/src/core/Android.bp10
-rw-r--r--gralloc4/src/core/exynos_format_allocation.h38
3 files changed, 6 insertions, 43 deletions
diff --git a/gralloc4/src/Android.bp b/gralloc4/src/Android.bp
index fb8e315..2a4a5e3 100644
--- a/gralloc4/src/Android.bp
+++ b/gralloc4/src/Android.bp
@@ -73,6 +73,7 @@ cc_library_shared {
],
header_libs: [
"google_hal_headers",
+ "device_kernel_headers",
],
export_include_dirs: ["libGralloc4Wrapper/include"]
}
diff --git a/gralloc4/src/core/Android.bp b/gralloc4/src/core/Android.bp
index aea2245..023962c 100644
--- a/gralloc4/src/core/Android.bp
+++ b/gralloc4/src/core/Android.bp
@@ -65,6 +65,9 @@ arm_gralloc_core_cc_defaults {
include_dirs: [
"hardware/google/gchips/include",
],
+ header_libs: [
+ "device_kernel_headers",
+ ],
static_libs: [
"libarect",
],
@@ -90,10 +93,3 @@ cc_library_static {
"arm_gralloc_version_defaults",
],
}
-
-cc_library_host_static {
- name: "libgralloc_core_host",
- defaults: [
- "arm_gralloc_core_defaults",
- ],
-}
diff --git a/gralloc4/src/core/exynos_format_allocation.h b/gralloc4/src/core/exynos_format_allocation.h
index 3742b59..099e732 100644
--- a/gralloc4/src/core/exynos_format_allocation.h
+++ b/gralloc4/src/core/exynos_format_allocation.h
@@ -16,45 +16,11 @@
#pragma once
+#include <video/mfc_macros.h>
+
#define PLANE_SIZE(w, h) ((w) * (h))
#define S2B_PLANE_SIZE(w, h) (GRALLOC_ALIGN((w) / 4, 16) * (GRALLOC_ALIGN(h, 16)))
-/* helper macros */
-#ifndef __ALIGN_UP
-#define __ALIGN_UP(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
-#endif
-
-/* SBWC align macros */
-#define SBWC_8B_STRIDE(w) (128 * (((w) + 31) / 32))
-#define SBWC_10B_STRIDE(w) (160 * (((w) + 31) / 32))
-#define SBWC_HEADER_STRIDE(w) ((((((w) + 63) / 64) + 15) / 16) * 16)
-
-#define SBWC_Y_VSTRIDE_BLOCKS(h) ((__ALIGN_UP((h), 16) + 3) / 4)
-#define SBWC_CBCR_VSTRIDE_BLOCKS(h) (((__ALIGN_UP((h), 16) / 2) + 3) / 4)
-
-#define SBWC_8B_Y_SIZE(w, h) ((SBWC_8B_STRIDE(w) * ((__ALIGN_UP((h), 16) + 3) / 4)) + 64)
-#define SBWC_8B_Y_HEADER_SIZE(w, h) __ALIGN_UP(((SBWC_HEADER_STRIDE(w) * ((__ALIGN_UP((h), 16) + 3) / 4)) + 256), 32)
-#define SBWC_8B_CBCR_SIZE(w, h) ((SBWC_8B_STRIDE(w) * (((__ALIGN_UP((h), 16) / 2) + 3) / 4)) + 64)
-#define SBWC_8B_CBCR_HEADER_SIZE(w, h) ((SBWC_HEADER_STRIDE(w) * (((__ALIGN_UP((h), 16) / 2) + 3) / 4)) + 128)
-
-#define SBWC_10B_Y_SIZE(w, h) ((SBWC_10B_STRIDE(w) * ((__ALIGN_UP((h), 16) + 3) / 4)) + 64)
-#define SBWC_10B_Y_HEADER_SIZE(w, h) __ALIGN_UP((((__ALIGN_UP((w), 32) * __ALIGN_UP((h), 16) * 2) + 256) - SBWC_10B_Y_SIZE(w, h)), 32)
-#define SBWC_10B_CBCR_SIZE(w, h) ((SBWC_10B_STRIDE(w) * (((__ALIGN_UP((h), 16) / 2) + 3) / 4)) + 64)
-#define SBWC_10B_CBCR_HEADER_SIZE(w, h) (((__ALIGN_UP((w), 32) * __ALIGN_UP((h), 16)) + 256) - SBWC_10B_CBCR_SIZE(w, h))
-
-/* SBWC Lossy align macros */
-#define SBWCL_8B_STRIDE(w, r) (((128 * (r)) / 100) * (((w) + 31) / 32))
-#define SBWCL_10B_STRIDE(w, r) (((160 * (r)) / 100) * (((w) + 31) / 32))
-
-#define SBWCL_8B_Y_SIZE(w, h, r) ((SBWCL_8B_STRIDE(w, r) * ((__ALIGN_UP((h), 8) + 3) / 4)) + 64)
-#define SBWCL_8B_CBCR_SIZE(w, h, r) ((SBWCL_8B_STRIDE(w, r) * (((__ALIGN_UP((h), 8) / 2) + 3) / 4)) + 64)
-
-#define SBWCL_10B_Y_SIZE(w, h, r) ((SBWCL_10B_STRIDE(w, r) * ((__ALIGN_UP((h), 8) + 3) / 4)) + 64)
-#define SBWCL_10B_CBCR_SIZE(w, h, r) ((SBWCL_10B_STRIDE(w, r) * (((__ALIGN_UP((h), 8) / 2) + 3) / 4)) + 64)
-
-#define SBWCL_8B_CBCR_BASE(base, w, h, r) ((base) + SBWCL_8B_Y_SIZE(w, h, r))
-#define SBWCL_10B_CBCR_BASE(base, w, h, r) ((base) + SBWCL_10B_Y_SIZE(w, h, r))
-
/*
* Compute SBWC buffer geometry for a buffer containing packed SBWC YUV data
* with bits per pixel bpp, width w, and height h.