Subversion Repositories Kolibri OS

Rev

Rev 1125 | Rev 1179 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1125 Rev 1126
Line 280... Line 280...
280
 
280
 
281
static struct drm_display_mode *drm_has_preferred_mode(struct drm_connector *connector, int width, int height)
281
static struct drm_display_mode *drm_has_preferred_mode(struct drm_connector *connector, int width, int height)
282
{
282
{
Line -... Line 283...
-
 
283
	struct drm_display_mode *mode;
-
 
284
 
283
	struct drm_display_mode *mode;
285
    ENTRY();
284
 
286
 
285
	list_for_each_entry(mode, &connector->modes, head) {
287
	list_for_each_entry(mode, &connector->modes, head) {
286
		if (drm_mode_width(mode) > width ||
288
		if (drm_mode_width(mode) > width ||
287
		    drm_mode_height(mode) > height)
289
		    drm_mode_height(mode) > height)
Line 378... Line 380...
378
		if (c == n)
380
		if (c == n)
379
			break;
381
			break;
380
		c++;
382
		c++;
381
	}
383
	}
Line -... Line 384...
-
 
384
 
-
 
385
    dbgprintf("n= %d\n", n);
382
 
386
 
383
	best_crtcs[n] = NULL;
387
	best_crtcs[n] = NULL;
384
	best_crtc = NULL;
388
	best_crtc = NULL;
385
	best_score = drm_pick_crtcs(dev, best_crtcs, modes, n+1, width, height);
389
	best_score = drm_pick_crtcs(dev, best_crtcs, modes, n+1, width, height);
386
	if (modes[n] == NULL)
390
	if (modes[n] == NULL)
Line 389... Line 393...
389
	crtcs = kmalloc(dev->mode_config.num_connector *
393
	crtcs = kmalloc(dev->mode_config.num_connector *
390
			sizeof(struct drm_crtc *), GFP_KERNEL);
394
			sizeof(struct drm_crtc *), GFP_KERNEL);
391
	if (!crtcs)
395
	if (!crtcs)
392
		return best_score;
396
		return best_score;
Line -... Line 397...
-
 
397
 
-
 
398
    dbgprintf("crtcs = %x\n", crtcs);
393
 
399
 
394
	my_score = 1;
400
	my_score = 1;
395
	if (connector->status == connector_status_connected)
401
	if (connector->status == connector_status_connected)
396
		my_score++;
402
		my_score++;
397
	if (drm_has_preferred_mode(connector, width, height))
403
	if (drm_has_preferred_mode(connector, width, height))
Line 398... Line 404...
398
		my_score++;
404
		my_score++;
399
 
405
 
-
 
406
	connector_funcs = connector->helper_private;
-
 
407
	encoder = connector_funcs->best_encoder(connector);
-
 
408
 
400
	connector_funcs = connector->helper_private;
409
    dbgprintf("encoder = %x\n", encoder);
401
	encoder = connector_funcs->best_encoder(connector);
410
 
Line 402... Line 411...
402
	if (!encoder)
411
	if (!encoder)
Line 437... Line 446...
437
		}
446
		}
438
		c++;
447
		c++;
439
	}
448
	}
440
out:
449
out:
441
	kfree(crtcs);
450
	kfree(crtcs);
-
 
451
 
-
 
452
    dbgprintf("best_score= %x\n", best_score);
-
 
453
 
-
 
454
    LEAVE();
-
 
455
 
442
	return best_score;
456
	return best_score;
443
}
457
}
Line 444... Line 458...
444
 
458
 
445
static void drm_setup_crtcs(struct drm_device *dev)
459
static void drm_setup_crtcs(struct drm_device *dev)
Line 452... Line 466...
452
	int width, height;
466
	int width, height;
453
	int i, ret;
467
	int i, ret;
Line 454... Line 468...
454
 
468
 
Line 455... Line 469...
455
	DRM_DEBUG("\n");
469
	DRM_DEBUG("\n");
456
 
470
 
Line 457... Line 471...
457
	width = dev->mode_config.max_width;
471
    width = 1280;  //dev->mode_config.max_width;
458
	height = dev->mode_config.max_height;
472
    height = 1024; //dev->mode_config.max_height;
459
 
473
 
460
	/* clean out all the encoder/crtc combos */
474
	/* clean out all the encoder/crtc combos */
Line 477... Line 491...
477
 
491
 
Line 478... Line 492...
478
	DRM_DEBUG("picking CRTCs for %dx%d config\n", width, height);
492
	DRM_DEBUG("picking CRTCs for %dx%d config\n", width, height);
Line 479... Line -...
479
 
-
 
480
	drm_pick_crtcs(dev, crtcs, modes, 0, width, height);
-
 
481
 
493
 
482
    dbgprintf("done\n");
494
	drm_pick_crtcs(dev, crtcs, modes, 0, width, height);
483
 
495
 
484
	i = 0;
496
	i = 0;
Line 493... Line 505...
493
 
505
 
494
		if (mode && crtc) {
506
		if (mode && crtc) {
495
			DRM_DEBUG("desired mode %s set on crtc %d\n",
507
			DRM_DEBUG("desired mode %s set on crtc %d\n",
496
				  mode->name, crtc->base.id);
508
				  mode->name, crtc->base.id);
-
 
509
			crtc->desired_mode = mode;
-
 
510
          //  crtc->mode = *mode;
497
			crtc->desired_mode = mode;
511
            crtc->enabled = true;
498
			connector->encoder->crtc = crtc;
512
			connector->encoder->crtc = crtc;
499
		} else
513
		} else
500
			connector->encoder->crtc = NULL;
514
			connector->encoder->crtc = NULL;
501
		i++;
515
		i++;
Line 587... Line 601...
587
	struct drm_encoder_helper_funcs *encoder_funcs;
601
	struct drm_encoder_helper_funcs *encoder_funcs;
588
	int saved_x, saved_y;
602
	int saved_x, saved_y;
589
	struct drm_encoder *encoder;
603
	struct drm_encoder *encoder;
590
	bool ret = true;
604
	bool ret = true;
Line -... Line 605...
-
 
605
 
-
 
606
    ENTRY();
591
 
607
 
Line 592... Line 608...
592
	adjusted_mode = drm_mode_duplicate(dev, mode);
608
	adjusted_mode = drm_mode_duplicate(dev, mode);
Line 593... Line 609...
593
 
609
 
Line 678... Line 694...
678
	if (!ret) {
694
	if (!ret) {
679
		crtc->mode = saved_mode;
695
		crtc->mode = saved_mode;
680
		crtc->x = saved_x;
696
		crtc->x = saved_x;
681
		crtc->y = saved_y;
697
		crtc->y = saved_y;
682
	}
698
	}
683
 
699
    LEAVE();
684
	return ret;
700
	return ret;
685
}
701
}
686
EXPORT_SYMBOL(drm_crtc_helper_set_mode);
702
EXPORT_SYMBOL(drm_crtc_helper_set_mode);
Line 911... Line 927...
911
					 dev->mode_config.max_height);
927
					 dev->mode_config.max_height);
Line 912... Line 928...
912
 
928
 
Line 913... Line 929...
913
	drm_setup_crtcs(dev);
929
	drm_setup_crtcs(dev);
914
 
930
 
Line 915... Line 931...
915
	/* alert the driver fb layer */
931
	/* alert the driver fb layer */
916
 //  dev->mode_config.funcs->fb_changed(dev);
932
    dev->mode_config.funcs->fb_changed(dev);
917
 
933
 
918
	/* FIXME: send hotplug event */
934
	/* FIXME: send hotplug event */
Line 955... Line 971...
955
			drm_helper_add_std_modes(dev, connector);
971
			drm_helper_add_std_modes(dev, connector);
956
	}
972
	}
Line 957... Line 973...
957
 
973
 
Line -... Line 974...
-
 
974
	drm_setup_crtcs(dev);
-
 
975
 
958
	drm_setup_crtcs(dev);
976
    radeonfb_create(dev->dev_private, 1280, 1024, 1280, 1024, NULL);
959
 
977
 
Line 960... Line 978...
960
	/* alert the driver fb layer */
978
//   /* alert the driver fb layer */
Line 961... Line 979...
961
 //  dev->mode_config.funcs->fb_changed(dev);
979
    dev->mode_config.funcs->fb_changed(dev);
962
 
980
 
Line 1080... Line 1098...
1080
 
1098
 
1081
	return 0;
1099
	return 0;
1082
}
1100
}
Line -... Line 1101...
-
 
1101
EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct);
-
 
1102
 
-
 
1103
void sysSetScreen(int width, int height)
-
 
1104
{
-
 
1105
  asm __volatile__
-
 
1106
  (
-
 
1107
    "decl %%eax \n\t"
-
 
1108
    "dec  %%edx \n\t"
-
 
1109
    "call *__imp__SetScreen"
-
 
1110
    :
-
 
1111
    :"a" (width),"d"(height)
-
 
1112
    :"memory","cc"
-
 
1113
  );
-
 
1114
}
1083
EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct);
1115
 
1084
 
1116
 
1085
int drm_helper_resume_force_mode(struct drm_device *dev)
1117
int drm_helper_resume_force_mode(struct drm_device *dev)
-
 
1118
{
-
 
1119
	struct drm_crtc *crtc;
1086
{
1120
    struct drm_framebuffer *fb;
Line -... Line 1121...
-
 
1121
 
-
 
1122
	int ret;
1087
	struct drm_crtc *crtc;
1123
 
Line 1088... Line 1124...
1088
	int ret;
1124
    ENTRY();
1089
 
1125
 
-
 
1126
	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
-
 
1127
 
-
 
1128
		if (!crtc->enabled)
-
 
1129
			continue;
-
 
1130
        dbgprintf("mode %x x %x y %x fb %x\n",
-
 
1131
                   crtc->x, crtc->y, crtc->fb, crtc->mode);
Line 1090... Line 1132...
1090
	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
1132
 
1091
 
1133
        fb = list_first_entry(&dev->mode_config.fb_kernel_list, struct drm_framebuffer, filp_head);
Line 1092... Line 1134...
1092
		if (!crtc->enabled)
1134
 
1093
			continue;
1135
        crtc->fb = fb;
-
 
1136
 
-
 
1137
        ret = drm_crtc_helper_set_mode(crtc, crtc->desired_mode,
-
 
1138
					       crtc->x, crtc->y, crtc->fb);
1094
 
1139
 
-
 
1140
		if (ret == false)
1095
		ret = drm_crtc_helper_set_mode(crtc, &crtc->mode,
1141
			DRM_ERROR("failed to set mode on crtc %p\n", crtc);
1096
					       crtc->x, crtc->y, crtc->fb);
1142
 
1097
 
1143
        sysSetScreen(1280,1024);