Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b491b3ce authored by Peiyong Lin's avatar Peiyong Lin
Browse files

[RenderEngine] Generalize RenderEngine instance creation methods.

Currently we only have GLES20RenderEngine as the only RenderEngine, however, in
the future we may have Vulkan RenderEngine. This patch adds a property to
control the creation of RenderEngine.

BUG: 112585051
Test: Build, flash, run display validation
Change-Id: I546300e8977d079f2760bd182fe53f3170976d56
parent 277482c5
Loading
Loading
Loading
Loading
+8 −14
Original line number Diff line number Diff line
@@ -16,28 +16,22 @@

#include <renderengine/RenderEngine.h>

#include <vector>

#include <cutils/properties.h>
#include <log/log.h>
#include <private/gui/SyncFeatures.h>
#include <renderengine/Image.h>
#include <renderengine/Mesh.h>
#include <renderengine/Surface.h>
#include <ui/Rect.h>
#include <ui/Region.h>
#include <utils/KeyedVector.h>
#include "gl/GLES20RenderEngine.h"
#include "gl/GLExtensions.h"
#include "gl/ProgramCache.h"

using namespace android::renderengine::gl;

extern "C" EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name);

namespace android {
namespace renderengine {

std::unique_ptr<impl::RenderEngine> RenderEngine::create(int hwcFormat, uint32_t featureFlags) {
    char prop[PROPERTY_VALUE_MAX];
    property_get(PROPERTY_DEBUG_RENDERENGINE_BACKEND, prop, "gles");
    if (strcmp(prop, "gles") == 0) {
        ALOGD("RenderEngine GLES Backend");
        return renderengine::gl::GLES20RenderEngine::create(hwcFormat, featureFlags);
    }
    ALOGE("UNKNOWN BackendType: %s, create GLES RenderEngine.", prop);
    return renderengine::gl::GLES20RenderEngine::create(hwcFormat, featureFlags);
}

+4 −4
Original line number Diff line number Diff line
@@ -21,8 +21,6 @@
#include <sys/types.h>
#include <memory>

#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <android-base/unique_fd.h>
#include <math/mat4.h>
#include <renderengine/Framebuffer.h>
@@ -30,7 +28,10 @@
#include <ui/GraphicTypes.h>
#include <ui/Transform.h>

#define EGL_NO_CONFIG ((EGLConfig)0)
/**
 * Allows to set RenderEngine backend to GLES (default) or Vulkan (NOT yet supported).
 */
#define PROPERTY_DEBUG_RENDERENGINE_BACKEND "debug.renderengine.backend"

struct ANativeWindowBuffer;

@@ -95,7 +96,6 @@ public:
    virtual void fillRegionWithColor(const Region& region, uint32_t height, float red, float green,
                                     float blue, float alpha) = 0;

    // common to all GL versions
    virtual void setScissor(uint32_t left, uint32_t bottom, uint32_t right, uint32_t top) = 0;
    virtual void disableScissor() = 0;
    virtual void genTextures(size_t count, uint32_t* names) = 0;
+1 −1

File changed.

Contains only whitespace changes.