Rev 4126 | Rev 4293 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4126 | Rev 4280 | ||
---|---|---|---|
Line 104... | Line 104... | ||
104 | struct drm_display_mode *mode = NULL, *tmpmode; |
104 | struct drm_display_mode *mode = NULL, *tmpmode; |
105 | struct drm_framebuffer *fb = NULL; |
105 | struct drm_framebuffer *fb = NULL; |
106 | struct drm_crtc *crtc; |
106 | struct drm_crtc *crtc; |
107 | struct drm_encoder *encoder; |
107 | struct drm_encoder *encoder; |
108 | struct drm_mode_set set; |
108 | struct drm_i915_gem_object *fb_obj; |
- | 109 | struct drm_mode_set set; |
|
109 | char *con_name; |
110 | char *con_name; |
110 | char *enc_name; |
111 | char *enc_name; |
111 | unsigned hdisplay, vdisplay; |
112 | unsigned hdisplay, vdisplay; |
112 | int ret; |
113 | int ret; |
113 | 114 | ||
Line 160... | Line 161... | ||
160 | 161 | ||
Line 161... | Line 162... | ||
161 | if (crtc->invert_dimensions) |
162 | if (crtc->invert_dimensions) |
162 | swap(hdisplay, vdisplay); |
163 | swap(hdisplay, vdisplay); |
Line -... | Line 164... | ||
- | 164 | ||
163 | 165 | fb_obj = get_fb_obj(); |
|
Line 164... | Line 166... | ||
164 | fb = fb_helper->fb; |
166 | fb = fb_helper->fb; |
165 | 167 | ||
- | 168 | fb->width = reqmode->width; |
|
166 | fb->width = reqmode->width; |
169 | fb->height = reqmode->height; |
167 | fb->height = reqmode->height; |
170 | |
168 | fb->pitches[0] = ALIGN(reqmode->width * 4, 64); |
- | |
- | 171 | fb->pitches[0] = fb->pitches[1] = fb->pitches[2] = |
|
169 | fb->pitches[1] = ALIGN(reqmode->width * 4, 64); |
172 | fb->pitches[3] = ALIGN(reqmode->width * 4, 512); |
Line 170... | Line 173... | ||
170 | fb->pitches[2] = ALIGN(reqmode->width * 4, 64); |
173 | |
171 | fb->pitches[3] = ALIGN(reqmode->width * 4, 64); |
174 | fb_obj->stride = fb->pitches[0]; |
Line 172... | Line 175... | ||
172 | 175 | ||
173 | fb->bits_per_pixel = 32; |
176 | fb->bits_per_pixel = 32; |
174 | fb->depth = 24; |
177 | fb->depth = 24; |
Line -... | Line 178... | ||
- | 178 | ||
- | 179 | crtc->fb = fb; |
|
175 | 180 | crtc->enabled = true; |
|
176 | crtc->fb = fb; |
181 | os_display->crtc = crtc; |
177 | crtc->enabled = true; |
182 | |
178 | os_display->crtc = crtc; |
183 | i915_gem_object_put_fence(fb_obj); |
179 | 184 | ||
Line 259... | Line 264... | ||
259 | return def_connector; |
264 | return def_connector; |
260 | }; |
265 | }; |
Line 261... | Line 266... | ||
261 | 266 | ||
262 | 267 | ||
263 | int init_display_kms(struct drm_device *dev) |
268 | int init_display_kms(struct drm_device *dev, videomode_t *usermode) |
264 | { |
269 | { |
265 | struct drm_connector *connector; |
270 | struct drm_connector *connector; |
266 | struct drm_connector_helper_funcs *connector_funcs; |
271 | struct drm_connector_helper_funcs *connector_funcs; |
Line 271... | Line 276... | ||
271 | cursor_t *cursor; |
276 | cursor_t *cursor; |
272 | u32_t ifl; |
277 | u32_t ifl; |
273 | int err; |
278 | int err; |
Line -... | Line 279... | ||
- | 279 | ||
- | 280 | ENTER(); |
|
- | 281 | ||
- | 282 | mutex_lock(&dev->mode_config.mutex); |
|
274 | 283 | ||
275 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) |
284 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) |
276 | { |
285 | { |
277 | if( connector->status != connector_status_connected) |
286 | if( connector->status != connector_status_connected) |
Line 287... | Line 296... | ||
287 | } |
296 | } |
288 | connector->encoder = encoder; |
297 | connector->encoder = encoder; |
289 | crtc = encoder->crtc; |
298 | crtc = encoder->crtc; |
290 | 299 | ||
Line 291... | Line 300... | ||
291 | DRM_DEBUG_KMS("CONNECTOR %x ID:%d status:%d ENCODER %x CRTC %x ID:%d\n", |
300 | DRM_DEBUG_KMS("CONNECTOR %p ID:%d status:%d ENCODER %x CRTC %p ID:%d\n", |
292 | connector, connector->base.id, |
301 | connector, connector->base.id, |
293 | connector->status, connector->encoder, |
302 | connector->status, connector->encoder, |
294 | crtc, crtc->base.id ); |
303 | crtc, crtc->base.id ); |
295 | - | ||
296 | break; |
304 | break; |
297 | }; |
305 | }; |
Line 298... | Line 306... | ||
298 | 306 | ||
299 | if(connector == NULL) |
307 | if(connector == NULL) |
300 | { |
308 | { |
- | 309 | DRM_DEBUG_KMS("No active connectors!\n"); |
|
301 | DRM_ERROR("No active connectors!\n"); |
310 | mutex_unlock(&dev->mode_config.mutex); |
302 | return -1; |
311 | return -1; |
Line -... | Line 312... | ||
- | 312 | }; |
|
- | 313 | ||
303 | }; |
314 | dbgprintf("CRTC %p\n", crtc); |
304 | 315 | ||
305 | if(crtc == NULL) |
316 | if(crtc == NULL) |
306 | { |
317 | { |
Line 307... | Line 318... | ||
307 | struct drm_crtc *tmp_crtc; |
318 | struct drm_crtc *tmp_crtc; |
308 | int crtc_mask = 1; |
319 | int crtc_mask = 1; |
- | 320 | ||
309 | 321 | list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) |
|
310 | list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) |
322 | { |
311 | { |
323 | dbgprintf("tmp_crtc %p\n", tmp_crtc); |
312 | if (encoder->possible_crtcs & crtc_mask) |
324 | if (encoder->possible_crtcs & crtc_mask) |
- | 325 | { |
|
313 | { |
326 | crtc = tmp_crtc; |
314 | crtc = tmp_crtc; |
327 | encoder->crtc = crtc; |
315 | encoder->crtc = crtc; |
328 | dbgprintf("CRTC %p\n", crtc); |
316 | break; |
329 | break; |
317 | }; |
330 | }; |
Line -... | Line 331... | ||
- | 331 | crtc_mask <<= 1; |
|
- | 332 | }; |
|
318 | crtc_mask <<= 1; |
333 | }; |
319 | }; |
334 | |
320 | }; |
335 | dbgprintf("CRTC %p\n", crtc); |
- | 336 | ||
321 | 337 | if(crtc == NULL) |
|
322 | if(crtc == NULL) |
338 | { |
Line 323... | Line -... | ||
323 | { |
- | |
324 | DRM_ERROR("No CRTC for encoder %d\n", encoder->base.id); |
339 | DRM_DEBUG_KMS("No CRTC for encoder %d\n", encoder->base.id); |
Line 325... | Line 340... | ||
325 | return -1; |
340 | mutex_unlock(&dev->mode_config.mutex); |
326 | }; |
341 | return -1; |
327 | 342 | }; |
|
328 | 343 | ||
Line 359... | Line 374... | ||
359 | select_cursor_kms(os_display->cursor); |
374 | select_cursor_kms(os_display->cursor); |
360 | }; |
375 | }; |
361 | safe_sti(ifl); |
376 | safe_sti(ifl); |
Line -... | Line 377... | ||
- | 377 | ||
- | 378 | if( (usermode->width == 0) || |
|
- | 379 | (usermode->height == 0)) |
|
- | 380 | { |
|
- | 381 | struct drm_display_mode *mode; |
|
- | 382 | ||
- | 383 | // connector->funcs->fill_modes(connector, dev->mode_config.max_width, |
|
- | 384 | // dev->mode_config.max_height); |
|
- | 385 | ||
- | 386 | list_for_each_entry(mode, &connector->modes, head) |
|
- | 387 | { |
|
- | 388 | printf("check mode w:%d h:%d %dHz\n", |
|
- | 389 | drm_mode_width(mode), drm_mode_height(mode), |
|
- | 390 | drm_mode_vrefresh(mode)); |
|
- | 391 | ||
- | 392 | if( os_display->width == drm_mode_width(mode) && |
|
- | 393 | os_display->height == drm_mode_height(mode) && |
|
- | 394 | drm_mode_vrefresh(mode) == 60) |
|
- | 395 | { |
|
- | 396 | usermode->width = os_display->width; |
|
- | 397 | usermode->height = os_display->height; |
|
- | 398 | usermode->freq = 60; |
|
- | 399 | break; |
|
- | 400 | ||
- | 401 | } |
|
- | 402 | } |
|
- | 403 | ||
- | 404 | if( usermode->width == 0 || |
|
- | 405 | usermode->height == 0) |
|
- | 406 | { |
|
- | 407 | mode = list_entry(connector->modes.next, typeof(*mode), head); |
|
- | 408 | ||
- | 409 | usermode->width = drm_mode_width(mode); |
|
- | 410 | usermode->height = drm_mode_height(mode); |
|
- | 411 | usermode->freq = drm_mode_vrefresh(mode); |
|
- | 412 | }; |
|
- | 413 | }; |
|
- | 414 | ||
- | 415 | mutex_unlock(&dev->mode_config.mutex); |
|
- | 416 | ||
- | 417 | set_mode(dev, os_display->connector, usermode, false); |
|
362 | 418 | ||
363 | #ifdef __HWA__ |
419 | #ifdef __HWA__ |
364 | err = init_bitmaps(); |
420 | err = init_bitmaps(); |
Line -... | Line 421... | ||
- | 421 | #endif |
|
- | 422 | ||
365 | #endif |
423 | LEAVE(); |
366 | 424 | ||
Line 367... | Line 425... | ||
367 | return 0; |
425 | return 0; |