• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  * Copyright (C) 2012, Code Aurora Forum. All rights reserved.
4  *
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
19 
20 #include "hwc_utils.h"
21 #include "overlayUtils.h"
22 
23 #define LIKELY( exp )       (__builtin_expect( (exp) != 0, true  ))
24 #define UNLIKELY( exp )     (__builtin_expect( (exp) != 0, false ))
25 
26 namespace qhwc {
27 namespace ovutils = overlay::utils;
28 
29 //Feature for using overlay to display videos.
30 class VideoOverlay {
31 public:
32     //Sets up members and prepares overlay if conditions are met
33     static bool prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list,
34             int dpy);
35     //Draws layer if this feature is on
36     static bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list,
37             int dpy);
38     //resets values
39     static void reset();
40 private:
41     //Configures overlay for video prim and ext
42     static bool configure(hwc_context_t *ctx, int dpy,
43             hwc_layer_1_t *yuvlayer);
44 
45     //Marks layer flags if this feature is used
46     static void markFlags(hwc_layer_1_t *yuvLayer);
47     //Flags if this feature is on.
48     static bool sIsModeOn[HWC_NUM_DISPLAY_TYPES];
49     static ovutils::eDest sDest[HWC_NUM_DISPLAY_TYPES];
50 };
51 
reset()52 inline void VideoOverlay::reset() {
53     for(uint32_t i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) {
54         sIsModeOn[i] = false;
55         sDest[i] = ovutils::OV_INVALID;
56     }
57 }
58 }; //namespace qhwc
59 
60 #endif //HWC_VIDEO_H
61