blob: 708eb6f9c60c77868dd18bc10570254697f6e6ec [file] [log] [blame]
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
Saurabh Shah56f610d2012-08-07 15:27:06 -07003 * Copyright (C) 2012, The Linux Foundation. All rights reserved.
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -07004 *
5 * Not a Contribution, Apache license notifications and license are
6 * retained for attribution purposes only.
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
Naseer Ahmed758bfc52012-11-28 17:02:08 -050020#ifndef HWC_FBUPDATE_H
21#define HWC_FBUPDATE_H
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070022#include "hwc_utils.h"
Naseer Ahmed72cf9762012-07-21 12:17:13 -070023#include "overlay.h"
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070024
25#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true ))
26#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false ))
27
28namespace qhwc {
Naseer Ahmed758bfc52012-11-28 17:02:08 -050029namespace ovutils = overlay::utils;
30
31//Framebuffer update
32class FBUpdate {
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070033 public:
34 // Sets up members and prepares overlay if conditions are met
Naseer Ahmed758bfc52012-11-28 17:02:08 -050035 static bool prepare(hwc_context_t *ctx, hwc_layer_1_t *fblayer, int dpy);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070036 // Draws layer if this feature is on
Naseer Ahmed758bfc52012-11-28 17:02:08 -050037 static bool draw(hwc_context_t *ctx, hwc_layer_1_t *fblayer, int dpy);
Saurabh Shah56f610d2012-08-07 15:27:06 -070038 //Reset values
39 static void reset();
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070040 private:
41 //Configures overlay
Naseer Ahmed758bfc52012-11-28 17:02:08 -050042 static bool configure(hwc_context_t *ctx, hwc_layer_1_t *fblayer,
43 int dpy);
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070044 //Flags if this feature is on.
Naseer Ahmed758bfc52012-11-28 17:02:08 -050045 static bool sModeOn[HWC_NUM_DISPLAY_TYPES];
46 static ovutils::eDest sDest[HWC_NUM_DISPLAY_TYPES];
Naseer Ahmed0c8b7b52012-07-20 09:06:13 -070047};
48
49}; //namespace qhwc
50
Naseer Ahmed758bfc52012-11-28 17:02:08 -050051#endif //HWC_FBUPDATE_H