Rev 2004 | Rev 3124 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2004 | Rev 2997 | ||
---|---|---|---|
Line 270... | Line 270... | ||
270 | fb = fb_helper->fb; |
270 | fb = fb_helper->fb; |
Line 271... | Line 271... | ||
271 | 271 | ||
272 | fb->width = reqmode->width; |
272 | fb->width = reqmode->width; |
- | 273 | fb->height = reqmode->height; |
|
- | 274 | ||
273 | fb->height = reqmode->height; |
275 | fb->pitches[0] = fb->pitches[1] = fb->pitches[2] = |
274 | fb->pitch = radeon_align_pitch(dev->dev_private, reqmode->width, 32, false) * ((32 + 1) / 8); |
276 | fb->pitches[3] = radeon_align_pitch(dev->dev_private, reqmode->width, 32, false) * ((32 + 1) / 8); |
- | 277 | fb->bits_per_pixel = 32; |
|
Line 275... | Line 278... | ||
275 | fb->bits_per_pixel = 32; |
278 | fb->depth = 24; |
276 | 279 | ||
277 | crtc->fb = fb; |
280 | crtc->fb = fb; |
Line 286... | Line 289... | ||
286 | if (ret == true) |
289 | if (ret == true) |
287 | { |
290 | { |
288 | rdisplay->width = fb->width; |
291 | rdisplay->width = fb->width; |
289 | rdisplay->height = fb->height; |
292 | rdisplay->height = fb->height; |
290 | rdisplay->pitch = fb->pitch; |
293 | rdisplay->pitch = fb->pitches[0]; |
291 | rdisplay->vrefresh = drm_mode_vrefresh(mode); |
294 | rdisplay->vrefresh = drm_mode_vrefresh(mode); |
Line 292... | Line 295... | ||
292 | 295 | ||
Line 293... | Line 296... | ||
293 | sysSetScreen(fb->width, fb->height, fb->pitch); |
296 | sysSetScreen(fb->width, fb->height, fb->pitches[0]); |
294 | 297 | ||
295 | dbgprintf("new mode %d x %d pitch %d\n", |
298 | dbgprintf("new mode %d x %d pitch %d\n", |
296 | fb->width, fb->height, fb->pitch); |
299 | fb->width, fb->height, fb->pitches[0]); |
297 | } |
300 | } |
298 | else |
301 | else |
299 | DRM_ERROR("failed to set mode %d_%d on crtc %p\n", |
302 | DRM_ERROR("failed to set mode %d_%d on crtc %p\n", |
Line 361... | Line 364... | ||
361 | bool init_display_kms(struct radeon_device *rdev, videomode_t *usermode) |
364 | bool init_display_kms(struct radeon_device *rdev, videomode_t *usermode) |
362 | { |
365 | { |
363 | struct drm_device *dev; |
366 | struct drm_device *dev; |
Line -... | Line 367... | ||
- | 367 | ||
- | 368 | struct drm_connector *connector; |
|
- | 369 | struct drm_connector_helper_funcs *connector_funcs; |
|
- | 370 | struct drm_encoder *encoder; |
|
- | 371 | struct drm_crtc *crtc = NULL; |
|
- | 372 | struct drm_framebuffer *fb; |
|
- | 373 | struct drm_display_mode *native; |
|
- | 374 | ||
364 | 375 | ||
365 | cursor_t *cursor; |
376 | cursor_t *cursor; |
366 | bool retval = false; |
377 | bool retval = false; |
Line 367... | Line 378... | ||
367 | u32_t ifl; |
378 | u32_t ifl; |
Line 372... | Line 383... | ||
372 | int i; |
383 | int i; |
Line 373... | Line 384... | ||
373 | 384 | ||
Line 374... | Line 385... | ||
374 | ENTER(); |
385 | ENTER(); |
Line -... | Line 386... | ||
- | 386 | ||
- | 387 | dev = rdev->ddev; |
|
- | 388 | ||
375 | 389 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) |
|
Line -... | Line 390... | ||
- | 390 | { |
|
- | 391 | if( connector->status != connector_status_connected) |
|
376 | rdisplay = GetDisplay(); |
392 | continue; |
377 | 393 | ||
- | 394 | connector_funcs = connector->helper_private; |
|
378 | dev = rdisplay->ddev = rdev->ddev; |
395 | encoder = connector_funcs->best_encoder(connector); |
- | 396 | if( encoder == NULL) |
|
- | 397 | { |
|
- | 398 | dbgprintf("CONNECTOR %x ID: %d no active encoders\n", |
|
- | 399 | connector, connector->base.id); |
|
- | 400 | continue; |
|
- | 401 | } |
|
- | 402 | connector->encoder = encoder; |
|
- | 403 | ||
- | 404 | dbgprintf("CONNECTOR %x ID: %d status %d encoder %x\n crtc %x\n", |
|
- | 405 | connector, connector->base.id, |
|
- | 406 | connector->status, connector->encoder, |
|
- | 407 | encoder->crtc); |
|
- | 408 | ||
- | 409 | crtc = encoder->crtc; |
|
379 | 410 | break; |
|
- | 411 | }; |
|
- | 412 | ||
- | 413 | if(connector == NULL) |
|
- | 414 | { |
|
- | 415 | dbgprintf("No active connectors!\n"); |
|
- | 416 | return -1; |
|
- | 417 | }; |
|
- | 418 | ||
- | 419 | { |
|
- | 420 | struct drm_display_mode *tmp; |
|
380 | ifl = safe_cli(); |
421 | |
- | 422 | list_for_each_entry(tmp, &connector->modes, head) { |
|
- | 423 | if (drm_mode_width(tmp) > 16384 || |
|
- | 424 | drm_mode_height(tmp) > 16384) |
|
- | 425 | continue; |
|
381 | { |
426 | if (tmp->type & DRM_MODE_TYPE_PREFERRED) |
- | 427 | { |
|
- | 428 | native = tmp; |
|
- | 429 | break; |
|
- | 430 | }; |
|
- | 431 | } |
|
- | 432 | } |
|
- | 433 | ||
- | 434 | if( ASIC_IS_AVIVO(rdev) && native ) |
|
- | 435 | { |
|
382 | list_for_each_entry(cursor, &rdisplay->cursors, list) |
436 | dbgprintf("native w %d h %d\n", native->hdisplay, native->vdisplay); |
383 | { |
- | |
Line -... | Line 437... | ||
- | 437 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(connector->encoder); |
|
- | 438 | radeon_encoder->rmx_type = RMX_FULL; |
|
- | 439 | radeon_encoder->native_mode = *native; |
|
- | 440 | }; |
|
- | 441 | ||
- | 442 | ||
- | 443 | if(crtc == NULL) |
|
- | 444 | { |
|
- | 445 | struct drm_crtc *tmp_crtc; |
|
- | 446 | int crtc_mask = 1; |
|
- | 447 | ||
- | 448 | list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) |
|
- | 449 | { |
|
- | 450 | if (encoder->possible_crtcs & crtc_mask) |
|
- | 451 | { |
|
- | 452 | crtc = tmp_crtc; |
|
Line -... | Line 453... | ||
- | 453 | encoder->crtc = crtc; |
|
- | 454 | break; |
|
384 | init_cursor(cursor); |
455 | }; |
385 | }; |
456 | crtc_mask <<= 1; |
- | 457 | }; |
|
Line 386... | Line 458... | ||
386 | }; |
458 | }; |
387 | safe_sti(ifl); |
- | |
388 | - | ||
389 | - | ||
390 | - | ||
Line 391... | Line -... | ||
391 | rfbdev = rdev->mode_info.rfbdev; |
- | |
Line 392... | Line 459... | ||
392 | fb_helper = &rfbdev->helper; |
459 | |
393 | - | ||
Line 394... | Line 460... | ||
394 | 460 | if(crtc == NULL) |
|
- | 461 | { |
|
- | 462 | dbgprintf("No CRTC for encoder %d\n", encoder->base.id); |
|
- | 463 | return -1; |
|
- | 464 | }; |
|
- | 465 | ||
Line 395... | Line -... | ||
395 | // for (i = 0; i < fb_helper->crtc_count; i++) |
- | |
396 | // { |
- | |
397 | struct drm_mode_set *mode_set = &fb_helper->crtc_info[0].mode_set; |
- | |
398 | struct drm_crtc *crtc; |
- | |
399 | struct drm_display_mode *mode; |
- | |
Line 400... | Line 466... | ||
400 | 466 | ||
- | 467 | dbgprintf("[Select CRTC:%d]\n", crtc->base.id); |
|
401 | crtc = mode_set->crtc; |
468 | |
402 | 469 | ||
403 | // if (!crtc->enabled) |
- | |
404 | // continue; |
470 | // drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON); |
405 | 471 | ||
Line -... | Line 472... | ||
- | 472 | rdisplay = GetDisplay(); |
|
- | 473 | rdisplay->ddev = dev; |
|
Line 406... | Line -... | ||
406 | mode = mode_set->mode; |
- | |
407 | - | ||
408 | dbgprintf("crtc %d width %d height %d vrefresh %d\n", |
- | |
Line 409... | Line 474... | ||
409 | crtc->base.id, |
474 | rdisplay->connector = connector; |
410 | drm_mode_width(mode), drm_mode_height(mode), |
475 | rdisplay->crtc = crtc; |
411 | drm_mode_vrefresh(mode)); |
476 | |
412 | // } |
477 | rdisplay->supported_modes = count_connector_modes(connector); |
Line -... | Line 478... | ||
- | 478 | ||
413 | 479 | ||
414 | 480 | ||
415 | rdisplay->connector = get_def_connector(dev); |
481 | ifl = safe_cli(); |
416 | if( rdisplay->connector == 0 ) |
482 | { |
417 | { |
483 | list_for_each_entry(cursor, &rdisplay->cursors, list) |
418 | dbgprintf("no active connectors\n"); |
484 | { |
Line 419... | Line 485... | ||
419 | return false; |
485 | init_cursor(cursor); |
420 | }; |
486 | }; |
- | 487 | ||
- | 488 | }; |
|
- | 489 | safe_sti(ifl); |
|
- | 490 | ||
- | 491 | ||
- | 492 | dbgprintf("current mode %d x %d x %d\n", |
|
- | 493 | rdisplay->width, rdisplay->height, rdisplay->vrefresh); |
|
Line 421... | Line 494... | ||
421 | 494 | dbgprintf("user mode mode %d x %d x %d\n", |
|
422 | 495 | usermode->width, usermode->height, usermode->freq); |
|
423 | rdisplay->crtc = rdisplay->connector->encoder->crtc = crtc; |
496 | |
424 | 497 | ||
Line 462... | Line 535... | ||
462 | int get_modes(videomode_t *mode, int *count) |
535 | int get_modes(videomode_t *mode, int *count) |
463 | { |
536 | { |
464 | int err = -1; |
537 | int err = -1; |
Line 465... | Line 538... | ||
465 | 538 | ||
Line 466... | Line 539... | ||
466 | ENTER(); |
539 | // ENTER(); |
Line 467... | Line 540... | ||
467 | 540 | ||
468 | dbgprintf("mode %x count %d\n", mode, *count); |
541 | dbgprintf("mode %x count %d\n", mode, *count); |
Line 495... | Line 568... | ||
495 | }; |
568 | }; |
496 | *count = i; |
569 | *count = i; |
497 | err = 0; |
570 | err = 0; |
498 | }; |
571 | }; |
499 | LEAVE(); |
572 | // LEAVE(); |
500 | return err; |
573 | return err; |
501 | } |
574 | } |
502 | 575 | ||
Line 503... | Line 576... | ||
503 | int set_user_mode(videomode_t *mode) |
576 | int set_user_mode(videomode_t *mode) |
504 | { |
577 | { |
505 | int err = -1; |
578 | int err = -1; |
Line 506... | Line 579... | ||
506 | 579 | ||
Line 507... | Line 580... | ||
507 | ENTER(); |
580 | // ENTER(); |
508 | 581 | ||
Line 509... | Line 582... | ||
509 | dbgprintf("width %d height %d vrefresh %d\n", |
582 | dbgprintf("width %d height %d vrefresh %d\n", |
Line 519... | Line 592... | ||
519 | if( set_mode(rdisplay->ddev, rdisplay->connector, mode, true) ) |
592 | if( set_mode(rdisplay->ddev, rdisplay->connector, mode, true) ) |
520 | err = 0; |
593 | err = 0; |
521 | }; |
594 | }; |
522 | 595 | ||
Line 523... | Line 596... | ||
523 | LEAVE(); |
596 | // LEAVE(); |
524 | return err; |
597 | return err; |
525 | }; |
598 | }; |
Line 526... | Line -... | ||
526 | - | ||
527 | 599 | ||
528 | 600 | ||
529 | int radeonfb_create_object(struct radeon_fbdev *rfbdev, |
601 | int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev, |
530 | struct drm_mode_fb_cmd *mode_cmd, |
602 | struct drm_mode_fb_cmd2 *mode_cmd, |
531 | struct drm_gem_object **gobj_p) |
603 | struct drm_gem_object **gobj_p) |
532 | { |
604 | { |
533 | struct radeon_device *rdev = rfbdev->rdev; |
605 | struct radeon_device *rdev = rfbdev->rdev; |
534 | struct drm_gem_object *gobj = NULL; |
606 | struct drm_gem_object *gobj = NULL; |
535 | struct radeon_bo *rbo = NULL; |
607 | struct radeon_bo *rbo = NULL; |
536 | bool fb_tiled = false; /* useful for testing */ |
608 | bool fb_tiled = false; /* useful for testing */ |
537 | u32 tiling_flags = 0; |
609 | u32 tiling_flags = 0; |
538 | int ret; |
610 | int ret; |
- | 611 | int aligned_size, size; |
|
Line 539... | Line 612... | ||
539 | int aligned_size, size; |
612 | int height = mode_cmd->height; |
540 | int height = mode_cmd->height; |
613 | u32 bpp, depth; |
Line -... | Line 614... | ||
- | 614 | ||
- | 615 | static struct radeon_bo kos_bo; |
|
- | 616 | static struct drm_mm_node vm_node; |
|
541 | 617 | ||
542 | static struct radeon_bo kos_bo; |
618 | |
- | 619 | drm_fb_get_bpp_depth(mode_cmd->pixel_format, &depth, &bpp); |
|
Line 543... | Line 620... | ||
543 | static struct drm_mm_node vm_node; |
620 | |
544 | 621 | /* need to align pitch with crtc limits */ |
|
545 | /* need to align pitch with crtc limits */ |
622 | mode_cmd->pitches[0] = radeon_align_pitch(rdev, mode_cmd->width, bpp, |
546 | mode_cmd->pitch = radeon_align_pitch(rdev, mode_cmd->width, mode_cmd->bpp, fb_tiled) * ((mode_cmd->bpp + 1) / 8); |
623 | fb_tiled) * ((bpp + 1) / 8); |
Line -... | Line 624... | ||
- | 624 | ||
547 | 625 | if (rdev->family >= CHIP_R600) |
|
548 | if (rdev->family >= CHIP_R600) |
626 | height = ALIGN(mode_cmd->height, 8); |
- | 627 | size = mode_cmd->pitches[0] * height; |
|
- | 628 | aligned_size = ALIGN(size, PAGE_SIZE); |
|
549 | height = ALIGN(mode_cmd->height, 8); |
629 | |
550 | size = mode_cmd->pitch * height; |
630 | |
Line 551... | Line 631... | ||
551 | aligned_size = ALIGN(size, PAGE_SIZE); |
631 | ret = drm_gem_object_init(rdev->ddev, &kos_bo.gem_base, aligned_size); |
552 | 632 | if (unlikely(ret)) { |
|
553 | ret = drm_gem_object_init(rdev->ddev, &kos_bo.gem_base, aligned_size); |
633 | printk(KERN_ERR "failed to allocate framebuffer (%d)\n", |
Line 567... | Line 647... | ||
567 | 647 | ||
Line 568... | Line 648... | ||
568 | if (fb_tiled) |
648 | if (fb_tiled) |
569 | tiling_flags = RADEON_TILING_MACRO; |
649 | tiling_flags = RADEON_TILING_MACRO; |
Line 570... | Line 650... | ||
570 | 650 | ||
- | 651 | // if (tiling_flags) { |
|
571 | if (tiling_flags) { |
652 | // ret = radeon_bo_set_tiling_flags(rbo, |
572 | rbo->tiling_flags = tiling_flags | RADEON_TILING_SURFACE; |
653 | // tiling_flags | RADEON_TILING_SURFACE, |
- | 654 | // mode_cmd->pitches[0]); |
|
- | 655 | // if (ret) |
|
573 | rbo->pitch = mode_cmd->pitch; |
656 | // dev_err(rdev->dev, "FB failed to set tiling flags\n"); |
Line 574... | Line 657... | ||
574 | } |
657 | // } |
575 | 658 | ||
576 | vm_node.size = 0xC00000 >> 12; |
659 | vm_node.size = 0xC00000 >> 12; |
Line 582... | Line 665... | ||
582 | rbo->tbo.offset += (u64)rbo->rdev->mc.vram_start; |
665 | rbo->tbo.offset += (u64)rbo->rdev->mc.vram_start; |
583 | rbo->kptr = (void*)0xFE000000; |
666 | rbo->kptr = (void*)0xFE000000; |
584 | rbo->pin_count = 1; |
667 | rbo->pin_count = 1; |
585 | 668 | ||
Line 586... | Line -... | ||
586 | // if (fb_tiled) |
- | |
587 | // radeon_bo_check_tiling(rbo, 0, 0); |
- | |
Line 588... | Line 669... | ||
588 | 669 | ||
589 | *gobj_p = gobj; |
670 | *gobj_p = gobj; |
590 | return 0; |
671 | return 0; |
Line 591... | Line -... | ||
591 | }><>>>><>><>><>><>><>><>><>>>><>><>><>><>><>><>><>><> |
- | |
592 | - |