From e6262092b72b175b2b807652bc335ddcab3edf95 Mon Sep 17 00:00:00 2001 From: Simon1511 Date: Sun, 21 Jan 2024 13:48:53 +0100 Subject: [PATCH] hidl: camera: add guards for camera3_stream_t alignments Change-Id: I3025180ce778270a9d4f039f60378c4e85207e96 --- hidl/camera/device/3.2/default/Android.bp | 5 +++- hidl/camera/device/3.3/default/Android.bp | 5 +++- hidl/camera/device/3.4/default/Android.bp | 5 +++- hidl/camera/device/3.5/default/Android.bp | 5 +++- hidl/camera/libhardware_headers/Android.bp | 23 +++++++++++++++++++ .../include/hardware/camera3.h | 8 +++++++ 6 files changed, 47 insertions(+), 4 deletions(-) diff --git a/hidl/camera/device/3.2/default/Android.bp b/hidl/camera/device/3.2/default/Android.bp index 4acba8f..4657928 100644 --- a/hidl/camera/device/3.2/default/Android.bp +++ b/hidl/camera/device/3.2/default/Android.bp @@ -1,6 +1,9 @@ cc_library_shared { name: "camera.device@3.2-impl.samsung", - defaults: ["hidl_defaults"], + defaults: [ + "hidl_defaults", + "samsung_camera3_defaults", + ], proprietary: true, srcs: [ "CameraDevice.cpp", diff --git a/hidl/camera/device/3.3/default/Android.bp b/hidl/camera/device/3.3/default/Android.bp index da88d34..130164e 100644 --- a/hidl/camera/device/3.3/default/Android.bp +++ b/hidl/camera/device/3.3/default/Android.bp @@ -1,6 +1,9 @@ cc_library_shared { name: "camera.device@3.3-impl.samsung", - defaults: ["hidl_defaults"], + defaults: [ + "hidl_defaults", + "samsung_camera3_defaults", + ], proprietary: true, srcs: [ "CameraDevice.cpp", diff --git a/hidl/camera/device/3.4/default/Android.bp b/hidl/camera/device/3.4/default/Android.bp index 2549598..4c12545 100644 --- a/hidl/camera/device/3.4/default/Android.bp +++ b/hidl/camera/device/3.4/default/Android.bp @@ -16,7 +16,10 @@ cc_library_shared { name: "camera.device@3.4-impl.samsung", - defaults: ["hidl_defaults"], + defaults: [ + "hidl_defaults", + "samsung_camera3_defaults", + ], proprietary: true, vendor: true, srcs: [ diff --git a/hidl/camera/device/3.5/default/Android.bp b/hidl/camera/device/3.5/default/Android.bp index 362babe..088252a 100644 --- a/hidl/camera/device/3.5/default/Android.bp +++ b/hidl/camera/device/3.5/default/Android.bp @@ -16,7 +16,10 @@ cc_library_shared { name: "camera.device@3.5-impl.samsung", - defaults: ["hidl_defaults"], + defaults: [ + "hidl_defaults", + "samsung_camera3_defaults", + ], proprietary: true, vendor: true, srcs: [ diff --git a/hidl/camera/libhardware_headers/Android.bp b/hidl/camera/libhardware_headers/Android.bp index aed6e1a..545c7aa 100644 --- a/hidl/camera/libhardware_headers/Android.bp +++ b/hidl/camera/libhardware_headers/Android.bp @@ -1,3 +1,26 @@ +soong_config_module_type { + name: "samsung_camera3", + module_type: "cc_defaults", + config_namespace: "samsungCameraVars", + bool_variables: [ + "needs_sec_reserved_field", + "usage_64bit", + ], + properties: ["cflags"], +} + +samsung_camera3 { + name: "samsung_camera3_defaults", + soong_config_variables: { + needs_sec_reserved_field: { + cflags: ["-DCAMERA_NEEDS_SEC_RESERVED_FIELD"], + }, + usage_64bit: { + cflags: ["-DCAMERA_64BIT_USAGE"], + }, + }, +} + cc_library_headers { name: "libhardware_headers.camera3_samsung", export_include_dirs: ["include"], diff --git a/hidl/camera/libhardware_headers/include/hardware/camera3.h b/hidl/camera/libhardware_headers/include/hardware/camera3.h index bb108f0..45a576f 100644 --- a/hidl/camera/libhardware_headers/include/hardware/camera3.h +++ b/hidl/camera/libhardware_headers/include/hardware/camera3.h @@ -1657,7 +1657,11 @@ typedef struct camera3_stream { * supported due to imcompatible buffer format, dataSpace, or other hardware * limitations. */ +#ifdef CAMERA_64BIT_USAGE uint64_t usage; +#else + uint32_t usage; +#endif /** * The maximum number of buffers the HAL device may need to have dequeued at @@ -1758,6 +1762,10 @@ typedef struct camera3_stream { /* reserved for future use */ void *reserved[6]; +#ifdef CAMERA_NEEDS_SEC_RESERVED_FIELD + char reserved_sec[0x28]; +#endif + } camera3_stream_t; /** -- 2.20.1