blob: dce4bf4e3dec81443c58f96bbe1a5d7c5decf108 [file] [log] [blame]
Naseer Ahmed29a26812012-06-14 00:56:20 -07001/*
2* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
3*
4* Redistribution and use in source and binary forms, with or without
5* modification, are permitted provided that the following conditions are
6* met:
7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above
10* copyright notice, this list of conditions and the following
11* disclaimer in the documentation and/or other materials provided
12* with the distribution.
13* * Neither the name of Code Aurora Forum, Inc. nor the names of its
14* contributors may be used to endorse or promote products derived
15* from this software without specific prior written permission.
16*
17* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28*/
29
30#ifndef OVERLAY_M3D_EXT_PIPE_H
31#define OVERLAY_M3D_EXT_PIPE_H
32
33#include "overlayGenPipe.h"
34#include "overlayUtils.h"
35
36namespace overlay {
37
38///////////// M3DExt Pipe ////////////////////////////
39/**
40* A specific impl of GenericPipe for 3D.
41* Whenever needed to have a pass through - we do it.
42* If there is a special need for special/diff behavior
43* do it here
44* PANEL is always EXTERNAL for this pipe.
45* CHAN = 0,1 it's either Channel 1 or channel 2 needed for
46* 3D crop and position */
47template <int CHAN>
48class M3DExtPipe : utils::NoCopy {
49public:
50 /* Please look at overlayGenPipe.h for info */
51 explicit M3DExtPipe();
52 ~M3DExtPipe();
53 bool open(RotatorBase* rot);
54 bool close();
55 bool commit();
56 void setId(int id);
57 void setMemoryId(int id);
58 bool queueBuffer(uint32_t offset);
59 bool dequeueBuffer(void*& buf);
60 bool waitForVsync();
61 bool setCrop(const utils::Dim& d);
62 bool start(const utils::PipeArgs& args);
63 bool setPosition(const utils::Dim& dim);
64 bool setParameter(const utils::Params& param);
65 bool setSource(const utils::PipeArgs& args);
66 const utils::PipeArgs& getArgs() const;
67 utils::eOverlayPipeType getOvPipeType() const;
68 void dump() const;
69private:
70 overlay::GenericPipe<utils::EXTERNAL> mM3d;
71 // Cache the M3D format
72 uint32_t mM3Dfmt;
73};
74
75///////////// M3DPrimary Pipe ////////////////////////////
76/**
77* A specific impl of GenericPipe for 3D.
78* Whenever needed to have a pass through - we do it.
79* If there is a special need for special/diff behavior
80* do it here
81* PANEL is always PRIMARY for this pipe.
82* CHAN = 0,1 it's either Channel 1 or channel 2 needed for
83* 3D crop and position */
84template <int CHAN>
85class M3DPrimaryPipe : utils::NoCopy {
86public:
87 /* Please look at overlayGenPipe.h for info */
88 explicit M3DPrimaryPipe();
89 ~M3DPrimaryPipe();
90 bool open(RotatorBase* rot);
91 bool close();
92 bool commit();
93 void setId(int id);
94 void setMemoryId(int id);
95 bool queueBuffer(uint32_t offset);
96 bool dequeueBuffer(void*& buf);
97 bool waitForVsync();
98 bool setCrop(const utils::Dim& d);
99 bool start(const utils::PipeArgs& args);
100 bool setPosition(const utils::Dim& dim);
101 bool setParameter(const utils::Params& param);
102 bool setSource(const utils::PipeArgs& args);
103 const utils::PipeArgs& getArgs() const;
104 utils::eOverlayPipeType getOvPipeType() const;
105 void dump() const;
106private:
107 overlay::GenericPipe<utils::PRIMARY> mM3d;
108 // Cache the M3D format
109 uint32_t mM3Dfmt;
110};
111
112///////////// S3DExt Pipe ////////////////////////////////
113/**
114* A specific impl of GenericPipe for 3D.
115* Whenever needed to have a pass through - we do it.
116* If there is a special need for special/diff behavior
117* do it here.
118* PANEL is always EXTERNAL for this pipe.
119* CHAN = 0,1 it's either Channel 1 or channel 2 needed for
120* 3D crop and position */
121template <int CHAN>
122class S3DExtPipe : utils::NoCopy {
123public:
124 /* Please look at overlayGenPipe.h for info */
125 explicit S3DExtPipe();
126 ~S3DExtPipe();
127 bool open(RotatorBase* rot);
128 bool close();
129 bool commit();
130 void setId(int id);
131 void setMemoryId(int id);
132 bool queueBuffer(uint32_t offset);
133 bool dequeueBuffer(void*& buf);
134 bool waitForVsync();
135 bool setCrop(const utils::Dim& d);
136 bool start(const utils::PipeArgs& args);
137 bool setPosition(const utils::Dim& dim);
138 bool setParameter(const utils::Params& param);
139 bool setSource(const utils::PipeArgs& args);
140 const utils::PipeArgs& getArgs() const;
141 utils::eOverlayPipeType getOvPipeType() const;
142 void dump() const;
143private:
144 overlay::GenericPipe<utils::EXTERNAL> mS3d;
145 // Cache the 3D format
146 uint32_t mS3Dfmt;
147};
148
149///////////// S3DPrimary Pipe ////////////////////////////
150/**
151* A specific impl of GenericPipe for 3D.
152* Whenever needed to have a pass through - we do it.
153* If there is a special need for special/diff behavior
154* do it here
155* PANEL is always PRIMARY for this pipe.
156* CHAN = 0,1 it's either Channel 1 or channel 2 needed for
157* 3D crop and position */
158template <int CHAN>
159class S3DPrimaryPipe : utils::NoCopy {
160public:
161 /* Please look at overlayGenPipe.h for info */
162 explicit S3DPrimaryPipe();
163 ~S3DPrimaryPipe();
164 bool open(RotatorBase* rot);
165 bool close();
166 bool commit();
167 void setId(int id);
168 void setMemoryId(int id);
169 bool queueBuffer(uint32_t offset);
170 bool dequeueBuffer(void*& buf);
171 bool waitForVsync();
172 bool setCrop(const utils::Dim& d);
173 bool start(const utils::PipeArgs& args);
174 bool setPosition(const utils::Dim& dim);
175 bool setParameter(const utils::Params& param);
176 bool setSource(const utils::PipeArgs& args);
177 const utils::PipeArgs& getArgs() const;
178 utils::eOverlayPipeType getOvPipeType() const;
179 void dump() const;
180private:
181 /* needed for 3D related IOCTL */
182 MdpCtrl3D mCtrl3D;
183 overlay::GenericPipe<utils::PRIMARY> mS3d;
184 // Cache the 3D format
185 uint32_t mS3Dfmt;
186};
187
188
189
190
191//------------------------Inlines and Templates--------------------------
192
193
194///////////// M3DExt Pipe ////////////////////////////
195template <int CHAN>
196inline M3DExtPipe<CHAN>::M3DExtPipe() : mM3Dfmt(0) {}
197template <int CHAN>
198inline M3DExtPipe<CHAN>::~M3DExtPipe() { close(); }
199template <int CHAN>
200inline bool M3DExtPipe<CHAN>::open(RotatorBase* rot) {
201 ALOGE_IF(DEBUG_OVERLAY, "M3DExtPipe open");
202 if(!mM3d.open(rot)) {
203 ALOGE("3Dpipe failed to open");
204 return false;
205 }
206 return true;
207}
208template <int CHAN>
209inline bool M3DExtPipe<CHAN>::close() {
210 return mM3d.close();
211}
212template <int CHAN>
213inline bool M3DExtPipe<CHAN>::commit() { return mM3d.commit(); }
214template <int CHAN>
215inline void M3DExtPipe<CHAN>::setId(int id) { mM3d.setId(id); }
216template <int CHAN>
217inline void M3DExtPipe<CHAN>::setMemoryId(int id) { mM3d.setMemoryId(id); }
218template <int CHAN>
219inline bool M3DExtPipe<CHAN>::queueBuffer(uint32_t offset) {
220 return mM3d.queueBuffer(offset); }
221template <int CHAN>
222inline bool M3DExtPipe<CHAN>::dequeueBuffer(void*& buf) {
223 return mM3d.dequeueBuffer(buf); }
224template <int CHAN>
225inline bool M3DExtPipe<CHAN>::waitForVsync() {
226 return mM3d.waitForVsync(); }
227template <int CHAN>
228inline bool M3DExtPipe<CHAN>::setCrop(const utils::Dim& d) {
229 utils::Dim _dim;
230 if(!utils::getCropS3D<CHAN>(d, _dim, mM3Dfmt)){
231 ALOGE("M3DExtPipe setCrop failed to getCropS3D");
232 _dim = d;
233 }
234 return mM3d.setCrop(_dim);
235}
236template <int CHAN>
237inline bool M3DExtPipe<CHAN>::start(const utils::PipeArgs& args) {
238 if(!mM3d.start(args)) {
239 ALOGE("M3DExtPipe start failed");
240 return false;
241 }
242 return true;
243}
244template <int CHAN>
245inline bool M3DExtPipe<CHAN>::setPosition(const utils::Dim& d) {
246 utils::Dim _dim;
247 // original setPositionHandleState has getPositionS3D(...,true)
248 // which means format is HAL_3D_OUT_SBS_MASK
249 // HAL_3D_OUT_SBS_MASK is 0x1000 >> 12 == 0x1 as the orig
250 // code suggets
251 utils::Whf _whf(mM3d.getScreenInfo().mFBWidth,
252 mM3d.getScreenInfo().mFBHeight,
253 mM3Dfmt);
254 if(!utils::getPositionS3D<CHAN>(_whf, _dim)) {
255 ALOGE("S3DPrimaryPipe setPosition err in getPositionS3D");
256 _dim = d;
257 }
258 return mM3d.setPosition(_dim);
259}
260template <int CHAN>
261inline bool M3DExtPipe<CHAN>::setParameter(const utils::Params& param) {
262 return mM3d.setParameter(param);
263}
264template <int CHAN>
265inline bool M3DExtPipe<CHAN>::setSource(const utils::PipeArgs& args)
266{
267 // extract 3D fmt
268 mM3Dfmt = utils::format3DInput(utils::getS3DFormat(args.whf.format)) |
269 utils::HAL_3D_OUT_MONOS_MASK;
270 if(mM3d.isClosed()){
271 if(!this->start(args)) {
272 ALOGE("M3DExtPipe setSource failed to start");
273 return false;
274 }
275 }
276 return mM3d.setSource(args);
277}
278template <int CHAN>
279inline const utils::PipeArgs& M3DExtPipe<CHAN>::getArgs() const {
280 return mM3d.getArgs();
281}
282template <int CHAN>
283inline utils::eOverlayPipeType M3DExtPipe<CHAN>::getOvPipeType() const {
284 return utils::OV_PIPE_TYPE_M3D_EXTERNAL;
285}
286template <int CHAN>
287inline void M3DExtPipe<CHAN>::dump() const {
288 ALOGE("M3DExtPipe Pipe fmt=%d", mM3Dfmt);
289 mM3d.dump();
290}
291
292
293///////////// M3DPrimary Pipe ////////////////////////////
294template <int CHAN>
295inline M3DPrimaryPipe<CHAN>::M3DPrimaryPipe() : mM3Dfmt(0) {}
296template <int CHAN>
297inline M3DPrimaryPipe<CHAN>::~M3DPrimaryPipe() { close(); }
298template <int CHAN>
299inline bool M3DPrimaryPipe<CHAN>::open(RotatorBase* rot) {
300 ALOGE_IF(DEBUG_OVERLAY, "M3DPrimaryPipe open");
301 if(!mM3d.open(rot)) {
302 ALOGE("3Dpipe failed to open");
303 return false;
304 }
305 return true;
306}
307template <int CHAN>
308inline bool M3DPrimaryPipe<CHAN>::close() {
309 return mM3d.close();
310}
311template <int CHAN>
312inline bool M3DPrimaryPipe<CHAN>::commit() { return mM3d.commit(); }
313template <int CHAN>
314inline void M3DPrimaryPipe<CHAN>::setId(int id) { mM3d.setId(id); }
315template <int CHAN>
316inline void M3DPrimaryPipe<CHAN>::setMemoryId(int id) { mM3d.setMemoryId(id); }
317template <int CHAN>
318inline bool M3DPrimaryPipe<CHAN>::queueBuffer(uint32_t offset) {
319 return mM3d.queueBuffer(offset); }
320template <int CHAN>
321inline bool M3DPrimaryPipe<CHAN>::dequeueBuffer(void*& buf) {
322 return mM3d.dequeueBuffer(buf); }
323template <int CHAN>
324inline bool M3DPrimaryPipe<CHAN>::waitForVsync() {
325 return mM3d.waitForVsync(); }
326template <int CHAN>
327inline bool M3DPrimaryPipe<CHAN>::setCrop(const utils::Dim& d) {
328 utils::Dim _dim;
329 if(!utils::getCropS3D<CHAN>(d, _dim, mM3Dfmt)){
330 ALOGE("M3DPrimaryPipe setCrop failed to getCropS3D");
331 _dim = d;
332 }
333 return mM3d.setCrop(_dim);
334}
335template <int CHAN>
336inline bool M3DPrimaryPipe<CHAN>::start(const utils::PipeArgs& args) {
337 if(!mM3d.start(args)) {
338 ALOGE("M3DPrimaryPipe start failed");
339 return false;
340 }
341 return true;
342}
343template <int CHAN>
344inline bool M3DPrimaryPipe<CHAN>::setPosition(const utils::Dim& d) {
345 return mM3d.setPosition(d);
346}
347template <int CHAN>
348inline bool M3DPrimaryPipe<CHAN>::setParameter(const utils::Params& param) {
349 return mM3d.setParameter(param);
350}
351template <int CHAN>
352inline bool M3DPrimaryPipe<CHAN>::setSource(const utils::PipeArgs& args)
353{
354 // extract 3D fmt
355 mM3Dfmt = utils::format3DInput(utils::getS3DFormat(args.whf.format)) |
356 utils::HAL_3D_OUT_MONOS_MASK;
357 if (mM3d.isClosed()) {
358 if (!this->start(args)) {
359 ALOGE("M3DPrimaryPipe setSource failed to start");
360 return false;
361 }
362 }
363 return mM3d.setSource(args);
364}
365template <int CHAN>
366inline const utils::PipeArgs& M3DPrimaryPipe<CHAN>::getArgs() const {
367 return mM3d.getArgs();
368}
369template <int CHAN>
370inline utils::eOverlayPipeType M3DPrimaryPipe<CHAN>::getOvPipeType() const {
371 return utils::OV_PIPE_TYPE_M3D_PRIMARY;
372}
373template <int CHAN>
374inline void M3DPrimaryPipe<CHAN>::dump() const {
375 ALOGE("M3DPrimaryPipe Pipe fmt=%d", mM3Dfmt);
376 mM3d.dump();
377}
378
379///////////// S3DExt Pipe ////////////////////////////////
380template <int CHAN>
381inline S3DExtPipe<CHAN>::S3DExtPipe() : mS3Dfmt(0) {}
382template <int CHAN>
383inline S3DExtPipe<CHAN>::~S3DExtPipe() { close(); }
384template <int CHAN>
385inline bool S3DExtPipe<CHAN>::open(RotatorBase* rot) {
386 ALOGE_IF(DEBUG_OVERLAY, "S3DExtPipe open");
387 if(!mS3d.open(rot)) {
388 ALOGE("3Dpipe failed to open");
389 return false;
390 }
391 return true;
392}
393template <int CHAN>
394inline bool S3DExtPipe<CHAN>::close() {
395 if(!utils::send3DInfoPacket(0)) {
396 ALOGE("S3DExtPipe close failed send3D info packet");
397 }
398 return mS3d.close();
399}
400template <int CHAN>
401inline bool S3DExtPipe<CHAN>::commit() { return mS3d.commit(); }
402template <int CHAN>
403inline void S3DExtPipe<CHAN>::setId(int id) { mS3d.setId(id); }
404template <int CHAN>
405inline void S3DExtPipe<CHAN>::setMemoryId(int id) { mS3d.setMemoryId(id); }
406template <int CHAN>
407inline bool S3DExtPipe<CHAN>::queueBuffer(uint32_t offset) {
408 //this->dump();
409 return mS3d.queueBuffer(offset); }
410template <int CHAN>
411inline bool S3DExtPipe<CHAN>::dequeueBuffer(void*& buf) {
412 return mS3d.dequeueBuffer(buf); }
413template <int CHAN>
414inline bool S3DExtPipe<CHAN>::waitForVsync() {
415 return mS3d.waitForVsync(); }
416template <int CHAN>
417inline bool S3DExtPipe<CHAN>::setCrop(const utils::Dim& d) {
418 utils::Dim _dim;
419 if(!utils::getCropS3D<CHAN>(d, _dim, mS3Dfmt)){
420 ALOGE("S3DExtPipe setCrop failed to getCropS3D");
421 _dim = d;
422 }
423 return mS3d.setCrop(_dim);
424}
425template <int CHAN>
426inline bool S3DExtPipe<CHAN>::start(const utils::PipeArgs& args) {
427 OVASSERT(mS3Dfmt, "S3DExtPipe mS3Dfmt should not be 0 here");
428 if(!mS3d.start(args)) {
429 ALOGE("S3DExtPipe start failed");
430 return false;
431 }
432 uint32_t fmt = mS3Dfmt & utils::OUTPUT_3D_MASK;
433 if(!utils::send3DInfoPacket(fmt)){
434 ALOGE("Error S3DExtPipe start error send3DInfoPacket %d", fmt);
435 return false;
436 }
437 return true;
438}
439template <int CHAN>
440inline bool S3DExtPipe<CHAN>::setPosition(const utils::Dim& d)
441{
442 utils::Dim _dim;
443 utils::Whf _whf(mS3d.getScreenInfo().mFBWidth,
444 mS3d.getScreenInfo().mFBHeight,
445 mS3Dfmt);
446 if(!utils::getPositionS3D<CHAN>(_whf, _dim)) {
447 ALOGE("S3DExtPipe setPosition err in getPositionS3D");
448 _dim = d;
449 }
450 return mS3d.setPosition(_dim);
451}
452template <int CHAN>
453inline bool S3DExtPipe<CHAN>::setParameter(const utils::Params& param) {
454 return mS3d.setParameter(param);
455}
456template <int CHAN>
457inline bool S3DExtPipe<CHAN>::setSource(const utils::PipeArgs& args) {
458 mS3Dfmt = utils::getS3DFormat(args.whf.format);
459 if(mS3d.isClosed()){
460 if(!this->start(args)) {
461 ALOGE("S3DExtPipe setSource failed to start");
462 return false;
463 }
464 }
465 return mS3d.setSource(args);
466}
467template <int CHAN>
468inline const utils::PipeArgs& S3DExtPipe<CHAN>::getArgs() const {
469 return mS3d.getArgs();
470}
471template <int CHAN>
472inline utils::eOverlayPipeType S3DExtPipe<CHAN>::getOvPipeType() const {
473 return utils::OV_PIPE_TYPE_S3D_EXTERNAL;
474}
475template <int CHAN>
476inline void S3DExtPipe<CHAN>::dump() const {
477 ALOGE("S3DExtPipe Pipe fmt=%d", mS3Dfmt);
478 mS3d.dump();
479}
480
481///////////// S3DPrimary Pipe ////////////////////////////
482template <int CHAN>
483inline S3DPrimaryPipe<CHAN>::S3DPrimaryPipe() : mS3Dfmt(0) {}
484template <int CHAN>
485inline S3DPrimaryPipe<CHAN>::~S3DPrimaryPipe() { close(); }
486template <int CHAN>
487inline bool S3DPrimaryPipe<CHAN>::open(RotatorBase* rot) {
488 ALOGE_IF(DEBUG_OVERLAY, "S3DPrimaryPipe open");
489 if(!mS3d.open(rot)) {
490 ALOGE("3Dpipe failed to open");
491 return false;
492 }
493 // set the ctrl fd
494 mCtrl3D.setFd(mS3d.getCtrlFd());
495 return true;
496}
497template <int CHAN>
498inline bool S3DPrimaryPipe<CHAN>::close() {
499 if(!utils::enableBarrier(0)) {
500 ALOGE("S3DExtPipe close failed enable barrier");
501 }
502 mCtrl3D.close();
503 return mS3d.close();
504}
505template <int CHAN>
506inline bool S3DPrimaryPipe<CHAN>::commit() { return mS3d.commit(); }
507template <int CHAN>
508inline void S3DPrimaryPipe<CHAN>::setId(int id) { mS3d.setId(id); }
509template <int CHAN>
510inline void S3DPrimaryPipe<CHAN>::setMemoryId(int id) { mS3d.setMemoryId(id); }
511template <int CHAN>
512inline bool S3DPrimaryPipe<CHAN>::queueBuffer(uint32_t offset) {
513 return mS3d.queueBuffer(offset); }
514template <int CHAN>
515inline bool S3DPrimaryPipe<CHAN>::dequeueBuffer(void*& buf) {
516 return mS3d.dequeueBuffer(buf); }
517template <int CHAN>
518inline bool S3DPrimaryPipe<CHAN>::waitForVsync() {
519 return mS3d.waitForVsync(); }
520template <int CHAN>
521inline bool S3DPrimaryPipe<CHAN>::setCrop(const utils::Dim& d) {
522 utils::Dim _dim;
523 if(!utils::getCropS3D<CHAN>(d, _dim, mS3Dfmt)){
524 ALOGE("S3DPrimaryPipe setCrop failed to getCropS3D");
525 _dim = d;
526 }
527 return mS3d.setCrop(_dim);
528}
529template <int CHAN>
530inline bool S3DPrimaryPipe<CHAN>::start(const utils::PipeArgs& args) {
531 if(!mS3d.start(args)) {
532 ALOGE("S3DPrimaryPipe start failed");
533 return false;
534 }
535 return true;
536}
537template <int CHAN>
538inline bool S3DPrimaryPipe<CHAN>::setPosition(const utils::Dim& d)
539{
540 utils::Whf fbwhf(mS3d.getScreenInfo().mFBWidth,
541 mS3d.getScreenInfo().mFBHeight,
542 0 /* fmt dont care*/);
543 mCtrl3D.setWh(fbwhf);
544 if(!mCtrl3D.useVirtualFB()) {
545 ALOGE("Failed to use VFB on %d (non fatal)", utils::FB0);
546 return false;
547 }
548 utils::Dim _dim;
549 // original setPositionHandleState has getPositionS3D(...,true)
550 // which means format is HAL_3D_OUT_SBS_MASK
551 // HAL_3D_OUT_SBS_MASK is 0x1000 >> 12 == 0x1 as the orig
552 // code suggets
553 utils::Whf _whf(d.w, d.h, utils::HAL_3D_OUT_SBS_MASK);
554 if(!utils::getPositionS3D<CHAN>(_whf, _dim)) {
555 ALOGE("S3DPrimaryPipe setPosition err in getPositionS3D");
556 _dim = d;
557 }
558 return mS3d.setPosition(_dim);
559}
560
561/* for S3DPrimaryPipe, we need to have barriers once
562* So the easiest way to achieve it, is to make sure FB0 is having it before
563* setParam is running */
564template <>
565inline bool S3DPrimaryPipe<utils::OV_PIPE0>::setParameter(
566 const utils::Params& param) {
567 if(utils::OVERLAY_TRANSFORM == param.param){
568 uint32_t barrier=0;
569 switch(param.value) {
570 case HAL_TRANSFORM_ROT_90:
571 case HAL_TRANSFORM_ROT_270:
572 barrier = utils::BARRIER_LAND;
573 break;
574 default:
575 barrier = utils::BARRIER_PORT;
576 break;
577 }
578 if(!utils::enableBarrier(barrier)) {
579 ALOGE("S3DPrimaryPipe setParameter failed to enable barrier");
580 }
581 }
582 return mS3d.setParameter(param);
583}
584
585template <int CHAN>
586inline bool S3DPrimaryPipe<CHAN>::setParameter(const utils::Params& param) {
587 return mS3d.setParameter(param);
588}
589template <int CHAN>
590inline bool S3DPrimaryPipe<CHAN>::setSource(const utils::PipeArgs& args)
591{
592 mS3Dfmt = utils::getS3DFormat(args.whf.format);
593 if(mS3d.isClosed()){
594 if(!this->start(args)) {
595 ALOGE("S3DPrimaryPipe setSource failed to start");
596 return false;
597 }
598 }
599 return mS3d.setSource(args);
600}
601template <int CHAN>
602inline const utils::PipeArgs& S3DPrimaryPipe<CHAN>::getArgs() const {
603 return mS3d.getArgs();
604}
605template <int CHAN>
606inline utils::eOverlayPipeType S3DPrimaryPipe<CHAN>::getOvPipeType() const {
607 return utils::OV_PIPE_TYPE_S3D_PRIMARY;
608}
609template <int CHAN>
610inline void S3DPrimaryPipe<CHAN>::dump() const {
611 ALOGE("S3DPrimaryPipe Pipe fmt=%d", mS3Dfmt);
612 mS3d.dump();
613}
614
615} // overlay
616
617#endif // OVERLAY_M3D_EXT_PIPE_H