OSDN Git Service

hwcomposer: Correct padding for 32/64-bit
authorDan Stoza <stoza@google.com>
Wed, 4 Jun 2014 22:21:22 +0000 (15:21 -0700)
committerDan Stoza <stoza@google.com>
Wed, 4 Jun 2014 23:10:46 +0000 (16:10 -0700)
The size of hwc_layer_1_t varies depending on whether we're building
for a 32- or 64-bit target. This change splits the padding into two
sections so that we can add more fields without changing the overall
size on either bitness.

Change-Id: Ib7c960a9feb0061586dc6398211d7d3dc012d573

include/hardware/hwcomposer.h

index 049edea..fa772d6 100644 (file)
@@ -297,10 +297,19 @@ typedef struct hwc_layer_1 {
         };
     };
 
-    /* Allow for expansion w/o breaking binary compatibility.
-     * Pad layer to 96 bytes, assuming 32-bit pointers.
+#ifdef __LP64__
+    /*
+     * For 64-bit mode, this struct is 120 bytes (and 8-byte aligned), and needs
+     * to be padded as such to maintain binary compatibility.
+     */
+    uint8_t reserved[120 - 96];
+#else
+    /*
+     * For 32-bit mode, this struct is 96 bytes, and needs to be padded as such
+     * to maintain binary compatibility.
      */
-    int32_t reserved[24 - 19];
+    uint8_t reserved[96 - 76];
+#endif
 
 } hwc_layer_1_t;