Loading media/c2/aidl/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ aidl_interface { double_loadable: true, srcs: ["android/hardware/media/c2/*.aidl"], include_dirs: [ "frameworks/native/aidl/gui", "frameworks/base/core/java", ], imports: [ "android.hardware.common-V2", Loading media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ interface IComponent { void queue(in android.hardware.media.c2.WorkBundle workBundle); void release(); void reset(); void setOutputSurface(in long blockPoolId, in android.view.Surface surface, in android.hardware.media.c2.SurfaceSyncObj syncObject); void setDecoderOutputAllocator(in android.hardware.media.c2.IGraphicBufferAllocator allocator); void start(); void stop(); parcelable BlockPool { Loading media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl→media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IGraphicBufferAllocator.aidl +19 −6 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * Copyright (C) 2023 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. Loading Loading @@ -33,9 +33,22 @@ package android.hardware.media.c2; @VintfStability parcelable SurfaceSyncObj { android.hardware.common.NativeHandle syncMemory; long bqId; int generationId; long consumerUsage; interface IGraphicBufferAllocator { android.hardware.media.c2.IGraphicBufferAllocator.Allocation allocate(in android.hardware.media.c2.IGraphicBufferAllocator.Description desc); boolean deallocate(in long id); android.hardware.media.c2.IGraphicBufferAllocator.WaitableFds getWaitableFds(); parcelable Allocation { android.hardware.HardwareBuffer buffer; ParcelFileDescriptor fence; } parcelable Description { int width; int height; int format; long usage; } parcelable WaitableFds { ParcelFileDescriptor allocEvent; ParcelFileDescriptor statusEvent; } } media/c2/aidl/android/hardware/media/c2/IComponent.aidl +7 −17 Original line number Diff line number Diff line Loading @@ -17,12 +17,10 @@ package android.hardware.media.c2; import android.hardware.common.NativeHandle; import android.view.Surface; import android.hardware.media.c2.IComponentInterface; import android.hardware.media.c2.IConfigurable; import android.hardware.media.c2.IGraphicBufferAllocator; import android.hardware.media.c2.WorkBundle; import android.hardware.media.c2.SurfaceSyncObj; /** * Interface for an AIDL Codec2 component. Loading Loading @@ -234,23 +232,15 @@ interface IComponent { void reset(); /** * Starts using a surface for output with a synchronization object * * This method must not block. * Specify an allocator for decoder output buffer from HAL. * * @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. * @throws ServiceSpecificException with one of the following values: * - `Status::CANNOT_DO` - The component does not support an output surface. * - `Status::REFUSED` - The output surface cannot be accessed. * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. * The method will be used once during the life-cycle of a codec instance. * @param allocator Decoder output buffer allocator from the client * @throws ServiceSpecificException with one of the following values * - `Status::CANNOT_DO` - The component does not support allocating from the client. * - `Status::CORRUPTED` - Some unknown error occurred. */ void setOutputSurface(in long blockPoolId, in Surface surface, in SurfaceSyncObj syncObject); void setDecoderOutputAllocator(in IGraphicBufferAllocator allocator); /** * Starts the component. Loading media/c2/aidl/android/hardware/media/c2/IGraphicBufferAllocator.aidl 0 → 100644 +114 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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; import android.hardware.HardwareBuffer; import android.os.ParcelFileDescriptor; /** * Interface for decoder output buffer allocator for HAL process * * A graphic buffer for decoder output is allocated by the interface. */ @VintfStability interface IGraphicBufferAllocator { /** * A graphic buffer allocation. * * buffer is in android.hardware.HardwareBuffer. * fence is provided in order to signal readiness of the buffer I/O inside * underlying Graphics subsystem. This is called a sync fence throughout Android framework. */ parcelable Allocation { HardwareBuffer buffer; ParcelFileDescriptor fence; } /** * Parameters for a graphic buffer allocation. * * Refer to AHardwareBuffer_Desc(libnativewindow) for details. */ parcelable Description { int width; int height; int format; long usage; } /** * Allocate a graphic buffer. * * @param desc Allocation parameters. * @return an android.hardware.HardwareBuffer which is basically same to * AHardwareBuffer. If underlying grpahics system is blocked, c2::Status::Blocked * will be returned. In this case getWaitableFds() will return file descriptors which * can be used to construct a waitable object. The waitable object will be notified * when underlying graphics system is unblocked * @throws ServiceSpecificException with one of the following values: * - `c2::Status::BAD_STATE` - The client is not in running states. * - `c2::Status::BLOCKED` - Underlying graphics system is blocked. * - `c2::Status::CORRUPTED` - Some unknown error occurred. */ Allocation allocate(in Description desc); /** * De-allocate a graphic buffer by graphic buffer's unique id. * * @param id graphic buffer's unique id. See also AHardwareBuffer_getId(). * @return {@code true} when de-allocate happened, {@code false} otherwise. */ boolean deallocate(in long id); /** * Fds for waitable object events. * * Fds are created by eventfd() with semaphore mode. * For allocEvent, An integer counter regarding dequeuable buffer count is maintained * by client using read()/write() to the fd. The fd can be checked whether it is * readable via poll(). When in readable status, the specified counter is positive * so allocate/dequeue can happen. * * For statusEvent, the client can notify further allocation is not feasible. * e.g.) life-cycle of the underlying allocator is ended. * * C2Fence object should be implemented based on this Fds. Thus, C2Fence can return * either by allocation being ready or allocation being infeasible by the client status * change. */ parcelable WaitableFds { ParcelFileDescriptor allocEvent; ParcelFileDescriptor statusEvent; } /** * Gets waiable file descriptors. * * Use this method once and cache it in order not to create unnecessary duplicated fds. * The returned array will have two fds. * * If many waitable objects based on the same fd are competing, all watiable objects will be * notified. After being notified, they should invoke allocate(). At least one of them can * successfully allocate. Others not having an Allocation will have c2::Status::BLOCKED * as return value. They should wait again via waitable objects based on the fds which are * already returned from this interface. * * @return an fd array which will be wrapped to C2Fence and will be waited for * until allocating is unblocked. */ WaitableFds getWaitableFds(); } Loading
media/c2/aidl/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ aidl_interface { double_loadable: true, srcs: ["android/hardware/media/c2/*.aidl"], include_dirs: [ "frameworks/native/aidl/gui", "frameworks/base/core/java", ], imports: [ "android.hardware.common-V2", Loading
media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ interface IComponent { void queue(in android.hardware.media.c2.WorkBundle workBundle); void release(); void reset(); void setOutputSurface(in long blockPoolId, in android.view.Surface surface, in android.hardware.media.c2.SurfaceSyncObj syncObject); void setDecoderOutputAllocator(in android.hardware.media.c2.IGraphicBufferAllocator allocator); void start(); void stop(); parcelable BlockPool { Loading
media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/SurfaceSyncObj.aidl→media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IGraphicBufferAllocator.aidl +19 −6 Original line number Diff line number Diff line /* * Copyright (C) 2022 The Android Open Source Project * Copyright (C) 2023 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. Loading Loading @@ -33,9 +33,22 @@ package android.hardware.media.c2; @VintfStability parcelable SurfaceSyncObj { android.hardware.common.NativeHandle syncMemory; long bqId; int generationId; long consumerUsage; interface IGraphicBufferAllocator { android.hardware.media.c2.IGraphicBufferAllocator.Allocation allocate(in android.hardware.media.c2.IGraphicBufferAllocator.Description desc); boolean deallocate(in long id); android.hardware.media.c2.IGraphicBufferAllocator.WaitableFds getWaitableFds(); parcelable Allocation { android.hardware.HardwareBuffer buffer; ParcelFileDescriptor fence; } parcelable Description { int width; int height; int format; long usage; } parcelable WaitableFds { ParcelFileDescriptor allocEvent; ParcelFileDescriptor statusEvent; } }
media/c2/aidl/android/hardware/media/c2/IComponent.aidl +7 −17 Original line number Diff line number Diff line Loading @@ -17,12 +17,10 @@ package android.hardware.media.c2; import android.hardware.common.NativeHandle; import android.view.Surface; import android.hardware.media.c2.IComponentInterface; import android.hardware.media.c2.IConfigurable; import android.hardware.media.c2.IGraphicBufferAllocator; import android.hardware.media.c2.WorkBundle; import android.hardware.media.c2.SurfaceSyncObj; /** * Interface for an AIDL Codec2 component. Loading Loading @@ -234,23 +232,15 @@ interface IComponent { void reset(); /** * Starts using a surface for output with a synchronization object * * This method must not block. * Specify an allocator for decoder output buffer from HAL. * * @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. * @throws ServiceSpecificException with one of the following values: * - `Status::CANNOT_DO` - The component does not support an output surface. * - `Status::REFUSED` - The output surface cannot be accessed. * - `Status::TIMED_OUT` - The operation cannot be finished in a timely manner. * The method will be used once during the life-cycle of a codec instance. * @param allocator Decoder output buffer allocator from the client * @throws ServiceSpecificException with one of the following values * - `Status::CANNOT_DO` - The component does not support allocating from the client. * - `Status::CORRUPTED` - Some unknown error occurred. */ void setOutputSurface(in long blockPoolId, in Surface surface, in SurfaceSyncObj syncObject); void setDecoderOutputAllocator(in IGraphicBufferAllocator allocator); /** * Starts the component. Loading
media/c2/aidl/android/hardware/media/c2/IGraphicBufferAllocator.aidl 0 → 100644 +114 −0 Original line number Diff line number Diff line /* * Copyright (C) 2023 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; import android.hardware.HardwareBuffer; import android.os.ParcelFileDescriptor; /** * Interface for decoder output buffer allocator for HAL process * * A graphic buffer for decoder output is allocated by the interface. */ @VintfStability interface IGraphicBufferAllocator { /** * A graphic buffer allocation. * * buffer is in android.hardware.HardwareBuffer. * fence is provided in order to signal readiness of the buffer I/O inside * underlying Graphics subsystem. This is called a sync fence throughout Android framework. */ parcelable Allocation { HardwareBuffer buffer; ParcelFileDescriptor fence; } /** * Parameters for a graphic buffer allocation. * * Refer to AHardwareBuffer_Desc(libnativewindow) for details. */ parcelable Description { int width; int height; int format; long usage; } /** * Allocate a graphic buffer. * * @param desc Allocation parameters. * @return an android.hardware.HardwareBuffer which is basically same to * AHardwareBuffer. If underlying grpahics system is blocked, c2::Status::Blocked * will be returned. In this case getWaitableFds() will return file descriptors which * can be used to construct a waitable object. The waitable object will be notified * when underlying graphics system is unblocked * @throws ServiceSpecificException with one of the following values: * - `c2::Status::BAD_STATE` - The client is not in running states. * - `c2::Status::BLOCKED` - Underlying graphics system is blocked. * - `c2::Status::CORRUPTED` - Some unknown error occurred. */ Allocation allocate(in Description desc); /** * De-allocate a graphic buffer by graphic buffer's unique id. * * @param id graphic buffer's unique id. See also AHardwareBuffer_getId(). * @return {@code true} when de-allocate happened, {@code false} otherwise. */ boolean deallocate(in long id); /** * Fds for waitable object events. * * Fds are created by eventfd() with semaphore mode. * For allocEvent, An integer counter regarding dequeuable buffer count is maintained * by client using read()/write() to the fd. The fd can be checked whether it is * readable via poll(). When in readable status, the specified counter is positive * so allocate/dequeue can happen. * * For statusEvent, the client can notify further allocation is not feasible. * e.g.) life-cycle of the underlying allocator is ended. * * C2Fence object should be implemented based on this Fds. Thus, C2Fence can return * either by allocation being ready or allocation being infeasible by the client status * change. */ parcelable WaitableFds { ParcelFileDescriptor allocEvent; ParcelFileDescriptor statusEvent; } /** * Gets waiable file descriptors. * * Use this method once and cache it in order not to create unnecessary duplicated fds. * The returned array will have two fds. * * If many waitable objects based on the same fd are competing, all watiable objects will be * notified. After being notified, they should invoke allocate(). At least one of them can * successfully allocate. Others not having an Allocation will have c2::Status::BLOCKED * as return value. They should wait again via waitable objects based on the fds which are * already returned from this interface. * * @return an fd array which will be wrapped to C2Fence and will be waited for * until allocating is unblocked. */ WaitableFds getWaitableFds(); }