Merge changes from topic "c2-aidl-pool" into main am: a037962389

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2912758

Change-Id: Ia4110a42873bc703987f3707becda82856faed80
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Sungtak Lee
2024-01-19 18:23:43 +00:00
committed by Automerger Merge Worker
4 changed files with 158 additions and 9 deletions

View File

@@ -51,12 +51,18 @@ interface IComponent {
long blockPoolId; long blockPoolId;
android.hardware.media.c2.IConfigurable configurable; android.hardware.media.c2.IConfigurable configurable;
} }
parcelable C2AidlGbAllocator { parcelable GbAllocator {
android.hardware.media.c2.IGraphicBufferAllocator igba;
ParcelFileDescriptor waitableFd; ParcelFileDescriptor waitableFd;
android.hardware.media.c2.IGraphicBufferAllocator igba;
} }
union BlockPoolAllocator { parcelable PooledGbAllocator {
ParcelFileDescriptor waitableFd;
long receiverId;
android.hardware.media.c2.IPooledGraphicBufferAllocator ipgba;
}
parcelable BlockPoolAllocator {
int allocatorId; int allocatorId;
android.hardware.media.c2.IComponent.C2AidlGbAllocator allocator; @nullable android.hardware.media.c2.IComponent.GbAllocator gbAllocator;
@nullable android.hardware.media.c2.IComponent.PooledGbAllocator pooledGbAllocator;
} }
} }

View File

@@ -0,0 +1,49 @@
/*
* Copyright (C) 2024 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.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.media.c2;
@VintfStability
interface IPooledGraphicBufferAllocator {
android.hardware.media.c2.IPooledGraphicBufferAllocator.Allocation allocate(in android.hardware.media.c2.IPooledGraphicBufferAllocator.Description desc);
boolean deallocate(in int id);
parcelable Allocation {
int bufferId;
@nullable ParcelFileDescriptor fence;
}
parcelable Description {
int widthPixels;
int heightPixels;
int format;
long usage;
}
}

View File

@@ -23,6 +23,7 @@ import android.hardware.media.c2.IGraphicBufferAllocator;
import android.hardware.media.c2.IInputSink; import android.hardware.media.c2.IInputSink;
import android.hardware.media.c2.IInputSurface; import android.hardware.media.c2.IInputSurface;
import android.hardware.media.c2.IInputSurfaceConnection; import android.hardware.media.c2.IInputSurfaceConnection;
import android.hardware.media.c2.IPooledGraphicBufferAllocator;
import android.hardware.media.c2.WorkBundle; import android.hardware.media.c2.WorkBundle;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
@@ -56,20 +57,36 @@ interface IComponent {
* graphic blocks. the waitable fd is used to create a specific type of * graphic blocks. the waitable fd is used to create a specific type of
* C2Fence which can be used for waiting until to allocate is not blocked. * C2Fence which can be used for waiting until to allocate is not blocked.
*/ */
parcelable C2AidlGbAllocator { parcelable GbAllocator {
IGraphicBufferAllocator igba;
ParcelFileDescriptor waitableFd; ParcelFileDescriptor waitableFd;
IGraphicBufferAllocator igba;
} }
/**
* C2AIDL allocator interface based on media.bufferpool2 along with a waitable fd.
*
* The interface is used from a specific type of C2BlockPool to allocate
* graphic blocks. the waitable fd is used to create a specific type of
* C2Fence which can be used for waiting until to allocate is not blocked.
* receiverId is id of receiver IConnection of media.bufferpool2.
*/
parcelable PooledGbAllocator {
ParcelFileDescriptor waitableFd;
long receiverId;
IPooledGraphicBufferAllocator ipgba;
}
/** /**
* Allocator for C2BlockPool. * Allocator for C2BlockPool.
* *
* C2BlockPool will use a C2Allocator which is specified by an id. * C2BlockPool will use a C2Allocator which is specified by an id.
* or C2AIDL allocator interface directly. * Based on allocator id, allocator is specified.
*/ */
union BlockPoolAllocator { parcelable BlockPoolAllocator {
int allocatorId; int allocatorId;
C2AidlGbAllocator allocator; @nullable GbAllocator gbAllocator;
@nullable PooledGbAllocator pooledGbAllocator;
} }
/** /**

View File

@@ -0,0 +1,77 @@
/*
* Copyright (C) 2024 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.os.ParcelFileDescriptor;
/**
* Interface for decoder output buffer allocator for HAL process
*
* A graphic buffer for decoder output is allocated by the interface.
*/
@VintfStability
interface IPooledGraphicBufferAllocator {
/**
* A graphic buffer allocation.
*
* bufferId is id of buffer from a media.bufferpool2. The buffer is
* 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 {
int bufferId;
@nullable ParcelFileDescriptor fence;
}
/**
* Parameters for a graphic buffer allocation.
*
* Refer to AHardwareBuffer_Desc(libnativewindow) for details.
*/
parcelable Description {
int widthPixels;
int heightPixels;
int format; // AHardwareBuffer_Format
long usage; // AHardwareBuffer_UsageFlags
}
/**
* Allocate a graphic buffer.
* deallocate() must be called after the allocated buffer is no longer needed.
*
* @param desc Allocation parameters.
* @return an id of a buffer, the id is created from media.bufferpool2 in order for
* caching and recycling,
* If underlying allocator is blocked, c2::Status::Blocked will be returned.
* Waitable fd must be obtained using the ndk object locally. The waitable fd must
* be passed to the receiver during BlockPool creation request via AIDL.
* @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 buffer id.
* @return {@code true} when de-allocate happened, {@code false} otherwise.
*/
boolean deallocate(in int id);
}