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_std.h"
|
||||||
#include "allocator_ion.h"
|
#include "allocator_ion.h"
|
||||||
#include "allocator_drm.h"
|
#include "allocator_drm.h"
|
||||||
|
#include "mpp_runtime.h"
|
||||||
|
|
||||||
MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
|
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_NORMAL :
|
||||||
case MPP_BUFFER_TYPE_V4L2 : {
|
case MPP_BUFFER_TYPE_V4L2 : {
|
||||||
*api = allocator_std;
|
*api = allocator_std;
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
case MPP_BUFFER_TYPE_ION : {
|
case MPP_BUFFER_TYPE_ION : {
|
||||||
#ifdef HAVE_DRM
|
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
|
||||||
*api = allocator_drm;
|
#if HAVE_DRM
|
||||||
#else
|
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
|
||||||
*api = allocator_ion;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
allocator_std;
|
||||||
break;
|
} break;
|
||||||
case MPP_BUFFER_TYPE_DRM : {
|
case MPP_BUFFER_TYPE_DRM : {
|
||||||
#ifdef HAVE_DRM
|
#if HAVE_DRM
|
||||||
*api = allocator_drm;
|
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
|
||||||
#else
|
#else
|
||||||
*api = allocator_std;
|
* api =
|
||||||
#endif
|
#endif
|
||||||
}
|
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
|
||||||
break;
|
allocator_std;
|
||||||
|
} break;
|
||||||
default : {
|
default : {
|
||||||
ret = MPP_NOK;
|
ret = MPP_NOK;
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -16,12 +16,11 @@
|
|||||||
|
|
||||||
#if defined(__gnu_linux__)
|
#if defined(__gnu_linux__)
|
||||||
#include "mpp_log.h"
|
#include "mpp_log.h"
|
||||||
|
#include "mpp_runtime.h"
|
||||||
|
|
||||||
#include "allocator_std.h"
|
#include "allocator_std.h"
|
||||||
#include "allocator_ion.h"
|
#include "allocator_ion.h"
|
||||||
#ifdef HAVE_DRM
|
|
||||||
#include "allocator_drm.h"
|
#include "allocator_drm.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Linux only support MPP_BUFFER_TYPE_NORMAL so far
|
* 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;
|
*api = allocator_std;
|
||||||
} break;
|
} break;
|
||||||
case MPP_BUFFER_TYPE_ION : {
|
case MPP_BUFFER_TYPE_ION : {
|
||||||
#ifdef RKPLATFORM
|
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
|
||||||
#ifdef HAVE_DRM
|
#if HAVE_DRM
|
||||||
*api = allocator_drm;
|
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
|
||||||
#else
|
|
||||||
*api = allocator_ion;
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
*api = allocator_std;
|
|
||||||
#endif
|
#endif
|
||||||
|
allocator_std;
|
||||||
} break;
|
} break;
|
||||||
case MPP_BUFFER_TYPE_V4L2 : {
|
case MPP_BUFFER_TYPE_V4L2 : {
|
||||||
mpp_err("os_allocator_get Linux MPP_BUFFER_TYPE_V4L2 do not implement yet\n");
|
mpp_err("os_allocator_get Linux MPP_BUFFER_TYPE_V4L2 do not implement yet\n");
|
||||||
*api = allocator_std;
|
*api = allocator_std;
|
||||||
} break;
|
} break;
|
||||||
case MPP_BUFFER_TYPE_DRM : {
|
case MPP_BUFFER_TYPE_DRM : {
|
||||||
#ifdef HAVE_DRM
|
#if HAVE_DRM
|
||||||
*api = allocator_drm;
|
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
|
||||||
#else
|
#else
|
||||||
*api = allocator_std;
|
* api =
|
||||||
#endif
|
#endif
|
||||||
|
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
|
||||||
|
allocator_std;
|
||||||
} break;
|
} break;
|
||||||
default : {
|
default : {
|
||||||
ret = MPP_NOK;
|
ret = MPP_NOK;
|
||||||
|
Reference in New Issue
Block a user