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

Commit a9aecbe3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Plumb fence from dequeueBuffer into renderengine"

parents b69cd650 6338c9d0
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -789,13 +789,18 @@ bool GLESRenderEngine::useProtectedContext(bool useProtectedContext) {
status_t GLESRenderEngine::drawLayers(const DisplaySettings& display,
status_t GLESRenderEngine::drawLayers(const DisplaySettings& display,
                                      const std::vector<LayerSettings>& layers,
                                      const std::vector<LayerSettings>& layers,
                                      ANativeWindowBuffer* const buffer,
                                      ANativeWindowBuffer* const buffer,
                                      base::unique_fd* drawFence) {
                                      base::unique_fd&& bufferFence, base::unique_fd* drawFence) {
    ATRACE_CALL();
    ATRACE_CALL();
    if (layers.empty()) {
    if (layers.empty()) {
        ALOGV("Drawing empty layer stack");
        ALOGV("Drawing empty layer stack");
        return NO_ERROR;
        return NO_ERROR;
    }
    }


    if (bufferFence.get() >= 0 && !waitFence(std::move(bufferFence))) {
        ATRACE_NAME("Waiting before draw");
        sync_wait(bufferFence.get(), -1);
    }

    BindNativeBufferAsFramebuffer fbo(*this, buffer);
    BindNativeBufferAsFramebuffer fbo(*this, buffer);


    if (fbo.getStatus() != NO_ERROR) {
    if (fbo.getStatus() != NO_ERROR) {
+2 −1
Original line number Original line Diff line number Diff line
@@ -81,7 +81,8 @@ public:
    bool supportsProtectedContent() const override;
    bool supportsProtectedContent() const override;
    bool useProtectedContext(bool useProtectedContext) override;
    bool useProtectedContext(bool useProtectedContext) override;
    status_t drawLayers(const DisplaySettings& display, const std::vector<LayerSettings>& layers,
    status_t drawLayers(const DisplaySettings& display, const std::vector<LayerSettings>& layers,
                        ANativeWindowBuffer* buffer, base::unique_fd* drawFence) override;
                        ANativeWindowBuffer* buffer, base::unique_fd&& bufferFence,
                        base::unique_fd* drawFence) override;


    // internal to RenderEngine
    // internal to RenderEngine
    EGLDisplay getEGLDisplay() const { return mEGLDisplay; }
    EGLDisplay getEGLDisplay() const { return mEGLDisplay; }
+5 −2
Original line number Original line Diff line number Diff line
@@ -167,7 +167,9 @@ public:
    // drawing any layers.
    // drawing any layers.
    // @param layers The layers to draw onto the display, in Z-order.
    // @param layers The layers to draw onto the display, in Z-order.
    // @param buffer The buffer which will be drawn to. This buffer will be
    // @param buffer The buffer which will be drawn to. This buffer will be
    // ready once displayFence fires.
    // ready once drawFence fires.
    // @param bufferFence Fence signalling that the buffer is ready to be drawn
    // to.
    // @param drawFence A pointer to a fence, which will fire when the buffer
    // @param drawFence A pointer to a fence, which will fire when the buffer
    // has been drawn to and is ready to be examined. The fence will be
    // has been drawn to and is ready to be examined. The fence will be
    // initialized by this method. The caller will be responsible for owning the
    // initialized by this method. The caller will be responsible for owning the
@@ -176,7 +178,8 @@ public:
    // now, this always returns NO_ERROR.
    // now, this always returns NO_ERROR.
    virtual status_t drawLayers(const DisplaySettings& display,
    virtual status_t drawLayers(const DisplaySettings& display,
                                const std::vector<LayerSettings>& layers,
                                const std::vector<LayerSettings>& layers,
                                ANativeWindowBuffer* buffer, base::unique_fd* drawFence) = 0;
                                ANativeWindowBuffer* buffer, base::unique_fd&& bufferFence,
                                base::unique_fd* drawFence) = 0;


protected:
protected:
    // Gets a framebuffer to render to. This framebuffer may or may not be
    // Gets a framebuffer to render to. This framebuffer may or may not be
+2 −2
Original line number Original line Diff line number Diff line
@@ -78,9 +78,9 @@ public:
    MOCK_CONST_METHOD0(isProtected, bool());
    MOCK_CONST_METHOD0(isProtected, bool());
    MOCK_CONST_METHOD0(supportsProtectedContent, bool());
    MOCK_CONST_METHOD0(supportsProtectedContent, bool());
    MOCK_METHOD1(useProtectedContext, bool(bool));
    MOCK_METHOD1(useProtectedContext, bool(bool));
    MOCK_METHOD4(drawLayers,
    MOCK_METHOD5(drawLayers,
                 status_t(const DisplaySettings&, const std::vector<LayerSettings>&,
                 status_t(const DisplaySettings&, const std::vector<LayerSettings>&,
                          ANativeWindowBuffer*, base::unique_fd*));
                          ANativeWindowBuffer*, base::unique_fd&&, base::unique_fd*));
};
};


} // namespace mock
} // namespace mock
+2 −1
Original line number Original line Diff line number Diff line
@@ -105,7 +105,8 @@ struct RenderEngineTest : public ::testing::Test {
                           std::vector<renderengine::LayerSettings> layers,
                           std::vector<renderengine::LayerSettings> layers,
                           sp<GraphicBuffer> buffer) {
                           sp<GraphicBuffer> buffer) {
        base::unique_fd fence;
        base::unique_fd fence;
        status_t status = sRE->drawLayers(settings, layers, buffer->getNativeBuffer(), &fence);
        status_t status = sRE->drawLayers(settings, layers, buffer->getNativeBuffer(),
                                          base::unique_fd(), &fence);


        int fd = fence.release();
        int fd = fence.release();
        if (fd >= 0) {
        if (fd >= 0) {
Loading