blob: 56f7401df93af1971d9271f9cfef037f1e7581cd [file] [log] [blame]
Ethan Yonker8373cfe2017-09-08 06:50:54 -05001/*
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>
21
22#include "graphics.h"
23#include "minui/minui.h"
24
25#ifdef MSM_BSP
26typedef struct {
27 unsigned char *mem_buf;
28 int size;
29 int ion_fd;
30 int mem_fd;
31 struct ion_handle_data handle_data;
32} memInfo;
33#endif
34
35class MinuiBackendOverlay : public MinuiBackend {
36 public:
37 GRSurface* Init() override;
38 GRSurface* Flip() override;
39 void Blank(bool) override;
40 ~MinuiBackendOverlay() override;
41 MinuiBackendOverlay();
42
43 private:
44 void SetDisplayedFramebuffer(unsigned n);
45 bool target_has_overlay();
46
47#ifdef MSM_BSP
48 int map_mdp_pixel_format();
49 void setDisplaySplit(void);
50 int getLeftSplit(void);
51 int getRightSplit(void);
52 int free_ion_mem(void);
53 int alloc_ion_mem(unsigned int size);
54 bool isDisplaySplit(void);
55 int allocate_overlay(int fd, GRSurface gr_fb[]);
56 int overlay_display_frame(int fd, void* data, size_t size);
57 int free_overlay(int fd);
58#endif
59
60 GRSurface gr_framebuffer[2];
61 bool double_buffered;
62 GRSurface* gr_draw;
63 int displayed_buffer;
64 fb_var_screeninfo vi;
65 int fb_fd;
66 bool isMDP5;
67 int leftSplit;
68 int rightSplit;
69 size_t frame_size;
70 int overlayL_id;
71 int overlayR_id;
72};
73
74#endif // _GRAPHICS_OVERLAY_H_