• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2014 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 // TODO(b/129481165): remove the #pragma below and fix conversion issues
18 #pragma clang diagnostic push
19 #pragma clang diagnostic ignored "-Wconversion"
20 
21 #include "MonitoredProducer.h"
22 #include "Layer.h"
23 #include "SurfaceFlinger.h"
24 
25 #include "Scheduler/MessageQueue.h"
26 
27 namespace android {
28 
MonitoredProducer(const sp<IGraphicBufferProducer> & producer,const sp<SurfaceFlinger> & flinger,const wp<Layer> & layer)29 MonitoredProducer::MonitoredProducer(const sp<IGraphicBufferProducer>& producer,
30         const sp<SurfaceFlinger>& flinger,
31         const wp<Layer>& layer) :
32     mProducer(producer),
33     mFlinger(flinger),
34     mLayer(layer) {}
35 
~MonitoredProducer()36 MonitoredProducer::~MonitoredProducer() {}
37 
requestBuffer(int slot,sp<GraphicBuffer> * buf)38 status_t MonitoredProducer::requestBuffer(int slot, sp<GraphicBuffer>* buf) {
39     return mProducer->requestBuffer(slot, buf);
40 }
41 
setMaxDequeuedBufferCount(int maxDequeuedBuffers)42 status_t MonitoredProducer::setMaxDequeuedBufferCount(
43         int maxDequeuedBuffers) {
44     return mProducer->setMaxDequeuedBufferCount(maxDequeuedBuffers);
45 }
46 
setAsyncMode(bool async)47 status_t MonitoredProducer::setAsyncMode(bool async) {
48     return mProducer->setAsyncMode(async);
49 }
50 
dequeueBuffer(int * slot,sp<Fence> * fence,uint32_t w,uint32_t h,PixelFormat format,uint64_t usage,uint64_t * outBufferAge,FrameEventHistoryDelta * outTimestamps)51 status_t MonitoredProducer::dequeueBuffer(int* slot, sp<Fence>* fence, uint32_t w, uint32_t h,
52                                           PixelFormat format, uint64_t usage,
53                                           uint64_t* outBufferAge,
54                                           FrameEventHistoryDelta* outTimestamps) {
55     return mProducer->dequeueBuffer(slot, fence, w, h, format, usage, outBufferAge, outTimestamps);
56 }
57 
detachBuffer(int slot)58 status_t MonitoredProducer::detachBuffer(int slot) {
59     return mProducer->detachBuffer(slot);
60 }
61 
detachNextBuffer(sp<GraphicBuffer> * outBuffer,sp<Fence> * outFence)62 status_t MonitoredProducer::detachNextBuffer(sp<GraphicBuffer>* outBuffer,
63         sp<Fence>* outFence) {
64     return mProducer->detachNextBuffer(outBuffer, outFence);
65 }
66 
attachBuffer(int * outSlot,const sp<GraphicBuffer> & buffer)67 status_t MonitoredProducer::attachBuffer(int* outSlot,
68         const sp<GraphicBuffer>& buffer) {
69     return mProducer->attachBuffer(outSlot, buffer);
70 }
71 
queueBuffer(int slot,const QueueBufferInput & input,QueueBufferOutput * output)72 status_t MonitoredProducer::queueBuffer(int slot, const QueueBufferInput& input,
73         QueueBufferOutput* output) {
74     return mProducer->queueBuffer(slot, input, output);
75 }
76 
cancelBuffer(int slot,const sp<Fence> & fence)77 status_t MonitoredProducer::cancelBuffer(int slot, const sp<Fence>& fence) {
78     return mProducer->cancelBuffer(slot, fence);
79 }
80 
query(int what,int * value)81 int MonitoredProducer::query(int what, int* value) {
82     return mProducer->query(what, value);
83 }
84 
connect(const sp<IProducerListener> & listener,int api,bool producerControlledByApp,QueueBufferOutput * output)85 status_t MonitoredProducer::connect(const sp<IProducerListener>& listener,
86         int api, bool producerControlledByApp, QueueBufferOutput* output) {
87     return mProducer->connect(listener, api, producerControlledByApp, output);
88 }
89 
disconnect(int api,DisconnectMode mode)90 status_t MonitoredProducer::disconnect(int api, DisconnectMode mode) {
91     return mProducer->disconnect(api, mode);
92 }
93 
setSidebandStream(const sp<NativeHandle> & stream)94 status_t MonitoredProducer::setSidebandStream(const sp<NativeHandle>& stream) {
95     return mProducer->setSidebandStream(stream);
96 }
97 
allocateBuffers(uint32_t width,uint32_t height,PixelFormat format,uint64_t usage)98 void MonitoredProducer::allocateBuffers(uint32_t width, uint32_t height,
99         PixelFormat format, uint64_t usage) {
100     mProducer->allocateBuffers(width, height, format, usage);
101 }
102 
allowAllocation(bool allow)103 status_t MonitoredProducer::allowAllocation(bool allow) {
104     return mProducer->allowAllocation(allow);
105 }
106 
setGenerationNumber(uint32_t generationNumber)107 status_t MonitoredProducer::setGenerationNumber(uint32_t generationNumber) {
108     return mProducer->setGenerationNumber(generationNumber);
109 }
110 
getConsumerName() const111 String8 MonitoredProducer::getConsumerName() const {
112     return mProducer->getConsumerName();
113 }
114 
setSharedBufferMode(bool sharedBufferMode)115 status_t MonitoredProducer::setSharedBufferMode(bool sharedBufferMode) {
116     return mProducer->setSharedBufferMode(sharedBufferMode);
117 }
118 
setAutoRefresh(bool autoRefresh)119 status_t MonitoredProducer::setAutoRefresh(bool autoRefresh) {
120     return mProducer->setAutoRefresh(autoRefresh);
121 }
122 
setDequeueTimeout(nsecs_t timeout)123 status_t MonitoredProducer::setDequeueTimeout(nsecs_t timeout) {
124     return mProducer->setDequeueTimeout(timeout);
125 }
126 
setLegacyBufferDrop(bool drop)127 status_t MonitoredProducer::setLegacyBufferDrop(bool drop) {
128     return mProducer->setLegacyBufferDrop(drop);
129 }
130 
getLastQueuedBuffer(sp<GraphicBuffer> * outBuffer,sp<Fence> * outFence,float outTransformMatrix[16])131 status_t MonitoredProducer::getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer,
132         sp<Fence>* outFence, float outTransformMatrix[16]) {
133     return mProducer->getLastQueuedBuffer(outBuffer, outFence,
134             outTransformMatrix);
135 }
136 
getLastQueuedBuffer(sp<GraphicBuffer> * outBuffer,sp<Fence> * outFence,Rect * outRect,uint32_t * outTransform)137 status_t MonitoredProducer::getLastQueuedBuffer(sp<GraphicBuffer>* outBuffer, sp<Fence>* outFence,
138                                                 Rect* outRect, uint32_t* outTransform) {
139     return mProducer->getLastQueuedBuffer(outBuffer, outFence, outRect, outTransform);
140 }
141 
getFrameTimestamps(FrameEventHistoryDelta * outDelta)142 void MonitoredProducer::getFrameTimestamps(FrameEventHistoryDelta* outDelta) {
143     mProducer->getFrameTimestamps(outDelta);
144 }
145 
getUniqueId(uint64_t * outId) const146 status_t MonitoredProducer::getUniqueId(uint64_t* outId) const {
147     return mProducer->getUniqueId(outId);
148 }
149 
getConsumerUsage(uint64_t * outUsage) const150 status_t MonitoredProducer::getConsumerUsage(uint64_t* outUsage) const {
151     return mProducer->getConsumerUsage(outUsage);
152 }
153 
setAutoPrerotation(bool autoPrerotation)154 status_t MonitoredProducer::setAutoPrerotation(bool autoPrerotation) {
155     return mProducer->setAutoPrerotation(autoPrerotation);
156 }
157 
onAsBinder()158 IBinder* MonitoredProducer::onAsBinder() {
159     return this;
160 }
161 
getLayer() const162 sp<Layer> MonitoredProducer::getLayer() const {
163     return mLayer.promote();
164 }
165 
166 // ---------------------------------------------------------------------------
167 }; // namespace android
168 
169 // TODO(b/129481165): remove the #pragma below and fix conversion issues
170 #pragma clang diagnostic pop // ignored "-Wconversion"
171