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

Commit 833074a2 authored by Peiyong Lin's avatar Peiyong Lin
Browse files

[RenderEngine] Organize RenderEngine directory.

This patch:
1. adds proper namespace renderengine to all RenderEngine code,
   and namespace gl to all GLES related code
2. creates gl/ directory for GLES backend code
3. Reorder include header files, remove unused header files.

BUG: 112585051
Test: Build, flash, run display validation
Change-Id: I81f0b8831213607cde08562958f7c38ddaf4c9e6
parent 38f38f38
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ BufferLayer::BufferLayer(SurfaceFlinger* flinger, const sp<Client>& client, cons
        mRefreshPending(false) {
    ALOGV("Creating Layer %s", name.string());

    mTexture.init(Texture::TEXTURE_EXTERNAL, mTextureName);
    mTexture.init(renderengine::Texture::TEXTURE_EXTERNAL, mTextureName);

    mPremultipliedAlpha = !(flags & ISurfaceComposerClient::eNonPremultiplied);

@@ -608,7 +608,7 @@ void BufferLayer::drawWithOpenGL(const RenderArea& renderArea, bool useIdentityT

    // TODO: we probably want to generate the texture coords with the mesh
    // here we assume that we only have 4 vertices
    Mesh::VertexArray<vec2> texCoords(getBE().mMesh.getTexCoordArray<vec2>());
    renderengine::Mesh::VertexArray<vec2> texCoords(getBE().mMesh.getTexCoordArray<vec2>());
    texCoords[0] = vec2(left, 1.0f - top);
    texCoords[1] = vec2(left, 1.0f - bottom);
    texCoords[2] = vec2(right, 1.0f - bottom);
+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ private:
    bool mBufferLatched; // TODO: Use mActiveBuffer?

    // The texture used to draw the layer in GLES composition mode
    mutable Texture mTexture;
    mutable renderengine::Texture mTexture;

    bool mRefreshPending;
};
+4 −2
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ namespace android {
static const mat4 mtxIdentity;

BufferLayerConsumer::BufferLayerConsumer(const sp<IGraphicBufferConsumer>& bq,
                                         RE::RenderEngine& engine, uint32_t tex, Layer* layer)
                                         renderengine::RenderEngine& engine, uint32_t tex,
                                         Layer* layer)
      : ConsumerBase(bq, false),
        mCurrentCrop(Rect::EMPTY_RECT),
        mCurrentTransform(0),
@@ -592,7 +593,8 @@ void BufferLayerConsumer::dumpLocked(String8& result, const char* prefix) const
    ConsumerBase::dumpLocked(result, prefix);
}

BufferLayerConsumer::Image::Image(sp<GraphicBuffer> graphicBuffer, RE::RenderEngine& engine)
BufferLayerConsumer::Image::Image(sp<GraphicBuffer> graphicBuffer,
                                  renderengine::RenderEngine& engine)
      : mGraphicBuffer(graphicBuffer),
        mImage{engine.createImage()},
        mCreated(false),
+12 −12
Original line number Diff line number Diff line
@@ -37,10 +37,10 @@ class DispSync;
class Layer;
class String8;

namespace RE {
namespace renderengine {
class RenderEngine;
class Image;
} // namespace RE
} // namespace renderengine

/*
 * BufferLayerConsumer consumes buffers of graphics data from a BufferQueue,
@@ -73,7 +73,7 @@ public:
    // BufferLayerConsumer constructs a new BufferLayerConsumer object.  The
    // tex parameter indicates the name of the RenderEngine texture to which
    // images are to be streamed.
    BufferLayerConsumer(const sp<IGraphicBufferConsumer>& bq, RE::RenderEngine& engine,
    BufferLayerConsumer(const sp<IGraphicBufferConsumer>& bq, renderengine::RenderEngine& engine,
                        uint32_t tex, Layer* layer);

    // Sets the contents changed listener. This should be used instead of
@@ -216,19 +216,19 @@ protected:
    status_t bindTextureImageLocked();

private:
    // Image is a utility class for tracking and creating RE::Images. There
    // Image is a utility class for tracking and creating renderengine::Images. There
    // is primarily just one image per slot, but there is also special cases:
    //  - After freeBuffer, we must still keep the current image/buffer
    // Reference counting RE::Images lets us handle all these cases easily while
    // also only creating new RE::Images from buffers when required.
    // Reference counting renderengine::Images lets us handle all these cases easily while
    // also only creating new renderengine::Images from buffers when required.
    class Image : public LightRefBase<Image> {
    public:
        Image(sp<GraphicBuffer> graphicBuffer, RE::RenderEngine& engine);
        Image(sp<GraphicBuffer> graphicBuffer, renderengine::RenderEngine& engine);

        Image(const Image& rhs) = delete;
        Image& operator=(const Image& rhs) = delete;

        // createIfNeeded creates an RE::Image if we haven't created one yet.
        // createIfNeeded creates an renderengine::Image if we haven't created one yet.
        status_t createIfNeeded();

        const sp<GraphicBuffer>& graphicBuffer() { return mGraphicBuffer; }
@@ -236,7 +236,7 @@ private:
            return mGraphicBuffer == nullptr ? nullptr : mGraphicBuffer->handle;
        }

        const RE::Image& image() const { return *mImage; }
        const renderengine::Image& image() const { return *mImage; }

    private:
        // Only allow instantiation using ref counting.
@@ -247,7 +247,7 @@ private:
        sp<GraphicBuffer> mGraphicBuffer;

        // mImage is the image created from mGraphicBuffer.
        std::unique_ptr<RE::Image> mImage;
        std::unique_ptr<renderengine::Image> mImage;
        bool mCreated;
        int32_t mCropWidth;
        int32_t mCropHeight;
@@ -255,7 +255,7 @@ private:

    // freeBufferLocked frees up the given buffer slot. If the slot has been
    // initialized this will release the reference to the GraphicBuffer in
    // that slot and destroy the RE::Image in that slot.  Otherwise it has no
    // that slot and destroy the renderengine::Image in that slot.  Otherwise it has no
    // effect.
    //
    // This method must be called with mMutex locked.
@@ -351,7 +351,7 @@ private:
    // setFilteringEnabled().
    bool mFilteringEnabled;

    RE::RenderEngine& mRE;
    renderengine::RenderEngine& mRE;

    // mTexName is the name of the RenderEngine texture to which streamed
    // images will be bound when bindTexImage is called. It is set at
+1 −1
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ private:
private:
    void onFirstRef() override;

    std::unique_ptr<RE::Image> mTextureImage;
    std::unique_ptr<renderengine::Image> mTextureImage;

    std::array<float, 16> mTransformMatrix;

Loading