Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
develop
Branches (3)
Tags (6)
develop
h265e_frame_parallel
release
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
release_20171218
develop
Branches (3)
Tags (6)
develop
h265e_frame_parallel
release
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
release_20171218
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
develop
Branches (3)
Tags (6)
develop
h265e_frame_parallel
release
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
release_20171218
mpp
/
osal
/
mpp_runtime.cpp
mpp
/
osal
/
mpp_runtime.cpp
mpp_runtime.cpp 5.99 KB
Copy Edit Raw Blame History
xueman.ruan authored 2023年02月14日 10:03 +08:00 . [hal_jpege]: Add dma heap options for JPEG encode.
/*
* 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_rt"
#include <fcntl.h>
#include <unistd.h>
#include "mpp_env.h"
#include "mpp_log.h"
#include "mpp_common.h"
#include "mpp_runtime.h"
#define MAX_DTS_PATH_LEN 256
static RK_U32 mpp_rt_debug = 0;
static const char *mpp_dts_base = "/proc/device-tree/";
static const char *mpp_vpu_names[] = {
"vpu_service",
"vpu-service",
"vpu",
//"hevc_service",
//"hevc-service",
//"rkvdec",
//"rkvenc",
//"vpu_combo",
};
#define mpp_rt_dbg(fmt, ...) do { if (mpp_rt_debug) mpp_log(fmt, ## __VA_ARGS__); } while (0)
static const char *mpp_vpu_address[] = {
"", /* old kernel */
"@10108000", /* rk3036 */
"@20020000", /* rk322x */
"@30000000", /* rv1108 */
"@ff9a0000", /* rk3288/3366 */
"@ff350000", /* rk322xh/3328 */
"@ff650000", /* rk3399 */
};
class MppRuntimeService
{
private:
// avoid any unwanted function
MppRuntimeService();
~MppRuntimeService() {};
MppRuntimeService(const MppRuntimeService &);
MppRuntimeService &operator=(const MppRuntimeService &);
RK_U32 allocator_valid[MPP_BUFFER_TYPE_BUTT];
public:
static MppRuntimeService *get_instance() {
static MppRuntimeService instance;
return &instance;
}
RK_U32 get_allocator_valid(MppBufferType type);
};
RK_U32 MppRuntimeService::get_allocator_valid(MppBufferType type)
{
MppBufferType buffer_type = (MppBufferType)(type & MPP_BUFFER_TYPE_MASK);
return (buffer_type < MPP_BUFFER_TYPE_BUTT) ? allocator_valid[buffer_type] : (0);
};
MppRuntimeService::MppRuntimeService()
{
mpp_env_get_u32("mpp_rt_debug", &mpp_rt_debug, 0);
allocator_valid[MPP_BUFFER_TYPE_NORMAL] = 1;
allocator_valid[MPP_BUFFER_TYPE_ION] = !access("/dev/ion", F_OK | R_OK | W_OK);
allocator_valid[MPP_BUFFER_TYPE_DRM] = !access("/dev/dri/card0", F_OK | R_OK | W_OK);
allocator_valid[MPP_BUFFER_TYPE_DMA_HEAP] = !access("/dev/dma_heap", F_OK | R_OK);
if (!allocator_valid[MPP_BUFFER_TYPE_ION] &&
!allocator_valid[MPP_BUFFER_TYPE_DRM] &&
!allocator_valid[MPP_BUFFER_TYPE_DMA_HEAP]) {
mpp_err("can NOT found any allocator\n");
return;
}
if (allocator_valid[MPP_BUFFER_TYPE_DMA_HEAP]) {
mpp_rt_dbg("use dma heap allocator\n");
return;
}
if (allocator_valid[MPP_BUFFER_TYPE_ION] && !allocator_valid[MPP_BUFFER_TYPE_DRM]) {
mpp_rt_dbg("use ion allocator\n");
return;
}
if (!allocator_valid[MPP_BUFFER_TYPE_ION] && allocator_valid[MPP_BUFFER_TYPE_DRM]) {
mpp_rt_dbg("use drm allocator\n");
return;
}
if (!access("/dev/mpp_service", F_OK | R_OK | W_OK)) {
allocator_valid[MPP_BUFFER_TYPE_ION] = 0;
mpp_rt_dbg("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] &&
allocator_valid[MPP_BUFFER_TYPE_DRM]) {
/* Detect hardware buffer type is ion or drm */
RK_U32 i, j;
char path[MAX_DTS_PATH_LEN];
RK_U32 path_len = MAX_DTS_PATH_LEN - 1;
RK_U32 dts_path_len = snprintf(path, path_len, "%s", mpp_dts_base);
char *p = path + dts_path_len;
RK_U32 allocator_found = 0;
path_len -= dts_path_len;
for (i = 0; i < MPP_ARRAY_ELEMS(mpp_vpu_names); i++) {
for (j = 0; j < MPP_ARRAY_ELEMS(mpp_vpu_address); j++) {
RK_U32 dev_path_len = snprintf(p, path_len, "%s%s",
mpp_vpu_names[i], mpp_vpu_address[j]);
int f_ok = access(path, F_OK);
if (f_ok == 0) {
snprintf(p + dev_path_len, path_len - dev_path_len, "/%s", "allocator");
f_ok = access(path, F_OK);
if (f_ok == 0) {
RK_S32 val = 0;
FILE *fp = fopen(path, "rb");
if (fp) {
size_t len = fread(&val, 1, 4, fp);
// zero for ion non-zero for drm ->
// zero - disable drm
// non-zero - disable ion
if (len != 4) {
mpp_err("failed to read dts allocator value default 0\n");
val = 0;
}
if (val == 0) {
allocator_valid[MPP_BUFFER_TYPE_DRM] = 0;
mpp_rt_dbg("found ion allocator in dts\n");
} else {
allocator_valid[MPP_BUFFER_TYPE_ION] = 0;
mpp_rt_dbg("found drm allocator in dts\n");
}
allocator_found = 1;
}
}
}
if (allocator_found)
break;
}
if (allocator_found)
break;
}
if (!allocator_found)
mpp_log("Can NOT found allocator in dts, enable both ion and drm\n");
}
}
RK_U32 mpp_rt_allcator_is_valid(MppBufferType type)
{
return MppRuntimeService::get_instance()->get_allocator_valid(type);
}
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

fork from https://github.com/rockchip-linux/mpp.git
Cancel

Releases

No release

Contributors

All

Language(Optional)

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/source-code-sync/mpp.git
git@gitee.com:source-code-sync/mpp.git
source-code-sync
mpp
mpp
develop
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /