diff options
author | Andrew F. Davis | 2019-06-11 16:12:11 -0500 |
---|---|---|
committer | Praneeth Bajjuri | 2019-06-25 17:50:46 -0500 |
commit | abd6b3e209b6ec291983fccb645beef7ac07e826 (patch) | |
tree | bdf89fd052337d36678ad38097084b70909a5a41 | |
parent | 3bddafe376d07090c6d48e567d17cb02719e2fbb (diff) | |
download | hardware-ti-am57x-abd6b3e209b6ec291983fccb645beef7ac07e826.tar.gz hardware-ti-am57x-abd6b3e209b6ec291983fccb645beef7ac07e826.tar.xz hardware-ti-am57x-abd6b3e209b6ec291983fccb645beef7ac07e826.zip |
libhwcomposer: Move video mode selection out of common function
The video mode selection may require tuning based on the display that
is being configured, move selecting the mode out of the configuration
populating function and select it outside. Pass the selected mode into
the function by reference to keep a similar code flow.
Signed-off-by: Andrew F. Davis <afd@ti.com>
-rw-r--r-- | libhwcomposer/hwc.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp index 55530b0..e452d1b 100644 --- a/libhwcomposer/hwc.cpp +++ b/libhwcomposer/hwc.cpp | |||
@@ -148,11 +148,8 @@ static void get_connectors(omap_hwc_device_t* hwc_dev) | |||
148 | } | 148 | } |
149 | 149 | ||
150 | static void setup_display_config(kms::Connector* connector, display_config_t *config, | 150 | static void setup_display_config(kms::Connector* connector, display_config_t *config, |
151 | kms::Videomode *mode) | 151 | kms::Videomode& videomode) |
152 | { | 152 | { |
153 | // FIXME: Allow selecting other modes until HWC 1.4 support is added | ||
154 | kms::Videomode videomode = connector->get_default_mode(); | ||
155 | |||
156 | config->xres = videomode.hdisplay; | 153 | config->xres = videomode.hdisplay; |
157 | config->yres = videomode.vdisplay; | 154 | config->yres = videomode.vdisplay; |
158 | config->fps = videomode.vrefresh; | 155 | config->fps = videomode.vrefresh; |
@@ -164,8 +161,6 @@ static void setup_display_config(kms::Connector* connector, display_config_t *co | |||
164 | 161 | ||
165 | if (!config->ydpi) | 162 | if (!config->ydpi) |
166 | config->ydpi = config->xdpi; | 163 | config->ydpi = config->xdpi; |
167 | |||
168 | *mode = videomode; | ||
169 | } | 164 | } |
170 | 165 | ||
171 | static int init_primary_display(omap_hwc_device_t* hwc_dev) | 166 | static int init_primary_display(omap_hwc_device_t* hwc_dev) |
@@ -175,12 +170,10 @@ static int init_primary_display(omap_hwc_device_t* hwc_dev) | |||
175 | return -EBUSY; | 170 | return -EBUSY; |
176 | } | 171 | } |
177 | 172 | ||
178 | display_config_t config; | ||
179 | kms::Videomode mode; | ||
180 | kms::Connector* connector = hwc_dev->primaryConector; | ||
181 | HWCDisplay* display = new HWCDisplay(DISP_ROLE_PRIMARY); | 173 | HWCDisplay* display = new HWCDisplay(DISP_ROLE_PRIMARY); |
182 | hwc_dev->displays[HWC_DISPLAY_PRIMARY] = display; | 174 | hwc_dev->displays[HWC_DISPLAY_PRIMARY] = display; |
183 | 175 | ||
176 | kms::Connector* connector = hwc_dev->primaryConector; | ||
184 | if (!connector) { | 177 | if (!connector) { |
185 | ALOGW("No connector found for primary display"); | 178 | ALOGW("No connector found for primary display"); |
186 | ALOGW("Using dummy primary display"); | 179 | ALOGW("Using dummy primary display"); |
@@ -205,7 +198,11 @@ static int init_primary_display(omap_hwc_device_t* hwc_dev) | |||
205 | return 0; | 198 | return 0; |
206 | } | 199 | } |
207 | 200 | ||
208 | setup_display_config(connector, &config, &mode); | 201 | // FIXME: Allow selecting other modes until HWC 1.4 support is added |
202 | kms::Videomode mode = connector->get_default_mode(); | ||
203 | |||
204 | display_config_t config; | ||
205 | setup_display_config(connector, &config, mode); | ||
209 | display->configs.push_back(config); | 206 | display->configs.push_back(config); |
210 | 207 | ||
211 | display->disp_link.card = hwc_dev->card; | 208 | display->disp_link.card = hwc_dev->card; |
@@ -228,9 +225,7 @@ static int add_external_hdmi_display(omap_hwc_device_t* hwc_dev) | |||
228 | return 0; | 225 | return 0; |
229 | } | 226 | } |
230 | 227 | ||
231 | kms::Videomode mode; | ||
232 | kms::Connector* connector = hwc_dev->externalConector; | 228 | kms::Connector* connector = hwc_dev->externalConector; |
233 | |||
234 | if (!connector) { | 229 | if (!connector) { |
235 | ALOGE("No connector for external display"); | 230 | ALOGE("No connector for external display"); |
236 | return -1; | 231 | return -1; |
@@ -246,12 +241,14 @@ static int add_external_hdmi_display(omap_hwc_device_t* hwc_dev) | |||
246 | } | 241 | } |
247 | } | 242 | } |
248 | 243 | ||
249 | display_config_t config; | ||
250 | |||
251 | HWCDisplay* display = new HWCDisplay(DISP_ROLE_SECONDARY); | 244 | HWCDisplay* display = new HWCDisplay(DISP_ROLE_SECONDARY); |
252 | hwc_dev->displays[HWC_DISPLAY_EXTERNAL] = display; | 245 | hwc_dev->displays[HWC_DISPLAY_EXTERNAL] = display; |
253 | 246 | ||
254 | setup_display_config(connector, &config, &mode); | 247 | // FIXME: Allow selecting other modes until HWC 1.4 support is added |
248 | kms::Videomode mode = connector->get_default_mode(); | ||
249 | |||
250 | display_config_t config; | ||
251 | setup_display_config(connector, &config, mode); | ||
255 | display->configs.push_back(config); | 252 | display->configs.push_back(config); |
256 | 253 | ||
257 | display->disp_link.card = hwc_dev->card; | 254 | display->disp_link.card = hwc_dev->card; |