blob: 86ebed7b6819d9c0580a77f6cdc15c9e3d7ad8d7 [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();
Naseer Ahmedf48aef62012-07-20 09:05:53 -070053 bool init(RotatorBase* rot);
Naseer Ahmed29a26812012-06-14 00:56:20 -070054 bool close();
55 bool commit();
Naseer Ahmedf48aef62012-07-20 09:05:53 -070056 bool queueBuffer(int fd, uint32_t offset);
Naseer Ahmed29a26812012-06-14 00:56:20 -070057 bool waitForVsync();
58 bool setCrop(const utils::Dim& d);
Naseer Ahmed29a26812012-06-14 00:56:20 -070059 bool setPosition(const utils::Dim& dim);
Naseer Ahmedf48aef62012-07-20 09:05:53 -070060 bool setTransform(const utils::eTransform& param);
Naseer Ahmed29a26812012-06-14 00:56:20 -070061 bool setSource(const utils::PipeArgs& args);
Naseer Ahmed29a26812012-06-14 00:56:20 -070062 utils::eOverlayPipeType getOvPipeType() const;
63 void dump() const;
64private:
65 overlay::GenericPipe<utils::EXTERNAL> mM3d;
66 // Cache the M3D format
67 uint32_t mM3Dfmt;
68};
69
70///////////// M3DPrimary Pipe ////////////////////////////
71/**
72* A specific impl of GenericPipe for 3D.
73* Whenever needed to have a pass through - we do it.
74* If there is a special need for special/diff behavior
75* do it here
76* PANEL is always PRIMARY for this pipe.
77* CHAN = 0,1 it's either Channel 1 or channel 2 needed for
78* 3D crop and position */
79template <int CHAN>
80class M3DPrimaryPipe : utils::NoCopy {
81public:
82 /* Please look at overlayGenPipe.h for info */
83 explicit M3DPrimaryPipe();
84 ~M3DPrimaryPipe();
Naseer Ahmedf48aef62012-07-20 09:05:53 -070085 bool init(RotatorBase* rot);
Naseer Ahmed29a26812012-06-14 00:56:20 -070086 bool close();
87 bool commit();
Naseer Ahmedf48aef62012-07-20 09:05:53 -070088 bool queueBuffer(int fd, uint32_t offset);
Naseer Ahmed29a26812012-06-14 00:56:20 -070089 bool waitForVsync();
90 bool setCrop(const utils::Dim& d);
Naseer Ahmed29a26812012-06-14 00:56:20 -070091 bool setPosition(const utils::Dim& dim);
Naseer Ahmedf48aef62012-07-20 09:05:53 -070092 bool setTransform(const utils::eTransform& param);
Naseer Ahmed29a26812012-06-14 00:56:20 -070093 bool setSource(const utils::PipeArgs& args);
Naseer Ahmed29a26812012-06-14 00:56:20 -070094 utils::eOverlayPipeType getOvPipeType() const;
95 void dump() const;
96private:
97 overlay::GenericPipe<utils::PRIMARY> mM3d;
98 // Cache the M3D format
99 uint32_t mM3Dfmt;
100};
101
102///////////// S3DExt Pipe ////////////////////////////////
103/**
104* A specific impl of GenericPipe for 3D.
105* Whenever needed to have a pass through - we do it.
106* If there is a special need for special/diff behavior
107* do it here.
108* PANEL is always EXTERNAL for this pipe.
109* CHAN = 0,1 it's either Channel 1 or channel 2 needed for
110* 3D crop and position */
111template <int CHAN>
112class S3DExtPipe : utils::NoCopy {
113public:
114 /* Please look at overlayGenPipe.h for info */
115 explicit S3DExtPipe();
116 ~S3DExtPipe();
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700117 bool init(RotatorBase* rot);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700118 bool close();
119 bool commit();
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700120 bool queueBuffer(int fd, uint32_t offset);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700121 bool waitForVsync();
122 bool setCrop(const utils::Dim& d);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700123 bool setPosition(const utils::Dim& dim);
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700124 bool setTransform(const utils::eTransform& param);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700125 bool setSource(const utils::PipeArgs& args);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700126 utils::eOverlayPipeType getOvPipeType() const;
127 void dump() const;
128private:
129 overlay::GenericPipe<utils::EXTERNAL> mS3d;
130 // Cache the 3D format
131 uint32_t mS3Dfmt;
132};
133
134///////////// S3DPrimary Pipe ////////////////////////////
135/**
136* A specific impl of GenericPipe for 3D.
137* Whenever needed to have a pass through - we do it.
138* If there is a special need for special/diff behavior
139* do it here
140* PANEL is always PRIMARY for this pipe.
141* CHAN = 0,1 it's either Channel 1 or channel 2 needed for
142* 3D crop and position */
143template <int CHAN>
144class S3DPrimaryPipe : utils::NoCopy {
145public:
146 /* Please look at overlayGenPipe.h for info */
147 explicit S3DPrimaryPipe();
148 ~S3DPrimaryPipe();
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700149 bool init(RotatorBase* rot);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700150 bool close();
151 bool commit();
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700152 bool queueBuffer(int fd, uint32_t offset);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700153 bool waitForVsync();
154 bool setCrop(const utils::Dim& d);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700155 bool setPosition(const utils::Dim& dim);
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700156 bool setTransform(const utils::eTransform& param);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700157 bool setSource(const utils::PipeArgs& args);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700158 utils::eOverlayPipeType getOvPipeType() const;
159 void dump() const;
160private:
161 /* needed for 3D related IOCTL */
162 MdpCtrl3D mCtrl3D;
163 overlay::GenericPipe<utils::PRIMARY> mS3d;
164 // Cache the 3D format
165 uint32_t mS3Dfmt;
166};
167
168
169
170
171//------------------------Inlines and Templates--------------------------
172
173
174///////////// M3DExt Pipe ////////////////////////////
175template <int CHAN>
176inline M3DExtPipe<CHAN>::M3DExtPipe() : mM3Dfmt(0) {}
177template <int CHAN>
178inline M3DExtPipe<CHAN>::~M3DExtPipe() { close(); }
179template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700180inline bool M3DExtPipe<CHAN>::init(RotatorBase* rot) {
181 ALOGE_IF(DEBUG_OVERLAY, "M3DExtPipe init");
182 if(!mM3d.init(rot)) {
183 ALOGE("3Dpipe failed to init");
Naseer Ahmed29a26812012-06-14 00:56:20 -0700184 return false;
185 }
186 return true;
187}
188template <int CHAN>
189inline bool M3DExtPipe<CHAN>::close() {
190 return mM3d.close();
191}
192template <int CHAN>
193inline bool M3DExtPipe<CHAN>::commit() { return mM3d.commit(); }
194template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700195inline bool M3DExtPipe<CHAN>::queueBuffer(int fd, uint32_t offset) {
196 return mM3d.queueBuffer(fd, offset);
197}
Naseer Ahmed29a26812012-06-14 00:56:20 -0700198template <int CHAN>
199inline bool M3DExtPipe<CHAN>::waitForVsync() {
200 return mM3d.waitForVsync(); }
201template <int CHAN>
202inline bool M3DExtPipe<CHAN>::setCrop(const utils::Dim& d) {
203 utils::Dim _dim;
204 if(!utils::getCropS3D<CHAN>(d, _dim, mM3Dfmt)){
205 ALOGE("M3DExtPipe setCrop failed to getCropS3D");
206 _dim = d;
207 }
208 return mM3d.setCrop(_dim);
209}
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700210
Naseer Ahmed29a26812012-06-14 00:56:20 -0700211template <int CHAN>
212inline bool M3DExtPipe<CHAN>::setPosition(const utils::Dim& d) {
213 utils::Dim _dim;
214 // original setPositionHandleState has getPositionS3D(...,true)
215 // which means format is HAL_3D_OUT_SBS_MASK
216 // HAL_3D_OUT_SBS_MASK is 0x1000 >> 12 == 0x1 as the orig
217 // code suggets
218 utils::Whf _whf(mM3d.getScreenInfo().mFBWidth,
219 mM3d.getScreenInfo().mFBHeight,
220 mM3Dfmt);
221 if(!utils::getPositionS3D<CHAN>(_whf, _dim)) {
222 ALOGE("S3DPrimaryPipe setPosition err in getPositionS3D");
223 _dim = d;
224 }
225 return mM3d.setPosition(_dim);
226}
227template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700228inline bool M3DExtPipe<CHAN>::setTransform(const utils::eTransform& param) {
229 return mM3d.setTransform(param);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700230}
231template <int CHAN>
232inline bool M3DExtPipe<CHAN>::setSource(const utils::PipeArgs& args)
233{
234 // extract 3D fmt
235 mM3Dfmt = utils::format3DInput(utils::getS3DFormat(args.whf.format)) |
236 utils::HAL_3D_OUT_MONOS_MASK;
Naseer Ahmed29a26812012-06-14 00:56:20 -0700237 return mM3d.setSource(args);
238}
239template <int CHAN>
Naseer Ahmed29a26812012-06-14 00:56:20 -0700240inline utils::eOverlayPipeType M3DExtPipe<CHAN>::getOvPipeType() const {
241 return utils::OV_PIPE_TYPE_M3D_EXTERNAL;
242}
243template <int CHAN>
244inline void M3DExtPipe<CHAN>::dump() const {
245 ALOGE("M3DExtPipe Pipe fmt=%d", mM3Dfmt);
246 mM3d.dump();
247}
248
249
250///////////// M3DPrimary Pipe ////////////////////////////
251template <int CHAN>
252inline M3DPrimaryPipe<CHAN>::M3DPrimaryPipe() : mM3Dfmt(0) {}
253template <int CHAN>
254inline M3DPrimaryPipe<CHAN>::~M3DPrimaryPipe() { close(); }
255template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700256inline bool M3DPrimaryPipe<CHAN>::init(RotatorBase* rot) {
257 ALOGE_IF(DEBUG_OVERLAY, "M3DPrimaryPipe init");
258 if(!mM3d.init(rot)) {
259 ALOGE("3Dpipe failed to init");
Naseer Ahmed29a26812012-06-14 00:56:20 -0700260 return false;
261 }
262 return true;
263}
264template <int CHAN>
265inline bool M3DPrimaryPipe<CHAN>::close() {
266 return mM3d.close();
267}
268template <int CHAN>
269inline bool M3DPrimaryPipe<CHAN>::commit() { return mM3d.commit(); }
270template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700271inline bool M3DPrimaryPipe<CHAN>::queueBuffer(int fd, uint32_t offset) {
272 return mM3d.queueBuffer(fd, offset);
273}
Naseer Ahmed29a26812012-06-14 00:56:20 -0700274template <int CHAN>
275inline bool M3DPrimaryPipe<CHAN>::waitForVsync() {
276 return mM3d.waitForVsync(); }
277template <int CHAN>
278inline bool M3DPrimaryPipe<CHAN>::setCrop(const utils::Dim& d) {
279 utils::Dim _dim;
280 if(!utils::getCropS3D<CHAN>(d, _dim, mM3Dfmt)){
281 ALOGE("M3DPrimaryPipe setCrop failed to getCropS3D");
282 _dim = d;
283 }
284 return mM3d.setCrop(_dim);
285}
286template <int CHAN>
Naseer Ahmed29a26812012-06-14 00:56:20 -0700287inline bool M3DPrimaryPipe<CHAN>::setPosition(const utils::Dim& d) {
288 return mM3d.setPosition(d);
289}
290template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700291inline bool M3DPrimaryPipe<CHAN>::setTransform(const utils::eTransform& param) {
292 return mM3d.setTransform(param);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700293}
294template <int CHAN>
295inline bool M3DPrimaryPipe<CHAN>::setSource(const utils::PipeArgs& args)
296{
297 // extract 3D fmt
298 mM3Dfmt = utils::format3DInput(utils::getS3DFormat(args.whf.format)) |
299 utils::HAL_3D_OUT_MONOS_MASK;
Naseer Ahmed29a26812012-06-14 00:56:20 -0700300 return mM3d.setSource(args);
301}
302template <int CHAN>
Naseer Ahmed29a26812012-06-14 00:56:20 -0700303inline utils::eOverlayPipeType M3DPrimaryPipe<CHAN>::getOvPipeType() const {
304 return utils::OV_PIPE_TYPE_M3D_PRIMARY;
305}
306template <int CHAN>
307inline void M3DPrimaryPipe<CHAN>::dump() const {
308 ALOGE("M3DPrimaryPipe Pipe fmt=%d", mM3Dfmt);
309 mM3d.dump();
310}
311
312///////////// S3DExt Pipe ////////////////////////////////
313template <int CHAN>
314inline S3DExtPipe<CHAN>::S3DExtPipe() : mS3Dfmt(0) {}
315template <int CHAN>
316inline S3DExtPipe<CHAN>::~S3DExtPipe() { close(); }
317template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700318inline bool S3DExtPipe<CHAN>::init(RotatorBase* rot) {
319 ALOGE_IF(DEBUG_OVERLAY, "S3DExtPipe init");
320 if(!mS3d.init(rot)) {
321 ALOGE("3Dpipe failed to init");
Naseer Ahmed29a26812012-06-14 00:56:20 -0700322 return false;
323 }
324 return true;
325}
326template <int CHAN>
327inline bool S3DExtPipe<CHAN>::close() {
328 if(!utils::send3DInfoPacket(0)) {
329 ALOGE("S3DExtPipe close failed send3D info packet");
330 }
331 return mS3d.close();
332}
333template <int CHAN>
334inline bool S3DExtPipe<CHAN>::commit() { return mS3d.commit(); }
335template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700336inline bool S3DExtPipe<CHAN>::queueBuffer(int fd, uint32_t offset) {
337 return mS3d.queueBuffer(fd, offset);
338}
Naseer Ahmed29a26812012-06-14 00:56:20 -0700339template <int CHAN>
340inline bool S3DExtPipe<CHAN>::waitForVsync() {
341 return mS3d.waitForVsync(); }
342template <int CHAN>
343inline bool S3DExtPipe<CHAN>::setCrop(const utils::Dim& d) {
344 utils::Dim _dim;
345 if(!utils::getCropS3D<CHAN>(d, _dim, mS3Dfmt)){
346 ALOGE("S3DExtPipe setCrop failed to getCropS3D");
347 _dim = d;
348 }
349 return mS3d.setCrop(_dim);
350}
351template <int CHAN>
Naseer Ahmed29a26812012-06-14 00:56:20 -0700352inline bool S3DExtPipe<CHAN>::setPosition(const utils::Dim& d)
353{
354 utils::Dim _dim;
355 utils::Whf _whf(mS3d.getScreenInfo().mFBWidth,
356 mS3d.getScreenInfo().mFBHeight,
357 mS3Dfmt);
358 if(!utils::getPositionS3D<CHAN>(_whf, _dim)) {
359 ALOGE("S3DExtPipe setPosition err in getPositionS3D");
360 _dim = d;
361 }
362 return mS3d.setPosition(_dim);
363}
364template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700365inline bool S3DExtPipe<CHAN>::setTransform(const utils::eTransform& param) {
366 return mS3d.setTransform(param);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700367}
368template <int CHAN>
369inline bool S3DExtPipe<CHAN>::setSource(const utils::PipeArgs& args) {
370 mS3Dfmt = utils::getS3DFormat(args.whf.format);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700371 return mS3d.setSource(args);
372}
373template <int CHAN>
Naseer Ahmed29a26812012-06-14 00:56:20 -0700374inline utils::eOverlayPipeType S3DExtPipe<CHAN>::getOvPipeType() const {
375 return utils::OV_PIPE_TYPE_S3D_EXTERNAL;
376}
377template <int CHAN>
378inline void S3DExtPipe<CHAN>::dump() const {
379 ALOGE("S3DExtPipe Pipe fmt=%d", mS3Dfmt);
380 mS3d.dump();
381}
382
383///////////// S3DPrimary Pipe ////////////////////////////
384template <int CHAN>
385inline S3DPrimaryPipe<CHAN>::S3DPrimaryPipe() : mS3Dfmt(0) {}
386template <int CHAN>
387inline S3DPrimaryPipe<CHAN>::~S3DPrimaryPipe() { close(); }
388template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700389inline bool S3DPrimaryPipe<CHAN>::init(RotatorBase* rot) {
390 ALOGE_IF(DEBUG_OVERLAY, "S3DPrimaryPipe init");
391 if(!mS3d.init(rot)) {
392 ALOGE("3Dpipe failed to init");
Naseer Ahmed29a26812012-06-14 00:56:20 -0700393 return false;
394 }
395 // set the ctrl fd
396 mCtrl3D.setFd(mS3d.getCtrlFd());
397 return true;
398}
399template <int CHAN>
400inline bool S3DPrimaryPipe<CHAN>::close() {
401 if(!utils::enableBarrier(0)) {
402 ALOGE("S3DExtPipe close failed enable barrier");
403 }
404 mCtrl3D.close();
405 return mS3d.close();
406}
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700407
Naseer Ahmed29a26812012-06-14 00:56:20 -0700408template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700409inline bool S3DPrimaryPipe<CHAN>::commit() {
410 uint32_t fmt = mS3Dfmt & utils::OUTPUT_3D_MASK;
411 if(!utils::send3DInfoPacket(fmt)){
412 ALOGE("Error S3DExtPipe start error send3DInfoPacket %d", fmt);
413 return false;
414 }
415 return mS3d.commit();
416}
Naseer Ahmed29a26812012-06-14 00:56:20 -0700417template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700418inline bool S3DPrimaryPipe<CHAN>::queueBuffer(int fd, uint32_t offset) {
419 return mS3d.queueBuffer(fd, offset);
420}
Naseer Ahmed29a26812012-06-14 00:56:20 -0700421template <int CHAN>
422inline bool S3DPrimaryPipe<CHAN>::waitForVsync() {
423 return mS3d.waitForVsync(); }
424template <int CHAN>
425inline bool S3DPrimaryPipe<CHAN>::setCrop(const utils::Dim& d) {
426 utils::Dim _dim;
427 if(!utils::getCropS3D<CHAN>(d, _dim, mS3Dfmt)){
428 ALOGE("S3DPrimaryPipe setCrop failed to getCropS3D");
429 _dim = d;
430 }
431 return mS3d.setCrop(_dim);
432}
433template <int CHAN>
Naseer Ahmed29a26812012-06-14 00:56:20 -0700434inline bool S3DPrimaryPipe<CHAN>::setPosition(const utils::Dim& d)
435{
436 utils::Whf fbwhf(mS3d.getScreenInfo().mFBWidth,
437 mS3d.getScreenInfo().mFBHeight,
438 0 /* fmt dont care*/);
439 mCtrl3D.setWh(fbwhf);
440 if(!mCtrl3D.useVirtualFB()) {
441 ALOGE("Failed to use VFB on %d (non fatal)", utils::FB0);
442 return false;
443 }
444 utils::Dim _dim;
445 // original setPositionHandleState has getPositionS3D(...,true)
446 // which means format is HAL_3D_OUT_SBS_MASK
447 // HAL_3D_OUT_SBS_MASK is 0x1000 >> 12 == 0x1 as the orig
448 // code suggets
449 utils::Whf _whf(d.w, d.h, utils::HAL_3D_OUT_SBS_MASK);
450 if(!utils::getPositionS3D<CHAN>(_whf, _dim)) {
451 ALOGE("S3DPrimaryPipe setPosition err in getPositionS3D");
452 _dim = d;
453 }
454 return mS3d.setPosition(_dim);
455}
456
457/* for S3DPrimaryPipe, we need to have barriers once
458* So the easiest way to achieve it, is to make sure FB0 is having it before
459* setParam is running */
460template <>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700461inline bool S3DPrimaryPipe<utils::OV_PIPE0>::setTransform(
462 const utils::eTransform& param) {
463 uint32_t barrier=0;
464 switch(param) {
465 case utils::OVERLAY_TRANSFORM_ROT_90:
466 case utils::OVERLAY_TRANSFORM_ROT_270:
467 barrier = utils::BARRIER_LAND;
468 break;
469 default:
470 barrier = utils::BARRIER_PORT;
471 break;
Naseer Ahmed29a26812012-06-14 00:56:20 -0700472 }
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700473 if(!utils::enableBarrier(barrier)) {
474 ALOGE("S3DPrimaryPipe setTransform failed to enable barrier");
475 }
476 return mS3d.setTransform(param);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700477}
478
479template <int CHAN>
Naseer Ahmedf48aef62012-07-20 09:05:53 -0700480inline bool S3DPrimaryPipe<CHAN>::setTransform(const utils::eTransform& param) {
481 return mS3d.setTransform(param);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700482}
483template <int CHAN>
484inline bool S3DPrimaryPipe<CHAN>::setSource(const utils::PipeArgs& args)
485{
486 mS3Dfmt = utils::getS3DFormat(args.whf.format);
Naseer Ahmed29a26812012-06-14 00:56:20 -0700487 return mS3d.setSource(args);
488}
489template <int CHAN>
Naseer Ahmed29a26812012-06-14 00:56:20 -0700490inline utils::eOverlayPipeType S3DPrimaryPipe<CHAN>::getOvPipeType() const {
491 return utils::OV_PIPE_TYPE_S3D_PRIMARY;
492}
493template <int CHAN>
494inline void S3DPrimaryPipe<CHAN>::dump() const {
495 ALOGE("S3DPrimaryPipe Pipe fmt=%d", mS3Dfmt);
496 mS3d.dump();
497}
498
499} // overlay
500
501#endif // OVERLAY_M3D_EXT_PIPE_H