Add bufferpool AIDL definitions
Bug: 254050250 Test: m Change-Id: I4b371ccd9a1e1ed59e642d585aa4119c775fbd2c
This commit is contained in:
parent
f05679810e
commit
90584d2caa
20 changed files with 897 additions and 0 deletions
|
@ -61,6 +61,7 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) {
|
|||
"android.hardware.graphics.common",
|
||||
"android.hardware.input.common",
|
||||
"android.hardware.keymaster",
|
||||
"android.hardware.media.bufferpool2",
|
||||
"android.hardware.radio",
|
||||
"android.hardware.uwb.fira_android",
|
||||
|
||||
|
|
35
media/bufferpool/aidl/Android.bp
Normal file
35
media/bufferpool/aidl/Android.bp
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2022 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.
|
||||
|
||||
aidl_interface {
|
||||
name: "android.hardware.media.bufferpool2",
|
||||
vendor_available: true,
|
||||
srcs: ["android/hardware/media/bufferpool2/*.aidl"],
|
||||
imports: [
|
||||
"android.hardware.common-V2",
|
||||
"android.hardware.common.fmq-V1",
|
||||
],
|
||||
stability: "vintf",
|
||||
backend: {
|
||||
cpp: {
|
||||
enabled: false,
|
||||
},
|
||||
java: {
|
||||
enabled: false,
|
||||
},
|
||||
ndk: {
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
@VintfStability
|
||||
parcelable Buffer {
|
||||
int id;
|
||||
android.hardware.common.NativeHandle buffer;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
@FixedSize @VintfStability
|
||||
parcelable BufferInvalidationMessage {
|
||||
int messageId;
|
||||
int fromBufferId;
|
||||
int toBufferId;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
@Backing(type="int") @VintfStability
|
||||
enum BufferStatus {
|
||||
NOT_USED = 0,
|
||||
USED = 1,
|
||||
TRANSFER_TO = 2,
|
||||
TRANSFER_FROM = 3,
|
||||
TRANSFER_TIMEOUT = 4,
|
||||
TRANSFER_LOST = 5,
|
||||
TRANSFER_FETCH = 6,
|
||||
TRANSFER_OK = 7,
|
||||
TRANSFER_ERROR = 8,
|
||||
INVALIDATION_ACK = 9,
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
@FixedSize @VintfStability
|
||||
parcelable BufferStatusMessage {
|
||||
long transactionId;
|
||||
int bufferId;
|
||||
android.hardware.media.bufferpool2.BufferStatus status;
|
||||
long connectionId;
|
||||
long targetConnectionId;
|
||||
long timestampUs;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
@VintfStability
|
||||
interface IAccessor {
|
||||
android.hardware.media.bufferpool2.IAccessor.ConnectionInfo connect(in android.hardware.media.bufferpool2.IObserver observer);
|
||||
@VintfStability
|
||||
parcelable ConnectionInfo {
|
||||
android.hardware.media.bufferpool2.IConnection connection;
|
||||
long connectionId;
|
||||
int msgId;
|
||||
android.hardware.common.fmq.MQDescriptor<android.hardware.media.bufferpool2.BufferStatusMessage,android.hardware.common.fmq.SynchronizedReadWrite> toFmqDesc;
|
||||
android.hardware.common.fmq.MQDescriptor<android.hardware.media.bufferpool2.BufferInvalidationMessage,android.hardware.common.fmq.UnsynchronizedWrite> fromFmqDesc;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
@VintfStability
|
||||
interface IClientManager {
|
||||
long registerSender(in android.hardware.media.bufferpool2.IAccessor bufferPool);
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
@VintfStability
|
||||
interface IConnection {
|
||||
android.hardware.media.bufferpool2.IConnection.FetchResult[] fetch(in android.hardware.media.bufferpool2.IConnection.FetchInfo[] fetchInfos);
|
||||
parcelable FetchInfo {
|
||||
long transactionId;
|
||||
int bufferId;
|
||||
}
|
||||
union FetchResult {
|
||||
android.hardware.media.bufferpool2.Buffer buffer;
|
||||
android.hardware.media.bufferpool2.ResultStatus failure;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
@VintfStability
|
||||
interface IObserver {
|
||||
oneway void onMessage(in long connectionId, in int msgId);
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
@VintfStability
|
||||
parcelable ResultStatus {
|
||||
int resultStatus;
|
||||
const int OK = 0;
|
||||
const int NO_MEMORY = 1;
|
||||
const int ALREADY_EXISTS = 2;
|
||||
const int NOT_FOUND = 3;
|
||||
const int CRITICAL_ERROR = 4;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
|
||||
import android.hardware.common.NativeHandle;
|
||||
|
||||
/**
|
||||
* Generic buffer for fast recycling for media/stagefright.
|
||||
*
|
||||
* During media pipeline buffer references are created, shared and
|
||||
* destroyed frequently. The underlying buffers are allocated on demand
|
||||
* by a buffer pool, and are recycled to the buffer pool when they are
|
||||
* no longer referenced by the clients.
|
||||
*
|
||||
* E.g. ion or gralloc buffer
|
||||
*/
|
||||
@VintfStability
|
||||
parcelable Buffer {
|
||||
int id;
|
||||
NativeHandle buffer;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
|
||||
/*
|
||||
* Buffer pool sends a buffer invalidation message to clients in order to
|
||||
* ensure fast reclamation of the buffers. Buffer pool implementation on
|
||||
* clients must release the invalidated buffers right away after finishing
|
||||
* the use of buffers upon receiving a buffer invalidation message.
|
||||
* Users cannot delay or control timing of the handling/reception of
|
||||
* invalidation messages. Buffer pool implementation must guarantee timely
|
||||
* handling of invalidation messages.
|
||||
*/
|
||||
@VintfStability
|
||||
@FixedSize
|
||||
parcelable BufferInvalidationMessage {
|
||||
int messageId;
|
||||
/**
|
||||
* Buffers from fromBufferId to toBufferId must be invalidated.
|
||||
* fromBufferId is inclusive, but toBufferId is not inclusive.
|
||||
* If fromBufferId > toBufferID, wrap happens. In that case
|
||||
* the wrap is based on UINT32_MAX.
|
||||
*/
|
||||
int fromBufferId;
|
||||
int toBufferId;
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
|
||||
/**
|
||||
* Buffer ownership status for the specified client.
|
||||
* Buffer transfer status for the specified buffer transafer transaction.
|
||||
* BufferStatus is posted along with BufferStatusMessage from a client to
|
||||
* the buffer pool for synchronization after status change.
|
||||
*/
|
||||
@VintfStability
|
||||
@Backing(type="int")
|
||||
enum BufferStatus {
|
||||
/**
|
||||
* No longer used by the specified client.
|
||||
*/
|
||||
NOT_USED = 0,
|
||||
/**
|
||||
* Buffer is acquired by the specified client.
|
||||
*/
|
||||
USED = 1,
|
||||
/**
|
||||
* Buffer is sent by the specified client.
|
||||
*/
|
||||
TRANSFER_TO = 2,
|
||||
/**
|
||||
* Buffer transfer is acked by the receiver client.
|
||||
*/
|
||||
TRANSFER_FROM = 3,
|
||||
/**
|
||||
* Buffer transfer is timed out by receiver client.
|
||||
*/
|
||||
TRANSFER_TIMEOUT = 4,
|
||||
/**
|
||||
* Buffer transfer is not acked by the receiver.
|
||||
*/
|
||||
TRANSFER_LOST = 5,
|
||||
/**
|
||||
* Buffer fetch request from the client.
|
||||
*/
|
||||
TRANSFER_FETCH = 6,
|
||||
/**
|
||||
* Buffer transaction succeeded.
|
||||
*/
|
||||
TRANSFER_OK = 7,
|
||||
/**
|
||||
* Buffer transaction failure.
|
||||
*/
|
||||
TRANSFER_ERROR = 8,
|
||||
/**
|
||||
* Buffer invalidation ack.
|
||||
*/
|
||||
INVALIDATION_ACK = 9,
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
|
||||
import android.hardware.media.bufferpool2.BufferStatus;
|
||||
|
||||
/**
|
||||
* Buffer ownership status change message. This message is
|
||||
* sent via fmq to the buffer pool from client processes.
|
||||
*/
|
||||
@VintfStability
|
||||
@FixedSize
|
||||
parcelable BufferStatusMessage {
|
||||
/**
|
||||
* Transaction Id = (SenderId : sender local transaction Id)
|
||||
* Transaction Id is created from sender and posted via fmq within
|
||||
* TRANSFER_TO message.
|
||||
*/
|
||||
long transactionId;
|
||||
int bufferId;
|
||||
BufferStatus status;
|
||||
/**
|
||||
* Used by the buffer pool, not by client.
|
||||
*/
|
||||
long connectionId;
|
||||
/**
|
||||
* Valid only when TRANSFER_TO is posted.
|
||||
*/
|
||||
long targetConnectionId;
|
||||
/**
|
||||
* Used by the buffer pool, not by client.
|
||||
* Monotonic timestamp in Us since fixed point in time as decided
|
||||
* by the sender of the message
|
||||
*/
|
||||
long timestampUs;
|
||||
}
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
|
||||
import android.hardware.common.fmq.MQDescriptor;
|
||||
import android.hardware.common.fmq.SynchronizedReadWrite;
|
||||
import android.hardware.common.fmq.UnsynchronizedWrite;
|
||||
|
||||
|
||||
import android.hardware.media.bufferpool2.BufferInvalidationMessage;
|
||||
import android.hardware.media.bufferpool2.BufferStatusMessage;
|
||||
import android.hardware.media.bufferpool2.IConnection;
|
||||
import android.hardware.media.bufferpool2.IObserver;
|
||||
|
||||
/**
|
||||
* IAccessor creates IConnection which is used from IClientManager in order to
|
||||
* use functionality of the specified buffer pool.
|
||||
*/
|
||||
@VintfStability
|
||||
interface IAccessor {
|
||||
@VintfStability
|
||||
/**
|
||||
* Connection information between the bufferpool process and the receiver
|
||||
* process. The information is used from the receiver process in order to
|
||||
* receive buffers from the bufferpool process.
|
||||
*/
|
||||
parcelable ConnectionInfo {
|
||||
/**
|
||||
* The interface to get shared buffers from the bufferpool.
|
||||
*/
|
||||
IConnection connection;
|
||||
/**
|
||||
* The identifier for a (sender/receiver) pair during buffer transfer.
|
||||
* This is system wide unique.
|
||||
*/
|
||||
long connectionId;
|
||||
/**
|
||||
* Id of the most recent message from bufferpool. This is monotonic.
|
||||
*/
|
||||
int msgId;
|
||||
/**
|
||||
* The FMQ descriptor for sending buffer status messages back to bufferpool
|
||||
*/
|
||||
MQDescriptor<BufferStatusMessage, SynchronizedReadWrite> toFmqDesc;
|
||||
/**
|
||||
* The FMQ descriptor for receiving buffer invalidation messages from bufferpool
|
||||
*/
|
||||
MQDescriptor<BufferInvalidationMessage, UnsynchronizedWrite> fromFmqDesc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new client and creates IConnection to the buffer pool for
|
||||
* the client. IConnection and FMQ are used by IClientManager in order to
|
||||
* communicate with the buffer pool. Via FMQ IClientManager sends
|
||||
* BufferStatusMessage(s) to the buffer pool.
|
||||
*
|
||||
* FMQ is used to send buffer ownership status changes to a buffer pool
|
||||
* from a buffer pool client. A buffer pool synchronizes FMQ messages when
|
||||
* there is an aidl request from the clients. Every client has its own
|
||||
* connection and FMQ to communicate with the buffer pool. So sending an
|
||||
* FMQ message on behalf of other clients is not possible.
|
||||
*
|
||||
* FMQ messages are sent when a buffer is acquired or released. Also, FMQ
|
||||
* messages are sent when a buffer is transferred from a client to another
|
||||
* client. FMQ has its own ID from a buffer pool. A client is specified
|
||||
* with the ID.
|
||||
*
|
||||
* To transfer a buffer, a sender must send an FMQ message. The message
|
||||
* must include a receiver's ID and a transaction ID. A receiver must send
|
||||
* the transaction ID to fetch a buffer from a buffer pool. Since the
|
||||
* sender already registered the receiver via an FMQ message, The buffer
|
||||
* pool must verify the receiver with the transaction ID. In order to
|
||||
* prevent faking a receiver, a connection to a buffer pool from client is
|
||||
* made and kept private. Also part of transaction ID is a sender ID in
|
||||
* order to prevent fake transactions from other clients. This must be
|
||||
* verified with an FMQ message from a buffer pool.
|
||||
*
|
||||
* @param observer The buffer pool event observer from the client.
|
||||
* Observer is provided to ensure FMQ messages are processed even when
|
||||
* client processes are idle. Buffer invalidation caused by
|
||||
* reconfiguration does not call observer. Buffer invalidation caused
|
||||
* by termination of pipeline call observer in order to ensure
|
||||
* invalidation is done after pipeline completion.
|
||||
* @return ConnectionInfo The information regarding the established
|
||||
* connection
|
||||
* @@throws ServiceSpecificException with one of the following values:
|
||||
* ResultStatus::NO_MEMORY - Memory allocation failure occurred.
|
||||
* ResultStatus::ALREADY_EXISTS - A connection was already made.
|
||||
* ResultStatus::CRITICAL_ERROR - Other errors.
|
||||
*/
|
||||
ConnectionInfo connect(in IObserver observer);
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
|
||||
import android.hardware.media.bufferpool2.IAccessor;
|
||||
|
||||
/**
|
||||
* IClientManager manages IConnection(s) inside a process. A locally
|
||||
* created IConnection represents a communication node(receiver) with the
|
||||
* specified buffer pool(IAccessor).
|
||||
* IConnection(s) are not exposed to other processes(IClientManager).
|
||||
* IClientManager instance must be unique within a process.
|
||||
*/
|
||||
@VintfStability
|
||||
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.
|
||||
*
|
||||
* @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::ALREADY_EXISTS - A sender was registered already.
|
||||
* ResultStatus::CRITICAL_ERROR - Other errors.
|
||||
*/
|
||||
long registerSender(in IAccessor bufferPool);
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
|
||||
import android.hardware.media.bufferpool2.Buffer;
|
||||
import android.hardware.media.bufferpool2.ResultStatus;
|
||||
|
||||
/**
|
||||
* A connection to a buffer pool which handles requests from a buffer pool
|
||||
* client. The connection must be made in order to receive buffers from
|
||||
* other buffer pool clients.
|
||||
*/
|
||||
@VintfStability
|
||||
interface IConnection {
|
||||
|
||||
parcelable FetchInfo {
|
||||
/**
|
||||
* Unique transaction id for buffer transferring.
|
||||
*/
|
||||
long transactionId;
|
||||
/**
|
||||
* Id of the buffer to be fetched.
|
||||
*/
|
||||
int bufferId;
|
||||
}
|
||||
|
||||
union FetchResult {
|
||||
/**
|
||||
* The fetched buffer on successful fetch.
|
||||
*/
|
||||
Buffer buffer;
|
||||
/**
|
||||
* The reason of the request failure. Possible values are below.
|
||||
*
|
||||
* ResultStatus::NOT_FOUND - A buffer was not found due to invalidation.
|
||||
* ResultStatus::CRITICAL_ERROR - Other errors.
|
||||
*/
|
||||
ResultStatus failure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves buffers using an array of FetchInfo.
|
||||
* Each element of FetchInfo array contains a bufferId and a transactionId
|
||||
* for each buffer to fetch. The method must be called from receiving side of buffers
|
||||
* during transferring only when the specified buffer is neither cached nor used.
|
||||
*
|
||||
* The method could have partial failures, in the case other successfully fetched buffers
|
||||
* will be in returned result along with the failures. The order of the returned result
|
||||
* will be the same with the fetchInfos.
|
||||
*
|
||||
* @param fetchInfos information of buffers to fetch
|
||||
* @return Requested buffers.
|
||||
* If there are failures, reasons of failures are also included.
|
||||
* @throws ServiceSpecificException with one of the following values:
|
||||
* ResultStatus::NO_MEMORY - Memory allocation failure occurred.
|
||||
* ResultStatus::CRITICAL_ERROR - Other errors.
|
||||
*/
|
||||
FetchResult[] fetch(in FetchInfo[] fetchInfos);
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
|
||||
/**
|
||||
* IObserver listens on notifications from the buffer pool. On receiving
|
||||
* notifications, FMQ messages from the specific buffer pool which are already
|
||||
* in the FMQ are processed.
|
||||
*/
|
||||
@VintfStability
|
||||
interface IObserver {
|
||||
/**
|
||||
* The specific buffer pool sent a message to the client. Calling this
|
||||
* method from the buffer pool enforces a buffer pool client process the
|
||||
* message.
|
||||
*
|
||||
* @param connectionId the connection Id of the specific buffer pool client
|
||||
* @param msgId Id of the most recent message
|
||||
*/
|
||||
oneway void onMessage(in long connectionId, in int msgId);
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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.bufferpool2;
|
||||
|
||||
@VintfStability
|
||||
parcelable ResultStatus {
|
||||
const int OK = 0;
|
||||
const int NO_MEMORY = 1;
|
||||
const int ALREADY_EXISTS = 2;
|
||||
const int NOT_FOUND = 3;
|
||||
const int CRITICAL_ERROR = 4;
|
||||
|
||||
int resultStatus;
|
||||
}
|
Loading…
Reference in a new issue