Rev 1963 | Rev 2004 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1963 | Rev 1986 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | #include "radeon_drm.h" |
4 | #include "radeon_drm.h" |
5 | #include "radeon.h" |
5 | #include "radeon.h" |
6 | #include "radeon_object.h" |
6 | #include "radeon_object.h" |
7 | #include "display.h" |
7 | #include "display.h" |
8 | 8 | #include "drm_fb_helper.h" |
|
- | 9 | ||
- | 10 | struct radeon_fbdev { |
|
- | 11 | struct drm_fb_helper helper; |
|
- | 12 | struct radeon_framebuffer rfb; |
|
- | 13 | struct list_head fbdev_list; |
|
- | 14 | struct radeon_device *rdev; |
|
- | 15 | }; |
|
- | 16 | ||
- | 17 | struct radeon_fbdev *kos_rfbdev; |
|
- | 18 | ||
Line 9... | Line 19... | ||
9 | 19 | ||
10 | static cursor_t* __stdcall select_cursor_kms(cursor_t *cursor); |
20 | static cursor_t* __stdcall select_cursor_kms(cursor_t *cursor); |
Line 195... | Line 205... | ||
195 | videomode_t *reqmode, bool strict) |
205 | videomode_t *reqmode, bool strict) |
196 | { |
206 | { |
197 | struct drm_display_mode *mode = NULL, *tmpmode; |
207 | struct drm_display_mode *mode = NULL, *tmpmode; |
198 | 208 | ||
Line -... | Line 209... | ||
- | 209 | struct drm_fb_helper *fb_helper; |
|
- | 210 | ||
- | 211 | fb_helper = &kos_rfbdev->helper; |
|
- | 212 | ||
- | 213 | ||
199 | bool ret = false; |
214 | bool ret = false; |
Line 200... | Line 215... | ||
200 | 215 | ||
Line 201... | Line 216... | ||
201 | ENTER(); |
216 | ENTER(); |
Line 258... | Line 273... | ||
258 | 273 | ||
Line 259... | Line 274... | ||
259 | dbgprintf("set mode %d %d connector %s encoder %s\n", |
274 | dbgprintf("set mode %d %d connector %s encoder %s\n", |
260 | reqmode->width, reqmode->height, con_name, enc_name); |
275 | reqmode->width, reqmode->height, con_name, enc_name); |
Line -... | Line 276... | ||
- | 276 | ||
- | 277 | fb = fb_helper->fb; |
|
261 | 278 | ||
262 | fb->width = reqmode->width; |
279 | fb->width = reqmode->width; |
263 | fb->height = reqmode->height; |
280 | fb->height = reqmode->height; |
- | 281 | fb->pitch = radeon_align_pitch(dev->dev_private, reqmode->width, 32, false) * ((32 + 1) / 8); |
|
Line 264... | Line 282... | ||
264 | fb->pitch = radeon_align_pitch(dev->dev_private, reqmode->width, 32, false) * ((32 + 1) / 8); |
282 | fb->bits_per_pixel = 32; |
265 | 283 | ||
266 | crtc->fb = fb; |
284 | crtc->fb = fb; |
Line 316... | Line 334... | ||
316 | { |
334 | { |
317 | struct drm_encoder *encoder; |
335 | struct drm_encoder *encoder; |
318 | struct drm_crtc *crtc; |
336 | struct drm_crtc *crtc; |
319 | 337 | ||
Line 320... | Line -... | ||
320 | dbgprintf("CONNECTOR %x ID: %d status %d encoder %x\n", connector, |
- | |
321 | connector->base.id, connector->status, connector->encoder); |
- | |
322 | - | ||
323 | if( connector->status != connector_status_connected) |
338 | if( connector->status != connector_status_connected) |
324 | continue; |
339 | continue; |
Line 325... | Line 340... | ||
325 | 340 | ||
326 | connector_funcs = connector->helper_private; |
341 | connector_funcs = connector->helper_private; |
Line 330... | Line 345... | ||
330 | 345 | ||
Line 331... | Line 346... | ||
331 | connector->encoder = encoder; |
346 | connector->encoder = encoder; |
Line 332... | Line 347... | ||
332 | 347 | ||
333 | crtc = encoder->crtc; |
- | |
Line -... | Line 348... | ||
- | 348 | crtc = encoder->crtc; |
|
- | 349 | ||
- | 350 | dbgprintf("CONNECTOR %x ID: %d status %d encoder %x\n crtc %x", |
|
- | 351 | connector, connector->base.id, |
|
- | 352 | connector->status, connector->encoder, |
|
334 | dbgprintf("encoder %x crtc %x\n", encoder, crtc); |
353 | crtc); |
335 | 354 | ||
Line 336... | Line 355... | ||
336 | if(crtc == NULL) |
355 | // if (crtc == NULL) |
- | 356 | // continue; |
|
337 | continue; |
357 | |
338 | 358 | def_connector = connector; |
|
Line 339... | Line 359... | ||
339 | def_connector = connector; |
359 | |
340 | break; |
360 | break; |
Line -... | Line 361... | ||
- | 361 | }; |
|
- | 362 | ||
341 | }; |
363 | return def_connector; |
342 | 364 | }; |
|
343 | return def_connector; |
365 | |
Line 344... | Line 366... | ||
344 | }; |
366 | |
345 | 367 | ||
346 | bool init_display_kms(struct radeon_device *rdev, videomode_t *usermode) |
368 | bool init_display_kms(struct radeon_device *rdev, videomode_t *usermode) |
Line -... | Line 369... | ||
- | 369 | { |
|
- | 370 | struct drm_device *dev; |
|
- | 371 | ||
- | 372 | cursor_t *cursor; |
|
- | 373 | bool retval = false; |
|
347 | { |
374 | u32_t ifl; |
Line 348... | Line 375... | ||
348 | struct drm_device *dev; |
375 | |
Line 349... | Line 376... | ||
349 | 376 | struct radeon_fbdev *rfbdev; |
|
Line 365... | Line 392... | ||
365 | }; |
392 | }; |
366 | }; |
393 | }; |
367 | safe_sti(ifl); |
394 | safe_sti(ifl); |
368 | 395 | ||
Line -... | Line 396... | ||
- | 396 | ||
- | 397 | ||
- | 398 | rfbdev = rdev->mode_info.rfbdev; |
|
- | 399 | fb_helper = &rfbdev->helper; |
|
- | 400 | ||
- | 401 | ||
- | 402 | // for (i = 0; i < fb_helper->crtc_count; i++) |
|
- | 403 | // { |
|
- | 404 | struct drm_mode_set *mode_set = &fb_helper->crtc_info[0].mode_set; |
|
- | 405 | struct drm_crtc *crtc; |
|
- | 406 | struct drm_display_mode *mode; |
|
- | 407 | ||
- | 408 | crtc = mode_set->crtc; |
|
- | 409 | ||
- | 410 | // if (!crtc->enabled) |
|
- | 411 | // continue; |
|
- | 412 | ||
- | 413 | mode = mode_set->mode; |
|
- | 414 | ||
- | 415 | dbgprintf("crtc %d width %d height %d vrefresh %d\n", |
|
- | 416 | crtc->base.id, |
|
- | 417 | drm_mode_width(mode), drm_mode_height(mode), |
|
- | 418 | drm_mode_vrefresh(mode)); |
|
- | 419 | // } |
|
- | 420 | ||
- | 421 | ||
369 | rdisplay->connector = get_def_connector(dev); |
422 | rdisplay->connector = get_def_connector(dev); |
370 | if( rdisplay->connector == 0 ) |
423 | if( rdisplay->connector == 0 ) |
371 | { |
424 | { |
372 | dbgprintf("no active connectors\n"); |
425 | dbgprintf("no active connectors\n"); |
373 | return false; |
426 | return false; |
374 | }; |
427 | }; |
Line -... | Line 428... | ||
- | 428 | ||
375 | 429 | ||
- | 430 | rdisplay->crtc = rdisplay->connector->encoder->crtc = crtc; |
|
376 | rdisplay->crtc = rdisplay->connector->encoder->crtc; |
431 | |
Line 377... | Line 432... | ||
377 | rdisplay->supported_modes = count_connector_modes(rdisplay->connector); |
432 | rdisplay->supported_modes = count_connector_modes(rdisplay->connector); |
378 | 433 | ||
379 | dbgprintf("current mode %d x %d x %d\n", |
434 | dbgprintf("current mode %d x %d x %d\n", |
Line 475... | Line 530... | ||
475 | LEAVE(); |
530 | LEAVE(); |
476 | return err; |
531 | return err; |
477 | }; |
532 | }; |
Line 478... | Line -... | ||
478 | - | ||
479 | #if 0 |
- | |
480 | void drm_helper_disable_unused_functions(struct drm_device *dev) |
- | |
481 | { |
- | |
482 | struct drm_encoder *encoder; |
- | |
483 | struct drm_connector *connector; |
- | |
484 | struct drm_encoder_helper_funcs *encoder_funcs; |
- | |
Line 485... | Line -... | ||
485 | struct drm_crtc *crtc; |
- | |
486 | - | ||
487 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
- | |
488 | if (!connector->encoder) |
- | |
489 | continue; |
- | |
490 | if (connector->status == connector_status_disconnected) |
- | |
Line -... | Line 533... | ||
- | 533 | ||
491 | connector->encoder = NULL; |
534 | |
492 | } |
535 | |
- | 536 | int radeonfb_create_object(struct radeon_fbdev *rfbdev, |
|
493 | 537 | struct drm_mode_fb_cmd *mode_cmd, |
|
494 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { |
538 | struct drm_gem_object **gobj_p) |
- | 539 | { |
|
495 | encoder_funcs = encoder->helper_private; |
540 | struct radeon_device *rdev = rfbdev->rdev; |
- | 541 | struct drm_gem_object *gobj = NULL; |
|
496 | if (!drm_helper_encoder_in_use(encoder)) { |
542 | struct radeon_bo *rbo = NULL; |
- | 543 | bool fb_tiled = false; /* useful for testing */ |
|
- | 544 | u32 tiling_flags = 0; |
|
- | 545 | int ret; |
|
- | 546 | int aligned_size, size; |
|
497 | if (encoder_funcs->disable) |
547 | int height = mode_cmd->height; |
- | 548 | ||
498 | (*encoder_funcs->disable)(encoder); |
549 | static struct radeon_bo kos_bo; |
- | 550 | static struct drm_mm_node vm_node; |
|
- | 551 | ||
- | 552 | /* need to align pitch with crtc limits */ |
|
499 | else |
553 | mode_cmd->pitch = radeon_align_pitch(rdev, mode_cmd->width, mode_cmd->bpp, fb_tiled) * ((mode_cmd->bpp + 1) / 8); |
500 | (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF); |
554 | |
501 | /* disconnector encoder from any connector */ |
555 | if (rdev->family >= CHIP_R600) |
Line 502... | Line 556... | ||
502 | encoder->crtc = NULL; |
556 | height = ALIGN(mode_cmd->height, 8); |
503 | } |
- | |
504 | } |
- | |
505 | 557 | size = mode_cmd->pitch * height; |
|
506 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { |
- | |
507 | struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; |
558 | aligned_size = ALIGN(size, PAGE_SIZE); |
508 | crtc->enabled = drm_helper_crtc_in_use(crtc); |
559 | |
- | 560 | ret = drm_gem_object_init(rdev->ddev, &kos_bo.gem_base, aligned_size); |
|
- | 561 | if (unlikely(ret)) { |
|
- | 562 | return ret; |
|
- | 563 | } |
|
- | 564 | ||
- | 565 | kos_bo.rdev = rdev; |
|
- | 566 | kos_bo.gem_base.driver_private = NULL; |
|
- | 567 | kos_bo.surface_reg = -1; |
|
- | 568 | kos_bo.domain = RADEON_GEM_DOMAIN_VRAM; |
|
- | 569 | ||
- | 570 | INIT_LIST_HEAD(&kos_bo.list); |
|
- | 571 | ||
- | 572 | gobj = &kos_bo.gem_base; |
|
- | 573 | rbo = gem_to_radeon_bo(gobj); |
|
- | 574 | ||
- | 575 | if (fb_tiled) |
|
- | 576 | tiling_flags = RADEON_TILING_MACRO; |
|
509 | if (!crtc->enabled) { |
577 | |
- | 578 | if (tiling_flags) { |
|
- | 579 | rbo->tiling_flags = tiling_flags | RADEON_TILING_SURFACE; |
|
- | 580 | rbo->pitch = mode_cmd->pitch; |
|
- | 581 | } |
|
- | 582 | ||
- | 583 | vm_node.size = 0xC00000 >> 12; |
|
- | 584 | vm_node.start = 0; |
|
- | 585 | vm_node.mm = NULL; |
|
- | 586 | ||
- | 587 | rbo->tbo.vm_node = &vm_node; |
|
- | 588 | rbo->tbo.offset = rbo->tbo.vm_node->start << PAGE_SHIFT; |
|
- | 589 | rbo->tbo.offset += (u64)rbo->rdev->mc.vram_start; |
|
- | 590 | rbo->kptr = (void*)0xFE000000; |
|
- | 591 | rbo->pin_count = 1; |
|
- | 592 | ||
- | 593 | // if (fb_tiled) |
|
510 | crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF); |
594 | // radeon_bo_check_tiling(rbo, 0, 0); |
- | 595 | ||
- | 596 | *gobj_p = gobj; |
|
- | 597 | return 0; |
|
511 | crtc->fb = NULL; |
598 | }><>>>><>><>><>><>><>><>><>>>><>><>><>=>><>><> |