mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 05:49:27 +00:00
Merge changes from topic "c2-aidl-pool" into main
* changes: media c2.aidl: Add IPooledGraphicBufferAllocator support media.bufferpool2: Support receiver side initated buffer transfer
This commit is contained in:
@@ -35,6 +35,7 @@ package android.hardware.media.bufferpool2;
|
||||
@VintfStability
|
||||
interface IClientManager {
|
||||
android.hardware.media.bufferpool2.IClientManager.Registration registerSender(in android.hardware.media.bufferpool2.IAccessor bufferPool);
|
||||
android.hardware.media.bufferpool2.IClientManager.Registration registerPassiveSender(in android.hardware.media.bufferpool2.IAccessor bufferPool);
|
||||
@VintfStability
|
||||
parcelable Registration {
|
||||
long connectionId;
|
||||
|
||||
@@ -40,7 +40,8 @@ interface IClientManager {
|
||||
/**
|
||||
* Sets up a buffer receiving communication node for the specified
|
||||
* buffer pool. A manager must create a IConnection to the buffer
|
||||
* pool if it does not already have a connection.
|
||||
* pool if it does not already have a connection. To transfer buffers
|
||||
* using the interface, the sender must initiates transfer.
|
||||
*
|
||||
* @param bufferPool a buffer pool which is specified with the IAccessor.
|
||||
* The specified buffer pool is the owner of received buffers.
|
||||
@@ -52,4 +53,21 @@ interface IClientManager {
|
||||
* ResultStatus::CRITICAL_ERROR - Other errors.
|
||||
*/
|
||||
Registration registerSender(in IAccessor bufferPool);
|
||||
|
||||
/**
|
||||
* Sets up a buffer receiving communication node for the specified
|
||||
* buffer pool. A manager must create a IConnection to the buffer
|
||||
* pool if it does not already have a connection. To transfer buffers
|
||||
* using the interface, the receiver must initiates transfer(on demand).
|
||||
*
|
||||
* @param bufferPool a buffer pool which is specified with the IAccessor.
|
||||
* The specified buffer pool is the owner of received buffers.
|
||||
* @return the Id of the communication node to the buffer pool.
|
||||
* This id is used in FMQ to notify IAccessor that a buffer has been
|
||||
* sent to that connection during transfers.
|
||||
* @throws ServiceSpecificException with one of the following values:
|
||||
* ResultStatus::NO_MEMORY - Memory allocation failure occurred.
|
||||
* ResultStatus::CRITICAL_ERROR - Other errors.
|
||||
*/
|
||||
Registration registerPassiveSender(in IAccessor bufferPool);
|
||||
}
|
||||
|
||||
@@ -422,6 +422,14 @@ void ClientManager::Impl::cleanUp(bool clearCache) {
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
::ndk::ScopedAStatus ClientManager::registerPassiveSender(
|
||||
const std::shared_ptr<IAccessor>& in_bufferPool, Registration* _aidl_return) {
|
||||
// TODO
|
||||
(void) in_bufferPool;
|
||||
(void) _aidl_return;
|
||||
return ::ndk::ScopedAStatus::fromServiceSpecificError(ResultStatus::NOT_FOUND);
|
||||
}
|
||||
|
||||
// Methods for local use.
|
||||
std::shared_ptr<ClientManager> ClientManager::sInstance;
|
||||
std::mutex ClientManager::sInstanceLock;
|
||||
|
||||
@@ -34,6 +34,11 @@ struct ClientManager : public BnClientManager {
|
||||
::aidl::android::hardware::media::bufferpool2::IClientManager::Registration* _aidl_return)
|
||||
override;
|
||||
|
||||
::ndk::ScopedAStatus registerPassiveSender(
|
||||
const std::shared_ptr<IAccessor>& in_bufferPool,
|
||||
::aidl::android::hardware::media::bufferpool2::IClientManager::Registration* _aidl_return)
|
||||
override;
|
||||
|
||||
/** Gets an instance. */
|
||||
static std::shared_ptr<ClientManager> getInstance();
|
||||
|
||||
|
||||
@@ -51,12 +51,18 @@ interface IComponent {
|
||||
long blockPoolId;
|
||||
android.hardware.media.c2.IConfigurable configurable;
|
||||
}
|
||||
parcelable C2AidlGbAllocator {
|
||||
android.hardware.media.c2.IGraphicBufferAllocator igba;
|
||||
parcelable GbAllocator {
|
||||
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;
|
||||
android.hardware.media.c2.IComponent.C2AidlGbAllocator allocator;
|
||||
@nullable android.hardware.media.c2.IComponent.GbAllocator gbAllocator;
|
||||
@nullable android.hardware.media.c2.IComponent.PooledGbAllocator pooledGbAllocator;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import android.hardware.media.c2.IGraphicBufferAllocator;
|
||||
import android.hardware.media.c2.IInputSink;
|
||||
import android.hardware.media.c2.IInputSurface;
|
||||
import android.hardware.media.c2.IInputSurfaceConnection;
|
||||
import android.hardware.media.c2.IPooledGraphicBufferAllocator;
|
||||
import android.hardware.media.c2.WorkBundle;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
|
||||
@@ -56,20 +57,36 @@ interface IComponent {
|
||||
* 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.
|
||||
*/
|
||||
parcelable C2AidlGbAllocator {
|
||||
IGraphicBufferAllocator igba;
|
||||
parcelable GbAllocator {
|
||||
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.
|
||||
*
|
||||
* 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;
|
||||
C2AidlGbAllocator allocator;
|
||||
@nullable GbAllocator gbAllocator;
|
||||
@nullable PooledGbAllocator pooledGbAllocator;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user