blob: cfc71cb9243cee8f839191ba3e379e2a5e77cc10 [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"
John Reckf8441e62017-10-23 13:10:41 -070020#include "SwapBehavior.h"
Stan Iliev768e3932016-07-08 21:34:52 -040021
22#include <SkRect.h>
23#include <utils/RefBase.h>
24
Derek Sollenberger0df62092016-09-27 16:04:42 -040025class GrContext;
26
Stan Iliev768e3932016-07-08 21:34:52 -040027namespace android {
28
29class Surface;
30
31namespace uirenderer {
32
33class DeferredLayerUpdater;
34
35namespace renderthread {
36
Stan Iliev768e3932016-07-08 21:34:52 -040037enum class MakeCurrentResult {
38 AlreadyCurrent,
39 Failed,
40 Succeeded
41};
42
Romain Guy26a2b972017-04-17 09:39:51 -070043enum class ColorMode {
44 Srgb,
45 WideColorGamut,
46 // Hdr
47};
48
Derek Sollenberger0df62092016-09-27 16:04:42 -040049class Frame;
50
Stan Iliev768e3932016-07-08 21:34:52 -040051class IRenderPipeline {
52public:
53 virtual MakeCurrentResult makeCurrent() = 0;
54 virtual Frame getFrame() = 0;
55 virtual bool draw(const Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
56 const FrameBuilder::LightGeometry& lightGeometry,
57 LayerUpdateQueue* layerUpdateQueue,
Romain Guy07ae5052017-06-13 18:25:32 -070058 const Rect& contentDrawBounds, bool opaque, bool wideColorGamut,
Stan Iliev768e3932016-07-08 21:34:52 -040059 const BakedOpRenderer::LightInfo& lightInfo,
60 const std::vector< sp<RenderNode> >& renderNodes,
61 FrameInfoVisualizer* profiler) = 0;
62 virtual bool swapBuffers(const Frame& frame, bool drew, const SkRect& screenDirty,
63 FrameInfo* currentFrameInfo, bool* requireSwap) = 0;
64 virtual bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) = 0;
Derek Sollenberger56ad6ec2016-07-22 12:13:32 -040065 virtual DeferredLayerUpdater* createTextureLayer() = 0;
Romain Guy26a2b972017-04-17 09:39:51 -070066 virtual bool setSurface(Surface* window, SwapBehavior swapBehavior, ColorMode colorMode) = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040067 virtual void onStop() = 0;
68 virtual bool isSurfaceReady() = 0;
69 virtual bool isContextReady() = 0;
70 virtual void onDestroyHardwareResources() = 0;
71 virtual void renderLayers(const FrameBuilder::LightGeometry& lightGeometry,
Romain Guy07ae5052017-06-13 18:25:32 -070072 LayerUpdateQueue* layerUpdateQueue, bool opaque, bool wideColorGamut,
Stan Iliev768e3932016-07-08 21:34:52 -040073 const BakedOpRenderer::LightInfo& lightInfo) = 0;
74 virtual TaskManager* getTaskManager() = 0;
Derek Sollenberger6a21ca52016-09-28 13:39:55 -040075 virtual bool createOrUpdateLayer(RenderNode* node,
Romain Guy07ae5052017-06-13 18:25:32 -070076 const DamageAccumulator& damageAccumulator, bool wideColorGamut) = 0;
Derek Sollenbergerb7d34b62016-11-04 10:46:18 -040077 virtual bool pinImages(std::vector<SkImage*>& mutableImages) = 0;
78 virtual bool pinImages(LsaVector<sk_sp<Bitmap>>& images) = 0;
79 virtual void unpinImages() = 0;
Stan Iliev47fed6ba2017-10-18 17:56:43 -040080 virtual void onPrepareTree() = 0;
Stan Iliev768e3932016-07-08 21:34:52 -040081
82 virtual ~IRenderPipeline() {}
83};
84
85} /* namespace renderthread */
86} /* namespace uirenderer */
87} /* namespace android */