1 /* 2 * Copyright (C) 2010 The Android Open Source Project 3 * Copyright (C) 2012, The Linux Foundation. All rights reserved. 4 * 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 */ 20 #ifndef HWC_FBUPDATE_H 21 #define HWC_FBUPDATE_H 22 #include "hwc_utils.h" 23 #include "overlay.h" 24 25 #define LIKELY( exp ) (__builtin_expect( (exp) != 0, true )) 26 #define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false )) 27 28 namespace qhwc { 29 namespace ovutils = overlay::utils; 30 31 //Framebuffer update 32 class FBUpdate { 33 public: 34 // Sets up members and prepares overlay if conditions are met 35 static bool prepare(hwc_context_t *ctx, hwc_layer_1_t *fblayer, int dpy); 36 // Draws layer if this feature is on 37 static bool draw(hwc_context_t *ctx, hwc_layer_1_t *fblayer, int dpy); 38 //Reset values 39 static void reset(); 40 private: 41 //Configures overlay 42 static bool configure(hwc_context_t *ctx, hwc_layer_1_t *fblayer, 43 int dpy); 44 //Flags if this feature is on. 45 static bool sModeOn[HWC_NUM_DISPLAY_TYPES]; 46 static ovutils::eDest sDest[HWC_NUM_DISPLAY_TYPES]; 47 }; 48 49 }; //namespace qhwc 50 51 #endif //HWC_FBUPDATE_H 52