Files
mpp/osal/test/mpp_platform_test.c
Ding Wei 7d05e33de8 [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>
2019-12-10 20:12:50 +08:00

90 lines
2.6 KiB
C

/*
* Copyright 2015 Rockchip Electronics Co. LTD
*
* 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.
*/
#define MODULE_TAG "mpp_plat_test"
#include "mpp_log.h"
#include "mpp_platform.h"
int main()
{
const char *dev = NULL;
RK_U32 vcodec_type = mpp_get_vcodec_type();
mpp_log("chip name: %s\n", mpp_get_soc_name());
mpp_log("\n");
mpp_log("chip vcodec type %08x\n", vcodec_type);
if (vcodec_type & (HAVE_VDPU1 | HAVE_VEPU1))
mpp_log("found vpu1 codec\n");
if (vcodec_type & (HAVE_VDPU2 | HAVE_VEPU2))
mpp_log("found vpu2 codec\n");
if (vcodec_type & HAVE_HEVC_DEC)
mpp_log("found RK hevc decoder\n");
if (vcodec_type & HAVE_RKVDEC)
mpp_log("found rkvdec decoder\n");
if (vcodec_type & HAVE_AVSDEC)
mpp_log("found avs+ decoder\n");
if (vcodec_type & HAVE_RKVENC)
mpp_log("found rkvenc encoder\n");
if (vcodec_type & HAVE_VEPU2)
mpp_log("found vpu2 encoder\n");
if (vcodec_type & HAVE_VEPU22)
mpp_log("found h265 stand-alone encoder\n");
mpp_log("\n");
mpp_log("start probing decoder device name:\n");
dev = mpp_get_vcodec_dev_name(MPP_CTX_DEC, MPP_VIDEO_CodingAVC);
mpp_log("H.264 decoder: %s\n", dev);
dev = mpp_get_vcodec_dev_name(MPP_CTX_DEC, MPP_VIDEO_CodingHEVC);
mpp_log("H.265 decoder: %s\n", dev);
dev = mpp_get_vcodec_dev_name(MPP_CTX_DEC, MPP_VIDEO_CodingMJPEG);
mpp_log("MJPEG decoder: %s\n", dev);
dev = mpp_get_vcodec_dev_name(MPP_CTX_DEC, MPP_VIDEO_CodingVP9);
mpp_log("VP9 decoder: %s\n", dev);
dev = mpp_get_vcodec_dev_name(MPP_CTX_DEC, MPP_VIDEO_CodingAVS);
mpp_log("avs decoder: %s\n", dev);
mpp_log("\n");
mpp_log("start probing encoder device name:\n");
dev = mpp_get_vcodec_dev_name(MPP_CTX_ENC, MPP_VIDEO_CodingAVC);
mpp_log("H.264 encoder: %s\n", dev);
dev = mpp_get_vcodec_dev_name(MPP_CTX_ENC, MPP_VIDEO_CodingHEVC);
mpp_log("H.265 encoder: %s\n", dev);
dev = mpp_get_vcodec_dev_name(MPP_CTX_ENC, MPP_VIDEO_CodingMJPEG);
mpp_log("MJPEG encoder: %s\n", dev);
mpp_log("mpp platform test done\n");
return 0;
}