blob: 36120187cc081d39c400afe73e4ff635ff5fc120 [file] [log] [blame]
Naseer Ahmedf48aef62012-07-20 09:05:53 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
Duy Truong73d36df2013-02-09 20:33:23 -08003 * Copyright (C) 2012, The Linux Foundation. All rights reserved.
Naseer Ahmedf48aef62012-07-20 09:05:53 -07004 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#ifndef HWC_VIDEO_H
18#define HWC_VIDEO_H
Naseer Ahmed758bfc52012-11-28 17:02:08 -050019
Naseer Ahmedf48aef62012-07-20 09:05:53 -070020#include "hwc_utils.h"
Naseer Ahmed758bfc52012-11-28 17:02:08 -050021#include "overlayUtils.h"
Naseer Ahmedf48aef62012-07-20 09:05:53 -070022
23#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true ))
24#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false ))
25
26namespace qhwc {
Naseer Ahmed758bfc52012-11-28 17:02:08 -050027namespace ovutils = overlay::utils;
28
Naseer Ahmedf48aef62012-07-20 09:05:53 -070029//Feature for using overlay to display videos.
30class VideoOverlay {
31public:
32 //Sets up members and prepares overlay if conditions are met
Saurabh Shah3e858eb2012-09-17 16:53:21 -070033 static bool prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list,
34 int dpy);
Naseer Ahmedf48aef62012-07-20 09:05:53 -070035 //Draws layer if this feature is on
Saurabh Shah3e858eb2012-09-17 16:53:21 -070036 static bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list,
37 int dpy);
Naseer Ahmed4c588a22012-07-31 19:12:17 -070038 //resets values
39 static void reset();
Naseer Ahmedf48aef62012-07-20 09:05:53 -070040private:
Naseer Ahmed4c588a22012-07-31 19:12:17 -070041 //Configures overlay for video prim and ext
Saurabh Shah3e858eb2012-09-17 16:53:21 -070042 static bool configure(hwc_context_t *ctx, int dpy,
43 hwc_layer_1_t *yuvlayer);
Naseer Ahmed758bfc52012-11-28 17:02:08 -050044
Naseer Ahmedf48aef62012-07-20 09:05:53 -070045 //Marks layer flags if this feature is used
Saurabh Shah3e858eb2012-09-17 16:53:21 -070046 static void markFlags(hwc_layer_1_t *yuvLayer);
Naseer Ahmedf48aef62012-07-20 09:05:53 -070047 //Flags if this feature is on.
Saurabh Shahc4d034f2012-09-27 15:55:15 -070048 static bool sIsModeOn[HWC_NUM_DISPLAY_TYPES];
Naseer Ahmed758bfc52012-11-28 17:02:08 -050049 static ovutils::eDest sDest[HWC_NUM_DISPLAY_TYPES];
Naseer Ahmedf48aef62012-07-20 09:05:53 -070050};
51
Naseer Ahmed4c588a22012-07-31 19:12:17 -070052inline void VideoOverlay::reset() {
Saurabh Shahc4d034f2012-09-27 15:55:15 -070053 for(uint32_t i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
54 sIsModeOn[i] = false;
Naseer Ahmed758bfc52012-11-28 17:02:08 -050055 sDest[i] = ovutils::OV_INVALID;
Saurabh Shahc4d034f2012-09-27 15:55:15 -070056 }
Naseer Ahmed4c588a22012-07-31 19:12:17 -070057}
Naseer Ahmedf48aef62012-07-20 09:05:53 -070058}; //namespace qhwc
59
60#endif //HWC_VIDEO_H