Commit | Line | Data |
---|---|---|
5763fb39 T |
1 | #ifndef EXYNOS_LEGACY_HDMI_H |
2 | #define EXYNOS_LEGACY_HDMI_H | |
3 | ||
4 | #include "ExynosHWC.h" | |
5 | #include "ExynosDisplay.h" | |
a4e95a20 EC |
6 | #include <linux/videodev2.h> |
7 | #include <linux/v4l2-dv-timings.h> | |
5763fb39 T |
8 | |
9 | #define NUM_VIRT_OVER_HDMI 5 | |
10 | #define MAX_HDMI_VIDEO_LAYERS 1 | |
11 | ||
12 | #if defined(USE_GRALLOC_FLAG_FOR_HDMI) | |
13 | #define HWC_SKIP_HDMI_RENDERING 0x80000000 | |
14 | #endif | |
15 | ||
16 | #define SUPPORTED_DV_TIMINGS_NUM 28 | |
17 | struct preset_index_mapping { | |
18 | int preset; | |
19 | int dv_timings_index; | |
20 | }; | |
21 | ||
22 | const struct preset_index_mapping preset_index_mappings[SUPPORTED_DV_TIMINGS_NUM] = { | |
23 | {V4L2_DV_480P59_94, 0}, | |
24 | {V4L2_DV_576P50, 1}, | |
25 | {V4L2_DV_720P50, 2}, | |
26 | {V4L2_DV_720P60, 3}, | |
27 | {V4L2_DV_1080I50, 4}, | |
28 | {V4L2_DV_1080I60, 5}, | |
29 | {V4L2_DV_1080P24, 6}, | |
30 | {V4L2_DV_1080P25, 7}, | |
31 | {V4L2_DV_1080P30, 8}, | |
32 | {V4L2_DV_1080P50, 9}, | |
33 | {V4L2_DV_1080P60, 10}, | |
34 | {V4L2_DV_2160P24, 11}, | |
35 | {V4L2_DV_2160P25, 12}, | |
36 | {V4L2_DV_2160P30, 13}, | |
37 | {V4L2_DV_2160P24_1, 14}, | |
38 | {V4L2_DV_720P60_SB_HALF, 15}, | |
39 | {V4L2_DV_720P60_TB, 16}, | |
40 | {V4L2_DV_720P50_SB_HALF, 17}, | |
41 | {V4L2_DV_720P50_TB, 18}, | |
42 | {V4L2_DV_1080P24_FP, 19}, | |
43 | {V4L2_DV_1080P24_SB_HALF, 20}, | |
44 | {V4L2_DV_1080P24_TB, 21}, | |
45 | {V4L2_DV_1080I60_SB_HALF, 22}, | |
46 | {V4L2_DV_1080I50_SB_HALF, 23}, | |
47 | {V4L2_DV_1080P60_SB_HALF, 24}, | |
48 | {V4L2_DV_1080P60_TB, 25}, | |
49 | {V4L2_DV_1080P30_SB_HALF, 26}, | |
50 | {V4L2_DV_1080P30_TB, 27} | |
51 | }; | |
52 | ||
53 | class ExynosExternalDisplay : public ExynosDisplay { | |
54 | public: | |
55 | /* Methods */ | |
56 | ExynosExternalDisplay(struct exynos5_hwc_composer_device_1_t *pdev); | |
57 | ~ExynosExternalDisplay(); | |
58 | ||
59 | void setHdmiStatus(bool status); | |
60 | ||
61 | bool isPresetSupported(unsigned int preset); | |
62 | int getConfig(); | |
63 | int getDisplayConfigs(uint32_t *configs, size_t *numConfigs); | |
64 | int enable(); | |
65 | void disable(); | |
66 | void setPreset(int preset); | |
67 | int convert3DTo2D(int preset); | |
68 | void setHdcpStatus(int status); | |
69 | void setAudioChannel(uint32_t channels); | |
70 | uint32_t getAudioChannel(); | |
71 | int getCecPaddr(); | |
72 | ||
73 | virtual int openHdmi(); | |
74 | virtual void closeHdmi(); | |
75 | virtual int blank(); | |
76 | virtual int prepare(hwc_display_contents_1_t* contents); | |
77 | virtual int set(hwc_display_contents_1_t* contents); | |
78 | void checkGrallocFlags(hwc_display_contents_1_t *contents); | |
79 | int clearDisplay(); | |
80 | ||
81 | /* Fields */ | |
82 | ExynosMPPModule *mMPPs[1]; | |
83 | ||
84 | bool mEnabled; | |
85 | bool mBlanked; | |
86 | ||
87 | const void *mLastLayerHandles[NUM_VIRT_OVER_HDMI]; | |
88 | int mVirtualOverlayFlag; | |
89 | ||
90 | exynos5_hwc_post_data_t mPostData; | |
91 | bool mRetry; | |
92 | int mForceOverlayLayerIndex; | |
93 | int mYuvLayers; | |
94 | bool mFbNeeded; | |
95 | size_t mFirstFb; | |
96 | size_t mLastFb; | |
97 | bool mGscUsed; | |
98 | int mCurrentGscIndex; | |
99 | bool mBypassSkipStaticLayer; | |
100 | int mLastOverlayWindowIndex; | |
101 | int mLastOverlayLayerIndex; | |
102 | int mGscLayers; | |
103 | size_t mLastFbWindow; | |
104 | ||
105 | uint32_t mDmaChannelMaxBandwidth[MAX_NUM_HDMI_DMA_CH]; | |
106 | uint32_t mDmaChannelMaxOverlapCount[MAX_NUM_HDMI_DMA_CH]; | |
107 | struct s3c_fb_win_config_data mLastConfigData; | |
108 | exynos5_gsc_map_t mLastGscMap[NUM_HW_WINDOWS]; | |
109 | const void *mLastHandles[NUM_HDMI_WINDOWS]; | |
110 | bool mUseSubtitles; | |
111 | bool mLocalExternalDisplayPause; | |
112 | bool mIsCameraStarted; | |
113 | uint32_t mFBT_Transform; | |
114 | bool mUseProtectedLayer; | |
115 | #if defined(USE_GRALLOC_FLAG_FOR_HDMI) | |
116 | bool mUseScreenshootLayer; | |
117 | #endif | |
118 | ||
119 | protected: | |
120 | void determineYuvOverlay(hwc_display_contents_1_t *contents); | |
121 | void determineSupportedOverlays(hwc_display_contents_1_t *contents); | |
122 | void determineBandwidthSupport(hwc_display_contents_1_t *contents); | |
123 | void assignWindows(hwc_display_contents_1_t *contents); | |
124 | bool assignGscLayer(hwc_layer_1_t &layer, int index, int nextWindow); | |
125 | int postGscM2M(hwc_layer_1_t &layer, struct s3c_fb_win_config *config, int win_map, int index); | |
126 | void configureHandle(private_handle_t *handle, hwc_frect_t &sourceCrop, | |
127 | hwc_rect_t &displayFrame, int32_t blending, int32_t planeAlpha, int fence_fd, s3c_fb_win_config &cfg); | |
128 | void skipStaticLayers(hwc_display_contents_1_t *contents); | |
129 | void handleStaticLayers(hwc_display_contents_1_t *contents, struct s3c_fb_win_config_data &win_data, int tot_ovly_wins); | |
130 | void skipUILayers(hwc_display_contents_1_t *contents); | |
131 | void cleanupGscs(); | |
132 | int getDVTimingsIndex(int preset); | |
133 | ||
134 | //virtual void configureOverlay(hwc_layer_1_t *layer, s3c_fb_win_config &cfg); | |
135 | //virtual bool isOverlaySupported(hwc_layer_1_t &layer, size_t i); | |
136 | //virtual int postFrame(hwc_display_contents_1_t *contents); | |
137 | void configureOverlay(hwc_layer_1_t *layer, s3c_fb_win_config &cfg); | |
138 | bool isOverlaySupported(hwc_layer_1_t &layer, size_t i); | |
139 | int postFrame(hwc_display_contents_1_t *contents); | |
140 | bool checkConfigChanged(struct s3c_fb_win_config_data lastConfigData, struct s3c_fb_win_config_data newConfigData); | |
141 | }; | |
142 | ||
143 | #endif |