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

Commit 6217a71c authored by Romain Guy's avatar Romain Guy
Browse files

Fix performance issue in Launcher

Bug #3515248

The problem is caused by the fast path when compositing layers on screen.
The fast path draws a single quad using glDrawArrays() whereas the general
path draws an arbitrary mesh using glDrawElements(). It looks like there's
an issue in the driver since glDrawArrays() is significantly slower than
glDrawElements() for a quad (6 vertices!)

This change just gets rid of the fast path.

Change-Id: Ib2361253ec67f44a988270f76c183422f12ce537
parent ad37cd3b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -92,7 +92,11 @@ Region* LayerRenderer::getRegion() {

void LayerRenderer::generateMesh() {
#if RENDER_LAYERS_AS_REGIONS
#if RENDER_LAYERS_RECT_AS_RECT
    if (mLayer->region.isRect() || mLayer->region.isEmpty()) {
#else
    if (mLayer->region.isEmpty()) {
#endif
        if (mLayer->mesh) {
            delete mLayer->mesh;
            delete mLayer->meshIndices;
+6 −0
Original line number Diff line number Diff line
@@ -636,11 +636,13 @@ void OpenGLRenderer::composeLayerRect(Layer* layer, const Rect& rect, bool swap)

void OpenGLRenderer::composeLayerRegion(Layer* layer, const Rect& rect) {
#if RENDER_LAYERS_AS_REGIONS
#if RENDER_LAYERS_RECT_AS_RECT
    if (layer->region.isRect()) {
        composeLayerRect(layer, rect);
        layer->region.clear();
        return;
    }
#endif

    if (!layer->region.isEmpty()) {
        size_t count;
@@ -1646,10 +1648,14 @@ void OpenGLRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* paint) {

#if RENDER_LAYERS_AS_REGIONS
    if (!layer->region.isEmpty()) {
#if RENDER_LAYERS_RECT_AS_RECT
        if (layer->region.isRect()) {
            const Rect r(x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight());
            composeLayerRect(layer, r);
        } else if (layer->mesh) {
#else
        if (layer->mesh) {
#endif
            const float a = alpha / 255.0f;
            const Rect& rect = layer->layer;

+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@

// If turned on, layers drawn inside FBOs are optimized with regions
#define RENDER_LAYERS_AS_REGIONS 1
// If turned on, layers that map to a single rect are drawn as a rect
#define RENDER_LAYERS_RECT_AS_RECT 0

/**
 * Debug level for app developers.