Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit acce6990 authored by Chia-I Wu's avatar Chia-I Wu
Browse files

graphics: add HIDL definition for HW composer

This is a direct translation of hwcomposer2.h to HIDL.

Test: make
Change-Id: Id007af271b06f0d86afc8bc7c57300c588dc4081
parent 4364bae7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ subdirs = [
    "biometrics/fingerprint/2.1",
    "graphics/allocator/2.0",
    "graphics/allocator/2.0/default",
    "graphics/composer/2.1",
    "graphics/mapper/2.0",
    "graphics/mapper/2.0/default",
    "light/2.0",
+55 −0
Original line number Diff line number Diff line
// This file is autogenerated by hidl-gen. Do not edit manually.

genrule {
    name: "android.hardware.graphics.composer@2.1_genc++",
    tool: "hidl-gen",
    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.composer@2.1",
    srcs: [
        "types.hal",
        "IComposer.hal",
        "IComposerCallback.hal",
    ],
    out: [
        "android/hardware/graphics/composer/2.1/types.cpp",
        "android/hardware/graphics/composer/2.1/ComposerAll.cpp",
        "android/hardware/graphics/composer/2.1/ComposerCallbackAll.cpp",
    ],
}

genrule {
    name: "android.hardware.graphics.composer@2.1_genc++_headers",
    tool: "hidl-gen",
    cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.graphics.composer@2.1",
    srcs: [
        "types.hal",
        "IComposer.hal",
        "IComposerCallback.hal",
    ],
    out: [
        "android/hardware/graphics/composer/2.1/types.h",
        "android/hardware/graphics/composer/2.1/IComposer.h",
        "android/hardware/graphics/composer/2.1/IHwComposer.h",
        "android/hardware/graphics/composer/2.1/BnComposer.h",
        "android/hardware/graphics/composer/2.1/BpComposer.h",
        "android/hardware/graphics/composer/2.1/BsComposer.h",
        "android/hardware/graphics/composer/2.1/IComposerCallback.h",
        "android/hardware/graphics/composer/2.1/IHwComposerCallback.h",
        "android/hardware/graphics/composer/2.1/BnComposerCallback.h",
        "android/hardware/graphics/composer/2.1/BpComposerCallback.h",
        "android/hardware/graphics/composer/2.1/BsComposerCallback.h",
    ],
}

cc_library_shared {
    name: "android.hardware.graphics.composer@2.1",
    generated_sources: ["android.hardware.graphics.composer@2.1_genc++"],
    generated_headers: ["android.hardware.graphics.composer@2.1_genc++_headers"],
    export_generated_headers: ["android.hardware.graphics.composer@2.1_genc++_headers"],
    shared_libs: [
        "libhidl",
        "libhwbinder",
        "libutils",
        "libcutils",
        "android.hardware.graphics.allocator@2.0",
    ],
}
+1166 −0

File added.

Preview size limit exceeded, changes collapsed.

+72 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.graphics.composer@2.1;

interface IComposerCallback {
    enum Connection : int32_t {
        INVALID = 0,

        /* The display has been connected */
        CONNECTED = 1,
        /* The display has been disconnected */
        DISCONNECTED = 2,
    };

    /*
     * Notifies the client that the given display has either been connected or
     * disconnected. Every active display (even a built-in physical display)
     * must trigger at least one hotplug notification, even if it only occurs
     * immediately after callback registration.
     *
     * Displays which have been connected are assumed to be in PowerMode::OFF,
     * and the onVsync callback should not be called for a display until vsync
     * has been enabled with setVsyncEnabled.
     *
     * The client may call back into the device while the callback is in
     * progress. The device must serialize calls to this callback such that
     * only one thread is calling it at a time.
     *
     * @param display is the display that triggers the hotplug event.
     * @param connected indicates whether the display is connected or
     *        disconnected.
     */
    onHotplug(Display display, Connection connected);

    /*
     * Notifies the client to trigger a screen refresh. This forces all layer
     * state for this display to be resent, and the display to be validated
     * and presented, even if there have been no changes.

     * This refresh will occur some time after the callback is initiated, but
     * not necessarily before it returns.  It is safe to trigger this callback
     * from other functions which call into the device.
     *
     * @param display is the display to refresh.
     */
    oneway onRefresh(Display display);

    /*
     * Notifies the client that a vsync event has occurred. This callback must
     * only be triggered when vsync is enabled for this display (through
     * setVsyncEnabled).
     *
     * @param display is the display which has received a vsync event
     * @param timestamp is the CLOCK_MONOTONIC time at which the vsync event
     *        occurred, in nanoseconds.
     */
    oneway onVsync(Display display, int64_t timestamp);
};
+163 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.graphics.composer@2.1;

/* Return codes from all functions. */
enum Error : int32_t {
    NONE            = 0, /* no error */
    BAD_CONFIG      = 1, /* invalid Config */
    BAD_DISPLAY     = 2, /* invalid Display */
    BAD_LAYER       = 3, /* invalid Layer */
    BAD_PARAMETER   = 4, /* invalid width, height, etc. */
    HAS_CHANGES     = 5,
    NO_RESOURCES    = 6, /* temporary failure due to resource contention */
    NOT_VALIDATED   = 7, /* validateDisplay has not been called */
    UNSUPPORTED     = 8, /* permanent failure */
};

typedef uint32_t Config;
typedef uint64_t Display;
typedef uint64_t Layer;

/*
 * Copied from android_transform_t
 *
 * TODO(olv) copy comments over and generate android_transform_t
 */
enum Transform : int32_t {
    FLIP_H    = 0x1,
    FLIP_V    = 0x2,
    ROT_90    = 0x4,
    ROT_180   = 0x3,
    ROT_270   = 0x7,
    RESERVED  = 0x8,
};

/*
 * Copied from android_color_mode_t
 *
 * TODO(olv) copy comments over and generate android_color_mode_t
 */
enum ColorMode : int32_t {
  NATIVE                        = 0,
  STANDARD_BT601_625            = 1,
  STANDARD_BT601_625_UNADJUSTED = 2,
  STANDARD_BT601_525            = 3,
  STANDARD_BT601_525_UNADJUSTED = 4,
  STANDARD_BT709                = 5,
  DCI_P3                        = 6,
  SRGB                          = 7,
  ADOBE_RGB                     = 8,
};

/*
 * Copied from android_color_transform_t
 *
 * TODO(olv) copy comments over and generate android_color_transform_t
 */
enum ColorTransform : int32_t {
    IDENTITY             = 0,
    ARBITRARY_MATRIX     = 1,
    VALUE_INVERSE        = 2,
    GRAYSCALE            = 3,
    CORRECT_PROTANOPIA   = 4,
    CORRECT_DEUTERANOPIA = 5,
    CORRECT_TRITANOPIA   = 6
};

/*
 * Copied from android_dataspace_t
 *
 * TODO(olv) copy comments over and generate android_dataspace_t
 */
enum Dataspace : int32_t {
    UNKNOWN                            = 0x0,
    ARBITRARY                          = 0x1,

    STANDARD_SHIFT                     = 16,
    STANDARD_MASK                      = 63 << STANDARD_SHIFT,
    STANDARD_UNSPECIFIED               = 0 << STANDARD_SHIFT,
    STANDARD_BT709                     = 1 << STANDARD_SHIFT,
    STANDARD_BT601_625                 = 2 << STANDARD_SHIFT,
    STANDARD_BT601_625_UNADJUSTED      = 3 << STANDARD_SHIFT,
    STANDARD_BT601_525                 = 4 << STANDARD_SHIFT,
    STANDARD_BT601_525_UNADJUSTED      = 5 << STANDARD_SHIFT,
    STANDARD_BT2020                    = 6 << STANDARD_SHIFT,
    STANDARD_BT2020_CONSTANT_LUMINANCE = 7 << STANDARD_SHIFT,
    STANDARD_BT470M                    = 8 << STANDARD_SHIFT,
    STANDARD_FILM                      = 9 << STANDARD_SHIFT,

    TRANSFER_SHIFT                     = 22,
    TRANSFER_MASK                      = 31 << TRANSFER_SHIFT,
    TRANSFER_UNSPECIFIED               = 0 << TRANSFER_SHIFT,
    TRANSFER_LINEAR                    = 1 << TRANSFER_SHIFT,
    TRANSFER_SRGB                      = 2 << TRANSFER_SHIFT,
    TRANSFER_SMPTE_170M                = 3 << TRANSFER_SHIFT,
    TRANSFER_GAMMA2_2                  = 4 << TRANSFER_SHIFT,
    TRANSFER_GAMMA2_8                  = 5 << TRANSFER_SHIFT,
    TRANSFER_ST2084                    = 6 << TRANSFER_SHIFT,
    TRANSFER_HLG                       = 7 << TRANSFER_SHIFT,

    RANGE_SHIFT                        = 27,
    RANGE_MASK                         = 7 << RANGE_SHIFT,
    RANGE_UNSPECIFIED                  = 0 << RANGE_SHIFT,
    RANGE_FULL                         = 1 << RANGE_SHIFT,
    RANGE_LIMITED                      = 2 << RANGE_SHIFT,

    SRGB_LINEAR                        = 0x200,
    V0_SRGB_LINEAR                     = STANDARD_BT709 |
                                         TRANSFER_LINEAR |
                                         RANGE_FULL,

    SRGB                               = 0x201,
    V0_SRGB                            = STANDARD_BT709 |
                                         TRANSFER_SRGB |
                                         RANGE_FULL,

    JFIF                               = 0x101,
    V0_JFIF                            = STANDARD_BT601_625 |
                                         TRANSFER_SMPTE_170M |
                                         RANGE_FULL,

    BT601_625                          = 0x102,
    V0_BT601_625                       = STANDARD_BT601_625 |
                                         TRANSFER_SMPTE_170M |
                                         RANGE_LIMITED,

    BT601_525                          = 0x103,
    V0_BT601_525                       = STANDARD_BT601_525 |
                                         TRANSFER_SMPTE_170M |
                                         RANGE_LIMITED,

    BT709                              = 0x104,
    V0_BT709                           = STANDARD_BT709 |
                                         TRANSFER_SMPTE_170M |
                                         RANGE_LIMITED,

    DEPTH                              = 0x1000,
};

/*
 * Copied from android_hdr_t
 *
 * TODO(olv) copy comments over and generate android_hdr_t
 */
enum Hdr : int32_t {
    DOLBY_VISION = 1,
    HDR10        = 2,
    HLG          = 3,
};