Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libva header fix #197

Merged
merged 6 commits into from
Oct 24, 2024
Merged
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
16 changes: 14 additions & 2 deletions c2_components/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ cc_library_headers {
cc_library_shared {
name: "libmfx_c2_components_hw",

defaults: ["mfx_c2_defaults"],
defaults: [
"mfx_c2_defaults",
"android.hardware.graphics.allocator-ndk_shared",
],

static_libs: [
"libmfx_c2_buffers",
Expand All @@ -57,6 +60,8 @@ cc_library_shared {
"[email protected]",
"[email protected]",
"[email protected]",
"libbinder_ndk",
"libvndksupport",
],

local_include_dirs: [
Expand All @@ -79,5 +84,12 @@ cc_library_shared {

],

header_libs: [
"libui_headers",
"libimapper_stablec",
"libimapper_providerutils",
"libva_headers",
],

vendor: true,
}
}
1 change: 1 addition & 0 deletions c2_components/src/mfx_c2_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "mfx_c2_debug.h"
#include "mfx_c2_components_registry.h"
#include "mfx_c2_components_monitor.h"
#include <assert.h>

using namespace android;

Expand Down
12 changes: 0 additions & 12 deletions c2_components/src/mfx_c2_encoder_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1381,23 +1381,11 @@ void MfxC2EncoderComponent::DoWork(std::unique_ptr<C2Work>&& work)
mfxMemId mem_id = nullptr;
bool decode_target = false;
native_handle_t *grallocHandle = android::UnwrapNativeCodec2GrallocHandle(c_graph_block->handle());
// From Android U, the get function of IMapper4 will check whether the buffer handle is reserved.
// So we need to call importBuffer before getting the buffer's info.
#if PLATFORM_SDK_VERSION >= 34 && defined(USE_GRALLOC4) // Android 14(U)
buffer_handle_t importedHandle = MfxGrallocInstance::getInstance()->ImportBuffer(grallocHandle);

mfxStatus mfx_sts = frame_converter->ConvertGrallocToVa(importedHandle,
decode_target, &mem_id);

native_handle_delete(const_cast<native_handle_t *>(importedHandle));
importedHandle = nullptr;
#else
mfxStatus mfx_sts = frame_converter->ConvertGrallocToVa(grallocHandle,
decode_target, &mem_id);

native_handle_delete(grallocHandle);
grallocHandle = nullptr;
#endif

if (MFX_ERR_NONE != mfx_sts) {
res = MfxStatusToC2(mfx_sts);
Expand Down
66 changes: 40 additions & 26 deletions c2_store/Android.bp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cc_library_static {

name: "libmfx_c2_store",
name: "libmfx_c2_store",

defaults: ["mfx_c2_defaults"],
defaults: ["mfx_c2_defaults"],

cflags: [
"-fexceptions"
],
cflags: [
"-fexceptions"
],

header_libs: [
"mfx_c2_components_headers",
Expand All @@ -21,12 +21,18 @@ cc_library_static {
}

cc_binary {

name: "[email protected]",
defaults: ["libcodec2-hidl-defaults", "mfx_c2_exe_defaults"],
name: "android.hardware.media.c2-service.intel",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi Jeeva, could you please share why we rename the service name here? Is there any naming rule defined in Android 15?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aidl naming convention removed the version information. Thats the reason behind the name change to android.hardware.media.c2-service.intel

vendor: true,
relative_install_path: "hw",

init_rc: ["android.hardware.media.c2-service.intel.rc"],

defaults: [
"libcodec2-hidl-defaults",
"libcodec2-aidl-defaults",
"mfx_c2_exe_defaults",
],

local_include_dirs: [
"include",
],
Expand All @@ -35,8 +41,6 @@ cc_binary {
"src/mfx_c2_service.cpp",
],

init_rc: ["[email protected]"],

header_libs: [
"mfx_c2_components_headers",
"libmedia_headers",
Expand All @@ -46,43 +50,53 @@ cc_binary {
static_libs: [
"libmfx_c2_store",
"libmfx_c2_utils_va",
"libexpat"
"libexpat",
],

// minijail is used to protect against unexpected system calls.
shared_libs: [
"[email protected]",
"libavservices_minijail",
"libbinder",
"libhidltransport",
"libhwbinder",
"libstagefright_omx",
"libstagefright_xmlparser",
"libbinder_ndk",
],
required: ["android.hardware.media.c2-vendor-seccomp_policy"],

vintf_fragments: ["manifest_media_c2_V1_0_default.xml"],

required: ["[email protected]"],

compile_multilib: "32",
// The content in manifest_media_c2_default.xml can be included
// directly in the main device manifest.xml file or via vintf_fragments.
// (Remove the line below if the entry is already in the main manifest.)
vintf_fragments: ["manifest_media_c2_default.xml"],
}

// seccomp policy file.
//
// This should be modified to suit the target device and architecture.
//
// Files in the "seccomp_policy" subdirectory are only provided as examples.
// They may not work on some devices and/or architectures without modification.
prebuilt_etc {
name: "android.hardware.media.c2@1.0-vendor.policy",
name: "android.hardware.media.c2-vendor-seccomp_policy",
vendor: true,
sub_dir: "seccomp_policy",

// If a specific architecture is targeted, multiple choices are not needed.
arch: {
arm: {
src: "seccomp_policy/android.hardware.media.c2@1.0-arm.policy",
src: "seccomp_policy/android.hardware.media.c2-default-arm.policy",
},
arm64: {
src: "seccomp_policy/[email protected]",
src: "seccomp_policy/android.hardware.media.c2-default-arm64.policy",
},
riscv64: {
src: "seccomp_policy/android.hardware.media.c2-default-riscv64.policy",
},
x86: {
src: "seccomp_policy/android.hardware.media.c2@1.0-x86.policy",
src: "seccomp_policy/android.hardware.media.c2-default-x86.policy",
},
x86_64: {
src: "seccomp_policy/android.hardware.media.c2@1.0-x86_64.policy",
src: "seccomp_policy/android.hardware.media.c2-default-x86_64.policy",
},
},

//This may be removed.
required: ["crash_dump.policy"],
}
7 changes: 7 additions & 0 deletions c2_store/android.hardware.media.c2-service.intel.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
service hardware-intel-media-c2-hal /vendor/bin/hw/android.hardware.media.c2-service.intel
class hal
user mediacodec
group camera mediadrm drmrpc
ioprio rt 4
task_profiles ProcessCapacityHigh

6 changes: 0 additions & 6 deletions c2_store/[email protected]

This file was deleted.

11 changes: 0 additions & 11 deletions c2_store/manifest_media_c2_V1_0_default.xml

This file was deleted.

11 changes: 0 additions & 11 deletions c2_store/manifest_media_c2_V1_1_default.xml

This file was deleted.

11 changes: 0 additions & 11 deletions c2_store/manifest_media_c2_V1_2_default.xml

This file was deleted.

7 changes: 7 additions & 0 deletions c2_store/manifest_media_c2_default.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.media.c2</name>
<version>1</version>
<fqname>IComponentStore/default</fqname>
</hal>
</manifest>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Copyright (C) 2019 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.

futex: 1
# ioctl calls are filtered via the selinux policy.
ioctl: 1
sched_yield: 1
close: 1
dup: 1
ppoll: 1
mprotect: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
mmap: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
getuid: 1
getrlimit: 1
fstat: 1
newfstatat: 1
fstatfs: 1
memfd_create: 1
ftruncate: 1

mremap: arg3 == 3 || arg3 == MREMAP_MAYMOVE
munmap: 1
prctl: 1
writev: 1
sigaltstack: 1
clone: 1
exit: 1
lseek: 1
rt_sigprocmask: 1
openat: 1
write: 1
nanosleep: 1
setpriority: 1
set_tid_address: 1
getdents64: 1
readlinkat: 1
read: 1
pread64: 1
gettimeofday: 1
faccessat: 1
exit_group: 1
restart_syscall: 1
rt_sigreturn: 1
getrandom: 1
madvise: 1

# crash dump policy additions
clock_gettime: 1
getpid: 1
gettid: 1
pipe2: 1
recvmsg: 1
process_vm_readv: 1
tgkill: 1
rt_sigaction: 1
rt_tgsigqueueinfo: 1
#mprotect: arg2 in 0x1|0x2
munmap: 1
#mmap: arg2 in 0x1|0x2
geteuid: 1
getgid: 1
getegid: 1
getgroups: 1

File renamed without changes.
Loading