From dc317acfe7e89531242947a7f10a9307db04e3b4 Mon Sep 17 00:00:00 2001 From: ShaoboFeng Date: Tue, 11 Jul 2023 20:33:08 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=89=93=E5=BC=80GPU=E4=BD=BF=E8=83=BD?= =?UTF-8?q?=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/configs/system_deps.toml | 2 ++ display_server/ft_build/ds_config.gni | 4 ++-- samples/BUILD.gn | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build/configs/system_deps.toml b/build/configs/system_deps.toml index 95e42a4..f2fbffb 100755 --- a/build/configs/system_deps.toml +++ b/build/configs/system_deps.toml @@ -37,4 +37,6 @@ package_deps = [ "libpng-devel", "libexif-devel", "cjson-devel", + # GPU render + "openssl-devel", ] diff --git a/display_server/ft_build/ds_config.gni b/display_server/ft_build/ds_config.gni index 53c47d0..550530d 100644 --- a/display_server/ft_build/ds_config.gni +++ b/display_server/ft_build/ds_config.gni @@ -13,8 +13,8 @@ import("//config.gni") declare_args() { - graphic_standard_feature_ace_enable_gpu = false - graphic_standard_feature_rs_enable_eglimage = false + graphic_standard_feature_ace_enable_gpu = true + graphic_standard_feature_rs_enable_eglimage = true graphic_standard_feature_rs_enable_uni_render = false graphic_standard_feature_enable_afbc = false } diff --git a/samples/BUILD.gn b/samples/BUILD.gn index a8ff755..e22ba7f 100644 --- a/samples/BUILD.gn +++ b/samples/BUILD.gn @@ -16,7 +16,7 @@ import("//config.gni") declare_args() { - enable_gpu = false + enable_gpu = true } ft_executable("clock") { -- Gitee From a18c287c4e0bca3ae13d94dec61cd0ce816e61d9 Mon Sep 17 00:00:00 2001 From: ShaoboFeng Date: Thu, 13 Jul 2023 15:59:41 +0800 Subject: [PATCH 2/2] adapter for VMWare --- .../src/render_context/render_context.cpp | 21 ++++++++++++++----- .../src/render_context/render_context.h | 6 +++++- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/display_server/rosen/modules/2d_graphics/src/render_context/render_context.cpp b/display_server/rosen/modules/2d_graphics/src/render_context/render_context.cpp index 0b7b2dc..df24d5a 100644 --- a/display_server/rosen/modules/2d_graphics/src/render_context/render_context.cpp +++ b/display_server/rosen/modules/2d_graphics/src/render_context/render_context.cpp @@ -17,9 +17,6 @@ #include #include - -#include "EGL/egl.h" -#include "EGL/eglext.h" #include "rs_trace.h" #include "window.h" @@ -166,13 +163,28 @@ void RenderContext::InitializeEglContext() EGLint count; EGLint config_attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; + EGLConfig configs[GET_MAX_EGL_CONFIG]; - ret = eglChooseConfig(eglDisplay_, config_attribs, &config_, 1, &count); + ret = eglChooseConfig(eglDisplay_, config_attribs, configs, GET_MAX_EGL_CONFIG, &count); if (!(ret && static_cast(count) >= 1)) { LOGE("Failed to eglChooseConfig"); return; } + EGLint value; + for (int i = 0; i< count; i++) { + if (eglGetConfigAttrib(eglDisplay_, configs[i], EGL_NATIVE_VISUAL_ID, &value)) { + if (value == PIXEL_FMT_BGRA_8888) { // get from hal + config_ = configs[i]; + break; + } + } + } + if (config_ == nullptr) { + LOGE("Failed to get egl config, default set first config\n"); + config_ = configs[0]; + } + static const EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, EGL_CONTEXT_CLIENT_VERSION_NUM, EGL_NONE }; eglContext_ = eglCreateContext(eglDisplay_, config_, EGL_NO_CONTEXT, context_attribs); @@ -291,7 +303,6 @@ sk_sp RenderContext::AcquireSurface(int width, int height) GrGLFramebufferInfo framebufferInfo; framebufferInfo.fFBOID = 0; - framebufferInfo.fFormat = GL_RGBA8; SkColorType colorType = kRGBA_8888_SkColorType; diff --git a/display_server/rosen/modules/2d_graphics/src/render_context/render_context.h b/display_server/rosen/modules/2d_graphics/src/render_context/render_context.h index 54561bf..f059247 100644 --- a/display_server/rosen/modules/2d_graphics/src/render_context/render_context.h +++ b/display_server/rosen/modules/2d_graphics/src/render_context/render_context.h @@ -20,6 +20,8 @@ #include "common/rs_rect.h" #include "EGL/egl.h" #include "EGL/eglext.h" +#include "GLES2/gl2.h" +#include "GLES2/gl2ext.h" #include "GLES3/gl32.h" #include "include/core/SkCanvas.h" #include "include/core/SkColorSpace.h" @@ -34,6 +36,8 @@ #endif #define GLES_VERSION 2 +#define GET_MAX_EGL_CONFIG 5 + namespace OHOS { namespace Rosen { class RenderContext { @@ -111,7 +115,7 @@ private: EGLContext eglContext_ = EGL_NO_CONTEXT; EGLSurface eglSurface_ = EGL_NO_SURFACE; EGLSurface pbufferSurface_= EGL_NO_SURFACE; - EGLConfig config_; + EGLConfig config_ = nullptr; #ifndef ROSEN_CROSS_PLATFORM ColorGamut colorSpace_ = ColorGamut::COLOR_GAMUT_SRGB; #endif -- Gitee