mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "Use NativeHandle in MQDescriptor instead of ParcelFileDescriptor" am: 1f00c21c28
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1556319 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I8db6eb1f7b7d85791719f399897baf231f8d8871
This commit is contained in:
@@ -9,6 +9,9 @@ aidl_interface {
|
|||||||
srcs: [
|
srcs: [
|
||||||
"android/hardware/common/fmq/*.aidl",
|
"android/hardware/common/fmq/*.aidl",
|
||||||
],
|
],
|
||||||
|
imports: [
|
||||||
|
"android.hardware.common",
|
||||||
|
],
|
||||||
stability: "vintf",
|
stability: "vintf",
|
||||||
backend: {
|
backend: {
|
||||||
java: {
|
java: {
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
|
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||||
// edit this file. It looks like you are doing that because you have modified
|
// two cases:
|
||||||
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
|
// 1). this is a frozen version file - do not edit this in any case.
|
||||||
// from an interface or a field from a parcelable and it broke the build. That
|
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||||
// breakage is intended.
|
// 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 changes to the AIDL files built
|
// 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
|
// 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
|
// 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
|
// independently updatable components of the system. If a device is shipped
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
package android.hardware.common.fmq;
|
package android.hardware.common.fmq;
|
||||||
@VintfStability
|
@VintfStability
|
||||||
parcelable GrantorDescriptor {
|
parcelable GrantorDescriptor {
|
||||||
|
int fdIndex;
|
||||||
int offset;
|
int offset;
|
||||||
long extent;
|
long extent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
|
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||||
// edit this file. It looks like you are doing that because you have modified
|
// two cases:
|
||||||
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
|
// 1). this is a frozen version file - do not edit this in any case.
|
||||||
// from an interface or a field from a parcelable and it broke the build. That
|
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||||
// breakage is intended.
|
// 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 changes to the AIDL files built
|
// 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
|
// 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
|
// 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
|
// independently updatable components of the system. If a device is shipped
|
||||||
@@ -19,7 +20,7 @@ package android.hardware.common.fmq;
|
|||||||
@VintfStability
|
@VintfStability
|
||||||
parcelable MQDescriptor {
|
parcelable MQDescriptor {
|
||||||
android.hardware.common.fmq.GrantorDescriptor[] grantors;
|
android.hardware.common.fmq.GrantorDescriptor[] grantors;
|
||||||
ParcelFileDescriptor fileDescriptor;
|
android.hardware.common.NativeHandle handle;
|
||||||
int quantum;
|
int quantum;
|
||||||
int flags;
|
int flags;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
|
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||||
// edit this file. It looks like you are doing that because you have modified
|
// two cases:
|
||||||
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
|
// 1). this is a frozen version file - do not edit this in any case.
|
||||||
// from an interface or a field from a parcelable and it broke the build. That
|
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||||
// breakage is intended.
|
// 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 changes to the AIDL files built
|
// 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
|
// 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
|
// 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
|
// independently updatable components of the system. If a device is shipped
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
|
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||||
// edit this file. It looks like you are doing that because you have modified
|
// two cases:
|
||||||
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
|
// 1). this is a frozen version file - do not edit this in any case.
|
||||||
// from an interface or a field from a parcelable and it broke the build. That
|
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||||
// breakage is intended.
|
// 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 changes to the AIDL files built
|
// 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
|
// 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
|
// 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
|
// independently updatable components of the system. If a device is shipped
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ package android.hardware.common.fmq;
|
|||||||
*/
|
*/
|
||||||
@VintfStability
|
@VintfStability
|
||||||
parcelable GrantorDescriptor {
|
parcelable GrantorDescriptor {
|
||||||
|
/*
|
||||||
|
* Index of file descriptor for this grantor
|
||||||
|
*/
|
||||||
|
int fdIndex;
|
||||||
/*
|
/*
|
||||||
* The offset of this descriptor in the shared memory in bytes.
|
* The offset of this descriptor in the shared memory in bytes.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package android.hardware.common.fmq;
|
package android.hardware.common.fmq;
|
||||||
|
|
||||||
|
import android.hardware.common.NativeHandle;
|
||||||
import android.hardware.common.fmq.GrantorDescriptor;
|
import android.hardware.common.fmq.GrantorDescriptor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -34,8 +35,11 @@ parcelable MQDescriptor<T, Flavor> {
|
|||||||
* for blocking operations in the shared memory.
|
* for blocking operations in the shared memory.
|
||||||
*/
|
*/
|
||||||
GrantorDescriptor[] grantors;
|
GrantorDescriptor[] grantors;
|
||||||
/* File descriptor for shared memory used in the message queue */
|
/*
|
||||||
ParcelFileDescriptor fileDescriptor;
|
* NativeHandle that contains the file descriptors for shared memory used
|
||||||
|
* in the message queue
|
||||||
|
*/
|
||||||
|
NativeHandle handle;
|
||||||
/* Size of each item, T, in bytes */
|
/* Size of each item, T, in bytes */
|
||||||
int quantum;
|
int quantum;
|
||||||
/* EventFlag word for blocking operations */
|
/* EventFlag word for blocking operations */
|
||||||
|
|||||||
@@ -41,12 +41,15 @@ interface ITestMsgQ {
|
|||||||
*
|
*
|
||||||
* @param configureFmq The server sets up a new unsynchronized FMQ if
|
* @param configureFmq The server sets up a new unsynchronized FMQ if
|
||||||
* this parameter is true.
|
* this parameter is true.
|
||||||
|
* @param userFd True to initialize the message queue with a user supplied
|
||||||
|
* file descriptor for the ring buffer.
|
||||||
|
* False to let the message queue use a single FD for everything.
|
||||||
*
|
*
|
||||||
* @return ret True if successful.
|
* @return ret True if successful.
|
||||||
* @return mqDesc This structure describes the unsynchronized FMQ that was
|
* @return mqDesc This structure describes the unsynchronized FMQ that was
|
||||||
* set up by the service. Client can use it to set up the FMQ at its end.
|
* set up by the service. Client can use it to set up the FMQ at its end.
|
||||||
*/
|
*/
|
||||||
getFmqUnsyncWrite(bool configureFmq) generates(bool ret, fmq_unsync<int32_t> mqDesc);
|
getFmqUnsyncWrite(bool configureFmq, bool userFd) generates(bool ret, fmq_unsync<int32_t> mqDesc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method request the service to write into the synchronized read/write
|
* This method request the service to write into the synchronized read/write
|
||||||
|
|||||||
@@ -91,9 +91,10 @@ cc_test {
|
|||||||
// These are static libs only for testing purposes and portability. Shared
|
// These are static libs only for testing purposes and portability. Shared
|
||||||
// libs should be used on device.
|
// libs should be used on device.
|
||||||
static_libs: [
|
static_libs: [
|
||||||
|
"android.hardware.common-unstable-ndk_platform",
|
||||||
|
"android.hardware.common.fmq-unstable-ndk_platform",
|
||||||
"android.hardware.tests.msgq@1.0",
|
"android.hardware.tests.msgq@1.0",
|
||||||
"android.fmq.test-ndk_platform",
|
"android.fmq.test-ndk_platform",
|
||||||
"android.hardware.common.fmq-unstable-ndk_platform",
|
|
||||||
],
|
],
|
||||||
whole_static_libs: [
|
whole_static_libs: [
|
||||||
"android.hardware.tests.msgq@1.0-impl",
|
"android.hardware.tests.msgq@1.0-impl",
|
||||||
|
|||||||
@@ -41,10 +41,19 @@ Return<bool> TestMsgQ::configureFmqSyncReadWrite(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Return<void> TestMsgQ::getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) {
|
Return<void> TestMsgQ::getFmqUnsyncWrite(bool configureFmq, bool userFd,
|
||||||
|
getFmqUnsyncWrite_cb _hidl_cb) {
|
||||||
if (configureFmq) {
|
if (configureFmq) {
|
||||||
static constexpr size_t kNumElementsInQueue = 1024;
|
static constexpr size_t kNumElementsInQueue = 1024;
|
||||||
mFmqUnsynchronized.reset(new (std::nothrow) MessageQueueUnsync(kNumElementsInQueue));
|
static constexpr size_t kElementSizeBytes = sizeof(int32_t);
|
||||||
|
android::base::unique_fd ringbufferFd;
|
||||||
|
if (userFd) {
|
||||||
|
ringbufferFd.reset(
|
||||||
|
::ashmem_create_region("UnsyncWrite", kNumElementsInQueue * kElementSizeBytes));
|
||||||
|
}
|
||||||
|
mFmqUnsynchronized.reset(new (std::nothrow) MessageQueueUnsync(
|
||||||
|
kNumElementsInQueue, false, std::move(ringbufferFd),
|
||||||
|
kNumElementsInQueue * kElementSizeBytes));
|
||||||
}
|
}
|
||||||
if ((mFmqUnsynchronized == nullptr) ||
|
if ((mFmqUnsynchronized == nullptr) ||
|
||||||
(mFmqUnsynchronized->isValid() == false)) {
|
(mFmqUnsynchronized->isValid() == false)) {
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ struct TestMsgQ : public ITestMsgQ {
|
|||||||
|
|
||||||
// Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow.
|
// Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow.
|
||||||
Return<bool> configureFmqSyncReadWrite(const MQDescriptorSync<int32_t>& mqDesc) override;
|
Return<bool> configureFmqSyncReadWrite(const MQDescriptorSync<int32_t>& mqDesc) override;
|
||||||
Return<void> getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) override;
|
Return<void> getFmqUnsyncWrite(bool configureFmq, bool userFd,
|
||||||
|
getFmqUnsyncWrite_cb _hidl_cb) override;
|
||||||
Return<bool> requestWriteFmqSync(int32_t count) override;
|
Return<bool> requestWriteFmqSync(int32_t count) override;
|
||||||
Return<bool> requestReadFmqSync(int32_t count) override;
|
Return<bool> requestReadFmqSync(int32_t count) override;
|
||||||
Return<bool> requestWriteFmqUnsync(int32_t count) override;
|
Return<bool> requestWriteFmqUnsync(int32_t count) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user