libhwjpeg: resolve compilation errors
[GitHub/LineageOS/android_hardware_samsung_slsi_exynos.git] / libvpphdmi / ExynosExternalDisplay.h
1 #ifndef EXYNOS_VPP_HDMI_H
2 #define EXYNOS_VPP_HDMI_H
3
4 #include <utils/Vector.h>
5 #include "ExynosHWC.h"
6 #include "ExynosDisplay.h"
7 #include <linux/videodev2.h>
8 #include "videodev2_exynos_hdmi.h"
9
10 #define MAX_HDMI_VIDEO_LAYERS 1
11
12 #define SUPPORTED_DV_TIMINGS_NUM 28
13
14 struct preset_index_mapping {
15 int preset;
16 int dv_timings_index;
17 };
18
19 const struct preset_index_mapping preset_index_mappings[SUPPORTED_DV_TIMINGS_NUM] = {
20 {V4L2_DV_480P59_94, 0},
21 {V4L2_DV_576P50, 1},
22 {V4L2_DV_720P50, 2},
23 {V4L2_DV_720P60, 3},
24 {V4L2_DV_1080I50, 4},
25 {V4L2_DV_1080I60, 5},
26 {V4L2_DV_1080P24, 6},
27 {V4L2_DV_1080P25, 7},
28 {V4L2_DV_1080P30, 8},
29 {V4L2_DV_1080P50, 9},
30 {V4L2_DV_1080P60, 10},
31 {V4L2_DV_2160P24, 11},
32 {V4L2_DV_2160P25, 12},
33 {V4L2_DV_2160P30, 13},
34 {V4L2_DV_2160P24_1, 14},
35 {V4L2_DV_720P60_SB_HALF, 15},
36 {V4L2_DV_720P60_TB, 16},
37 {V4L2_DV_720P50_SB_HALF, 17},
38 {V4L2_DV_720P50_TB, 18},
39 {V4L2_DV_1080P24_FP, 19},
40 {V4L2_DV_1080P24_SB_HALF, 20},
41 {V4L2_DV_1080P24_TB, 21},
42 {V4L2_DV_1080I60_SB_HALF, 22},
43 {V4L2_DV_1080I50_SB_HALF, 23},
44 {V4L2_DV_1080P60_SB_HALF, 24},
45 {V4L2_DV_1080P60_TB, 25},
46 {V4L2_DV_1080P30_SB_HALF, 26},
47 {V4L2_DV_1080P30_TB, 27}
48 };
49
50 enum {
51 HDMI_RESOLUTION_BASE = 0,
52 HDMI_480P_59_94,
53 HDMI_576P_50,
54 HDMI_720P_24,
55 HDMI_720P_25,
56 HDMI_720P_30,
57 HDMI_720P_50,
58 HDMI_720P_59_94,
59 HDMI_720P_60,
60 HDMI_1080I_29_97,
61 HDMI_1080I_30,
62 HDMI_1080I_25,
63 HDMI_1080I_50,
64 HDMI_1080I_60,
65 HDMI_1080P_24,
66 HDMI_1080P_25,
67 HDMI_1080P_30,
68 HDMI_1080P_50,
69 HDMI_1080P_60,
70 HDMI_480P_60,
71 HDMI_1080I_59_94,
72 HDMI_1080P_59_94,
73 HDMI_1080P_23_98,
74 HDMI_2160P_30 = 47,
75 };
76
77 #define S3D_720P_60_BASE 22
78 #define S3D_720P_59_94_BASE 25
79 #define S3D_720P_50_BASE 28
80 #define S3D_1080P_24_BASE 31
81 #define S3D_1080P_23_98_BASE 34
82 #define S3D_1080P_60_BASE 39
83 #define S3D_1080P_30_BASE 42
84
85 class ExynosExternalDisplay : public ExynosDisplay {
86 public:
87 /* Methods */
88 ExynosExternalDisplay(struct exynos5_hwc_composer_device_1_t *pdev);
89 ~ExynosExternalDisplay();
90
91 void setHdmiStatus(bool status);
92
93 bool isPresetSupported(unsigned int preset);
94 int getConfig();
95 int enable();
96 void disable();
97 void setPreset(int preset);
98 int convert3DTo2D(int preset);
99 void setHdcpStatus(int status);
100 void setAudioChannel(uint32_t channels);
101 uint32_t getAudioChannel();
102 int getCecPaddr();
103 bool isIONBufferAllocated() {return mFlagIONBufferAllocated;};
104
105 virtual int openHdmi();
106 virtual void closeHdmi();
107 virtual int blank();
108 virtual int prepare(hwc_display_contents_1_t* contents);
109 virtual int set(hwc_display_contents_1_t* contents);
110 virtual void allocateLayerInfos(hwc_display_contents_1_t* contents);
111 virtual int32_t getDisplayAttributes(const uint32_t attribute, uint32_t config = 0);
112 virtual void determineYuvOverlay(hwc_display_contents_1_t *contents);
113 virtual void determineSupportedOverlays(hwc_display_contents_1_t *contents);
114 virtual int clearDisplay();
115 virtual void freeExtVideoBuffers();
116 virtual int getDisplayConfigs(uint32_t *configs, size_t *numConfigs);
117 virtual int getActiveConfig();
118 virtual int setActiveConfig(int index);
119
120 bool mEnabled;
121 bool mBlanked;
122
123 bool mUseSubtitles;
124 int mReserveMemFd;
125 android::Vector< unsigned int > mConfigurations;
126
127 protected:
128 void skipUILayers(hwc_display_contents_1_t *contents);
129 int getDVTimingsIndex(int preset);
130 virtual void handleStaticLayers(hwc_display_contents_1_t *contents, struct decon_win_config_data &win_data, int tot_ovly_wins);
131 void cleanConfigurations();
132 void dumpConfigurations();
133 virtual void configureHandle(private_handle_t *handle, size_t index, hwc_layer_1_t &layer, int fence_fd, decon_win_config &cfg);
134 virtual int postMPPM2M(hwc_layer_1_t &layer, struct decon_win_config *config, int win_map, int index);
135 virtual int postFrame(hwc_display_contents_1_t *contents);
136 virtual void doPreProcessing(hwc_display_contents_1_t* contents);
137 private:
138 buffer_handle_t mDRMTempBuffer;
139 bool mFlagIONBufferAllocated;
140 void requestIONMemory();
141 void freeIONMemory();
142 bool checkIONBufferPrepared();
143 int configureDRMSkipHandle(decon_win_config &cfg);
144 void setHdmiResolution(int resolution, int s3dMode);
145 };
146
147 #endif