Ethan Yonker | 8373cfe | 2017-09-08 06:50:54 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _GRAPHICS_OVERLAY_H_ |
| 18 | #define _GRAPHICS_OVERLAY_H_ |
| 19 | |
| 20 | #include <linux/fb.h> |
Andreas Schneider | 6de5941 | 2017-11-02 17:55:31 +0100 | [diff] [blame] | 21 | #include <linux/ion.h> |
Ethan Yonker | 8373cfe | 2017-09-08 06:50:54 -0500 | [diff] [blame] | 22 | |
| 23 | #include "graphics.h" |
| 24 | #include "minui/minui.h" |
| 25 | |
| 26 | #ifdef MSM_BSP |
| 27 | typedef struct { |
| 28 | unsigned char *mem_buf; |
| 29 | int size; |
| 30 | int ion_fd; |
| 31 | int mem_fd; |
| 32 | struct ion_handle_data handle_data; |
| 33 | } memInfo; |
| 34 | #endif |
| 35 | |
| 36 | class MinuiBackendOverlay : public MinuiBackend { |
| 37 | public: |
| 38 | GRSurface* Init() override; |
| 39 | GRSurface* Flip() override; |
| 40 | void Blank(bool) override; |
| 41 | ~MinuiBackendOverlay() override; |
| 42 | MinuiBackendOverlay(); |
| 43 | |
| 44 | private: |
| 45 | void SetDisplayedFramebuffer(unsigned n); |
| 46 | bool target_has_overlay(); |
| 47 | |
| 48 | #ifdef MSM_BSP |
| 49 | int map_mdp_pixel_format(); |
| 50 | void setDisplaySplit(void); |
| 51 | int getLeftSplit(void); |
| 52 | int getRightSplit(void); |
| 53 | int free_ion_mem(void); |
| 54 | int alloc_ion_mem(unsigned int size); |
| 55 | bool isDisplaySplit(void); |
| 56 | int allocate_overlay(int fd, GRSurface gr_fb[]); |
| 57 | int overlay_display_frame(int fd, void* data, size_t size); |
| 58 | int free_overlay(int fd); |
| 59 | #endif |
| 60 | |
| 61 | GRSurface gr_framebuffer[2]; |
| 62 | bool double_buffered; |
| 63 | GRSurface* gr_draw; |
| 64 | int displayed_buffer; |
| 65 | fb_var_screeninfo vi; |
| 66 | int fb_fd; |
| 67 | bool isMDP5; |
| 68 | int leftSplit; |
| 69 | int rightSplit; |
| 70 | size_t frame_size; |
| 71 | int overlayL_id; |
| 72 | int overlayR_id; |
| 73 | }; |
| 74 | |
| 75 | #endif // _GRAPHICS_OVERLAY_H_ |