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

Commit a3434d47 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add media.c2@1.2" into sc-dev

parents 418843cf aede9615
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -359,7 +359,7 @@
    </hal>
    <hal format="hidl" optional="true">
        <name>android.hardware.media.c2</name>
        <version>1.0-1</version>
        <version>1.0-2</version>
        <interface>
            <name>IComponentStore</name>
            <regex-instance>default[0-9]*</regex-instance>
+31 −0
Original line number Diff line number Diff line
// This file is autogenerated by hidl-gen -Landroidbp.

hidl_interface {
    name: "android.hardware.media.c2@1.2",
    root: "android.hardware",
    srcs: [
        "types.hal",
        "IComponent.hal",
        "IComponentStore.hal",
    ],
    interfaces: [
        "android.hardware.graphics.bufferqueue@1.0",
        "android.hardware.graphics.bufferqueue@2.0",
        "android.hardware.graphics.common@1.0",
        "android.hardware.graphics.common@1.1",
        "android.hardware.graphics.common@1.2",
        "android.hardware.media.bufferpool@2.0",
        "android.hardware.media.c2@1.0",
        "android.hardware.media.c2@1.1",
        "android.hardware.media.omx@1.0",
        "android.hardware.media@1.0",
        "android.hidl.base@1.0",
        "android.hidl.safe_union@1.0",
    ],
    gen_java: false,
    apex_available: [
        "//apex_available:platform",
        "com.android.media.swcodec",
        "test_com.android.media.swcodec",
    ],
}
+61 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 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.media.c2@1.2;

import android.hardware.graphics.bufferqueue@2.0::IGraphicBufferProducer;
import android.hardware.media.c2@1.1::IComponent;
import android.hardware.media.c2@1.0::Status;


/**
 * Interface for a Codec2 component corresponding to API level 1.2 or below.
 * Components have two states: stopped and running. The running state has three
 * sub-states: executing, tripped and error.
 *
 * All methods in `IComponent` must not block. If a method call cannot be
 * completed in a timely manner, it must return `TIMED_OUT` in the return
 * status.
 *
 * @note This is an extension of version 1.1 of `IComponent`. The purpose of the
 * extension is to add blocking allocation of output buffer from surface.
 */
interface IComponent extends @1.1::IComponent {
    /**
     * Starts using a surface for output with a synchronization object
     *
     * This method must not block.
     *
     * @param blockPoolId Id of the `C2BlockPool` to be associated with the
     *     output surface.
     * @param surface Output surface.
     * @param syncObject synchronization object for buffer allocation between
     *     Framework and Component.
     * @return status Status of the call, which may be
     *   - `OK`        - The operation completed successfully.
     *   - `CANNOT_DO` - The component does not support an output surface.
     *   - `REFUSED`   - The output surface cannot be accessed.
     *   - `TIMED_OUT` - The operation cannot be finished in a timely manner.
     *   - `CORRUPTED` - Some unknown error occurred.
     */
    setOutputSurfaceWithSyncObj(
            uint64_t blockPoolId,
            @2.0::IGraphicBufferProducer surface,
            SurfaceSyncObj syncObject
        ) generates (
            Status status
        );
};
+64 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 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.media.c2@1.2;

import android.hardware.media.bufferpool@2.0::IClientManager;
import android.hardware.media.c2@1.0::IComponentListener;
import android.hardware.media.c2@1.1::IComponentStore;
import android.hardware.media.c2@1.0::Status;

import IComponent;

/**
 * Entry point for Codec2 HAL.
 *
 * All methods in `IComponentStore` must not block. If a method call cannot be
 * completed in a timely manner, it must return `TIMED_OUT` in the return
 * status. The only exceptions are getPoolClientManager() and getConfigurable(),
 * which must always return immediately.
 *
 * @note This is an extension of version 1.1 of `IComponentStore`. The purpose
 * of the extension is to add support for blocking output buffer allocator.
 */
interface IComponentStore extends @1.1::IComponentStore {
    /**
     * Creates a component by name.
     *
     * @param name Name of the component to create. This must match one of the
     *     names returned by listComponents().
     * @param listener Callback receiver.
     * @param pool `IClientManager` object of the BufferPool in the client
     *     process. This may be null if the client does not own a BufferPool.
     * @return status Status of the call, which may be
     *   - `OK`        - The component was created successfully.
     *   - `NOT_FOUND` - There is no component with the given name.
     *   - `NO_MEMORY` - Not enough memory to create the component.
     *   - `TIMED_OUT` - The operation cannot be finished in a timely manner.
     *   - `CORRUPTED` - Some unknown error occurred.
     * @return comp The created component if @p status is `OK`.
     *
     * @sa IComponentListener.
     */
    createComponent_1_2(
            string name,
            IComponentListener listener,
            IClientManager pool
        ) generates (
            Status status,
            IComponent comp
        );
};

media/c2/1.2/types.hal

0 → 100644
+52 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 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.media.c2@1.2;

/**
 * Surface(BufferQueue/IGBP) synchronization object regarding # of dequeued
 * output buffers. This keeps # of dequeued buffers from Surface less than
 * configured max # of dequeued buffers all the time.
 */
struct SurfaceSyncObj {
    /**
     * ASharedMemory for synchronization data. Layout is below
     *
     * |lock(futex)                               4bytes|
     * |conditional_variable(futex)               4bytes|
     * |# of max dequeable buffer                 4bytes|
     * |# of dequeued buffer                      4bytes|
     * |Status of the surface                     4bytes|
     *      INIT        = 0, Configuring surface is not finished.
     *      ACTIVE      = 1, Surface is ready to allocate(dequeue).
     *      SWITCHING   = 2, Switching to the new surface. It is blocked
     *                       to allocate(dequeue) a buffer until switching
     *                       completes.
     */
    handle syncMemory;

    // Read-only.
    // The values which are tied and not changed with respect to Surface
    // which is currently set up.
    /** BufferQueue id. */
    uint64_t bqId;
    /** Generation id. */
    uint32_t generationId;
    /** Consumer usage flags. See +ndk
      * libnativewindow#AHardwareBuffer_UsageFlags for possible values.
      */
    uint64_t consumerUsage;
};