Show a patch.

GET /api/1.1/patches/12433/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 12433,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/12433/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/12433/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20210527010149.30601-2-laurent.pinchart@ideasonboard.com>",
    "date": "2021-05-27T01:01:49",
    "name": "[libcamera-devel,2/2] android: Update Android headers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "2832793361c52a57507de5bf08bdcfa0f2cc246f",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/1.1/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/12433/mbox/",
    "series": [
        {
            "id": 2076,
            "url": "https://patchwork.libcamera.org/api/1.1/series/2076/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2076",
            "date": "2021-05-27T01:01:48",
            "name": "[libcamera-devel,1/2] android: Don't rely on indirect inclusion of unistd.h",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/2076/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/12433/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/12433/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>",
        "X-Original-To": "parsemail@patchwork.libcamera.org",
        "Delivered-To": "parsemail@patchwork.libcamera.org",
        "Received": [
            "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3505CBDB80\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 27 May 2021 01:02:05 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED31B68926;\n\tThu, 27 May 2021 03:02:04 +0200 (CEST)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 601566050E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 May 2021 03:02:02 +0200 (CEST)",
            "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AFA28156A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 27 May 2021 03:02:01 +0200 (CEST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"q0B57AUr\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1622077322;\n\tbh=+7AVQvpQpiBMqDsj4yunjwpv9pMeSUpyAgSOx9D2swQ=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=q0B57AUr2Hnku0hXdCl+4kYwuqW4O8BmdBZN0e+zBsnnMcmX1t01U01grkdspZHbf\n\tutAlfbNtDZ36GJPmlYu9JpfMjRBIUCm2PPZ9PSr59hQIbmZAScYfrsuHJV6UcJif58\n\tXWoPq/CPNS4zdy/YqpGW/ZZWaYFjy4mwMppzFTmA=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 27 May 2021 04:01:49 +0300",
        "Message-Id": "<20210527010149.30601-2-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.28.1",
        "In-Reply-To": "<20210527010149.30601-1-laurent.pinchart@ideasonboard.com>",
        "References": "<20210527010149.30601-1-laurent.pinchart@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 2/2] android: Update Android headers",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "<libcamera-devel.lists.libcamera.org>",
        "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>",
        "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>",
        "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>",
        "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>",
        "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Import the latest version of the Android headers from Chrome OS (commit\na30340e77ec8 (\"camera: Uprev Android camera headers\")). This brings in\nthe Camera HAL v3.5 support.\n\nThe headers are imported verbatim, except for the addition of the SPDX\nheaders.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n .../libhardware/include/hardware/camera3.h    | 215 +++-\n .../include/hardware/camera_common.h          |  16 +-\n .../libhardware/include/hardware/fb.h         |   2 +-\n .../libhardware/include/hardware/gralloc.h    |  97 +-\n .../libhardware/include/hardware/hardware.h   |   6 +\n .../core/include/cutils/native_handle.h       |  36 +\n .../system/core/include/system/camera.h       |   9 +\n .../system/core/include/system/graphics.h     | 793 +++------------\n .../system/core/include/system/window.h       | 955 ------------------\n 9 files changed, 469 insertions(+), 1660 deletions(-)\n delete mode 100644 include/android/system/core/include/system/window.h\n---\nCompile-tested only for now.",
    "diff": "diff --git a/include/android/hardware/libhardware/include/hardware/camera3.h b/include/android/hardware/libhardware/include/hardware/camera3.h\nindex d89bc9304b00..fd1e2072ad20 100644\n--- a/include/android/hardware/libhardware/include/hardware/camera3.h\n+++ b/include/android/hardware/libhardware/include/hardware/camera3.h\n@@ -1,6 +1,6 @@\n /* SPDX-License-Identifier: Apache-2.0 */\n /*\n- * Copyright (C) 2013 The Android Open Source Project\n+ * Copyright (C) 2013-2018 The Android Open Source Project\n  *\n  * Licensed under the Apache License, Version 2.0 (the \"License\");\n  * you may not use this file except in compliance with the License.\n@@ -22,21 +22,21 @@\n #include \"camera_common.h\"\n \n /**\n- * Camera device HAL 3.3 [ CAMERA_DEVICE_API_VERSION_3_3 ]\n+ * Camera device HAL 3.5[ CAMERA_DEVICE_API_VERSION_3_5 ]\n  *\n  * This is the current recommended version of the camera device HAL.\n  *\n  * Supports the android.hardware.Camera API, and as of v3.2, the\n- * android.hardware.camera2 API in LIMITED or FULL modes.\n+ * android.hardware.camera2 API as LIMITED or above hardware level.\n  *\n  * Camera devices that support this version of the HAL must return\n- * CAMERA_DEVICE_API_VERSION_3_3 in camera_device_t.common.version and in\n+ * CAMERA_DEVICE_API_VERSION_3_5 in camera_device_t.common.version and in\n  * camera_info_t.device_version (from camera_module_t.get_camera_info).\n  *\n- * CAMERA_DEVICE_API_VERSION_3_3:\n- *    Camera modules that may contain version 3.3 devices must implement at\n- *    least version 2.2 of the camera module interface (as defined by\n- *    camera_module_t.common.module_api_version).\n+ * CAMERA_DEVICE_API_VERSION_3_3 and above:\n+ *    Camera modules that may contain version 3.3 or above devices must\n+ *    implement at least version 2.2 of the camera module interface (as defined\n+ *    by camera_module_t.common.module_api_version).\n  *\n  * CAMERA_DEVICE_API_VERSION_3_2:\n  *    Camera modules that may contain version 3.2 devices must implement at\n@@ -138,6 +138,52 @@\n  *\n  *   - Addition of camera3 stream configuration operation mode to camera3_stream_configuration_t\n  *\n+ * 3.4: Minor additions to supported metadata and changes to data_space support\n+ *\n+ *   - Add ANDROID_SENSOR_OPAQUE_RAW_SIZE static metadata as mandatory if\n+ *     RAW_OPAQUE format is supported.\n+ *\n+ *   - Add ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE static metadata as\n+ *     mandatory if any RAW format is supported\n+ *\n+ *   - Switch camera3_stream_t data_space field to a more flexible definition,\n+ *     using the version 0 definition of dataspace encoding.\n+ *\n+ *   - General metadata additions which are available to use for HALv3.2 or\n+ *     newer:\n+ *     - ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_3\n+ *     - ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST\n+ *     - ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE\n+ *     - ANDROID_SENSOR_DYNAMIC_BLACK_LEVEL\n+ *     - ANDROID_SENSOR_DYNAMIC_WHITE_LEVEL\n+ *     - ANDROID_SENSOR_OPAQUE_RAW_SIZE\n+ *     - ANDROID_SENSOR_OPTICAL_BLACK_REGIONS\n+ *\n+ * 3.5: Minor revisions to support session parameters and logical multi camera:\n+ *\n+ *   - Add ANDROID_REQUEST_AVAILABLE_SESSION_KEYS static metadata, which is\n+ *     optional for implementations that want to support session parameters. If support is\n+ *     needed, then Hal should populate the list with all available capture request keys\n+ *     that can cause severe processing delays when modified by client. Typical examples\n+ *     include parameters that require time-consuming HW re-configuration or internal camera\n+ *     pipeline update.\n+ *\n+ *   - Add a session parameter field to camera3_stream_configuration which can be populated\n+ *     by clients with initial values for the keys found in ANDROID_REQUEST_AVAILABLE_SESSION_KEYS.\n+ *\n+ *   - Metadata additions for logical multi camera capability:\n+ *     - ANDROID_REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA\n+ *     - ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS\n+ *     - ANDROID_LOGICAL_MULTI_CAMERA_SYNC_TYPE\n+ *\n+ *   - Add physical camera id field in camera3_stream, so that for a logical\n+ *     multi camera, the application has the option to specify which physical camera\n+ *     a particular stream is configured on.\n+ *\n+ *   - Add physical camera id and settings field in camera3_capture_request, so that\n+ *     for a logical multi camera, the application has the option to specify individual\n+ *     settings for a particular physical device.\n+ *\n  */\n \n /**\n@@ -1460,6 +1506,13 @@ typedef enum camera3_stream_configuration_mode {\n      *      android.lens.opticalStabilizationMode (if it is supported)\n      *      android.scaler.cropRegion\n      *      android.statistics.faceDetectMode (if it is supported)\n+     *   6. To reduce the amount of data passed across process boundaries at\n+     *      high frame rate, within one batch, camera framework only propagates\n+     *      the last shutter notify and the last capture results (including partial\n+     *      results and final result) to the app. The shutter notifies and capture\n+     *      results for the other requests in the batch are derived by\n+     *      the camera framework. As a result, the HAL can return empty metadata\n+     *      except for the last result in the batch.\n      *\n      * For more details about high speed stream requirements, see\n      * android.control.availableHighSpeedVideoConfigurations and CONSTRAINED_HIGH_SPEED_VIDEO\n@@ -1578,6 +1631,13 @@ typedef struct camera3_stream {\n      *   value of this is 0.\n      *   For all streams passed via configure_streams(), the HAL must write\n      *   over this field with its usage flags.\n+     *\n+     *   From Android O, the usage flag for an output stream may be bitwise\n+     *   combination of usage flags for multiple consumers, for the purpose of\n+     *   sharing one camera stream between those consumers. The HAL must fail\n+     *   configure_streams call with -EINVAL if the combined flags cannot be\n+     *   supported due to imcompatible buffer format, dataSpace, or other hardware\n+     *   limitations.\n      */\n     uint32_t usage;\n \n@@ -1612,11 +1672,19 @@ typedef struct camera3_stream {\n      *   be HAL_DATASPACE_UNKNOWN, and the appropriate color space, etc, should\n      *   be determined from the usage flags and the format.\n      *\n-     * >= CAMERA_DEVICE_API_VERSION_3_3:\n+     * = CAMERA_DEVICE_API_VERSION_3_3:\n      *\n      *   Always set by the camera service. HAL must use this dataSpace to\n      *   configure the stream to the correct colorspace, or to select between\n-     *   color and depth outputs if supported.\n+     *   color and depth outputs if supported. The dataspace values are the\n+     *   legacy definitions in graphics.h\n+     *\n+     * >= CAMERA_DEVICE_API_VERSION_3_4:\n+     *\n+     *   Always set by the camera service. HAL must use this dataSpace to\n+     *   configure the stream to the correct colorspace, or to select between\n+     *   color and depth outputs if supported. The dataspace values are set\n+     *   using the V0 dataspace definitions in graphics.h\n      */\n     android_dataspace_t data_space;\n \n@@ -1646,6 +1714,29 @@ typedef struct camera3_stream {\n      */\n     int rotation;\n \n+    /**\n+     * The physical camera id this stream belongs to.\n+     *\n+     * <= CAMERA_DEVICE_API_VERISON_3_4:\n+     *\n+     *    Not defined and must not be accessed.\n+     *\n+     * >= CAMERA_DEVICE_API_VERISON_3_5:\n+     *\n+     *    Always set by camera service. If the camera device is not a logical\n+     *    multi camera, or if the camera is a logical multi camera but the stream\n+     *    is not a physical output stream, this field will point to a 0-length\n+     *    string.\n+     *\n+     *    A logical multi camera is a camera device backed by multiple physical\n+     *    cameras that are also exposed to the application. And for a logical\n+     *    multi camera, a physical output stream is an output stream specifically\n+     *    requested on an underlying physical camera.\n+     *\n+     *    For an input stream, this field is guaranteed to be a 0-length string.\n+     */\n+    const char* physical_camera_id;\n+\n     /**\n      * This should be one of the camera3_stream_rotation_t values except for\n      * CAMERA3_STREAM_ROTATION_180.\n@@ -1663,7 +1754,7 @@ typedef struct camera3_stream {\n     int crop_rotate_scale_degrees;\n \n     /* reserved for future use */\n-    void *reserved[6];\n+    void *reserved[5];\n \n } camera3_stream_t;\n \n@@ -1697,16 +1788,30 @@ typedef struct camera3_stream_configuration {\n     /**\n      * >= CAMERA_DEVICE_API_VERSION_3_3:\n      *\n-     * The operation mode of streams in this configuration, one of the value defined in\n-     * camera3_stream_configuration_mode_t.\n-     * The HAL can use this mode as an indicator to set the stream property (e.g.,\n-     * camera3_stream->max_buffers) appropriately. For example, if the configuration is\n-     * CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE, the HAL may want to set aside more\n-     * buffers for batch mode operation (see android.control.availableHighSpeedVideoConfigurations\n-     * for batch mode definition).\n+     * The operation mode of streams in this configuration, one of the value\n+     * defined in camera3_stream_configuration_mode_t.  The HAL can use this\n+     * mode as an indicator to set the stream property (e.g.,\n+     * camera3_stream->max_buffers) appropriately. For example, if the\n+     * configuration is\n+     * CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE, the HAL may\n+     * want to set aside more buffers for batch mode operation (see\n+     * android.control.availableHighSpeedVideoConfigurations for batch mode\n+     * definition).\n      *\n      */\n     uint32_t operation_mode;\n+\n+    /**\n+     * >= CAMERA_DEVICE_API_VERSION_3_5:\n+     *\n+     * The session metadata buffer contains the initial values of\n+     * ANDROID_REQUEST_AVAILABLE_SESSION_KEYS. This field is optional\n+     * and camera clients can choose to ignore it, in which case it will\n+     * be set to NULL. If parameters are present, then Hal should examine\n+     * the parameter values and configure its internal camera pipeline\n+     * accordingly.\n+     */\n+    const camera_metadata_t *session_parameters;\n } camera3_stream_configuration_t;\n \n /**\n@@ -1950,7 +2055,7 @@ typedef enum camera3_error_msg_code {\n      * available. Subsequent requests are unaffected, and the device remains\n      * operational. The frame_number field specifies the request for which the\n      * buffer was dropped, and error_stream contains a pointer to the stream\n-     * that dropped the frame.u\n+     * that dropped the frame.\n      */\n     CAMERA3_MSG_ERROR_BUFFER = 4,\n \n@@ -2190,6 +2295,44 @@ typedef struct camera3_capture_request {\n      */\n     const camera3_stream_buffer_t *output_buffers;\n \n+    /**\n+     * <= CAMERA_DEVICE_API_VERISON_3_4:\n+     *\n+     *    Not defined and must not be accessed.\n+     *\n+     * >= CAMERA_DEVICE_API_VERSION_3_5:\n+     *    The number of physical camera settings to be applied. If 'num_physcam_settings'\n+     *    equals 0 or a physical device is not included, then Hal must decide the\n+     *    specific physical device settings based on the default 'settings'.\n+     */\n+    uint32_t num_physcam_settings;\n+\n+    /**\n+     * <= CAMERA_DEVICE_API_VERISON_3_4:\n+     *\n+     *    Not defined and must not be accessed.\n+     *\n+     * >= CAMERA_DEVICE_API_VERSION_3_5:\n+     *    The physical camera ids. The array will contain 'num_physcam_settings'\n+     *    camera id strings for all physical devices that have specific settings.\n+     *    In case some id is invalid, the process capture request must fail and return\n+     *    -EINVAL.\n+     */\n+    const char **physcam_id;\n+\n+    /**\n+     * <= CAMERA_DEVICE_API_VERISON_3_4:\n+     *\n+     *    Not defined and must not be accessed.\n+     *\n+     * >= CAMERA_DEVICE_API_VERSION_3_5:\n+     *    The capture settings for the physical cameras. The array will contain\n+     *    'num_physcam_settings' settings for invididual physical devices. In\n+     *    case the settings at some particular index are empty, the process capture\n+     *    request must fail and return -EINVAL.\n+     */\n+    const camera_metadata_t **physcam_settings;\n+\n } camera3_capture_request_t;\n \n /**\n@@ -2367,6 +2510,37 @@ typedef struct camera3_capture_result {\n       */\n      uint32_t partial_result;\n \n+     /**\n+      * >= CAMERA_DEVICE_API_VERSION_3_5:\n+      *\n+      * Specifies the number of physical camera metadata this capture result\n+      * contains. It must be equal to the number of physical cameras being\n+      * requested from.\n+      *\n+      * If the current camera device is not a logical multi-camera, or the\n+      * corresponding capture_request doesn't request on any physical camera,\n+      * this field must be 0.\n+      */\n+     uint32_t num_physcam_metadata;\n+\n+     /**\n+      * >= CAMERA_DEVICE_API_VERSION_3_5:\n+      *\n+      * An array of strings containing the physical camera ids for the returned\n+      * physical camera metadata. The length of the array is\n+      * num_physcam_metadata.\n+      */\n+     const char **physcam_ids;\n+\n+     /**\n+      * >= CAMERA_DEVICE_API_VERSION_3_5:\n+      *\n+      * The array of physical camera metadata for the physical cameras being\n+      * requested upon. This array should have a 1-to-1 mapping with the\n+      * physcam_ids. The length of the array is num_physcam_metadata.\n+      */\n+     const camera_metadata_t **physcam_metadata;\n+\n } camera3_capture_result_t;\n \n /**********************************************************************\n@@ -2899,7 +3073,8 @@ typedef struct camera3_device_ops {\n      *  0:      On a successful start to processing the capture request\n      *\n      * -EINVAL: If the input is malformed (the settings are NULL when not\n-     *          allowed, there are 0 output buffers, etc) and capture processing\n+     *          allowed, invalid physical camera settings,\n+     *          there are 0 output buffers, etc) and capture processing\n      *          cannot start. Failures during request processing should be\n      *          handled by calling camera3_callback_ops_t.notify(). In case of\n      *          this error, the framework will retain responsibility for the\ndiff --git a/include/android/hardware/libhardware/include/hardware/camera_common.h b/include/android/hardware/libhardware/include/hardware/camera_common.h\nindex 26df06987030..5c9bc06fe0b7 100644\n--- a/include/android/hardware/libhardware/include/hardware/camera_common.h\n+++ b/include/android/hardware/libhardware/include/hardware/camera_common.h\n@@ -141,17 +141,19 @@ __BEGIN_DECLS\n  * All device versions <= HARDWARE_DEVICE_API_VERSION(1, 0xFF) must be treated\n  * as CAMERA_DEVICE_API_VERSION_1_0\n  */\n-#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)\n-#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0)\n-#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1)\n-#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0)\n-#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1)\n+#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) // DEPRECATED\n+#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) // NO LONGER SUPPORTED\n+#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1) // NO LONGER SUPPORTED\n+#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0) // NO LONGER SUPPORTED\n+#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1) // NO LONGER SUPPORTED\n #define CAMERA_DEVICE_API_VERSION_3_2 HARDWARE_DEVICE_API_VERSION(3, 2)\n #define CAMERA_DEVICE_API_VERSION_3_3 HARDWARE_DEVICE_API_VERSION(3, 3)\n+#define CAMERA_DEVICE_API_VERSION_3_4 HARDWARE_DEVICE_API_VERSION(3, 4)\n+#define CAMERA_DEVICE_API_VERSION_3_5 HARDWARE_DEVICE_API_VERSION(3, 5)\n \n-// Device version 3.3 is current, older HAL camera device versions are not\n+// Device version 3.5 is current, older HAL camera device versions are not\n // recommended for new devices.\n-#define CAMERA_DEVICE_API_VERSION_CURRENT CAMERA_DEVICE_API_VERSION_3_3\n+#define CAMERA_DEVICE_API_VERSION_CURRENT CAMERA_DEVICE_API_VERSION_3_5\n \n /**\n  * Defined in /system/media/camera/include/system/camera_metadata.h\ndiff --git a/include/android/hardware/libhardware/include/hardware/fb.h b/include/android/hardware/libhardware/include/hardware/fb.h\nindex 9ea9a6e60f05..2d9153aed00b 100644\n--- a/include/android/hardware/libhardware/include/hardware/fb.h\n+++ b/include/android/hardware/libhardware/include/hardware/fb.h\n@@ -161,7 +161,7 @@ typedef struct framebuffer_device_t {\n static inline int framebuffer_open(const struct hw_module_t* module,\n         struct framebuffer_device_t** device) {\n     return module->methods->open(module,\n-            GRALLOC_HARDWARE_FB0, (struct hw_device_t**)device);\n+            GRALLOC_HARDWARE_FB0, TO_HW_DEVICE_T_OPEN(device));\n }\n \n static inline int framebuffer_close(struct framebuffer_device_t* device) {\ndiff --git a/include/android/hardware/libhardware/include/hardware/gralloc.h b/include/android/hardware/libhardware/include/hardware/gralloc.h\nindex 80da4cb8e16b..01a7672747a4 100644\n--- a/include/android/hardware/libhardware/include/hardware/gralloc.h\n+++ b/include/android/hardware/libhardware/include/hardware/gralloc.h\n@@ -19,9 +19,8 @@\n #ifndef ANDROID_GRALLOC_INTERFACE_H\n #define ANDROID_GRALLOC_INTERFACE_H\n \n-#include <system/window.h>\n+#include <hardware/hardware.h>\n #include <system/graphics.h>\n-#include <hardware/hardware.h>\n \n #include <stdint.h>\n #include <sys/cdefs.h>\n@@ -29,8 +28,8 @@\n \n #include <cutils/native_handle.h>\n \n-#include <hardware/hardware.h>\n #include <hardware/fb.h>\n+#include <hardware/hardware.h>\n \n __BEGIN_DECLS\n \n@@ -69,69 +68,69 @@ __BEGIN_DECLS\n \n enum {\n     /* buffer is never read in software */\n-    GRALLOC_USAGE_SW_READ_NEVER         = 0x00000000,\n+    GRALLOC_USAGE_SW_READ_NEVER         = 0x00000000U,\n     /* buffer is rarely read in software */\n-    GRALLOC_USAGE_SW_READ_RARELY        = 0x00000002,\n+    GRALLOC_USAGE_SW_READ_RARELY        = 0x00000002U,\n     /* buffer is often read in software */\n-    GRALLOC_USAGE_SW_READ_OFTEN         = 0x00000003,\n+    GRALLOC_USAGE_SW_READ_OFTEN         = 0x00000003U,\n     /* mask for the software read values */\n-    GRALLOC_USAGE_SW_READ_MASK          = 0x0000000F,\n+    GRALLOC_USAGE_SW_READ_MASK          = 0x0000000FU,\n \n     /* buffer is never written in software */\n-    GRALLOC_USAGE_SW_WRITE_NEVER        = 0x00000000,\n+    GRALLOC_USAGE_SW_WRITE_NEVER        = 0x00000000U,\n     /* buffer is rarely written in software */\n-    GRALLOC_USAGE_SW_WRITE_RARELY       = 0x00000020,\n+    GRALLOC_USAGE_SW_WRITE_RARELY       = 0x00000020U,\n     /* buffer is often written in software */\n-    GRALLOC_USAGE_SW_WRITE_OFTEN        = 0x00000030,\n+    GRALLOC_USAGE_SW_WRITE_OFTEN        = 0x00000030U,\n     /* mask for the software write values */\n-    GRALLOC_USAGE_SW_WRITE_MASK         = 0x000000F0,\n+    GRALLOC_USAGE_SW_WRITE_MASK         = 0x000000F0U,\n \n     /* buffer will be used as an OpenGL ES texture */\n-    GRALLOC_USAGE_HW_TEXTURE            = 0x00000100,\n+    GRALLOC_USAGE_HW_TEXTURE            = 0x00000100U,\n     /* buffer will be used as an OpenGL ES render target */\n-    GRALLOC_USAGE_HW_RENDER             = 0x00000200,\n+    GRALLOC_USAGE_HW_RENDER             = 0x00000200U,\n     /* buffer will be used by the 2D hardware blitter */\n-    GRALLOC_USAGE_HW_2D                 = 0x00000400,\n+    GRALLOC_USAGE_HW_2D                 = 0x00000400U,\n     /* buffer will be used by the HWComposer HAL module */\n-    GRALLOC_USAGE_HW_COMPOSER           = 0x00000800,\n+    GRALLOC_USAGE_HW_COMPOSER           = 0x00000800U,\n     /* buffer will be used with the framebuffer device */\n-    GRALLOC_USAGE_HW_FB                 = 0x00001000,\n+    GRALLOC_USAGE_HW_FB                 = 0x00001000U,\n \n     /* buffer should be displayed full-screen on an external display when\n      * possible */\n-    GRALLOC_USAGE_EXTERNAL_DISP         = 0x00002000,\n+    GRALLOC_USAGE_EXTERNAL_DISP         = 0x00002000U,\n \n     /* Must have a hardware-protected path to external display sink for\n      * this buffer.  If a hardware-protected path is not available, then\n      * either don't composite only this buffer (preferred) to the\n      * external sink, or (less desirable) do not route the entire\n      * composition to the external sink.  */\n-    GRALLOC_USAGE_PROTECTED             = 0x00004000,\n+    GRALLOC_USAGE_PROTECTED             = 0x00004000U,\n \n     /* buffer may be used as a cursor */\n-    GRALLOC_USAGE_CURSOR                = 0x00008000,\n+    GRALLOC_USAGE_CURSOR                = 0x00008000U,\n \n     /* buffer will be used with the HW video encoder */\n-    GRALLOC_USAGE_HW_VIDEO_ENCODER      = 0x00010000,\n+    GRALLOC_USAGE_HW_VIDEO_ENCODER      = 0x00010000U,\n     /* buffer will be written by the HW camera pipeline */\n-    GRALLOC_USAGE_HW_CAMERA_WRITE       = 0x00020000,\n+    GRALLOC_USAGE_HW_CAMERA_WRITE       = 0x00020000U,\n     /* buffer will be read by the HW camera pipeline */\n-    GRALLOC_USAGE_HW_CAMERA_READ        = 0x00040000,\n+    GRALLOC_USAGE_HW_CAMERA_READ        = 0x00040000U,\n     /* buffer will be used as part of zero-shutter-lag queue */\n-    GRALLOC_USAGE_HW_CAMERA_ZSL         = 0x00060000,\n+    GRALLOC_USAGE_HW_CAMERA_ZSL         = 0x00060000U,\n     /* mask for the camera access values */\n-    GRALLOC_USAGE_HW_CAMERA_MASK        = 0x00060000,\n+    GRALLOC_USAGE_HW_CAMERA_MASK        = 0x00060000U,\n     /* mask for the software usage bit-mask */\n-    GRALLOC_USAGE_HW_MASK               = 0x00071F00,\n+    GRALLOC_USAGE_HW_MASK               = 0x00071F00U,\n \n     /* buffer will be used as a RenderScript Allocation */\n-    GRALLOC_USAGE_RENDERSCRIPT          = 0x00100000,\n+    GRALLOC_USAGE_RENDERSCRIPT          = 0x00100000U,\n \n     /* Set by the consumer to indicate to the producer that they may attach a\n      * buffer that they did not detach from the BufferQueue. Will be filtered\n      * out by GRALLOC_USAGE_ALLOC_MASK, so gralloc modules will not need to\n      * handle this flag. */\n-    GRALLOC_USAGE_FOREIGN_BUFFERS       = 0x00200000,\n+    GRALLOC_USAGE_FOREIGN_BUFFERS       = 0x00200000U,\n \n     /* Mask of all flags which could be passed to a gralloc module for buffer\n      * allocation. Any flags not in this mask do not need to be handled by\n@@ -139,11 +138,11 @@ enum {\n     GRALLOC_USAGE_ALLOC_MASK            = ~(GRALLOC_USAGE_FOREIGN_BUFFERS),\n \n     /* implementation-specific private usage flags */\n-    GRALLOC_USAGE_PRIVATE_0             = 0x10000000,\n-    GRALLOC_USAGE_PRIVATE_1             = 0x20000000,\n-    GRALLOC_USAGE_PRIVATE_2             = 0x40000000,\n-    GRALLOC_USAGE_PRIVATE_3             = 0x80000000,\n-    GRALLOC_USAGE_PRIVATE_MASK          = 0xF0000000,\n+    GRALLOC_USAGE_PRIVATE_0             = 0x10000000U,\n+    GRALLOC_USAGE_PRIVATE_1             = 0x20000000U,\n+    GRALLOC_USAGE_PRIVATE_2             = 0x40000000U,\n+    GRALLOC_USAGE_PRIVATE_3             = 0x80000000U,\n+    GRALLOC_USAGE_PRIVATE_MASK          = 0xF0000000U,\n };\n \n /*****************************************************************************/\n@@ -373,13 +372,45 @@ typedef struct alloc_device_t {\n static inline int gralloc_open(const struct hw_module_t* module, \n         struct alloc_device_t** device) {\n     return module->methods->open(module, \n-            GRALLOC_HARDWARE_GPU0, (struct hw_device_t**)device);\n+            GRALLOC_HARDWARE_GPU0, TO_HW_DEVICE_T_OPEN(device));\n }\n \n static inline int gralloc_close(struct alloc_device_t* device) {\n     return device->common.close(&device->common);\n }\n \n+/**\n+ * map_usage_to_memtrack should be called after allocating a gralloc buffer.\n+ *\n+ * @param usage - it is the flag used when alloc function is called.\n+ *\n+ * This function maps the gralloc usage flags to appropriate memtrack bucket.\n+ * GrallocHAL implementers and users should make an additional ION_IOCTL_TAG\n+ * call using the memtrack tag returned by this function. This will help the\n+ * in-kernel memtack to categorize the memory allocated by different processes\n+ * according to their usage.\n+ *\n+ */\n+static inline const char* map_usage_to_memtrack(uint32_t usage) {\n+    usage &= GRALLOC_USAGE_ALLOC_MASK;\n+\n+    if ((usage & GRALLOC_USAGE_HW_CAMERA_WRITE) != 0) {\n+        return \"camera\";\n+    } else if ((usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) != 0 ||\n+            (usage & GRALLOC_USAGE_EXTERNAL_DISP) != 0) {\n+        return \"video\";\n+    } else if ((usage & GRALLOC_USAGE_HW_RENDER) != 0 ||\n+            (usage & GRALLOC_USAGE_HW_TEXTURE) != 0) {\n+        return \"gl\";\n+    } else if ((usage & GRALLOC_USAGE_HW_CAMERA_READ) != 0) {\n+        return \"camera\";\n+    } else if ((usage & GRALLOC_USAGE_SW_READ_MASK) != 0 ||\n+            (usage & GRALLOC_USAGE_SW_WRITE_MASK) != 0) {\n+        return \"cpu\";\n+    }\n+    return \"graphics\";\n+}\n+\n __END_DECLS\n \n #endif  // ANDROID_GRALLOC_INTERFACE_H\ndiff --git a/include/android/hardware/libhardware/include/hardware/hardware.h b/include/android/hardware/libhardware/include/hardware/hardware.h\nindex 10b73df7150a..8919f1204cde 100644\n--- a/include/android/hardware/libhardware/include/hardware/hardware.h\n+++ b/include/android/hardware/libhardware/include/hardware/hardware.h\n@@ -202,6 +202,12 @@ typedef struct hw_device_t {\n \n } hw_device_t;\n \n+#ifdef __cplusplus\n+#define TO_HW_DEVICE_T_OPEN(x) reinterpret_cast<struct hw_device_t**>(x)\n+#else\n+#define TO_HW_DEVICE_T_OPEN(x) (struct hw_device_t**)(x)\n+#endif\n+\n /**\n  * Name of the hal_module_info\n  */\ndiff --git a/include/android/system/core/include/cutils/native_handle.h b/include/android/system/core/include/cutils/native_handle.h\nindex edd7888fe284..dbd37672f040 100644\n--- a/include/android/system/core/include/cutils/native_handle.h\n+++ b/include/android/system/core/include/cutils/native_handle.h\n@@ -18,18 +18,37 @@\n #ifndef NATIVE_HANDLE_H_\n #define NATIVE_HANDLE_H_\n \n+#include <stdalign.h>\n+\n #ifdef __cplusplus\n extern \"C\" {\n #endif\n \n+#define NATIVE_HANDLE_MAX_FDS 1024\n+#define NATIVE_HANDLE_MAX_INTS 1024\n+\n+/* Declare a char array for use with native_handle_init */\n+#define NATIVE_HANDLE_DECLARE_STORAGE(name, maxFds, maxInts) \\\n+    alignas(native_handle_t) char (name)[                            \\\n+      sizeof(native_handle_t) + sizeof(int) * ((maxFds) + (maxInts))]\n+\n typedef struct native_handle\n {\n     int version;        /* sizeof(native_handle_t) */\n     int numFds;         /* number of file-descriptors at &data[0] */\n     int numInts;        /* number of ints at &data[numFds] */\n+#if defined(__clang__)\n+#pragma clang diagnostic push\n+#pragma clang diagnostic ignored \"-Wzero-length-array\"\n+#endif\n     int data[0];        /* numFds + numInts ints */\n+#if defined(__clang__)\n+#pragma clang diagnostic pop\n+#endif\n } native_handle_t;\n \n+typedef const native_handle_t* buffer_handle_t;\n+\n /*\n  * native_handle_close\n  * \n@@ -40,6 +59,14 @@ typedef struct native_handle\n  */\n int native_handle_close(const native_handle_t* h);\n \n+/*\n+ * native_handle_init\n+ *\n+ * Initializes a native_handle_t from storage.  storage must be declared with\n+ * NATIVE_HANDLE_DECLARE_STORAGE.  numFds and numInts must not respectively\n+ * exceed maxFds and maxInts used to declare the storage.\n+ */\n+native_handle_t* native_handle_init(char* storage, int numFds, int numInts);\n \n /*\n  * native_handle_create\n@@ -50,6 +77,15 @@ int native_handle_close(const native_handle_t* h);\n  */\n native_handle_t* native_handle_create(int numFds, int numInts);\n \n+/*\n+ * native_handle_clone\n+ *\n+ * creates a native_handle_t and initializes it from another native_handle_t.\n+ * Must be destroyed with native_handle_delete().\n+ *\n+ */\n+native_handle_t* native_handle_clone(const native_handle_t* handle);\n+\n /*\n  * native_handle_delete\n  * \ndiff --git a/include/android/system/core/include/system/camera.h b/include/android/system/core/include/system/camera.h\nindex a1b68d054d93..9d69588f9829 100644\n--- a/include/android/system/core/include/system/camera.h\n+++ b/include/android/system/core/include/system/camera.h\n@@ -204,6 +204,15 @@ enum {\n      * (except disconnect and sending CAMERA_CMD_PING) after getting this.\n      */\n     CAMERA_ERROR_RELEASED = 2,\n+\n+    /**\n+     * Camera was released because device policy change or the client application\n+     * is going to background. The client should call Camera::disconnect\n+     * immediately after getting this notification. Otherwise, the camera will be\n+     * released by camera service in a short time. The client should not call any\n+     * method (except disconnect and sending CAMERA_CMD_PING) after getting this.\n+     */\n+    CAMERA_ERROR_DISABLED = 3,\n     CAMERA_ERROR_SERVER_DIED = 100\n };\n \ndiff --git a/include/android/system/core/include/system/graphics.h b/include/android/system/core/include/system/graphics.h\nindex 909ffe68e78b..6341e642d57c 100644\n--- a/include/android/system/core/include/system/graphics.h\n+++ b/include/android/system/core/include/system/graphics.h\n@@ -18,12 +18,32 @@\n #ifndef SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H\n #define SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H\n \n+#include <stddef.h>\n #include <stdint.h>\n \n+/*\n+ * Some of the enums are now defined in HIDL in hardware/interfaces and are\n+ * generated.\n+ */\n+#include \"graphics-base.h\"\n+#include \"graphics-sw.h\"\n+\n #ifdef __cplusplus\n extern \"C\" {\n #endif\n \n+/* for compatibility */\n+#define HAL_PIXEL_FORMAT_YCbCr_420_888 HAL_PIXEL_FORMAT_YCBCR_420_888\n+#define HAL_PIXEL_FORMAT_YCbCr_422_SP HAL_PIXEL_FORMAT_YCBCR_422_SP\n+#define HAL_PIXEL_FORMAT_YCrCb_420_SP HAL_PIXEL_FORMAT_YCRCB_420_SP\n+#define HAL_PIXEL_FORMAT_YCbCr_422_I HAL_PIXEL_FORMAT_YCBCR_422_I\n+typedef android_pixel_format_t android_pixel_format;\n+typedef android_transform_t android_transform;\n+typedef android_dataspace_t android_dataspace;\n+typedef android_color_mode_t android_color_mode;\n+typedef android_color_transform_t android_color_transform;\n+typedef android_hdr_t android_hdr;\n+\n /*\n  * If the HAL needs to create service threads to handle graphics related\n  * tasks, these threads need to run at HAL_PRIORITY_URGENT_DISPLAY priority\n@@ -38,411 +58,6 @@ extern \"C\" {\n \n #define HAL_PRIORITY_URGENT_DISPLAY     (-8)\n \n-/**\n- * pixel format definitions\n- */\n-\n-enum {\n-    /*\n-     * \"linear\" color pixel formats:\n-     *\n-     * When used with ANativeWindow, the dataSpace field describes the color\n-     * space of the buffer.\n-     *\n-     * The color space determines, for example, if the formats are linear or\n-     * gamma-corrected; or whether any special operations are performed when\n-     * reading or writing into a buffer in one of these formats.\n-     */\n-    HAL_PIXEL_FORMAT_RGBA_8888          = 1,\n-    HAL_PIXEL_FORMAT_RGBX_8888          = 2,\n-    HAL_PIXEL_FORMAT_RGB_888            = 3,\n-    HAL_PIXEL_FORMAT_RGB_565            = 4,\n-    HAL_PIXEL_FORMAT_BGRA_8888          = 5,\n-\n-    /*\n-     * 0x100 - 0x1FF\n-     *\n-     * This range is reserved for pixel formats that are specific to the HAL\n-     * implementation.  Implementations can use any value in this range to\n-     * communicate video pixel formats between their HAL modules.  These formats\n-     * must not have an alpha channel.  Additionally, an EGLimage created from a\n-     * gralloc buffer of one of these formats must be supported for use with the\n-     * GL_OES_EGL_image_external OpenGL ES extension.\n-     */\n-\n-    /*\n-     * Android YUV format:\n-     *\n-     * This format is exposed outside of the HAL to software decoders and\n-     * applications.  EGLImageKHR must support it in conjunction with the\n-     * OES_EGL_image_external extension.\n-     *\n-     * YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed\n-     * by (W/2) x (H/2) Cr and Cb planes.\n-     *\n-     * This format assumes\n-     * - an even width\n-     * - an even height\n-     * - a horizontal stride multiple of 16 pixels\n-     * - a vertical stride equal to the height\n-     *\n-     *   y_size = stride * height\n-     *   c_stride = ALIGN(stride/2, 16)\n-     *   c_size = c_stride * height/2\n-     *   size = y_size + c_size * 2\n-     *   cr_offset = y_size\n-     *   cb_offset = y_size + c_size\n-     *\n-     * When used with ANativeWindow, the dataSpace field describes the color\n-     * space of the buffer.\n-     */\n-    HAL_PIXEL_FORMAT_YV12   = 0x32315659, // YCrCb 4:2:0 Planar\n-\n-\n-    /*\n-     * Android Y8 format:\n-     *\n-     * This format is exposed outside of the HAL to the framework.\n-     * The expected gralloc usage flags are SW_* and HW_CAMERA_*,\n-     * and no other HW_ flags will be used.\n-     *\n-     * Y8 is a YUV planar format comprised of a WxH Y plane,\n-     * with each pixel being represented by 8 bits.\n-     *\n-     * It is equivalent to just the Y plane from YV12.\n-     *\n-     * This format assumes\n-     * - an even width\n-     * - an even height\n-     * - a horizontal stride multiple of 16 pixels\n-     * - a vertical stride equal to the height\n-     *\n-     *   size = stride * height\n-     *\n-     * When used with ANativeWindow, the dataSpace field describes the color\n-     * space of the buffer.\n-     */\n-    HAL_PIXEL_FORMAT_Y8     = 0x20203859,\n-\n-    /*\n-     * Android Y16 format:\n-     *\n-     * This format is exposed outside of the HAL to the framework.\n-     * The expected gralloc usage flags are SW_* and HW_CAMERA_*,\n-     * and no other HW_ flags will be used.\n-     *\n-     * Y16 is a YUV planar format comprised of a WxH Y plane,\n-     * with each pixel being represented by 16 bits.\n-     *\n-     * It is just like Y8, but has double the bits per pixel (little endian).\n-     *\n-     * This format assumes\n-     * - an even width\n-     * - an even height\n-     * - a horizontal stride multiple of 16 pixels\n-     * - a vertical stride equal to the height\n-     * - strides are specified in pixels, not in bytes\n-     *\n-     *   size = stride * height * 2\n-     *\n-     * When used with ANativeWindow, the dataSpace field describes the color\n-     * space of the buffer, except that dataSpace field\n-     * HAL_DATASPACE_DEPTH indicates that this buffer contains a depth\n-     * image where each sample is a distance value measured by a depth camera,\n-     * plus an associated confidence value.\n-     */\n-    HAL_PIXEL_FORMAT_Y16    = 0x20363159,\n-\n-    /*\n-     * Android RAW sensor format:\n-     *\n-     * This format is exposed outside of the camera HAL to applications.\n-     *\n-     * RAW16 is a single-channel, 16-bit, little endian format, typically\n-     * representing raw Bayer-pattern images from an image sensor, with minimal\n-     * processing.\n-     *\n-     * The exact pixel layout of the data in the buffer is sensor-dependent, and\n-     * needs to be queried from the camera device.\n-     *\n-     * Generally, not all 16 bits are used; more common values are 10 or 12\n-     * bits. If not all bits are used, the lower-order bits are filled first.\n-     * All parameters to interpret the raw data (black and white points,\n-     * color space, etc) must be queried from the camera device.\n-     *\n-     * This format assumes\n-     * - an even width\n-     * - an even height\n-     * - a horizontal stride multiple of 16 pixels\n-     * - a vertical stride equal to the height\n-     * - strides are specified in pixels, not in bytes\n-     *\n-     *   size = stride * height * 2\n-     *\n-     * This format must be accepted by the gralloc module when used with the\n-     * following usage flags:\n-     *    - GRALLOC_USAGE_HW_CAMERA_*\n-     *    - GRALLOC_USAGE_SW_*\n-     *    - GRALLOC_USAGE_RENDERSCRIPT\n-     *\n-     * When used with ANativeWindow, the dataSpace should be\n-     * HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial\n-     * extra metadata to define.\n-     */\n-    HAL_PIXEL_FORMAT_RAW16 = 0x20,\n-\n-    /*\n-     * Android RAW10 format:\n-     *\n-     * This format is exposed outside of the camera HAL to applications.\n-     *\n-     * RAW10 is a single-channel, 10-bit per pixel, densely packed in each row,\n-     * unprocessed format, usually representing raw Bayer-pattern images coming from\n-     * an image sensor.\n-     *\n-     * In an image buffer with this format, starting from the first pixel of each\n-     * row, each 4 consecutive pixels are packed into 5 bytes (40 bits). Each one\n-     * of the first 4 bytes contains the top 8 bits of each pixel, The fifth byte\n-     * contains the 2 least significant bits of the 4 pixels, the exact layout data\n-     * for each 4 consecutive pixels is illustrated below (Pi[j] stands for the jth\n-     * bit of the ith pixel):\n-     *\n-     *          bit 7                                     bit 0\n-     *          =====|=====|=====|=====|=====|=====|=====|=====|\n-     * Byte 0: |P0[9]|P0[8]|P0[7]|P0[6]|P0[5]|P0[4]|P0[3]|P0[2]|\n-     *         |-----|-----|-----|-----|-----|-----|-----|-----|\n-     * Byte 1: |P1[9]|P1[8]|P1[7]|P1[6]|P1[5]|P1[4]|P1[3]|P1[2]|\n-     *         |-----|-----|-----|-----|-----|-----|-----|-----|\n-     * Byte 2: |P2[9]|P2[8]|P2[7]|P2[6]|P2[5]|P2[4]|P2[3]|P2[2]|\n-     *         |-----|-----|-----|-----|-----|-----|-----|-----|\n-     * Byte 3: |P3[9]|P3[8]|P3[7]|P3[6]|P3[5]|P3[4]|P3[3]|P3[2]|\n-     *         |-----|-----|-----|-----|-----|-----|-----|-----|\n-     * Byte 4: |P3[1]|P3[0]|P2[1]|P2[0]|P1[1]|P1[0]|P0[1]|P0[0]|\n-     *          ===============================================\n-     *\n-     * This format assumes\n-     * - a width multiple of 4 pixels\n-     * - an even height\n-     * - a vertical stride equal to the height\n-     * - strides are specified in bytes, not in pixels\n-     *\n-     *   size = stride * height\n-     *\n-     * When stride is equal to width * (10 / 8), there will be no padding bytes at\n-     * the end of each row, the entire image data is densely packed. When stride is\n-     * larger than width * (10 / 8), padding bytes will be present at the end of each\n-     * row (including the last row).\n-     *\n-     * This format must be accepted by the gralloc module when used with the\n-     * following usage flags:\n-     *    - GRALLOC_USAGE_HW_CAMERA_*\n-     *    - GRALLOC_USAGE_SW_*\n-     *    - GRALLOC_USAGE_RENDERSCRIPT\n-     *\n-     * When used with ANativeWindow, the dataSpace field should be\n-     * HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial\n-     * extra metadata to define.\n-     */\n-    HAL_PIXEL_FORMAT_RAW10 = 0x25,\n-\n-    /*\n-     * Android RAW12 format:\n-     *\n-     * This format is exposed outside of camera HAL to applications.\n-     *\n-     * RAW12 is a single-channel, 12-bit per pixel, densely packed in each row,\n-     * unprocessed format, usually representing raw Bayer-pattern images coming from\n-     * an image sensor.\n-     *\n-     * In an image buffer with this format, starting from the first pixel of each\n-     * row, each two consecutive pixels are packed into 3 bytes (24 bits). The first\n-     * and second byte contains the top 8 bits of first and second pixel. The third\n-     * byte contains the 4 least significant bits of the two pixels, the exact layout\n-     * data for each two consecutive pixels is illustrated below (Pi[j] stands for\n-     * the jth bit of the ith pixel):\n-     *\n-     *           bit 7                                            bit 0\n-     *          ======|======|======|======|======|======|======|======|\n-     * Byte 0: |P0[11]|P0[10]|P0[ 9]|P0[ 8]|P0[ 7]|P0[ 6]|P0[ 5]|P0[ 4]|\n-     *         |------|------|------|------|------|------|------|------|\n-     * Byte 1: |P1[11]|P1[10]|P1[ 9]|P1[ 8]|P1[ 7]|P1[ 6]|P1[ 5]|P1[ 4]|\n-     *         |------|------|------|------|------|------|------|------|\n-     * Byte 2: |P1[ 3]|P1[ 2]|P1[ 1]|P1[ 0]|P0[ 3]|P0[ 2]|P0[ 1]|P0[ 0]|\n-     *          =======================================================\n-     *\n-     * This format assumes:\n-     * - a width multiple of 4 pixels\n-     * - an even height\n-     * - a vertical stride equal to the height\n-     * - strides are specified in bytes, not in pixels\n-     *\n-     *   size = stride * height\n-     *\n-     * When stride is equal to width * (12 / 8), there will be no padding bytes at\n-     * the end of each row, the entire image data is densely packed. When stride is\n-     * larger than width * (12 / 8), padding bytes will be present at the end of\n-     * each row (including the last row).\n-     *\n-     * This format must be accepted by the gralloc module when used with the\n-     * following usage flags:\n-     *    - GRALLOC_USAGE_HW_CAMERA_*\n-     *    - GRALLOC_USAGE_SW_*\n-     *    - GRALLOC_USAGE_RENDERSCRIPT\n-     *\n-     * When used with ANativeWindow, the dataSpace field should be\n-     * HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial\n-     * extra metadata to define.\n-     */\n-    HAL_PIXEL_FORMAT_RAW12 = 0x26,\n-\n-    /*\n-     * Android opaque RAW format:\n-     *\n-     * This format is exposed outside of the camera HAL to applications.\n-     *\n-     * RAW_OPAQUE is a format for unprocessed raw image buffers coming from an\n-     * image sensor. The actual structure of buffers of this format is\n-     * implementation-dependent.\n-     *\n-     * This format must be accepted by the gralloc module when used with the\n-     * following usage flags:\n-     *    - GRALLOC_USAGE_HW_CAMERA_*\n-     *    - GRALLOC_USAGE_SW_*\n-     *    - GRALLOC_USAGE_RENDERSCRIPT\n-     *\n-     * When used with ANativeWindow, the dataSpace field should be\n-     * HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial\n-     * extra metadata to define.\n-     */\n-    HAL_PIXEL_FORMAT_RAW_OPAQUE = 0x24,\n-\n-    /*\n-     * Android binary blob graphics buffer format:\n-     *\n-     * This format is used to carry task-specific data which does not have a\n-     * standard image structure. The details of the format are left to the two\n-     * endpoints.\n-     *\n-     * A typical use case is for transporting JPEG-compressed images from the\n-     * Camera HAL to the framework or to applications.\n-     *\n-     * Buffers of this format must have a height of 1, and width equal to their\n-     * size in bytes.\n-     *\n-     * When used with ANativeWindow, the mapping of the dataSpace field to\n-     * buffer contents for BLOB is as follows:\n-     *\n-     *  dataSpace value               | Buffer contents\n-     * -------------------------------+-----------------------------------------\n-     *  HAL_DATASPACE_JFIF            | An encoded JPEG image\n-     *  HAL_DATASPACE_DEPTH           | An android_depth_points buffer\n-     *  Other                         | Unsupported\n-     *\n-     */\n-    HAL_PIXEL_FORMAT_BLOB = 0x21,\n-\n-    /*\n-     * Android format indicating that the choice of format is entirely up to the\n-     * device-specific Gralloc implementation.\n-     *\n-     * The Gralloc implementation should examine the usage bits passed in when\n-     * allocating a buffer with this format, and it should derive the pixel\n-     * format from those usage flags.  This format will never be used with any\n-     * of the GRALLOC_USAGE_SW_* usage flags.\n-     *\n-     * If a buffer of this format is to be used as an OpenGL ES texture, the\n-     * framework will assume that sampling the texture will always return an\n-     * alpha value of 1.0 (i.e. the buffer contains only opaque pixel values).\n-     *\n-     * When used with ANativeWindow, the dataSpace field describes the color\n-     * space of the buffer.\n-     */\n-    HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 0x22,\n-\n-    /*\n-     * Android flexible YCbCr 4:2:0 formats\n-     *\n-     * This format allows platforms to use an efficient YCbCr/YCrCb 4:2:0\n-     * buffer layout, while still describing the general format in a\n-     * layout-independent manner.  While called YCbCr, it can be\n-     * used to describe formats with either chromatic ordering, as well as\n-     * whole planar or semiplanar layouts.\n-     *\n-     * struct android_ycbcr (below) is the the struct used to describe it.\n-     *\n-     * This format must be accepted by the gralloc module when\n-     * USAGE_SW_WRITE_* or USAGE_SW_READ_* are set.\n-     *\n-     * This format is locked for use by gralloc's (*lock_ycbcr) method, and\n-     * locking with the (*lock) method will return an error.\n-     *\n-     * When used with ANativeWindow, the dataSpace field describes the color\n-     * space of the buffer.\n-     */\n-    HAL_PIXEL_FORMAT_YCbCr_420_888 = 0x23,\n-\n-    /*\n-     * Android flexible YCbCr 4:2:2 formats\n-     *\n-     * This format allows platforms to use an efficient YCbCr/YCrCb 4:2:2\n-     * buffer layout, while still describing the general format in a\n-     * layout-independent manner.  While called YCbCr, it can be\n-     * used to describe formats with either chromatic ordering, as well as\n-     * whole planar or semiplanar layouts.\n-     *\n-     * This format is currently only used by SW readable buffers\n-     * produced by MediaCodecs, so the gralloc module can ignore this format.\n-     */\n-    HAL_PIXEL_FORMAT_YCbCr_422_888 = 0x27,\n-\n-    /*\n-     * Android flexible YCbCr 4:4:4 formats\n-     *\n-     * This format allows platforms to use an efficient YCbCr/YCrCb 4:4:4\n-     * buffer layout, while still describing the general format in a\n-     * layout-independent manner.  While called YCbCr, it can be\n-     * used to describe formats with either chromatic ordering, as well as\n-     * whole planar or semiplanar layouts.\n-     *\n-     * This format is currently only used by SW readable buffers\n-     * produced by MediaCodecs, so the gralloc module can ignore this format.\n-     */\n-    HAL_PIXEL_FORMAT_YCbCr_444_888 = 0x28,\n-\n-    /*\n-     * Android flexible RGB 888 formats\n-     *\n-     * This format allows platforms to use an efficient RGB/BGR/RGBX/BGRX\n-     * buffer layout, while still describing the general format in a\n-     * layout-independent manner.  While called RGB, it can be\n-     * used to describe formats with either color ordering and optional\n-     * padding, as well as whole planar layout.\n-     *\n-     * This format is currently only used by SW readable buffers\n-     * produced by MediaCodecs, so the gralloc module can ignore this format.\n-     */\n-    HAL_PIXEL_FORMAT_FLEX_RGB_888 = 0x29,\n-\n-    /*\n-     * Android flexible RGBA 8888 formats\n-     *\n-     * This format allows platforms to use an efficient RGBA/BGRA/ARGB/ABGR\n-     * buffer layout, while still describing the general format in a\n-     * layout-independent manner.  While called RGBA, it can be\n-     * used to describe formats with any of the component orderings, as\n-     * well as whole planar layout.\n-     *\n-     * This format is currently only used by SW readable buffers\n-     * produced by MediaCodecs, so the gralloc module can ignore this format.\n-     */\n-    HAL_PIXEL_FORMAT_FLEX_RGBA_8888 = 0x2A,\n-\n-    /* Legacy formats (deprecated), used by ImageFormat.java */\n-    HAL_PIXEL_FORMAT_YCbCr_422_SP       = 0x10, // NV16\n-    HAL_PIXEL_FORMAT_YCrCb_420_SP       = 0x11, // NV21\n-    HAL_PIXEL_FORMAT_YCbCr_422_I        = 0x14, // YUY2\n-};\n-\n /*\n  * Structure for describing YCbCr formats for consumption by applications.\n  * This is used with HAL_PIXEL_FORMAT_YCbCr_*_888.\n@@ -452,15 +67,15 @@ enum {\n  *\n  * Buffers must have a 8 bit depth.\n  *\n- * @y, @cb, and @cr point to the first byte of their respective planes.\n+ * y, cb, and cr point to the first byte of their respective planes.\n  *\n  * Stride describes the distance in bytes from the first value of one row of\n  * the image to the first value of the next row.  It includes the width of the\n  * image plus padding.\n- * @ystride is the stride of the luma plane.\n- * @cstride is the stride of the chroma planes.\n+ * ystride is the stride of the luma plane.\n+ * cstride is the stride of the chroma planes.\n  *\n- * @chroma_step is the distance in bytes from one chroma pixel value to the\n+ * chroma_step is the distance in bytes from one chroma pixel value to the\n  * next.  This is 2 bytes for semiplanar (because chroma values are interleaved\n  * and each chroma value is one byte) and 1 for planar.\n  */\n@@ -477,6 +92,102 @@ struct android_ycbcr {\n     uint32_t reserved[8];\n };\n \n+/*\n+ * Structures for describing flexible YUVA/RGBA formats for consumption by\n+ * applications. Such flexible formats contain a plane for each component (e.g.\n+ * red, green, blue), where each plane is laid out in a grid-like pattern\n+ * occupying unique byte addresses and with consistent byte offsets between\n+ * neighboring pixels.\n+ *\n+ * The android_flex_layout structure is used with any pixel format that can be\n+ * represented by it, such as:\n+ *  - HAL_PIXEL_FORMAT_YCbCr_*_888\n+ *  - HAL_PIXEL_FORMAT_FLEX_RGB*_888\n+ *  - HAL_PIXEL_FORMAT_RGB[AX]_888[8],BGRA_8888,RGB_888\n+ *  - HAL_PIXEL_FORMAT_YV12,Y8,Y16,YCbCr_422_SP/I,YCrCb_420_SP\n+ *  - even implementation defined formats that can be represented by\n+ *    the structures\n+ *\n+ * Vertical increment (aka. row increment or stride) describes the distance in\n+ * bytes from the first pixel of one row to the first pixel of the next row\n+ * (below) for the component plane. This can be negative.\n+ *\n+ * Horizontal increment (aka. column or pixel increment) describes the distance\n+ * in bytes from one pixel to the next pixel (to the right) on the same row for\n+ * the component plane. This can be negative.\n+ *\n+ * Each plane can be subsampled either vertically or horizontally by\n+ * a power-of-two factor.\n+ *\n+ * The bit-depth of each component can be arbitrary, as long as the pixels are\n+ * laid out on whole bytes, in native byte-order, using the most significant\n+ * bits of each unit.\n+ */\n+\n+typedef enum android_flex_component {\n+    /* luma */\n+    FLEX_COMPONENT_Y = 1 << 0,\n+    /* chroma blue */\n+    FLEX_COMPONENT_Cb = 1 << 1,\n+    /* chroma red */\n+    FLEX_COMPONENT_Cr = 1 << 2,\n+\n+    /* red */\n+    FLEX_COMPONENT_R = 1 << 10,\n+    /* green */\n+    FLEX_COMPONENT_G = 1 << 11,\n+    /* blue */\n+    FLEX_COMPONENT_B = 1 << 12,\n+\n+    /* alpha */\n+    FLEX_COMPONENT_A = 1 << 30,\n+} android_flex_component_t;\n+\n+typedef struct android_flex_plane {\n+    /* pointer to the first byte of the top-left pixel of the plane. */\n+    uint8_t *top_left;\n+\n+    android_flex_component_t component;\n+\n+    /* bits allocated for the component in each pixel. Must be a positive\n+       multiple of 8. */\n+    int32_t bits_per_component;\n+    /* number of the most significant bits used in the format for this\n+       component. Must be between 1 and bits_per_component, inclusive. */\n+    int32_t bits_used;\n+\n+    /* horizontal increment */\n+    int32_t h_increment;\n+    /* vertical increment */\n+    int32_t v_increment;\n+    /* horizontal subsampling. Must be a positive power of 2. */\n+    int32_t h_subsampling;\n+    /* vertical subsampling. Must be a positive power of 2. */\n+    int32_t v_subsampling;\n+} android_flex_plane_t;\n+\n+typedef enum android_flex_format {\n+    /* not a flexible format */\n+    FLEX_FORMAT_INVALID = 0x0,\n+    FLEX_FORMAT_Y = FLEX_COMPONENT_Y,\n+    FLEX_FORMAT_YCbCr = FLEX_COMPONENT_Y | FLEX_COMPONENT_Cb | FLEX_COMPONENT_Cr,\n+    FLEX_FORMAT_YCbCrA = FLEX_FORMAT_YCbCr | FLEX_COMPONENT_A,\n+    FLEX_FORMAT_RGB = FLEX_COMPONENT_R | FLEX_COMPONENT_G | FLEX_COMPONENT_B,\n+    FLEX_FORMAT_RGBA = FLEX_FORMAT_RGB | FLEX_COMPONENT_A,\n+} android_flex_format_t;\n+\n+typedef struct android_flex_layout {\n+    /* the kind of flexible format */\n+    android_flex_format_t format;\n+\n+    /* number of planes; 0 for FLEX_FORMAT_INVALID */\n+    uint32_t num_planes;\n+    /* a plane for each component; ordered in increasing component value order.\n+       E.g. FLEX_FORMAT_RGBA maps 0 -> R, 1 -> G, etc.\n+       Can be NULL for FLEX_FORMAT_INVALID */\n+    android_flex_plane_t *planes;\n+} android_flex_layout_t;\n+\n /**\n  * Structure used to define depth point clouds for format HAL_PIXEL_FORMAT_BLOB\n  * with dataSpace value of HAL_DATASPACE_DEPTH.\n@@ -489,9 +200,9 @@ struct android_ycbcr {\n  * measurement is correct. It is between 0.f and 1.f, inclusive, with 1.f ==\n  * 100% confidence.\n  *\n- * @num_points is the number of points in the list\n+ * num_points is the number of points in the list\n  *\n- * @xyz_points is the flexible array of floating-point values.\n+ * xyz_points is the flexible array of floating-point values.\n  *   It contains (num_points) * 4 floats.\n  *\n  *   For example:\n@@ -516,246 +227,40 @@ struct android_depth_points {\n     /** reserved for future use, set to 0 by gralloc's (*lock)() */\n     uint32_t reserved[8];\n \n+#if defined(__clang__)\n+#pragma clang diagnostic push\n+#pragma clang diagnostic ignored \"-Wc99-extensions\"\n+#endif\n     float xyzc_points[];\n+#if defined(__clang__)\n+#pragma clang diagnostic pop\n+#endif\n };\n \n /**\n- * Transformation definitions\n- *\n- * IMPORTANT NOTE:\n- * HAL_TRANSFORM_ROT_90 is applied CLOCKWISE and AFTER HAL_TRANSFORM_FLIP_{H|V}.\n- *\n- */\n-\n-enum {\n-    /* flip source image horizontally (around the vertical axis) */\n-    HAL_TRANSFORM_FLIP_H    = 0x01,\n-    /* flip source image vertically (around the horizontal axis)*/\n-    HAL_TRANSFORM_FLIP_V    = 0x02,\n-    /* rotate source image 90 degrees clockwise */\n-    HAL_TRANSFORM_ROT_90    = 0x04,\n-    /* rotate source image 180 degrees */\n-    HAL_TRANSFORM_ROT_180   = 0x03,\n-    /* rotate source image 270 degrees clockwise */\n-    HAL_TRANSFORM_ROT_270   = 0x07,\n-    /* don't use. see system/window.h */\n-    HAL_TRANSFORM_RESERVED  = 0x08,\n+  * These structures are used to define the reference display's\n+  * capabilities for HDR content. Display engine can use this\n+  * to better tone map content to user's display.\n+  * Color is defined in CIE XYZ coordinates\n+  */\n+struct android_xy_color {\n+    float x;\n+    float y;\n };\n \n-/**\n- * Dataspace Definitions\n- * ======================\n- *\n- * Dataspace is the definition of how pixel values should be interpreted.\n- *\n- * For many formats, this is the colorspace of the image data, which includes\n- * primaries (including white point) and the transfer characteristic function,\n- * which describes both gamma curve and numeric range (within the bit depth).\n- *\n- * Other dataspaces include depth measurement data from a depth camera.\n- */\n-\n-typedef enum android_dataspace {\n-    /*\n-     * Default-assumption data space, when not explicitly specified.\n-     *\n-     * It is safest to assume the buffer is an image with sRGB primaries and\n-     * encoding ranges, but the consumer and/or the producer of the data may\n-     * simply be using defaults. No automatic gamma transform should be\n-     * expected, except for a possible display gamma transform when drawn to a\n-     * screen.\n-     */\n-    HAL_DATASPACE_UNKNOWN = 0x0,\n-\n-    /*\n-     * Arbitrary dataspace with manually defined characteristics.  Definition\n-     * for colorspaces or other meaning must be communicated separately.\n-     *\n-     * This is used when specifying primaries, transfer characteristics,\n-     * etc. separately.\n-     *\n-     * A typical use case is in video encoding parameters (e.g. for H.264),\n-     * where a colorspace can have separately defined primaries, transfer\n-     * characteristics, etc.\n-     */\n-    HAL_DATASPACE_ARBITRARY = 0x1,\n-\n-    /*\n-     * RGB Colorspaces\n-     * -----------------\n-     *\n-     * Primaries are given using (x,y) coordinates in the CIE 1931 definition\n-     * of x and y specified by ISO 11664-1.\n-     *\n-     * Transfer characteristics are the opto-electronic transfer characteristic\n-     * at the source as a function of linear optical intensity (luminance).\n-     */\n-\n-    /*\n-     * sRGB linear encoding:\n-     *\n-     * The red, green, and blue components are stored in sRGB space, but\n-     * are linear, not gamma-encoded.\n-     * The RGB primaries and the white point are the same as BT.709.\n-     *\n-     * The values are encoded using the full range ([0,255] for 8-bit) for all\n-     * components.\n-     */\n-    HAL_DATASPACE_SRGB_LINEAR = 0x200,\n-\n-    /*\n-     * sRGB gamma encoding:\n-     *\n-     * The red, green and blue components are stored in sRGB space, and\n-     * converted to linear space when read, using the standard sRGB to linear\n-     * equation:\n-     *\n-     * Clinear = Csrgb / 12.92                  for Csrgb <= 0.04045\n-     *         = (Csrgb + 0.055 / 1.055)^2.4    for Csrgb >  0.04045\n-     *\n-     * When written the inverse transformation is performed:\n-     *\n-     * Csrgb = 12.92 * Clinear                  for Clinear <= 0.0031308\n-     *       = 1.055 * Clinear^(1/2.4) - 0.055  for Clinear >  0.0031308\n-     *\n-     *\n-     * The alpha component, if present, is always stored in linear space and\n-     * is left unmodified when read or written.\n-     *\n-     * The RGB primaries and the white point are the same as BT.709.\n-     *\n-     * The values are encoded using the full range ([0,255] for 8-bit) for all\n-     * components.\n-     *\n-     */\n-    HAL_DATASPACE_SRGB = 0x201,\n-\n-    /*\n-     * YCbCr Colorspaces\n-     * -----------------\n-     *\n-     * Primaries are given using (x,y) coordinates in the CIE 1931 definition\n-     * of x and y specified by ISO 11664-1.\n-     *\n-     * Transfer characteristics are the opto-electronic transfer characteristic\n-     * at the source as a function of linear optical intensity (luminance).\n-     */\n-\n-    /*\n-     * JPEG File Interchange Format (JFIF)\n-     *\n-     * Same model as BT.601-625, but all values (Y, Cb, Cr) range from 0 to 255\n-     *\n-     * Transfer characteristic curve:\n-     *  E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018\n-     *  E = 4.500 L, 0.018 > L >= 0\n-     *      L - luminance of image 0 <= L <= 1 for conventional colorimetry\n-     *      E - corresponding electrical signal\n-     *\n-     * Primaries:       x       y\n-     *  green           0.290   0.600\n-     *  blue            0.150   0.060\n-     *  red             0.640   0.330\n-     *  white (D65)     0.3127  0.3290\n-     */\n-    HAL_DATASPACE_JFIF = 0x101,\n-\n-    /*\n-     * ITU-R Recommendation 601 (BT.601) - 625-line\n-     *\n-     * Standard-definition television, 625 Lines (PAL)\n-     *\n-     * For 8-bit-depth formats:\n-     * Luma (Y) samples should range from 16 to 235, inclusive\n-     * Chroma (Cb, Cr) samples should range from 16 to 240, inclusive\n-     *\n-     * For 10-bit-depth formats:\n-     * Luma (Y) samples should range from 64 to 940, inclusive\n-     * Chroma (Cb, Cr) samples should range from 64 to 960, inclusive\n-     *\n-     * Transfer characteristic curve:\n-     *  E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018\n-     *  E = 4.500 L, 0.018 > L >= 0\n-     *      L - luminance of image 0 <= L <= 1 for conventional colorimetry\n-     *      E - corresponding electrical signal\n-     *\n-     * Primaries:       x       y\n-     *  green           0.290   0.600\n-     *  blue            0.150   0.060\n-     *  red             0.640   0.330\n-     *  white (D65)     0.3127  0.3290\n-     */\n-    HAL_DATASPACE_BT601_625 = 0x102,\n-\n-    /*\n-     * ITU-R Recommendation 601 (BT.601) - 525-line\n-     *\n-     * Standard-definition television, 525 Lines (NTSC)\n-     *\n-     * For 8-bit-depth formats:\n-     * Luma (Y) samples should range from 16 to 235, inclusive\n-     * Chroma (Cb, Cr) samples should range from 16 to 240, inclusive\n-     *\n-     * For 10-bit-depth formats:\n-     * Luma (Y) samples should range from 64 to 940, inclusive\n-     * Chroma (Cb, Cr) samples should range from 64 to 960, inclusive\n-     *\n-     * Transfer characteristic curve:\n-     *  E = 1.099 * L ^ 0.45 - 0.099, 1.00 >= L >= 0.018\n-     *  E = 4.500 L, 0.018 > L >= 0\n-     *      L - luminance of image 0 <= L <= 1 for conventional colorimetry\n-     *      E - corresponding electrical signal\n-     *\n-     * Primaries:       x       y\n-     *  green           0.310   0.595\n-     *  blue            0.155   0.070\n-     *  red             0.630   0.340\n-     *  white (D65)     0.3127  0.3290\n-     */\n-    HAL_DATASPACE_BT601_525 = 0x103,\n-\n-    /*\n-     * ITU-R Recommendation 709 (BT.709)\n-     *\n-     * High-definition television\n-     *\n-     * For 8-bit-depth formats:\n-     * Luma (Y) samples should range from 16 to 235, inclusive\n-     * Chroma (Cb, Cr) samples should range from 16 to 240, inclusive\n-     *\n-     * For 10-bit-depth formats:\n-     * Luma (Y) samples should range from 64 to 940, inclusive\n-     * Chroma (Cb, Cr) samples should range from 64 to 960, inclusive\n-     *\n-     * Primaries:       x       y\n-     *  green           0.300   0.600\n-     *  blue            0.150   0.060\n-     *  red             0.640   0.330\n-     *  white (D65)     0.3127  0.3290\n-     */\n-    HAL_DATASPACE_BT709 = 0x104,\n-\n-    /*\n-     * The buffer contains depth ranging measurements from a depth camera.\n-     * This value is valid with formats:\n-     *    HAL_PIXEL_FORMAT_Y16: 16-bit samples, consisting of a depth measurement\n-     *       and an associated confidence value. The 3 MSBs of the sample make\n-     *       up the confidence value, and the low 13 LSBs of the sample make up\n-     *       the depth measurement.\n-     *       For the confidence section, 0 means 100% confidence, 1 means 0%\n-     *       confidence. The mapping to a linear float confidence value between\n-     *       0.f and 1.f can be obtained with\n-     *         float confidence = (((depthSample >> 13) - 1) & 0x7) / 7.0f;\n-     *       The depth measurement can be extracted simply with\n-     *         uint16_t range = (depthSample & 0x1FFF);\n-     *    HAL_PIXEL_FORMAT_BLOB: A depth point cloud, as\n-     *       a variable-length float (x,y,z, confidence) coordinate point list.\n-     *       The point cloud will be represented with the android_depth_points\n-     *       structure.\n-     */\n-    HAL_DATASPACE_DEPTH = 0x1000\n+struct android_smpte2086_metadata {\n+    struct android_xy_color displayPrimaryRed;\n+    struct android_xy_color displayPrimaryGreen;\n+    struct android_xy_color displayPrimaryBlue;\n+    struct android_xy_color whitePoint;\n+    float maxLuminance;\n+    float minLuminance;\n+};\n \n-} android_dataspace_t;\n+struct android_cta861_3_metadata {\n+    float maxContentLightLevel;\n+    float maxFrameAverageLightLevel;\n+};\n \n #ifdef __cplusplus\n }\ndiff --git a/include/android/system/core/include/system/window.h b/include/android/system/core/include/system/window.h\ndeleted file mode 100644\nindex 2c9d6063fdb5..000000000000\n--- a/include/android/system/core/include/system/window.h\n+++ /dev/null\n@@ -1,955 +0,0 @@\n-/* SPDX-License-Identifier: Apache-2.0 */\n-/*\n- * Copyright (C) 2011 The Android Open Source Project\n- *\n- * Licensed under the Apache License, Version 2.0 (the \"License\");\n- * you may not use this file except in compliance with the License.\n- * You may obtain a copy of the License at\n- *\n- *      http://www.apache.org/licenses/LICENSE-2.0\n- *\n- * Unless required by applicable law or agreed to in writing, software\n- * distributed under the License is distributed on an \"AS IS\" BASIS,\n- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n- * See the License for the specific language governing permissions and\n- * limitations under the License.\n- */\n-\n-#ifndef SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H\n-#define SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H\n-\n-#include <cutils/native_handle.h>\n-#include <errno.h>\n-#include <limits.h>\n-#include <stdint.h>\n-#include <string.h>\n-#include <sys/cdefs.h>\n-#include <system/graphics.h>\n-#include <unistd.h>\n-\n-#ifndef __UNUSED\n-#define __UNUSED __attribute__((__unused__))\n-#endif\n-#ifndef __deprecated\n-#define __deprecated __attribute__((__deprecated__))\n-#endif\n-\n-__BEGIN_DECLS\n-\n-/*****************************************************************************/\n-\n-#define ANDROID_NATIVE_MAKE_CONSTANT(a,b,c,d) \\\n-    (((unsigned)(a)<<24)|((unsigned)(b)<<16)|((unsigned)(c)<<8)|(unsigned)(d))\n-\n-#define ANDROID_NATIVE_WINDOW_MAGIC \\\n-    ANDROID_NATIVE_MAKE_CONSTANT('_','w','n','d')\n-\n-#define ANDROID_NATIVE_BUFFER_MAGIC \\\n-    ANDROID_NATIVE_MAKE_CONSTANT('_','b','f','r')\n-\n-// ---------------------------------------------------------------------------\n-\n-// This #define may be used to conditionally compile device-specific code to\n-// support either the prior ANativeWindow interface, which did not pass libsync\n-// fences around, or the new interface that does.  This #define is only present\n-// when the ANativeWindow interface does include libsync support.\n-#define ANDROID_NATIVE_WINDOW_HAS_SYNC 1\n-\n-// ---------------------------------------------------------------------------\n-\n-typedef const native_handle_t* buffer_handle_t;\n-\n-// ---------------------------------------------------------------------------\n-\n-typedef struct android_native_rect_t\n-{\n-    int32_t left;\n-    int32_t top;\n-    int32_t right;\n-    int32_t bottom;\n-} android_native_rect_t;\n-\n-// ---------------------------------------------------------------------------\n-\n-typedef struct android_native_base_t\n-{\n-    /* a magic value defined by the actual EGL native type */\n-    int magic;\n-\n-    /* the sizeof() of the actual EGL native type */\n-    int version;\n-\n-    void* reserved[4];\n-\n-    /* reference-counting interface */\n-    void (*incRef)(struct android_native_base_t* base);\n-    void (*decRef)(struct android_native_base_t* base);\n-} android_native_base_t;\n-\n-typedef struct ANativeWindowBuffer\n-{\n-#ifdef __cplusplus\n-    ANativeWindowBuffer() {\n-        common.magic = ANDROID_NATIVE_BUFFER_MAGIC;\n-        common.version = sizeof(ANativeWindowBuffer);\n-        memset(common.reserved, 0, sizeof(common.reserved));\n-    }\n-\n-    // Implement the methods that sp<ANativeWindowBuffer> expects so that it\n-    // can be used to automatically refcount ANativeWindowBuffer's.\n-    void incStrong(const void* /*id*/) const {\n-        common.incRef(const_cast<android_native_base_t*>(&common));\n-    }\n-    void decStrong(const void* /*id*/) const {\n-        common.decRef(const_cast<android_native_base_t*>(&common));\n-    }\n-#endif\n-\n-    struct android_native_base_t common;\n-\n-    int width;\n-    int height;\n-    int stride;\n-    int format;\n-    int usage;\n-\n-    void* reserved[2];\n-\n-    buffer_handle_t handle;\n-\n-    void* reserved_proc[8];\n-} ANativeWindowBuffer_t;\n-\n-// Old typedef for backwards compatibility.\n-typedef ANativeWindowBuffer_t android_native_buffer_t;\n-\n-// ---------------------------------------------------------------------------\n-\n-/* attributes queriable with query() */\n-enum {\n-    NATIVE_WINDOW_WIDTH     = 0,\n-    NATIVE_WINDOW_HEIGHT    = 1,\n-    NATIVE_WINDOW_FORMAT    = 2,\n-\n-    /* The minimum number of buffers that must remain un-dequeued after a buffer\n-     * has been queued.  This value applies only if set_buffer_count was used to\n-     * override the number of buffers and if a buffer has since been queued.\n-     * Users of the set_buffer_count ANativeWindow method should query this\n-     * value before calling set_buffer_count.  If it is necessary to have N\n-     * buffers simultaneously dequeued as part of the steady-state operation,\n-     * and this query returns M then N+M buffers should be requested via\n-     * native_window_set_buffer_count.\n-     *\n-     * Note that this value does NOT apply until a single buffer has been\n-     * queued.  In particular this means that it is possible to:\n-     *\n-     * 1. Query M = min undequeued buffers\n-     * 2. Set the buffer count to N + M\n-     * 3. Dequeue all N + M buffers\n-     * 4. Cancel M buffers\n-     * 5. Queue, dequeue, queue, dequeue, ad infinitum\n-     */\n-    NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS = 3,\n-\n-    /* Check whether queueBuffer operations on the ANativeWindow send the buffer\n-     * to the window compositor.  The query sets the returned 'value' argument\n-     * to 1 if the ANativeWindow DOES send queued buffers directly to the window\n-     * compositor and 0 if the buffers do not go directly to the window\n-     * compositor.\n-     *\n-     * This can be used to determine whether protected buffer content should be\n-     * sent to the ANativeWindow.  Note, however, that a result of 1 does NOT\n-     * indicate that queued buffers will be protected from applications or users\n-     * capturing their contents.  If that behavior is desired then some other\n-     * mechanism (e.g. the GRALLOC_USAGE_PROTECTED flag) should be used in\n-     * conjunction with this query.\n-     */\n-    NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER = 4,\n-\n-    /* Get the concrete type of a ANativeWindow.  See below for the list of\n-     * possible return values.\n-     *\n-     * This query should not be used outside the Android framework and will\n-     * likely be removed in the near future.\n-     */\n-    NATIVE_WINDOW_CONCRETE_TYPE = 5,\n-\n-\n-    /*\n-     * Default width and height of ANativeWindow buffers, these are the\n-     * dimensions of the window buffers irrespective of the\n-     * NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS call and match the native window\n-     * size unless overridden by NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS.\n-     */\n-    NATIVE_WINDOW_DEFAULT_WIDTH = 6,\n-    NATIVE_WINDOW_DEFAULT_HEIGHT = 7,\n-\n-    /*\n-     * transformation that will most-likely be applied to buffers. This is only\n-     * a hint, the actual transformation applied might be different.\n-     *\n-     * INTENDED USE:\n-     *\n-     * The transform hint can be used by a producer, for instance the GLES\n-     * driver, to pre-rotate the rendering such that the final transformation\n-     * in the composer is identity. This can be very useful when used in\n-     * conjunction with the h/w composer HAL, in situations where it\n-     * cannot handle arbitrary rotations.\n-     *\n-     * 1. Before dequeuing a buffer, the GL driver (or any other ANW client)\n-     *    queries the ANW for NATIVE_WINDOW_TRANSFORM_HINT.\n-     *\n-     * 2. The GL driver overrides the width and height of the ANW to\n-     *    account for NATIVE_WINDOW_TRANSFORM_HINT. This is done by querying\n-     *    NATIVE_WINDOW_DEFAULT_{WIDTH | HEIGHT}, swapping the dimensions\n-     *    according to NATIVE_WINDOW_TRANSFORM_HINT and calling\n-     *    native_window_set_buffers_dimensions().\n-     *\n-     * 3. The GL driver dequeues a buffer of the new pre-rotated size.\n-     *\n-     * 4. The GL driver renders to the buffer such that the image is\n-     *    already transformed, that is applying NATIVE_WINDOW_TRANSFORM_HINT\n-     *    to the rendering.\n-     *\n-     * 5. The GL driver calls native_window_set_transform to apply\n-     *    inverse transformation to the buffer it just rendered.\n-     *    In order to do this, the GL driver needs\n-     *    to calculate the inverse of NATIVE_WINDOW_TRANSFORM_HINT, this is\n-     *    done easily:\n-     *\n-     *        int hintTransform, inverseTransform;\n-     *        query(..., NATIVE_WINDOW_TRANSFORM_HINT, &hintTransform);\n-     *        inverseTransform = hintTransform;\n-     *        if (hintTransform & HAL_TRANSFORM_ROT_90)\n-     *            inverseTransform ^= HAL_TRANSFORM_ROT_180;\n-     *\n-     *\n-     * 6. The GL driver queues the pre-transformed buffer.\n-     *\n-     * 7. The composer combines the buffer transform with the display\n-     *    transform.  If the buffer transform happens to cancel out the\n-     *    display transform then no rotation is needed.\n-     *\n-     */\n-    NATIVE_WINDOW_TRANSFORM_HINT = 8,\n-\n-    /*\n-     * Boolean that indicates whether the consumer is running more than\n-     * one buffer behind the producer.\n-     */\n-    NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND = 9,\n-\n-    /*\n-     * The consumer gralloc usage bits currently set by the consumer.\n-     * The values are defined in hardware/libhardware/include/gralloc.h.\n-     */\n-    NATIVE_WINDOW_CONSUMER_USAGE_BITS = 10,\n-\n-    /**\n-     * Transformation that will by applied to buffers by the hwcomposer.\n-     * This must not be set or checked by producer endpoints, and will\n-     * disable the transform hint set in SurfaceFlinger (see\n-     * NATIVE_WINDOW_TRANSFORM_HINT).\n-     *\n-     * INTENDED USE:\n-     * Temporary - Please do not use this.  This is intended only to be used\n-     * by the camera's LEGACY mode.\n-     *\n-     * In situations where a SurfaceFlinger client wishes to set a transform\n-     * that is not visible to the producer, and will always be applied in the\n-     * hardware composer, the client can set this flag with\n-     * native_window_set_buffers_sticky_transform.  This can be used to rotate\n-     * and flip buffers consumed by hardware composer without actually changing\n-     * the aspect ratio of the buffers produced.\n-     */\n-    NATIVE_WINDOW_STICKY_TRANSFORM = 11,\n-\n-    /**\n-     * The default data space for the buffers as set by the consumer.\n-     * The values are defined in graphics.h.\n-     */\n-    NATIVE_WINDOW_DEFAULT_DATASPACE = 12,\n-\n-    /*\n-     * Returns the age of the contents of the most recently dequeued buffer as\n-     * the number of frames that have elapsed since it was last queued. For\n-     * example, if the window is double-buffered, the age of any given buffer in\n-     * steady state will be 2. If the dequeued buffer has never been queued, its\n-     * age will be 0.\n-     */\n-    NATIVE_WINDOW_BUFFER_AGE = 13,\n-};\n-\n-/* Valid operations for the (*perform)() hook.\n- *\n- * Values marked as 'deprecated' are supported, but have been superceded by\n- * other functionality.\n- *\n- * Values marked as 'private' should be considered private to the framework.\n- * HAL implementation code with access to an ANativeWindow should not use these,\n- * as it may not interact properly with the framework's use of the\n- * ANativeWindow.\n- */\n-enum {\n-    NATIVE_WINDOW_SET_USAGE                 =  0,\n-    NATIVE_WINDOW_CONNECT                   =  1,   /* deprecated */\n-    NATIVE_WINDOW_DISCONNECT                =  2,   /* deprecated */\n-    NATIVE_WINDOW_SET_CROP                  =  3,   /* private */\n-    NATIVE_WINDOW_SET_BUFFER_COUNT          =  4,\n-    NATIVE_WINDOW_SET_BUFFERS_GEOMETRY      =  5,   /* deprecated */\n-    NATIVE_WINDOW_SET_BUFFERS_TRANSFORM     =  6,\n-    NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP     =  7,\n-    NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS    =  8,\n-    NATIVE_WINDOW_SET_BUFFERS_FORMAT        =  9,\n-    NATIVE_WINDOW_SET_SCALING_MODE          = 10,   /* private */\n-    NATIVE_WINDOW_LOCK                      = 11,   /* private */\n-    NATIVE_WINDOW_UNLOCK_AND_POST           = 12,   /* private */\n-    NATIVE_WINDOW_API_CONNECT               = 13,   /* private */\n-    NATIVE_WINDOW_API_DISCONNECT            = 14,   /* private */\n-    NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS = 15, /* private */\n-    NATIVE_WINDOW_SET_POST_TRANSFORM_CROP   = 16,   /* private */\n-    NATIVE_WINDOW_SET_BUFFERS_STICKY_TRANSFORM = 17,/* private */\n-    NATIVE_WINDOW_SET_SIDEBAND_STREAM       = 18,\n-    NATIVE_WINDOW_SET_BUFFERS_DATASPACE     = 19,\n-    NATIVE_WINDOW_SET_SURFACE_DAMAGE        = 20,   /* private */\n-};\n-\n-/* parameter for NATIVE_WINDOW_[API_][DIS]CONNECT */\n-enum {\n-    /* Buffers will be queued by EGL via eglSwapBuffers after being filled using\n-     * OpenGL ES.\n-     */\n-    NATIVE_WINDOW_API_EGL = 1,\n-\n-    /* Buffers will be queued after being filled using the CPU\n-     */\n-    NATIVE_WINDOW_API_CPU = 2,\n-\n-    /* Buffers will be queued by Stagefright after being filled by a video\n-     * decoder.  The video decoder can either be a software or hardware decoder.\n-     */\n-    NATIVE_WINDOW_API_MEDIA = 3,\n-\n-    /* Buffers will be queued by the the camera HAL.\n-     */\n-    NATIVE_WINDOW_API_CAMERA = 4,\n-};\n-\n-/* parameter for NATIVE_WINDOW_SET_BUFFERS_TRANSFORM */\n-enum {\n-    /* flip source image horizontally */\n-    NATIVE_WINDOW_TRANSFORM_FLIP_H = HAL_TRANSFORM_FLIP_H ,\n-    /* flip source image vertically */\n-    NATIVE_WINDOW_TRANSFORM_FLIP_V = HAL_TRANSFORM_FLIP_V,\n-    /* rotate source image 90 degrees clock-wise, and is applied after TRANSFORM_FLIP_{H|V} */\n-    NATIVE_WINDOW_TRANSFORM_ROT_90 = HAL_TRANSFORM_ROT_90,\n-    /* rotate source image 180 degrees */\n-    NATIVE_WINDOW_TRANSFORM_ROT_180 = HAL_TRANSFORM_ROT_180,\n-    /* rotate source image 270 degrees clock-wise */\n-    NATIVE_WINDOW_TRANSFORM_ROT_270 = HAL_TRANSFORM_ROT_270,\n-    /* transforms source by the inverse transform of the screen it is displayed onto. This\n-     * transform is applied last */\n-    NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY = 0x08\n-};\n-\n-/* parameter for NATIVE_WINDOW_SET_SCALING_MODE */\n-enum {\n-    /* the window content is not updated (frozen) until a buffer of\n-     * the window size is received (enqueued)\n-     */\n-    NATIVE_WINDOW_SCALING_MODE_FREEZE           = 0,\n-    /* the buffer is scaled in both dimensions to match the window size */\n-    NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW  = 1,\n-    /* the buffer is scaled uniformly such that the smaller dimension\n-     * of the buffer matches the window size (cropping in the process)\n-     */\n-    NATIVE_WINDOW_SCALING_MODE_SCALE_CROP       = 2,\n-    /* the window is clipped to the size of the buffer's crop rectangle; pixels\n-     * outside the crop rectangle are treated as if they are completely\n-     * transparent.\n-     */\n-    NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP    = 3,\n-};\n-\n-/* values returned by the NATIVE_WINDOW_CONCRETE_TYPE query */\n-enum {\n-    NATIVE_WINDOW_FRAMEBUFFER               = 0, /* FramebufferNativeWindow */\n-    NATIVE_WINDOW_SURFACE                   = 1, /* Surface */\n-};\n-\n-/* parameter for NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP\n- *\n- * Special timestamp value to indicate that timestamps should be auto-generated\n- * by the native window when queueBuffer is called.  This is equal to INT64_MIN,\n- * defined directly to avoid problems with C99/C++ inclusion of stdint.h.\n- */\n-static const int64_t NATIVE_WINDOW_TIMESTAMP_AUTO = (-9223372036854775807LL-1);\n-\n-struct ANativeWindow\n-{\n-#ifdef __cplusplus\n-    ANativeWindow()\n-        : flags(0), minSwapInterval(0), maxSwapInterval(0), xdpi(0), ydpi(0)\n-    {\n-        common.magic = ANDROID_NATIVE_WINDOW_MAGIC;\n-        common.version = sizeof(ANativeWindow);\n-        memset(common.reserved, 0, sizeof(common.reserved));\n-    }\n-\n-    /* Implement the methods that sp<ANativeWindow> expects so that it\n-       can be used to automatically refcount ANativeWindow's. */\n-    void incStrong(const void* /*id*/) const {\n-        common.incRef(const_cast<android_native_base_t*>(&common));\n-    }\n-    void decStrong(const void* /*id*/) const {\n-        common.decRef(const_cast<android_native_base_t*>(&common));\n-    }\n-#endif\n-\n-    struct android_native_base_t common;\n-\n-    /* flags describing some attributes of this surface or its updater */\n-    const uint32_t flags;\n-\n-    /* min swap interval supported by this updated */\n-    const int   minSwapInterval;\n-\n-    /* max swap interval supported by this updated */\n-    const int   maxSwapInterval;\n-\n-    /* horizontal and vertical resolution in DPI */\n-    const float xdpi;\n-    const float ydpi;\n-\n-    /* Some storage reserved for the OEM's driver. */\n-    intptr_t    oem[4];\n-\n-    /*\n-     * Set the swap interval for this surface.\n-     *\n-     * Returns 0 on success or -errno on error.\n-     */\n-    int     (*setSwapInterval)(struct ANativeWindow* window,\n-                int interval);\n-\n-    /*\n-     * Hook called by EGL to acquire a buffer. After this call, the buffer\n-     * is not locked, so its content cannot be modified. This call may block if\n-     * no buffers are available.\n-     *\n-     * The window holds a reference to the buffer between dequeueBuffer and\n-     * either queueBuffer or cancelBuffer, so clients only need their own\n-     * reference if they might use the buffer after queueing or canceling it.\n-     * Holding a reference to a buffer after queueing or canceling it is only\n-     * allowed if a specific buffer count has been set.\n-     *\n-     * Returns 0 on success or -errno on error.\n-     *\n-     * XXX: This function is deprecated.  It will continue to work for some\n-     * time for binary compatibility, but the new dequeueBuffer function that\n-     * outputs a fence file descriptor should be used in its place.\n-     */\n-    int     (*dequeueBuffer_DEPRECATED)(struct ANativeWindow* window,\n-                struct ANativeWindowBuffer** buffer);\n-\n-    /*\n-     * hook called by EGL to lock a buffer. This MUST be called before modifying\n-     * the content of a buffer. The buffer must have been acquired with\n-     * dequeueBuffer first.\n-     *\n-     * Returns 0 on success or -errno on error.\n-     *\n-     * XXX: This function is deprecated.  It will continue to work for some\n-     * time for binary compatibility, but it is essentially a no-op, and calls\n-     * to it should be removed.\n-     */\n-    int     (*lockBuffer_DEPRECATED)(struct ANativeWindow* window,\n-                struct ANativeWindowBuffer* buffer);\n-\n-    /*\n-     * Hook called by EGL when modifications to the render buffer are done.\n-     * This unlocks and post the buffer.\n-     *\n-     * The window holds a reference to the buffer between dequeueBuffer and\n-     * either queueBuffer or cancelBuffer, so clients only need their own\n-     * reference if they might use the buffer after queueing or canceling it.\n-     * Holding a reference to a buffer after queueing or canceling it is only\n-     * allowed if a specific buffer count has been set.\n-     *\n-     * Buffers MUST be queued in the same order than they were dequeued.\n-     *\n-     * Returns 0 on success or -errno on error.\n-     *\n-     * XXX: This function is deprecated.  It will continue to work for some\n-     * time for binary compatibility, but the new queueBuffer function that\n-     * takes a fence file descriptor should be used in its place (pass a value\n-     * of -1 for the fence file descriptor if there is no valid one to pass).\n-     */\n-    int     (*queueBuffer_DEPRECATED)(struct ANativeWindow* window,\n-                struct ANativeWindowBuffer* buffer);\n-\n-    /*\n-     * hook used to retrieve information about the native window.\n-     *\n-     * Returns 0 on success or -errno on error.\n-     */\n-    int     (*query)(const struct ANativeWindow* window,\n-                int what, int* value);\n-\n-    /*\n-     * hook used to perform various operations on the surface.\n-     * (*perform)() is a generic mechanism to add functionality to\n-     * ANativeWindow while keeping backward binary compatibility.\n-     *\n-     * DO NOT CALL THIS HOOK DIRECTLY.  Instead, use the helper functions\n-     * defined below.\n-     *\n-     * (*perform)() returns -ENOENT if the 'what' parameter is not supported\n-     * by the surface's implementation.\n-     *\n-     * See above for a list of valid operations, such as\n-     * NATIVE_WINDOW_SET_USAGE or NATIVE_WINDOW_CONNECT\n-     */\n-    int     (*perform)(struct ANativeWindow* window,\n-                int operation, ... );\n-\n-    /*\n-     * Hook used to cancel a buffer that has been dequeued.\n-     * No synchronization is performed between dequeue() and cancel(), so\n-     * either external synchronization is needed, or these functions must be\n-     * called from the same thread.\n-     *\n-     * The window holds a reference to the buffer between dequeueBuffer and\n-     * either queueBuffer or cancelBuffer, so clients only need their own\n-     * reference if they might use the buffer after queueing or canceling it.\n-     * Holding a reference to a buffer after queueing or canceling it is only\n-     * allowed if a specific buffer count has been set.\n-     *\n-     * XXX: This function is deprecated.  It will continue to work for some\n-     * time for binary compatibility, but the new cancelBuffer function that\n-     * takes a fence file descriptor should be used in its place (pass a value\n-     * of -1 for the fence file descriptor if there is no valid one to pass).\n-     */\n-    int     (*cancelBuffer_DEPRECATED)(struct ANativeWindow* window,\n-                struct ANativeWindowBuffer* buffer);\n-\n-    /*\n-     * Hook called by EGL to acquire a buffer. This call may block if no\n-     * buffers are available.\n-     *\n-     * The window holds a reference to the buffer between dequeueBuffer and\n-     * either queueBuffer or cancelBuffer, so clients only need their own\n-     * reference if they might use the buffer after queueing or canceling it.\n-     * Holding a reference to a buffer after queueing or canceling it is only\n-     * allowed if a specific buffer count has been set.\n-     *\n-     * The libsync fence file descriptor returned in the int pointed to by the\n-     * fenceFd argument will refer to the fence that must signal before the\n-     * dequeued buffer may be written to.  A value of -1 indicates that the\n-     * caller may access the buffer immediately without waiting on a fence.  If\n-     * a valid file descriptor is returned (i.e. any value except -1) then the\n-     * caller is responsible for closing the file descriptor.\n-     *\n-     * Returns 0 on success or -errno on error.\n-     */\n-    int     (*dequeueBuffer)(struct ANativeWindow* window,\n-                struct ANativeWindowBuffer** buffer, int* fenceFd);\n-\n-    /*\n-     * Hook called by EGL when modifications to the render buffer are done.\n-     * This unlocks and post the buffer.\n-     *\n-     * The window holds a reference to the buffer between dequeueBuffer and\n-     * either queueBuffer or cancelBuffer, so clients only need their own\n-     * reference if they might use the buffer after queueing or canceling it.\n-     * Holding a reference to a buffer after queueing or canceling it is only\n-     * allowed if a specific buffer count has been set.\n-     *\n-     * The fenceFd argument specifies a libsync fence file descriptor for a\n-     * fence that must signal before the buffer can be accessed.  If the buffer\n-     * can be accessed immediately then a value of -1 should be used.  The\n-     * caller must not use the file descriptor after it is passed to\n-     * queueBuffer, and the ANativeWindow implementation is responsible for\n-     * closing it.\n-     *\n-     * Returns 0 on success or -errno on error.\n-     */\n-    int     (*queueBuffer)(struct ANativeWindow* window,\n-                struct ANativeWindowBuffer* buffer, int fenceFd);\n-\n-    /*\n-     * Hook used to cancel a buffer that has been dequeued.\n-     * No synchronization is performed between dequeue() and cancel(), so\n-     * either external synchronization is needed, or these functions must be\n-     * called from the same thread.\n-     *\n-     * The window holds a reference to the buffer between dequeueBuffer and\n-     * either queueBuffer or cancelBuffer, so clients only need their own\n-     * reference if they might use the buffer after queueing or canceling it.\n-     * Holding a reference to a buffer after queueing or canceling it is only\n-     * allowed if a specific buffer count has been set.\n-     *\n-     * The fenceFd argument specifies a libsync fence file decsriptor for a\n-     * fence that must signal before the buffer can be accessed.  If the buffer\n-     * can be accessed immediately then a value of -1 should be used.\n-     *\n-     * Note that if the client has not waited on the fence that was returned\n-     * from dequeueBuffer, that same fence should be passed to cancelBuffer to\n-     * ensure that future uses of the buffer are preceded by a wait on that\n-     * fence.  The caller must not use the file descriptor after it is passed\n-     * to cancelBuffer, and the ANativeWindow implementation is responsible for\n-     * closing it.\n-     *\n-     * Returns 0 on success or -errno on error.\n-     */\n-    int     (*cancelBuffer)(struct ANativeWindow* window,\n-                struct ANativeWindowBuffer* buffer, int fenceFd);\n-};\n-\n- /* Backwards compatibility: use ANativeWindow (struct ANativeWindow in C).\n-  * android_native_window_t is deprecated.\n-  */\n-typedef struct ANativeWindow ANativeWindow;\n-typedef struct ANativeWindow android_native_window_t __deprecated;\n-\n-/*\n- *  native_window_set_usage(..., usage)\n- *  Sets the intended usage flags for the next buffers\n- *  acquired with (*lockBuffer)() and on.\n- *  By default (if this function is never called), a usage of\n- *      GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE\n- *  is assumed.\n- *  Calling this function will usually cause following buffers to be\n- *  reallocated.\n- */\n-\n-static inline int native_window_set_usage(\n-        struct ANativeWindow* window, int usage)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_USAGE, usage);\n-}\n-\n-/* deprecated. Always returns 0. Don't call. */\n-static inline int native_window_connect(\n-        struct ANativeWindow* window __UNUSED, int api __UNUSED) __deprecated;\n-\n-static inline int native_window_connect(\n-        struct ANativeWindow* window __UNUSED, int api __UNUSED) {\n-    return 0;\n-}\n-\n-/* deprecated. Always returns 0. Don't call. */\n-static inline int native_window_disconnect(\n-        struct ANativeWindow* window __UNUSED, int api __UNUSED) __deprecated;\n-\n-static inline int native_window_disconnect(\n-        struct ANativeWindow* window __UNUSED, int api __UNUSED) {\n-    return 0;\n-}\n-\n-/*\n- * native_window_set_crop(..., crop)\n- * Sets which region of the next queued buffers needs to be considered.\n- * Depending on the scaling mode, a buffer's crop region is scaled and/or\n- * cropped to match the surface's size.  This function sets the crop in\n- * pre-transformed buffer pixel coordinates.\n- *\n- * The specified crop region applies to all buffers queued after it is called.\n- *\n- * If 'crop' is NULL, subsequently queued buffers won't be cropped.\n- *\n- * An error is returned if for instance the crop region is invalid, out of the\n- * buffer's bound or if the window is invalid.\n- */\n-static inline int native_window_set_crop(\n-        struct ANativeWindow* window,\n-        android_native_rect_t const * crop)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_CROP, crop);\n-}\n-\n-/*\n- * native_window_set_post_transform_crop(..., crop)\n- * Sets which region of the next queued buffers needs to be considered.\n- * Depending on the scaling mode, a buffer's crop region is scaled and/or\n- * cropped to match the surface's size.  This function sets the crop in\n- * post-transformed pixel coordinates.\n- *\n- * The specified crop region applies to all buffers queued after it is called.\n- *\n- * If 'crop' is NULL, subsequently queued buffers won't be cropped.\n- *\n- * An error is returned if for instance the crop region is invalid, out of the\n- * buffer's bound or if the window is invalid.\n- */\n-static inline int native_window_set_post_transform_crop(\n-        struct ANativeWindow* window,\n-        android_native_rect_t const * crop)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_POST_TRANSFORM_CROP, crop);\n-}\n-\n-/*\n- * native_window_set_active_rect(..., active_rect)\n- *\n- * This function is deprecated and will be removed soon.  For now it simply\n- * sets the post-transform crop for compatibility while multi-project commits\n- * get checked.\n- */\n-static inline int native_window_set_active_rect(\n-        struct ANativeWindow* window,\n-        android_native_rect_t const * active_rect) __deprecated;\n-\n-static inline int native_window_set_active_rect(\n-        struct ANativeWindow* window,\n-        android_native_rect_t const * active_rect)\n-{\n-    return native_window_set_post_transform_crop(window, active_rect);\n-}\n-\n-/*\n- * native_window_set_buffer_count(..., count)\n- * Sets the number of buffers associated with this native window.\n- */\n-static inline int native_window_set_buffer_count(\n-        struct ANativeWindow* window,\n-        size_t bufferCount)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_BUFFER_COUNT, bufferCount);\n-}\n-\n-/*\n- * native_window_set_buffers_geometry(..., int w, int h, int format)\n- * All buffers dequeued after this call will have the dimensions and format\n- * specified.  A successful call to this function has the same effect as calling\n- * native_window_set_buffers_size and native_window_set_buffers_format.\n- *\n- * XXX: This function is deprecated.  The native_window_set_buffers_dimensions\n- * and native_window_set_buffers_format functions should be used instead.\n- */\n-static inline int native_window_set_buffers_geometry(\n-        struct ANativeWindow* window,\n-        int w, int h, int format) __deprecated;\n-\n-static inline int native_window_set_buffers_geometry(\n-        struct ANativeWindow* window,\n-        int w, int h, int format)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_GEOMETRY,\n-            w, h, format);\n-}\n-\n-/*\n- * native_window_set_buffers_dimensions(..., int w, int h)\n- * All buffers dequeued after this call will have the dimensions specified.\n- * In particular, all buffers will have a fixed-size, independent from the\n- * native-window size. They will be scaled according to the scaling mode\n- * (see native_window_set_scaling_mode) upon window composition.\n- *\n- * If w and h are 0, the normal behavior is restored. That is, dequeued buffers\n- * following this call will be sized to match the window's size.\n- *\n- * Calling this function will reset the window crop to a NULL value, which\n- * disables cropping of the buffers.\n- */\n-static inline int native_window_set_buffers_dimensions(\n-        struct ANativeWindow* window,\n-        int w, int h)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS,\n-            w, h);\n-}\n-\n-/*\n- * native_window_set_buffers_user_dimensions(..., int w, int h)\n- *\n- * Sets the user buffer size for the window, which overrides the\n- * window's size.  All buffers dequeued after this call will have the\n- * dimensions specified unless overridden by\n- * native_window_set_buffers_dimensions.  All buffers will have a\n- * fixed-size, independent from the native-window size. They will be\n- * scaled according to the scaling mode (see\n- * native_window_set_scaling_mode) upon window composition.\n- *\n- * If w and h are 0, the normal behavior is restored. That is, the\n- * default buffer size will match the windows's size.\n- *\n- * Calling this function will reset the window crop to a NULL value, which\n- * disables cropping of the buffers.\n- */\n-static inline int native_window_set_buffers_user_dimensions(\n-        struct ANativeWindow* window,\n-        int w, int h)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS,\n-            w, h);\n-}\n-\n-/*\n- * native_window_set_buffers_format(..., int format)\n- * All buffers dequeued after this call will have the format specified.\n- *\n- * If the specified format is 0, the default buffer format will be used.\n- */\n-static inline int native_window_set_buffers_format(\n-        struct ANativeWindow* window,\n-        int format)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_FORMAT, format);\n-}\n-\n-/*\n- * native_window_set_buffers_data_space(..., int dataSpace)\n- * All buffers queued after this call will be associated with the dataSpace\n- * parameter specified.\n- *\n- * dataSpace specifies additional information about the buffer that's dependent\n- * on the buffer format and the endpoints. For example, it can be used to convey\n- * the color space of the image data in the buffer, or it can be used to\n- * indicate that the buffers contain depth measurement data instead of color\n- * images.  The default dataSpace is 0, HAL_DATASPACE_UNKNOWN, unless it has been\n- * overridden by the consumer.\n- */\n-static inline int native_window_set_buffers_data_space(\n-        struct ANativeWindow* window,\n-        android_dataspace_t dataSpace)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_DATASPACE,\n-            dataSpace);\n-}\n-\n-/*\n- * native_window_set_buffers_transform(..., int transform)\n- * All buffers queued after this call will be displayed transformed according\n- * to the transform parameter specified.\n- */\n-static inline int native_window_set_buffers_transform(\n-        struct ANativeWindow* window,\n-        int transform)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_TRANSFORM,\n-            transform);\n-}\n-\n-/*\n- * native_window_set_buffers_sticky_transform(..., int transform)\n- * All buffers queued after this call will be displayed transformed according\n- * to the transform parameter specified applied on top of the regular buffer\n- * transform.  Setting this transform will disable the transform hint.\n- *\n- * Temporary - This is only intended to be used by the LEGACY camera mode, do\n- *   not use this for anything else.\n- */\n-static inline int native_window_set_buffers_sticky_transform(\n-        struct ANativeWindow* window,\n-        int transform)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_STICKY_TRANSFORM,\n-            transform);\n-}\n-\n-/*\n- * native_window_set_buffers_timestamp(..., int64_t timestamp)\n- * All buffers queued after this call will be associated with the timestamp\n- * parameter specified. If the timestamp is set to NATIVE_WINDOW_TIMESTAMP_AUTO\n- * (the default), timestamps will be generated automatically when queueBuffer is\n- * called. The timestamp is measured in nanoseconds, and is normally monotonically\n- * increasing. The timestamp should be unaffected by time-of-day adjustments,\n- * and for a camera should be strictly monotonic but for a media player may be\n- * reset when the position is set.\n- */\n-static inline int native_window_set_buffers_timestamp(\n-        struct ANativeWindow* window,\n-        int64_t timestamp)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP,\n-            timestamp);\n-}\n-\n-/*\n- * native_window_set_scaling_mode(..., int mode)\n- * All buffers queued after this call will be associated with the scaling mode\n- * specified.\n- */\n-static inline int native_window_set_scaling_mode(\n-        struct ANativeWindow* window,\n-        int mode)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_SCALING_MODE,\n-            mode);\n-}\n-\n-/*\n- * native_window_api_connect(..., int api)\n- * connects an API to this window. only one API can be connected at a time.\n- * Returns -EINVAL if for some reason the window cannot be connected, which\n- * can happen if it's connected to some other API.\n- */\n-static inline int native_window_api_connect(\n-        struct ANativeWindow* window, int api)\n-{\n-    return window->perform(window, NATIVE_WINDOW_API_CONNECT, api);\n-}\n-\n-/*\n- * native_window_api_disconnect(..., int api)\n- * disconnect the API from this window.\n- * An error is returned if for instance the window wasn't connected in the\n- * first place.\n- */\n-static inline int native_window_api_disconnect(\n-        struct ANativeWindow* window, int api)\n-{\n-    return window->perform(window, NATIVE_WINDOW_API_DISCONNECT, api);\n-}\n-\n-/*\n- * native_window_dequeue_buffer_and_wait(...)\n- * Dequeue a buffer and wait on the fence associated with that buffer.  The\n- * buffer may safely be accessed immediately upon this function returning.  An\n- * error is returned if either of the dequeue or the wait operations fail.\n- */\n-static inline int native_window_dequeue_buffer_and_wait(ANativeWindow *anw,\n-        struct ANativeWindowBuffer** anb) {\n-    return anw->dequeueBuffer_DEPRECATED(anw, anb);\n-}\n-\n-/*\n- * native_window_set_sideband_stream(..., native_handle_t*)\n- * Attach a sideband buffer stream to a native window.\n- */\n-static inline int native_window_set_sideband_stream(\n-        struct ANativeWindow* window,\n-        native_handle_t* sidebandHandle)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_SIDEBAND_STREAM,\n-            sidebandHandle);\n-}\n-\n-/*\n- * native_window_set_surface_damage(..., android_native_rect_t* rects, int numRects)\n- * Set the surface damage (i.e., the region of the surface that has changed\n- * since the previous frame). The damage set by this call will be reset (to the\n- * default of full-surface damage) after calling queue, so this must be called\n- * prior to every frame with damage that does not cover the whole surface if the\n- * caller desires downstream consumers to use this optimization.\n- *\n- * The damage region is specified as an array of rectangles, with the important\n- * caveat that the origin of the surface is considered to be the bottom-left\n- * corner, as in OpenGL ES.\n- *\n- * If numRects is set to 0, rects may be NULL, and the surface damage will be\n- * set to the full surface (the same as if this function had not been called for\n- * this frame).\n- */\n-static inline int native_window_set_surface_damage(\n-        struct ANativeWindow* window,\n-        const android_native_rect_t* rects, size_t numRects)\n-{\n-    return window->perform(window, NATIVE_WINDOW_SET_SURFACE_DAMAGE,\n-            rects, numRects);\n-}\n-\n-__END_DECLS\n-\n-#endif /* SYSTEM_CORE_INCLUDE_ANDROID_WINDOW_H */\n",
    "prefixes": [
        "libcamera-devel",
        "2/2"
    ]
}