Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ipc/aidl/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ aidl_interface {
imports: [
"android.hardware.common-V2",
],
frozen: true,
versions_with_info: [
{
version: "1",
imports: ["android.hardware.common-V2"],
},
],
frozen: true,

}
2 changes: 1 addition & 1 deletion ipc/aidl/aidl_api/vendor.qti.hardware.agm/1/.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
efa4ab1ccef17baa301d81deca852ddc0bbafbfb
911502163cfdc3a8ebbefd1960e38f135ed339f2
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
///////////////////////////////////////////////////////////////////////////////
// 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 vendor.qti.hardware.agm;
@Backing(type="int") @VintfStability
enum AgmCshmCacheType {
CACHED = 1,
UNCACHED = 2,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
///////////////////////////////////////////////////////////////////////////////
// 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 vendor.qti.hardware.agm;
@VintfStability
parcelable AgmCshmInfo {
int memID;
vendor.qti.hardware.agm.AgmCshmCacheType type;
android.hardware.common.NativeHandle allocHandle;
int flags;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
Expand Down Expand Up @@ -71,6 +71,9 @@ interface IAGM {
void ipc_agm_set_params_with_tag(in int sessiondId, in int aifId, in vendor.qti.hardware.agm.AgmTagConfig tagConfig);
void ipc_agm_set_params_with_tag_to_acdb(in int sessiondId, in int aifId, in byte[] payload);
void ipc_agm_dump(in vendor.qti.hardware.agm.AgmDumpInfo dumpInfo);
vendor.qti.hardware.agm.AgmCshmInfo ipc_agm_cshm_alloc(in int size, in vendor.qti.hardware.agm.AgmCshmInfo info);
void ipc_agm_cshm_dealloc(in int memID);
void ipc_agm_cshm_msg(in int memID, in int offset, in int length, in int miid, in int propFlag);
parcelable AgmReadWithMetadataReturn {
vendor.qti.hardware.agm.AgmBuff buffer;
int capturesSize;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
///////////////////////////////////////////////////////////////////////////////
// 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 vendor.qti.hardware.agm;
@Backing(type="int") @VintfStability
enum AgmCshmCacheType {
CACHED = 1,
UNCACHED = 2,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
///////////////////////////////////////////////////////////////////////////////
// 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 vendor.qti.hardware.agm;
@VintfStability
parcelable AgmCshmInfo {
int memID;
vendor.qti.hardware.agm.AgmCshmCacheType type;
android.hardware.common.NativeHandle allocHandle;
int flags;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause-Clear
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
Expand Down Expand Up @@ -71,6 +71,9 @@ interface IAGM {
void ipc_agm_set_params_with_tag(in int sessiondId, in int aifId, in vendor.qti.hardware.agm.AgmTagConfig tagConfig);
void ipc_agm_set_params_with_tag_to_acdb(in int sessiondId, in int aifId, in byte[] payload);
void ipc_agm_dump(in vendor.qti.hardware.agm.AgmDumpInfo dumpInfo);
vendor.qti.hardware.agm.AgmCshmInfo ipc_agm_cshm_alloc(in int size, in vendor.qti.hardware.agm.AgmCshmInfo info);
void ipc_agm_cshm_dealloc(in int memID);
void ipc_agm_cshm_msg(in int memID, in int offset, in int length, in int miid, in int propFlag);
parcelable AgmReadWithMetadataReturn {
vendor.qti.hardware.agm.AgmBuff buffer;
int capturesSize;
Expand Down
5 changes: 4 additions & 1 deletion ipc/aidl/aidlconverter/inc/agm/AgmLegacyToAidl.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Changes from Qualcomm Technologies, Inc. are provided under the following license:
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/

Expand Down Expand Up @@ -273,4 +274,6 @@ struct LegacyToAidl {
*/
static void convertMmapBufferInfoToAidl(struct agm_buf_info *legacyBufferInfo,
MmapBufInfo *aidlBufferInfo, int flags);

static aidl::android::hardware::common::NativeHandle convertfdToAidl(int fd);
};
9 changes: 8 additions & 1 deletion ipc/aidl/aidlconverter/src/AgmLegacyToAidl.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Changes from Qualcomm Technologies, Inc. are provided under the following license:
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/

Expand Down Expand Up @@ -314,6 +315,12 @@ aidl::android::hardware::common::NativeHandle fdToNativeHandle(int fd, int intTo
return std::move(handle);
}

aidl::android::hardware::common::NativeHandle LegacyToAidl::convertfdToAidl(int fd) {
aidl::android::hardware::common::NativeHandle aidlfd;
aidlfd = fdToNativeHandle(fd, fd);
return std::move(aidlfd);
}

AgmBuff LegacyToAidl::convertAgmBufferToAidl(struct agm_buff *legacyBuffer, bool externalMemory,
bool copyBuffers) {
AgmBuff aidlBuffer;
Expand Down
33 changes: 33 additions & 0 deletions ipc/aidl/client/AgmClientWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,39 @@ int agm_session_write_datapath_params(uint32_t session_id, struct agm_buff *buf)
client->ipc_agm_session_write_datapath_params(session_id, aidlBuffer), __func__);
}

int32_t agm_cshm_alloc(uint32_t size, agm_cshm_info *info) {

const native_handle *FdHandle = nullptr;
auto client = getAgm();
RETURN_IF_AGM_SERVICE_NOT_REGISTERED(client);
AgmCshmInfo infoAidl;
AgmCshmInfo infoAidlResult;
infoAidl.type = static_cast<AgmCshmCacheType>(info->type);
infoAidl.flags = info->flags;
auto status = client->ipc_agm_cshm_alloc(size, infoAidl, &infoAidlResult);
auto fdInfo = AidlToLegacy::getFdIntFromNativeHandle(infoAidlResult.allocHandle);
info->mem_id = infoAidlResult.memID;
info->fd = fdInfo.first;

return statusTFromBinderStatus(status);
}

int agm_cshm_msg(uint32_t mem_id, uint32_t offset, uint32_t length,
uint32_t miid, uint32_t prop_flag) {

auto client = getAgm();
RETURN_IF_AGM_SERVICE_NOT_REGISTERED(client);

return statusTFromBinderStatus(
client->ipc_agm_cshm_msg(mem_id, offset, length, miid, prop_flag));
}

int agm_cshm_dealloc(uint32_t mem_id) {
auto client = getAgm();
RETURN_IF_AGM_SERVICE_NOT_REGISTERED(client);
return statusTFromBinderStatus(client->ipc_agm_cshm_dealloc(mem_id));
}

int agm_dump(struct agm_dump_info *dump_info) {
return 0;
}
23 changes: 23 additions & 0 deletions ipc/aidl/server/AgmServerWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,4 +951,27 @@ ::ndk::ScopedAStatus AgmServerWrapper::ipc_agm_set_params_with_tag_to_acdb(
::ndk::ScopedAStatus AgmServerWrapper::ipc_agm_dump(const AgmDumpInfo &in_dumpInfo) {
return ScopedAStatus::ok();
}

::ndk::ScopedAStatus AgmServerWrapper::ipc_agm_cshm_alloc(
int32_t size, const AgmCshmInfo &in_info, AgmCshmInfo *_aidl_return) {

agm_cshm_info agm_info;
agm_info.type = (agm_cshm_type) in_info.type;
agm_info.flags = in_info.flags;
auto status = agm_cshm_alloc(size, &agm_info);
_aidl_return->allocHandle = LegacyToAidl::convertfdToAidl(agm_info.fd);
_aidl_return->memID = agm_info.mem_id;
return status_tToBinderResult(status);
}
::ndk::ScopedAStatus AgmServerWrapper::ipc_agm_cshm_msg(int32_t in_mem_id, int32_t in_offset,
int32_t in_length, int32_t in_miid, int32_t in_prop_flag) {

return status_tToBinderResult(
agm_cshm_msg(in_mem_id , in_offset, in_length, in_miid, in_prop_flag));
}

::ndk::ScopedAStatus AgmServerWrapper::ipc_agm_cshm_dealloc(int32_t mem_id) {
return status_tToBinderResult(agm_cshm_dealloc(mem_id));
}

}
12 changes: 8 additions & 4 deletions ipc/aidl/server/AgmServerWrapper.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/

Expand All @@ -8,7 +8,7 @@
#include <agm/agm_api.h>
#include <aidl/vendor/qti/hardware/agm/BnAGM.h>
#include <aidl/vendor/qti/hardware/agm/IAGMCallback.h>

#include <map>
#include <log/log.h>
#include <algorithm>
#include <unordered_map>
Expand Down Expand Up @@ -271,7 +271,11 @@ class AgmServerWrapper : public BnAGM, public ISessionOps {
::ndk::ScopedAStatus ipc_agm_dump(
const ::aidl::vendor::qti::hardware::agm::AgmDumpInfo &in_dumpInfo)
override;

::ndk::ScopedAStatus ipc_agm_cshm_alloc(int32_t size,
const AgmCshmInfo &in_info, AgmCshmInfo *_aidl_return) override;
::ndk::ScopedAStatus ipc_agm_cshm_msg(int32_t in_mem_id, int32_t in_offset,
int32_t in_length, int32_t in_miid, int32_t in_prop_flag) override;
::ndk::ScopedAStatus ipc_agm_cshm_dealloc(int32_t mem_id) override;
void addSessionHandle(uint32_t sessionId, uint64_t handle) override;
void removeSessionHandle(uint64_t handle) override;
void connectSessionAif(uint32_t sessionId, uint32_t aifId, bool state) override;
Expand All @@ -289,4 +293,4 @@ class AgmServerWrapper : public BnAGM, public ISessionOps {
std::unordered_map<int /*pid */, std::shared_ptr<ClientInfo>> mClients;
bool mInitialized = false;
};
}
}
23 changes: 23 additions & 0 deletions ipc/aidl/vendor/qti/hardware/agm/AgmCshmCacheType.aidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/

package vendor.qti.hardware.agm;
/* AgmCshmCachetype type of memory to be allocated*/
@Backing(type="int") @VintfStability
enum AgmCshmCacheType {
/**
* Indicates that the allocated shared memory is cacheable.
* This typically offers better performance due to faster access,
* but may require explicit cache management
* to ensure data consistency between CPU and hardware devices.
*/
CACHED = 1,
/**
* Indicates that the allocated shared memory is non-cacheable.
* This avoids issues with cache coherency,
* though it may result in slower access speeds.
*/
UNCACHED = 2,
}
22 changes: 22 additions & 0 deletions ipc/aidl/vendor/qti/hardware/agm/AgmCshmInfo.aidl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/

package vendor.qti.hardware.agm;

import android.hardware.common.NativeHandle;

import vendor.qti.hardware.agm.AgmCshmCacheType;

/* memID memID of the memory allocated
* type type of the memory allocated
* fd fd of the memory allocated
* flags reserved flag for future usage*/
@VintfStability
parcelable AgmCshmInfo {
int memID;
AgmCshmCacheType type;
NativeHandle allocHandle;
int flags;
}
Loading
Loading