aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2009-07-20 01:48:07 -0400
committerDave Airlie <airlied@redhat.com>2009-08-04 00:02:51 -0400
commit58367ed65f30128d8b763bf4c1fb942da49ade15 (patch)
tree3fe8fd947ac82480d914aedc5191ee28d640d631 /drivers
parent87fdff81cd2d770f0adc742e21eb5e062ad20def (diff)
drm: Add the debug info in generic drm mode by using DRM_DEBUG_KMS
Add the debug info in generic drm mode by using DRM_DEBUG_KMS Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/drm_crtc.c29
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c44
2 files changed, 40 insertions, 33 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 8fab7890a363..9c758305472c 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1060,7 +1060,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
1060 if (file_priv->master->minor->type == DRM_MINOR_CONTROL) { 1060 if (file_priv->master->minor->type == DRM_MINOR_CONTROL) {
1061 list_for_each_entry(crtc, &dev->mode_config.crtc_list, 1061 list_for_each_entry(crtc, &dev->mode_config.crtc_list,
1062 head) { 1062 head) {
1063 DRM_DEBUG("CRTC ID is %d\n", crtc->base.id); 1063 DRM_DEBUG_KMS("CRTC ID is %d\n", crtc->base.id);
1064 if (put_user(crtc->base.id, crtc_id + copied)) { 1064 if (put_user(crtc->base.id, crtc_id + copied)) {
1065 ret = -EFAULT; 1065 ret = -EFAULT;
1066 goto out; 1066 goto out;
@@ -1088,7 +1088,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
1088 list_for_each_entry(encoder, 1088 list_for_each_entry(encoder,
1089 &dev->mode_config.encoder_list, 1089 &dev->mode_config.encoder_list,
1090 head) { 1090 head) {
1091 DRM_DEBUG("ENCODER ID is %d\n", 1091 DRM_DEBUG_KMS("ENCODER ID is %d\n",
1092 encoder->base.id); 1092 encoder->base.id);
1093 if (put_user(encoder->base.id, encoder_id + 1093 if (put_user(encoder->base.id, encoder_id +
1094 copied)) { 1094 copied)) {
@@ -1119,7 +1119,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
1119 list_for_each_entry(connector, 1119 list_for_each_entry(connector,
1120 &dev->mode_config.connector_list, 1120 &dev->mode_config.connector_list,
1121 head) { 1121 head) {
1122 DRM_DEBUG("CONNECTOR ID is %d\n", 1122 DRM_DEBUG_KMS("CONNECTOR ID is %d\n",
1123 connector->base.id); 1123 connector->base.id);
1124 if (put_user(connector->base.id, 1124 if (put_user(connector->base.id,
1125 connector_id + copied)) { 1125 connector_id + copied)) {
@@ -1143,7 +1143,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
1143 } 1143 }
1144 card_res->count_connectors = connector_count; 1144 card_res->count_connectors = connector_count;
1145 1145
1146 DRM_DEBUG("Counted %d %d %d\n", card_res->count_crtcs, 1146 DRM_DEBUG_KMS("Counted %d %d %d\n", card_res->count_crtcs,
1147 card_res->count_connectors, card_res->count_encoders); 1147 card_res->count_connectors, card_res->count_encoders);
1148 1148
1149out: 1149out:
@@ -1246,7 +1246,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
1246 1246
1247 memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo)); 1247 memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo));
1248 1248
1249 DRM_DEBUG("connector id %d:\n", out_resp->connector_id); 1249 DRM_DEBUG_KMS("connector id %d:\n", out_resp->connector_id);
1250 1250
1251 mutex_lock(&dev->mode_config.mutex); 1251 mutex_lock(&dev->mode_config.mutex);
1252 1252
@@ -1422,7 +1422,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1422 obj = drm_mode_object_find(dev, crtc_req->crtc_id, 1422 obj = drm_mode_object_find(dev, crtc_req->crtc_id,
1423 DRM_MODE_OBJECT_CRTC); 1423 DRM_MODE_OBJECT_CRTC);
1424 if (!obj) { 1424 if (!obj) {
1425 DRM_DEBUG("Unknown CRTC ID %d\n", crtc_req->crtc_id); 1425 DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id);
1426 ret = -EINVAL; 1426 ret = -EINVAL;
1427 goto out; 1427 goto out;
1428 } 1428 }
@@ -1435,7 +1435,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1435 list_for_each_entry(crtcfb, 1435 list_for_each_entry(crtcfb,
1436 &dev->mode_config.crtc_list, head) { 1436 &dev->mode_config.crtc_list, head) {
1437 if (crtcfb == crtc) { 1437 if (crtcfb == crtc) {
1438 DRM_DEBUG("Using current fb for setmode\n"); 1438 DRM_DEBUG_KMS("Using current fb for "
1439 "setmode\n");
1439 fb = crtc->fb; 1440 fb = crtc->fb;
1440 } 1441 }
1441 } 1442 }
@@ -1443,7 +1444,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1443 obj = drm_mode_object_find(dev, crtc_req->fb_id, 1444 obj = drm_mode_object_find(dev, crtc_req->fb_id,
1444 DRM_MODE_OBJECT_FB); 1445 DRM_MODE_OBJECT_FB);
1445 if (!obj) { 1446 if (!obj) {
1446 DRM_DEBUG("Unknown FB ID%d\n", crtc_req->fb_id); 1447 DRM_DEBUG_KMS("Unknown FB ID%d\n",
1448 crtc_req->fb_id);
1447 ret = -EINVAL; 1449 ret = -EINVAL;
1448 goto out; 1450 goto out;
1449 } 1451 }
@@ -1456,13 +1458,13 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1456 } 1458 }
1457 1459
1458 if (crtc_req->count_connectors == 0 && mode) { 1460 if (crtc_req->count_connectors == 0 && mode) {
1459 DRM_DEBUG("Count connectors is 0 but mode set\n"); 1461 DRM_DEBUG_KMS("Count connectors is 0 but mode set\n");
1460 ret = -EINVAL; 1462 ret = -EINVAL;
1461 goto out; 1463 goto out;
1462 } 1464 }
1463 1465
1464 if (crtc_req->count_connectors > 0 && !mode && !fb) { 1466 if (crtc_req->count_connectors > 0 && !mode && !fb) {
1465 DRM_DEBUG("Count connectors is %d but no mode or fb set\n", 1467 DRM_DEBUG_KMS("Count connectors is %d but no mode or fb set\n",
1466 crtc_req->count_connectors); 1468 crtc_req->count_connectors);
1467 ret = -EINVAL; 1469 ret = -EINVAL;
1468 goto out; 1470 goto out;
@@ -1495,7 +1497,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
1495 obj = drm_mode_object_find(dev, out_id, 1497 obj = drm_mode_object_find(dev, out_id,
1496 DRM_MODE_OBJECT_CONNECTOR); 1498 DRM_MODE_OBJECT_CONNECTOR);
1497 if (!obj) { 1499 if (!obj) {
1498 DRM_DEBUG("Connector id %d unknown\n", out_id); 1500 DRM_DEBUG_KMS("Connector id %d unknown\n",
1501 out_id);
1499 ret = -EINVAL; 1502 ret = -EINVAL;
1500 goto out; 1503 goto out;
1501 } 1504 }
@@ -1528,7 +1531,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,
1528 struct drm_crtc *crtc; 1531 struct drm_crtc *crtc;
1529 int ret = 0; 1532 int ret = 0;
1530 1533
1531 DRM_DEBUG("\n"); 1534 DRM_DEBUG_KMS("\n");
1532 1535
1533 if (!req->flags) { 1536 if (!req->flags) {
1534 DRM_ERROR("no operation set\n"); 1537 DRM_ERROR("no operation set\n");
@@ -1538,7 +1541,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,
1538 mutex_lock(&dev->mode_config.mutex); 1541 mutex_lock(&dev->mode_config.mutex);
1539 obj = drm_mode_object_find(dev, req->crtc_id, DRM_MODE_OBJECT_CRTC); 1542 obj = drm_mode_object_find(dev, req->crtc_id, DRM_MODE_OBJECT_CRTC);
1540 if (!obj) { 1543 if (!obj) {
1541 DRM_DEBUG("Unknown CRTC ID %d\n", req->crtc_id); 1544 DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id);
1542 ret = -EINVAL; 1545 ret = -EINVAL;
1543 goto out; 1546 goto out;
1544 } 1547 }
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 3da9cfa31848..9cd845132580 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -94,7 +94,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
94 int count = 0; 94 int count = 0;
95 int mode_flags = 0; 95 int mode_flags = 0;
96 96
97 DRM_DEBUG("%s\n", drm_get_connector_name(connector)); 97 DRM_DEBUG_KMS("%s\n", drm_get_connector_name(connector));
98 /* set all modes to the unverified state */ 98 /* set all modes to the unverified state */
99 list_for_each_entry_safe(mode, t, &connector->modes, head) 99 list_for_each_entry_safe(mode, t, &connector->modes, head)
100 mode->status = MODE_UNVERIFIED; 100 mode->status = MODE_UNVERIFIED;
@@ -102,7 +102,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
102 connector->status = connector->funcs->detect(connector); 102 connector->status = connector->funcs->detect(connector);
103 103
104 if (connector->status == connector_status_disconnected) { 104 if (connector->status == connector_status_disconnected) {
105 DRM_DEBUG("%s is disconnected\n", 105 DRM_DEBUG_KMS("%s is disconnected\n",
106 drm_get_connector_name(connector)); 106 drm_get_connector_name(connector));
107 /* TODO set EDID to NULL */ 107 /* TODO set EDID to NULL */
108 return 0; 108 return 0;
@@ -138,7 +138,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
138 138
139 drm_mode_sort(&connector->modes); 139 drm_mode_sort(&connector->modes);
140 140
141 DRM_DEBUG("Probed modes for %s\n", drm_get_connector_name(connector)); 141 DRM_DEBUG_KMS("Probed modes for %s\n",
142 drm_get_connector_name(connector));
142 list_for_each_entry_safe(mode, t, &connector->modes, head) { 143 list_for_each_entry_safe(mode, t, &connector->modes, head) {
143 mode->vrefresh = drm_mode_vrefresh(mode); 144 mode->vrefresh = drm_mode_vrefresh(mode);
144 145
@@ -184,12 +185,13 @@ static void drm_helper_add_std_modes(struct drm_device *dev,
184 drm_mode_list_concat(&connector->probed_modes, 185 drm_mode_list_concat(&connector->probed_modes,
185 &connector->modes); 186 &connector->modes);
186 187
187 DRM_DEBUG("Adding mode %s to %s\n", stdmode->name, 188 DRM_DEBUG_KMS("Adding mode %s to %s\n", stdmode->name,
188 drm_get_connector_name(connector)); 189 drm_get_connector_name(connector));
189 } 190 }
190 drm_mode_sort(&connector->modes); 191 drm_mode_sort(&connector->modes);
191 192
192 DRM_DEBUG("Added std modes on %s\n", drm_get_connector_name(connector)); 193 DRM_DEBUG_KMS("Added std modes on %s\n",
194 drm_get_connector_name(connector));
193 list_for_each_entry_safe(mode, t, &connector->modes, head) { 195 list_for_each_entry_safe(mode, t, &connector->modes, head) {
194 mode->vrefresh = drm_mode_vrefresh(mode); 196 mode->vrefresh = drm_mode_vrefresh(mode);
195 197
@@ -312,7 +314,7 @@ static void drm_enable_connectors(struct drm_device *dev, bool *enabled)
312 314
313 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 315 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
314 enabled[i] = drm_connector_enabled(connector, true); 316 enabled[i] = drm_connector_enabled(connector, true);
315 DRM_DEBUG("connector %d enabled? %s\n", connector->base.id, 317 DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
316 enabled[i] ? "yes" : "no"); 318 enabled[i] ? "yes" : "no");
317 any_enabled |= enabled[i]; 319 any_enabled |= enabled[i];
318 i++; 320 i++;
@@ -342,7 +344,7 @@ static bool drm_target_preferred(struct drm_device *dev,
342 continue; 344 continue;
343 } 345 }
344 346
345 DRM_DEBUG("looking for preferred mode on connector %d\n", 347 DRM_DEBUG_KMS("looking for preferred mode on connector %d\n",
346 connector->base.id); 348 connector->base.id);
347 349
348 modes[i] = drm_has_preferred_mode(connector, width, height); 350 modes[i] = drm_has_preferred_mode(connector, width, height);
@@ -351,7 +353,7 @@ static bool drm_target_preferred(struct drm_device *dev,
351 list_for_each_entry(modes[i], &connector->modes, head) 353 list_for_each_entry(modes[i], &connector->modes, head)
352 break; 354 break;
353 } 355 }
354 DRM_DEBUG("found mode %s\n", modes[i] ? modes[i]->name : 356 DRM_DEBUG_KMS("found mode %s\n", modes[i] ? modes[i]->name :
355 "none"); 357 "none");
356 i++; 358 i++;
357 } 359 }
@@ -452,7 +454,7 @@ static void drm_setup_crtcs(struct drm_device *dev)
452 int width, height; 454 int width, height;
453 int i, ret; 455 int i, ret;
454 456
455 DRM_DEBUG("\n"); 457 DRM_DEBUG_KMS("\n");
456 458
457 width = dev->mode_config.max_width; 459 width = dev->mode_config.max_width;
458 height = dev->mode_config.max_height; 460 height = dev->mode_config.max_height;
@@ -475,7 +477,7 @@ static void drm_setup_crtcs(struct drm_device *dev)
475 if (!ret) 477 if (!ret)
476 DRM_ERROR("Unable to find initial modes\n"); 478 DRM_ERROR("Unable to find initial modes\n");
477 479
478 DRM_DEBUG("picking CRTCs for %dx%d config\n", width, height); 480 DRM_DEBUG_KMS("picking CRTCs for %dx%d config\n", width, height);
479 481
480 drm_pick_crtcs(dev, crtcs, modes, 0, width, height); 482 drm_pick_crtcs(dev, crtcs, modes, 0, width, height);
481 483
@@ -490,7 +492,7 @@ static void drm_setup_crtcs(struct drm_device *dev)
490 } 492 }
491 493
492 if (mode && crtc) { 494 if (mode && crtc) {
493 DRM_DEBUG("desired mode %s set on crtc %d\n", 495 DRM_DEBUG_KMS("desired mode %s set on crtc %d\n",
494 mode->name, crtc->base.id); 496 mode->name, crtc->base.id);
495 crtc->desired_mode = mode; 497 crtc->desired_mode = mode;
496 connector->encoder->crtc = crtc; 498 connector->encoder->crtc = crtc;
@@ -713,7 +715,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
713 struct drm_crtc_helper_funcs *crtc_funcs; 715 struct drm_crtc_helper_funcs *crtc_funcs;
714 int ret = 0; 716 int ret = 0;
715 717
716 DRM_DEBUG("\n"); 718 DRM_DEBUG_KMS("\n");
717 719
718 if (!set) 720 if (!set)
719 return -EINVAL; 721 return -EINVAL;
@@ -726,7 +728,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
726 728
727 crtc_funcs = set->crtc->helper_private; 729 crtc_funcs = set->crtc->helper_private;
728 730
729 DRM_DEBUG("crtc: %p %d fb: %p connectors: %p num_connectors: %d (x, y) (%i, %i)\n", 731 DRM_DEBUG_KMS("crtc: %p %d fb: %p connectors: %p num_connectors:"
732 " %d (x, y) (%i, %i)\n",
730 set->crtc, set->crtc->base.id, set->fb, set->connectors, 733 set->crtc, set->crtc->base.id, set->fb, set->connectors,
731 (int)set->num_connectors, set->x, set->y); 734 (int)set->num_connectors, set->x, set->y);
732 735
@@ -756,7 +759,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
756 if (set->crtc->fb != set->fb) { 759 if (set->crtc->fb != set->fb) {
757 /* If we have no fb then treat it as a full mode set */ 760 /* If we have no fb then treat it as a full mode set */
758 if (set->crtc->fb == NULL) { 761 if (set->crtc->fb == NULL) {
759 DRM_DEBUG("crtc has no fb, full mode set\n"); 762 DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
760 mode_changed = true; 763 mode_changed = true;
761 } else if ((set->fb->bits_per_pixel != 764 } else if ((set->fb->bits_per_pixel !=
762 set->crtc->fb->bits_per_pixel) || 765 set->crtc->fb->bits_per_pixel) ||
@@ -770,7 +773,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
770 fb_changed = true; 773 fb_changed = true;
771 774
772 if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) { 775 if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) {
773 DRM_DEBUG("modes are different, full mode set\n"); 776 DRM_DEBUG_KMS("modes are different, full mode set\n");
774 drm_mode_debug_printmodeline(&set->crtc->mode); 777 drm_mode_debug_printmodeline(&set->crtc->mode);
775 drm_mode_debug_printmodeline(set->mode); 778 drm_mode_debug_printmodeline(set->mode);
776 mode_changed = true; 779 mode_changed = true;
@@ -796,7 +799,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
796 } 799 }
797 800
798 if (new_encoder != connector->encoder) { 801 if (new_encoder != connector->encoder) {
799 DRM_DEBUG("encoder changed, full mode switch\n"); 802 DRM_DEBUG_KMS("encoder changed, full mode switch\n");
800 mode_changed = true; 803 mode_changed = true;
801 connector->encoder = new_encoder; 804 connector->encoder = new_encoder;
802 } 805 }
@@ -831,11 +834,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
831 goto fail_set_mode; 834 goto fail_set_mode;
832 } 835 }
833 if (new_crtc != connector->encoder->crtc) { 836 if (new_crtc != connector->encoder->crtc) {
834 DRM_DEBUG("crtc changed, full mode switch\n"); 837 DRM_DEBUG_KMS("crtc changed, full mode switch\n");
835 mode_changed = true; 838 mode_changed = true;
836 connector->encoder->crtc = new_crtc; 839 connector->encoder->crtc = new_crtc;
837 } 840 }
838 DRM_DEBUG("setting connector %d crtc to %p\n", 841 DRM_DEBUG_KMS("setting connector %d crtc to %p\n",
839 connector->base.id, new_crtc); 842 connector->base.id, new_crtc);
840 } 843 }
841 844
@@ -848,7 +851,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
848 set->crtc->fb = set->fb; 851 set->crtc->fb = set->fb;
849 set->crtc->enabled = (set->mode != NULL); 852 set->crtc->enabled = (set->mode != NULL);
850 if (set->mode != NULL) { 853 if (set->mode != NULL) {
851 DRM_DEBUG("attempting to set mode from userspace\n"); 854 DRM_DEBUG_KMS("attempting to set mode from"
855 " userspace\n");
852 drm_mode_debug_printmodeline(set->mode); 856 drm_mode_debug_printmodeline(set->mode);
853 if (!drm_crtc_helper_set_mode(set->crtc, set->mode, 857 if (!drm_crtc_helper_set_mode(set->crtc, set->mode,
854 set->x, set->y, 858 set->x, set->y,
@@ -901,7 +905,7 @@ EXPORT_SYMBOL(drm_crtc_helper_set_config);
901 905
902bool drm_helper_plugged_event(struct drm_device *dev) 906bool drm_helper_plugged_event(struct drm_device *dev)
903{ 907{
904 DRM_DEBUG("\n"); 908 DRM_DEBUG_KMS("\n");
905 909
906 drm_helper_probe_connector_modes(dev, dev->mode_config.max_width, 910 drm_helper_probe_connector_modes(dev, dev->mode_config.max_width,
907 dev->mode_config.max_height); 911 dev->mode_config.max_height);