[mpp]: add /dev/mpp_service support

Add a new ioctl mode for kernel-4.19 or later.
Tips:
    1. There will be only one device /dev/mpp_service in kernel.
       User should use client type to distinguish different device.
    2. Each codec use the same function as before.
    3. Ioctl magic changes from VPU_IOC to MPP_IOC.
    4. Update structure for ioctl argument.
	Original structure:
	    data_ptr | size
	In this mode has many sortcommings:
	a) Need many ioctl cmd for different requirements.
	b) Data_ptr not to differ library for 32 or 64 system.
	c) Contain only one info ioctl once.

    New data structure:
        cmd_type | flags | size | offset | data_ptr
    a) Cmd_type works like previous ioctl cmd.
    b) Flags is extend to mark current data for any purpose.
    c) Size is the same as before.
    d) Data_ptr use 32 bits build in 32 system while 64 bits in 64 system.

kernel-4.19 related commit:
ib94ac0df876dfcc786b25ed3de6a68d861d2ef1e
cda9d27c62017309519bcbf8fe91057dfdc21076

Change-Id: I13d54a2e4823b7378265f100540916a22f62b9d4
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
This commit is contained in:
Ding Wei
2019-11-12 09:15:17 +08:00
committed by Herman Chen
parent a9d6b3a994
commit 7d05e33de8
39 changed files with 375 additions and 152 deletions

View File

@@ -94,6 +94,15 @@ MppRuntimeService::MppRuntimeService()
mpp_log("found drm allocator\n");
}
if ((!access("/dev/mpp_service", F_OK | R_OK | W_OK)) &&
allocator_valid[MPP_BUFFER_TYPE_ION] &&
allocator_valid[MPP_BUFFER_TYPE_DRM]) {
allocator_valid[MPP_BUFFER_TYPE_ION] = 0;
mpp_log("use drm allocator for mpp_service\n");
return;
}
// If both ion and drm is enabled detect allocator in dts to choose one
// TODO: When unify dma fd kernel is completed this part will be removed.
if (allocator_valid[MPP_BUFFER_TYPE_ION] &&