Home | History | Annotate | Download | only in impl
      1 /*
      2  * Copyright 2019 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #pragma once
     18 
     19 #include <memory>
     20 #include <utility>
     21 #include <vector>
     22 
     23 #include <compositionengine/Output.h>
     24 #include <compositionengine/impl/OutputCompositionState.h>
     25 
     26 namespace android::compositionengine {
     27 
     28 class CompositionEngine;
     29 class Layer;
     30 class OutputLayer;
     31 
     32 namespace impl {
     33 
     34 class Output : public virtual compositionengine::Output {
     35 public:
     36     Output(const CompositionEngine&);
     37     ~Output() override;
     38 
     39     bool isValid() const override;
     40 
     41     void setCompositionEnabled(bool) override;
     42     void setProjection(const ui::Transform&, int32_t orientation, const Rect& frame,
     43                        const Rect& viewport, const Rect& scissor, bool needsFiltering) override;
     44     void setBounds(const ui::Size&) override;
     45     void setLayerStackFilter(uint32_t layerStackId, bool isInternal) override;
     46 
     47     void setColorTransform(const mat4&) override;
     48     void setColorMode(ui::ColorMode, ui::Dataspace, ui::RenderIntent) override;
     49 
     50     void dump(std::string&) const override;
     51 
     52     const std::string& getName() const override;
     53     void setName(const std::string&) override;
     54 
     55     compositionengine::DisplayColorProfile* getDisplayColorProfile() const override;
     56     void setDisplayColorProfile(std::unique_ptr<compositionengine::DisplayColorProfile>) override;
     57 
     58     compositionengine::RenderSurface* getRenderSurface() const override;
     59     void setRenderSurface(std::unique_ptr<compositionengine::RenderSurface>) override;
     60 
     61     const OutputCompositionState& getState() const override;
     62     OutputCompositionState& editState() override;
     63 
     64     Region getDirtyRegion(bool repaintEverything) const override;
     65     bool belongsInOutput(uint32_t, bool) const override;
     66 
     67     compositionengine::OutputLayer* getOutputLayerForLayer(
     68             compositionengine::Layer*) const override;
     69     std::unique_ptr<compositionengine::OutputLayer> getOrCreateOutputLayer(
     70             std::optional<DisplayId>, std::shared_ptr<compositionengine::Layer>,
     71             sp<LayerFE>) override;
     72     void setOutputLayersOrderedByZ(OutputLayers&&) override;
     73     const OutputLayers& getOutputLayersOrderedByZ() const override;
     74 
     75     // Testing
     76     void setDisplayColorProfileForTest(std::unique_ptr<compositionengine::DisplayColorProfile>);
     77     void setRenderSurfaceForTest(std::unique_ptr<compositionengine::RenderSurface>);
     78 
     79 protected:
     80     const CompositionEngine& getCompositionEngine() const;
     81     void dumpBase(std::string&) const;
     82 
     83 private:
     84     void dirtyEntireOutput();
     85 
     86     const CompositionEngine& mCompositionEngine;
     87 
     88     std::string mName;
     89 
     90     OutputCompositionState mState;
     91 
     92     std::unique_ptr<compositionengine::DisplayColorProfile> mDisplayColorProfile;
     93     std::unique_ptr<compositionengine::RenderSurface> mRenderSurface;
     94 
     95     OutputLayers mOutputLayersOrderedByZ;
     96 };
     97 
     98 } // namespace impl
     99 } // namespace android::compositionengine
    100