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

Commit d5351331 authored by Pawin Vongmasa's avatar Pawin Vongmasa
Browse files

Add AIDL type for HardwareBuffer

This includes other types needed by HardwareBuffer.

Test: Builds

Bug: 145839204
Change-Id: I86c9d2f0cb04b597da9a93b7b6210b041312e1ac
parent 9ee9aa05
Loading
Loading
Loading
Loading

common/aidl/Android.bp

0 → 100644
+21 −0
Original line number Diff line number Diff line
aidl_interface {
    name: "vintf-common",
    host_supported: true,
    vendor_available: true,
    vndk: {
        enabled: true,
        support_system_process: true,
    },
    srcs: [
        "android/hardware/common/*.aidl",
    ],
    stability: "vintf",
    backend: {
        java: {
            enabled: false,
        },
        cpp: {
            enabled: false,
        },
    },
}
+26 −0
Original line number Diff line number Diff line
/*
 * Copyright 2019 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.common;

/**
 * Representation of a native handle.
 */
@VintfStability
parcelable NativeHandle {
    ParcelFileDescriptor[] fds;
    int[] ints;
}
+3 −0
Original line number Diff line number Diff line
@@ -10,6 +10,9 @@ aidl_interface {
        "android/hardware/graphics/common/*.aidl",
    ],
    stability: "vintf",
    imports: [
        "vintf-common"
    ],
    backend: {
        java: {
            enabled: false,
+114 −0
Original line number Diff line number Diff line
/*
 * Copyright 2019 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.common;

/**
 * Buffer usage definitions.
 */
@VintfStability
@Backing(type="long")
enum BufferUsage {
    /** bit 0-3 is an enum */
    CPU_READ_MASK                      = 0xf,
    /** buffer is never read by CPU */
    CPU_READ_NEVER                     = 0,
    /** buffer is rarely read by CPU */
    CPU_READ_RARELY                    = 2,
    /** buffer is often read by CPU */
    CPU_READ_OFTEN                     = 3,

    /** bit 4-7 is an enum */
    CPU_WRITE_MASK                     = 0xf << 4,
    /** buffer is never written by CPU */
    CPU_WRITE_NEVER                    = 0 << 4,
    /** buffer is rarely written by CPU */
    CPU_WRITE_RARELY                   = 2 << 4,
    /** buffer is often written by CPU */
    CPU_WRITE_OFTEN                    = 3 << 4,

    /** buffer is used as a GPU texture */
    GPU_TEXTURE                        = 1 << 8,

    /** buffer is used as a GPU render target */
    GPU_RENDER_TARGET                  = 1 << 9,

    /** bit 10 must be zero */

    /** buffer is used as a composer HAL overlay layer */
    COMPOSER_OVERLAY                   = 1 << 11,
    /** buffer is used as a composer HAL client target */
    COMPOSER_CLIENT_TARGET             = 1 << 12,

    /** bit 13 must be zero */

    /**
     * Buffer is allocated with hardware-level protection against copying the
     * contents (or information derived from the contents) into unprotected
     * memory.
     */
    PROTECTED                          = 1 << 14,

    /** buffer is used as a hwcomposer HAL cursor layer */
    COMPOSER_CURSOR                    = 1 << 15,

    /** buffer is used as a video encoder input */
    VIDEO_ENCODER                      = 1 << 16,

    /** buffer is used as a camera HAL output */
    CAMERA_OUTPUT                      = 1 << 17,

    /** buffer is used as a camera HAL input */
    CAMERA_INPUT                       = 1 << 18,

    /** bit 19 must be zero */

    /** buffer is used as a renderscript allocation */
    RENDERSCRIPT                       = 1 << 20,

    /** bit 21 must be zero */

    /** buffer is used as a video decoder output */
    VIDEO_DECODER                      = 1 << 22,

    /** buffer is used as a sensor direct report output */
    SENSOR_DIRECT_DATA                 = 1 << 23,

    /** buffer is used as a cube map texture */
    GPU_CUBE_MAP                       = 1 << 25,

    /** buffer contains a complete mipmap hierarchy */
    GPU_MIPMAP_COMPLETE                = 1 << 26,

    /**
     * Buffer is used as input for HEIC encoder.
     */
    HW_IMAGE_ENCODER                   = 1 << 27,

    /**
     * buffer is used as as an OpenGL shader storage or uniform
     * buffer object
     */
    GPU_DATA_BUFFER                    = 1 << 24,

    /** bits 25-27 must be zero and are reserved for future versions */
    /** bits 28-31 are reserved for vendor extensions */
    VENDOR_MASK                        = 0xf << 28,

    /** bits 32-47 must be zero and are reserved for future versions */
    /** bits 48-63 are reserved for vendor extensions */
    VENDOR_MASK_HI                     = 0xffff << 48,
}
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright 2019 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.common;

import android.hardware.common.NativeHandle;
import android.hardware.graphics.common.HardwareBufferDescription;

/**
 * Stable AIDL counterpart of AHardwareBuffer.
 *
 * @note This is different from the public HardwareBuffer.
 * @sa +ndk libnativewindow#AHardwareBuffer
 */
@VintfStability
parcelable HardwareBuffer {
    HardwareBufferDescription description;
    NativeHandle handle;
}
Loading