enable ohos gpu

Signed-off-by: pengquan1 <pengquan1@huawei.com>
This commit is contained in:
pengquan1 2022-01-18 11:04:42 +08:00
parent 26773aac80
commit afa16a5278
3 changed files with 6 additions and 30 deletions

View File

@ -26,13 +26,6 @@
#include <refbase.h>
#include "surface_type.h"
// gbm.h
extern "C" {
struct gbm_device;
struct gbm_device *gbm_create_device(int32_t fd);
void gbm_device_destroy(struct gbm_device *);
}
using EglCreateImageFunc = PFNEGLCREATEIMAGEKHRPROC;
using EglDestroyImageFunc = PFNEGLDESTROYIMAGEKHRPROC;
using EglImageTargetTexture2DFunc = PFNGLEGLIMAGETARGETTEXTURE2DOESPROC;
@ -79,7 +72,7 @@ private:
thread_local static inline sptr<EglManager> instance_ = nullptr;
bool initFlag_ = false;
int drmFd_ = -1;
struct gbm_device *device_ = nullptr;
void *device_ = nullptr;
EGLDisplay display_;
EGLContext context_;

View File

@ -25,7 +25,6 @@
namespace OHOS {
namespace {
constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, 0, "EglManager" };
constexpr const char *GBM_DEVICE_PATH = "/dev/dri/card0";
constexpr int32_t EGL_CONTEXT_CLIENT_VERSION_NUM = 2;
constexpr char CHARACTER_WHITESPACE = ' ';
constexpr const char *CHARACTER_STRING_WHITESPACE = " ";
@ -101,19 +100,7 @@ GSError EglManager::Init(EGLContext context)
GSError EglManager::GbmInit()
{
ScopedBytrace func(__func__);
drmFd_ = open(GBM_DEVICE_PATH, O_RDWR);
if (drmFd_ < 0) {
BLOGE("Failed to open drm render node.");
return GSERROR_INTERNEL;
}
device_ = gbm_create_device(drmFd_);
if (device_ == nullptr) {
BLOGE("Failed to create gbm device.");
return GSERROR_INTERNEL;
}
device_ = EGL_DEFAULT_DISPLAY;
return GSERROR_OK;
}
@ -333,10 +320,6 @@ void EglManager::Deinit()
{
initFlag_ = false;
if (device_) {
gbm_device_destroy(device_);
}
if (drmFd_ >= 0) {
close(drmFd_);
}

View File

@ -16,16 +16,16 @@ import("//build/ohos.gni")
import("//build/ohos_var.gni")
if ("${product_name}" == "rk3566" || "${product_name}" == "rk3568" ||
"${product_name}" == "Hi3516DV300") {
"${product_name}" == "Hi3516DV300" || "${product_name}" == "ohos-arm64") {
gpu_defines = [ "ACE_DISABLE_GL" ]
ace_enable_gpu = false # temporary gpu
} else {
gpu_defines = [ "ACE_DISABLE_GL" ]
ace_enable_gpu = false
gpu_defines = [ "ACE_ENABLE_GL" ]
ace_enable_gpu = true
}
if (ace_enable_gpu) {
libgl = [ "//device/hihope/hardware/gpu:mali-bifrost-g52-g2p0-wayland" ]
libgl = [ "//device/hisilicon/hardware/gpu:gpu_libs" ]
} else {
libgl = []
}