mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 17:46:50 +08:00
[allocator]: Use auto detect on Android and Linux
There is case that Android 7.1+3.10 kernel without drm and also Android 7.1+4.4 kernel with both drm and ion. Use the runtime function to support both of them. This patch needs more test. Change-Id: I53f0a30abf057f8e0e6e122e09782896d4789168 Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "allocator_std.h"
|
||||
#include "allocator_ion.h"
|
||||
#include "allocator_drm.h"
|
||||
#include "mpp_runtime.h"
|
||||
|
||||
MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
|
||||
{
|
||||
@@ -27,28 +28,26 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
|
||||
case MPP_BUFFER_TYPE_NORMAL :
|
||||
case MPP_BUFFER_TYPE_V4L2 : {
|
||||
*api = allocator_std;
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
case MPP_BUFFER_TYPE_ION : {
|
||||
#ifdef HAVE_DRM
|
||||
*api = allocator_drm;
|
||||
#else
|
||||
*api = allocator_ion;
|
||||
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
|
||||
#if HAVE_DRM
|
||||
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
allocator_std;
|
||||
} break;
|
||||
case MPP_BUFFER_TYPE_DRM : {
|
||||
#ifdef HAVE_DRM
|
||||
*api = allocator_drm;
|
||||
#if HAVE_DRM
|
||||
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
|
||||
#else
|
||||
*api = allocator_std;
|
||||
* api =
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
|
||||
allocator_std;
|
||||
} break;
|
||||
default : {
|
||||
ret = MPP_NOK;
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@@ -16,12 +16,11 @@
|
||||
|
||||
#if defined(__gnu_linux__)
|
||||
#include "mpp_log.h"
|
||||
#include "mpp_runtime.h"
|
||||
|
||||
#include "allocator_std.h"
|
||||
#include "allocator_ion.h"
|
||||
#ifdef HAVE_DRM
|
||||
#include "allocator_drm.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Linux only support MPP_BUFFER_TYPE_NORMAL so far
|
||||
@@ -36,26 +35,24 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
|
||||
*api = allocator_std;
|
||||
} break;
|
||||
case MPP_BUFFER_TYPE_ION : {
|
||||
#ifdef RKPLATFORM
|
||||
#ifdef HAVE_DRM
|
||||
*api = allocator_drm;
|
||||
#else
|
||||
*api = allocator_ion;
|
||||
#endif
|
||||
#else
|
||||
*api = allocator_std;
|
||||
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
|
||||
#if HAVE_DRM
|
||||
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
|
||||
#endif
|
||||
allocator_std;
|
||||
} break;
|
||||
case MPP_BUFFER_TYPE_V4L2 : {
|
||||
mpp_err("os_allocator_get Linux MPP_BUFFER_TYPE_V4L2 do not implement yet\n");
|
||||
*api = allocator_std;
|
||||
} break;
|
||||
case MPP_BUFFER_TYPE_DRM : {
|
||||
#ifdef HAVE_DRM
|
||||
*api = allocator_drm;
|
||||
#if HAVE_DRM
|
||||
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
|
||||
#else
|
||||
*api = allocator_std;
|
||||
* api =
|
||||
#endif
|
||||
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
|
||||
allocator_std;
|
||||
} break;
|
||||
default : {
|
||||
ret = MPP_NOK;
|
||||
|
Reference in New Issue
Block a user