hidl: camera: add guards for camera3_stream_t alignments
authorSimon1511 <me@simon1511.de>
Sun, 21 Jan 2024 12:48:53 +0000 (13:48 +0100)
committerŁukasz Patron <priv.luk@gmail.com>
Tue, 30 Jan 2024 11:48:47 +0000 (11:48 +0000)
Change-Id: I3025180ce778270a9d4f039f60378c4e85207e96

hidl/camera/device/3.2/default/Android.bp
hidl/camera/device/3.3/default/Android.bp
hidl/camera/device/3.4/default/Android.bp
hidl/camera/device/3.5/default/Android.bp
hidl/camera/libhardware_headers/Android.bp
hidl/camera/libhardware_headers/include/hardware/camera3.h

index 4acba8f5b15fc8a86114bd3f96e080792c5d0b92..465792862931fb1009393343c957245a88b40870 100644 (file)
@@ -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",
index da88d342413221e331c135112e220fea5876d642..130164e7a33d054da10135c0fc81bf365d76d907 100644 (file)
@@ -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",
index 2549598ab1908d291975ad79136faf4faf371c00..4c125457b03d0b2aa6d6ccf508a17a4c31a1703a 100644 (file)
 
 cc_library_shared {
     name: "camera.device@3.4-impl.samsung",
-    defaults: ["hidl_defaults"],
+    defaults: [
+        "hidl_defaults",
+        "samsung_camera3_defaults",
+    ],
     proprietary: true,
     vendor: true,
     srcs: [
index 362babe16cd3976b93f1401987af66a173fda988..088252a217f8b262a75426367e95042734fd283a 100644 (file)
 
 cc_library_shared {
     name: "camera.device@3.5-impl.samsung",
-    defaults: ["hidl_defaults"],
+    defaults: [
+        "hidl_defaults",
+        "samsung_camera3_defaults",
+    ],
     proprietary: true,
     vendor: true,
     srcs: [
index aed6e1a5a119549b710005bb0abb1f00442b43d8..545c7aa0de0d808d2883dfac2e6889e02c901dde 100644 (file)
@@ -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"],
index bb108f0285c8d2779ee289653bc817d94d0cc64f..45a576f967d968652d4df7a9a185dac251715eac 100644 (file)
@@ -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;
 
 /**