1 /*
2  * Copyright 2022 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 <android-base/unique_fd.h>
20 #include <ui/GraphicBuffer.h>
21 
22 namespace android::compositionengine::impl {
23 
24 struct GpuCompositionResult {
25     // Composition ready fence.
26     base::unique_fd fence{};
27 
28     // Buffer to be used for gpu composition. If gpu composition was not successful,
29     // then we want to reuse the buffer instead of dequeuing another buffer.
30     std::shared_ptr<renderengine::ExternalTexture> buffer = nullptr;
31 
bufferAvailableGpuCompositionResult32     bool bufferAvailable() const { return buffer != nullptr; };
33 };
34 
35 } // namespace android::compositionengine::impl
36