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

Commit 08ca2a25 authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Support render-ahead in vulkan" into qt-dev

parents 64b51f91 0fa0cbca
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@
#include "Properties.h"
#include "Debug.h"
#include "DeviceInfo.h"
#include "SkTraceEventCommon.h"
#include "HWUIProperties.sysprop.h"
#include "SkTraceEventCommon.h"

#include <algorithm>
#include <cstdlib>
@@ -67,7 +67,7 @@ bool Properties::debuggingEnabled = false;
bool Properties::isolatedProcess = false;

int Properties::contextPriority = 0;
int Properties::defaultRenderAhead = 0;
uint32_t Properties::defaultRenderAhead = 0;

static int property_get_int(const char* key, int defaultValue) {
    char buf[PROPERTY_VALUE_MAX] = {
@@ -130,12 +130,9 @@ bool Properties::load() {

    enableForceDarkSupport = property_get_bool(PROPERTY_ENABLE_FORCE_DARK, true);

    defaultRenderAhead = std::max(0, std::min(2, property_get_int(PROPERTY_RENDERAHEAD,
            render_ahead().value_or(0))));

    if (defaultRenderAhead && sRenderPipelineType == RenderPipelineType::SkiaVulkan) {
        ALOGW("hwui.render_ahead of %d ignored because pipeline is skiavk", defaultRenderAhead);
    }
    defaultRenderAhead =
            std::max(0u, std::min(2u, static_cast<uint32_t>(property_get_int(
                                              PROPERTY_RENDERAHEAD, render_ahead().value_or(0)))));

    return (prevDebugLayersUpdates != debugLayersUpdates) || (prevDebugOverdraw != debugOverdraw);
}
+1 −1
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ public:

    ANDROID_API static int contextPriority;

    static int defaultRenderAhead;
    static uint32_t defaultRenderAhead;

private:
    static ProfileType sProfileType;
+1 −1
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */

#include "ShaderCache.h"
#include <GrContext.h>
#include <log/log.h>
#include <openssl/sha.h>
#include <algorithm>
@@ -23,7 +24,6 @@
#include "FileBlobCache.h"
#include "Properties.h"
#include "utils/TraceUtils.h"
#include <GrContext.h>

namespace android {
namespace uirenderer {
+18 −2
Original line number Diff line number Diff line
@@ -156,8 +156,23 @@ void SkiaOpenGLPipeline::onStop() {
    }
}

static void setBufferCount(ANativeWindow* window, uint32_t extraBuffers) {
    int query_value;
    int err = window->query(window, NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &query_value);
    if (err != 0 || query_value < 0) {
        ALOGE("window->query failed: %s (%d) value=%d", strerror(-err), err, query_value);
        return;
    }
    auto min_undequeued_buffers = static_cast<uint32_t>(query_value);

    int bufferCount = min_undequeued_buffers + 2 + extraBuffers;
    ALOGD("Setting buffer count to %d, min_undequeued %u, extraBuffers %u",
            bufferCount, min_undequeued_buffers, extraBuffers);
    native_window_set_buffer_count(window, bufferCount);
}

bool SkiaOpenGLPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBehavior,
                                    ColorMode colorMode) {
                                    ColorMode colorMode, uint32_t extraBuffers) {
    if (mEglSurface != EGL_NO_SURFACE) {
        mEglManager.destroySurface(mEglSurface);
        mEglSurface = EGL_NO_SURFACE;
@@ -177,6 +192,7 @@ bool SkiaOpenGLPipeline::setSurface(ANativeWindow* surface, SwapBehavior swapBeh
    if (mEglSurface != EGL_NO_SURFACE) {
        const bool preserveBuffer = (swapBehavior != SwapBehavior::kSwap_discardBuffer);
        mBufferPreserved = mEglManager.setPreserveBuffer(mEglSurface, preserveBuffer);
        setBufferCount(surface, extraBuffers);
        return true;
    }

+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ public:
                     FrameInfo* currentFrameInfo, bool* requireSwap) override;
    DeferredLayerUpdater* createTextureLayer() override;
    bool setSurface(ANativeWindow* surface, renderthread::SwapBehavior swapBehavior,
                    renderthread::ColorMode colorMode) override;
                    renderthread::ColorMode colorMode, uint32_t extraBuffers) override;
    void onStop() override;
    bool isSurfaceReady() override;
    bool isContextReady() override;
Loading