blob: f9b6e384d211e1851338fc5f92c2ce0e40161eac [file] [log] [blame]
Stan Iliev768e3932016-07-08 21:34:52 -04001/*
2 * Copyright (C) 2016 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 "FrameInfoVisualizer.h"
Stan Iliev768e3932016-07-08 21:34:52 -040020
21#include <SkRect.h>
22#include <utils/RefBase.h>
23
Derek Sollenberger0df62092016-09-27 16:04:42 -040024class GrContext;
25
Stan Iliev768e3932016-07-08 21:34:52 -040026namespace android {
27
28class Surface;
29
30namespace uirenderer {
31
32class DeferredLayerUpdater;
33
34namespace renderthread {
35
36enum class SwapBehavior {
37 kSwap_default,
38 kSwap_discardBuffer,
39};
40
41enum class MakeCurrentResult {
42 AlreadyCurrent,
43 Failed,
44 Succeeded
45};
46
Romain Guy26a2b972017-04-17 09:39:51 -070047enum class ColorMode {
48 Srgb,
49 WideColorGamut,
50 // Hdr
51};
52
Derek Sollenberger0df62092016-09-27 16:04:42 -040053class Frame;
54
Stan Iliev768e3932016-07-08 21:34:52 -040055class IRenderPipeline {
56public:
57 virtual MakeCurrentResult makeCurrent() = 0;
58 virtual Frame getFrame() = 0;
59 virtual bool draw(const Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
60 const FrameBuilder::LightGeometry& lightGeometry,
61 LayerUpdateQueue* layerUpdateQueue,
Romain Guy07ae5052017-06-13 18:25:32 -070062 const Rect& contentDrawBounds, bool opaque, bool wideColorGamut,
Stan Iliev768e3932016-07-08 21:34:52 -040063 const BakedOpRenderer::LightInfo& lightInfo,
64 const std::vector< sp<RenderNode> >& renderNodes,
65 FrameInfoVisualizer* profiler) = 0;
66 virtual bool swapBuffers(const Frame& frame, bool drew, const SkRect& screenDirty,
67 FrameInfo* currentFrameInfo, bool* requireSwap) = 0;
68 virtual bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) = 0;
Derek Sollenberger56ad6ec2016-07-22 12:13:32 -040069 virtual DeferredLayerUpdater* createTextureLayer() = 0;
Romain Guy26a2b972017-04-17 09:39:51 -070070 virtual bool setSurface(Surface* window, SwapBehavior swapBehavior, ColorMode colorMode) = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040071 virtual void onStop() = 0;
72 virtual bool isSurfaceReady() = 0;
73 virtual bool isContextReady() = 0;
74 virtual void onDestroyHardwareResources() = 0;
75 virtual void renderLayers(const FrameBuilder::LightGeometry& lightGeometry,
Romain Guy07ae5052017-06-13 18:25:32 -070076 LayerUpdateQueue* layerUpdateQueue, bool opaque, bool wideColorGamut,
Stan Iliev768e3932016-07-08 21:34:52 -040077 const BakedOpRenderer::LightInfo& lightInfo) = 0;
78 virtual TaskManager* getTaskManager() = 0;
Derek Sollenberger6a21ca52016-09-28 13:39:55 -040079 virtual bool createOrUpdateLayer(RenderNode* node,
Romain Guy07ae5052017-06-13 18:25:32 -070080 const DamageAccumulator& damageAccumulator, bool wideColorGamut) = 0;
Derek Sollenbergerb7d34b62016-11-04 10:46:18 -040081 virtual bool pinImages(std::vector<SkImage*>& mutableImages) = 0;
82 virtual bool pinImages(LsaVector<sk_sp<Bitmap>>& images) = 0;
83 virtual void unpinImages() = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040084
85 virtual ~IRenderPipeline() {}
86};
87
88} /* namespace renderthread */
89} /* namespace uirenderer */
90} /* namespace android */