Commit 58367ed6 authored by Zhao Yakui's avatar Zhao Yakui Committed by Dave Airlie

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: default avatarZhao Yakui <yakui.zhao@intel.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 87fdff81
...@@ -1060,7 +1060,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data, ...@@ -1060,7 +1060,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
if (file_priv->master->minor->type == DRM_MINOR_CONTROL) { if (file_priv->master->minor->type == DRM_MINOR_CONTROL) {
list_for_each_entry(crtc, &dev->mode_config.crtc_list, list_for_each_entry(crtc, &dev->mode_config.crtc_list,
head) { head) {
DRM_DEBUG("CRTC ID is %d\n", crtc->base.id); DRM_DEBUG_KMS("CRTC ID is %d\n", crtc->base.id);
if (put_user(crtc->base.id, crtc_id + copied)) { if (put_user(crtc->base.id, crtc_id + copied)) {
ret = -EFAULT; ret = -EFAULT;
goto out; goto out;
...@@ -1088,7 +1088,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data, ...@@ -1088,7 +1088,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
list_for_each_entry(encoder, list_for_each_entry(encoder,
&dev->mode_config.encoder_list, &dev->mode_config.encoder_list,
head) { head) {
DRM_DEBUG("ENCODER ID is %d\n", DRM_DEBUG_KMS("ENCODER ID is %d\n",
encoder->base.id); encoder->base.id);
if (put_user(encoder->base.id, encoder_id + if (put_user(encoder->base.id, encoder_id +
copied)) { copied)) {
...@@ -1119,7 +1119,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data, ...@@ -1119,7 +1119,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
list_for_each_entry(connector, list_for_each_entry(connector,
&dev->mode_config.connector_list, &dev->mode_config.connector_list,
head) { head) {
DRM_DEBUG("CONNECTOR ID is %d\n", DRM_DEBUG_KMS("CONNECTOR ID is %d\n",
connector->base.id); connector->base.id);
if (put_user(connector->base.id, if (put_user(connector->base.id,
connector_id + copied)) { connector_id + copied)) {
...@@ -1143,7 +1143,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data, ...@@ -1143,7 +1143,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
} }
card_res->count_connectors = connector_count; card_res->count_connectors = connector_count;
DRM_DEBUG("Counted %d %d %d\n", card_res->count_crtcs, DRM_DEBUG_KMS("Counted %d %d %d\n", card_res->count_crtcs,
card_res->count_connectors, card_res->count_encoders); card_res->count_connectors, card_res->count_encoders);
out: out:
...@@ -1246,7 +1246,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, ...@@ -1246,7 +1246,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo)); memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo));
DRM_DEBUG("connector id %d:\n", out_resp->connector_id); DRM_DEBUG_KMS("connector id %d:\n", out_resp->connector_id);
mutex_lock(&dev->mode_config.mutex); mutex_lock(&dev->mode_config.mutex);
...@@ -1422,7 +1422,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -1422,7 +1422,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
obj = drm_mode_object_find(dev, crtc_req->crtc_id, obj = drm_mode_object_find(dev, crtc_req->crtc_id,
DRM_MODE_OBJECT_CRTC); DRM_MODE_OBJECT_CRTC);
if (!obj) { if (!obj) {
DRM_DEBUG("Unknown CRTC ID %d\n", crtc_req->crtc_id); DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -1435,7 +1435,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -1435,7 +1435,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
list_for_each_entry(crtcfb, list_for_each_entry(crtcfb,
&dev->mode_config.crtc_list, head) { &dev->mode_config.crtc_list, head) {
if (crtcfb == crtc) { if (crtcfb == crtc) {
DRM_DEBUG("Using current fb for setmode\n"); DRM_DEBUG_KMS("Using current fb for "
"setmode\n");
fb = crtc->fb; fb = crtc->fb;
} }
} }
...@@ -1443,7 +1444,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -1443,7 +1444,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
obj = drm_mode_object_find(dev, crtc_req->fb_id, obj = drm_mode_object_find(dev, crtc_req->fb_id,
DRM_MODE_OBJECT_FB); DRM_MODE_OBJECT_FB);
if (!obj) { if (!obj) {
DRM_DEBUG("Unknown FB ID%d\n", crtc_req->fb_id); DRM_DEBUG_KMS("Unknown FB ID%d\n",
crtc_req->fb_id);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -1456,13 +1458,13 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -1456,13 +1458,13 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
} }
if (crtc_req->count_connectors == 0 && mode) { if (crtc_req->count_connectors == 0 && mode) {
DRM_DEBUG("Count connectors is 0 but mode set\n"); DRM_DEBUG_KMS("Count connectors is 0 but mode set\n");
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
if (crtc_req->count_connectors > 0 && !mode && !fb) { if (crtc_req->count_connectors > 0 && !mode && !fb) {
DRM_DEBUG("Count connectors is %d but no mode or fb set\n", DRM_DEBUG_KMS("Count connectors is %d but no mode or fb set\n",
crtc_req->count_connectors); crtc_req->count_connectors);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
...@@ -1495,7 +1497,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -1495,7 +1497,8 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
obj = drm_mode_object_find(dev, out_id, obj = drm_mode_object_find(dev, out_id,
DRM_MODE_OBJECT_CONNECTOR); DRM_MODE_OBJECT_CONNECTOR);
if (!obj) { if (!obj) {
DRM_DEBUG("Connector id %d unknown\n", out_id); DRM_DEBUG_KMS("Connector id %d unknown\n",
out_id);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
...@@ -1528,7 +1531,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev, ...@@ -1528,7 +1531,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,
struct drm_crtc *crtc; struct drm_crtc *crtc;
int ret = 0; int ret = 0;
DRM_DEBUG("\n"); DRM_DEBUG_KMS("\n");
if (!req->flags) { if (!req->flags) {
DRM_ERROR("no operation set\n"); DRM_ERROR("no operation set\n");
...@@ -1538,7 +1541,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev, ...@@ -1538,7 +1541,7 @@ int drm_mode_cursor_ioctl(struct drm_device *dev,
mutex_lock(&dev->mode_config.mutex); mutex_lock(&dev->mode_config.mutex);
obj = drm_mode_object_find(dev, req->crtc_id, DRM_MODE_OBJECT_CRTC); obj = drm_mode_object_find(dev, req->crtc_id, DRM_MODE_OBJECT_CRTC);
if (!obj) { if (!obj) {
DRM_DEBUG("Unknown CRTC ID %d\n", req->crtc_id); DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;
} }
......
...@@ -94,7 +94,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, ...@@ -94,7 +94,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
int count = 0; int count = 0;
int mode_flags = 0; int mode_flags = 0;
DRM_DEBUG("%s\n", drm_get_connector_name(connector)); DRM_DEBUG_KMS("%s\n", drm_get_connector_name(connector));
/* set all modes to the unverified state */ /* set all modes to the unverified state */
list_for_each_entry_safe(mode, t, &connector->modes, head) list_for_each_entry_safe(mode, t, &connector->modes, head)
mode->status = MODE_UNVERIFIED; mode->status = MODE_UNVERIFIED;
...@@ -102,7 +102,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, ...@@ -102,7 +102,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
connector->status = connector->funcs->detect(connector); connector->status = connector->funcs->detect(connector);
if (connector->status == connector_status_disconnected) { if (connector->status == connector_status_disconnected) {
DRM_DEBUG("%s is disconnected\n", DRM_DEBUG_KMS("%s is disconnected\n",
drm_get_connector_name(connector)); drm_get_connector_name(connector));
/* TODO set EDID to NULL */ /* TODO set EDID to NULL */
return 0; return 0;
...@@ -138,7 +138,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, ...@@ -138,7 +138,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
drm_mode_sort(&connector->modes); drm_mode_sort(&connector->modes);
DRM_DEBUG("Probed modes for %s\n", drm_get_connector_name(connector)); DRM_DEBUG_KMS("Probed modes for %s\n",
drm_get_connector_name(connector));
list_for_each_entry_safe(mode, t, &connector->modes, head) { list_for_each_entry_safe(mode, t, &connector->modes, head) {
mode->vrefresh = drm_mode_vrefresh(mode); mode->vrefresh = drm_mode_vrefresh(mode);
...@@ -184,12 +185,13 @@ static void drm_helper_add_std_modes(struct drm_device *dev, ...@@ -184,12 +185,13 @@ static void drm_helper_add_std_modes(struct drm_device *dev,
drm_mode_list_concat(&connector->probed_modes, drm_mode_list_concat(&connector->probed_modes,
&connector->modes); &connector->modes);
DRM_DEBUG("Adding mode %s to %s\n", stdmode->name, DRM_DEBUG_KMS("Adding mode %s to %s\n", stdmode->name,
drm_get_connector_name(connector)); drm_get_connector_name(connector));
} }
drm_mode_sort(&connector->modes); drm_mode_sort(&connector->modes);
DRM_DEBUG("Added std modes on %s\n", drm_get_connector_name(connector)); DRM_DEBUG_KMS("Added std modes on %s\n",
drm_get_connector_name(connector));
list_for_each_entry_safe(mode, t, &connector->modes, head) { list_for_each_entry_safe(mode, t, &connector->modes, head) {
mode->vrefresh = drm_mode_vrefresh(mode); mode->vrefresh = drm_mode_vrefresh(mode);
...@@ -312,7 +314,7 @@ static void drm_enable_connectors(struct drm_device *dev, bool *enabled) ...@@ -312,7 +314,7 @@ static void drm_enable_connectors(struct drm_device *dev, bool *enabled)
list_for_each_entry(connector, &dev->mode_config.connector_list, head) { list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
enabled[i] = drm_connector_enabled(connector, true); enabled[i] = drm_connector_enabled(connector, true);
DRM_DEBUG("connector %d enabled? %s\n", connector->base.id, DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
enabled[i] ? "yes" : "no"); enabled[i] ? "yes" : "no");
any_enabled |= enabled[i]; any_enabled |= enabled[i];
i++; i++;
...@@ -342,7 +344,7 @@ static bool drm_target_preferred(struct drm_device *dev, ...@@ -342,7 +344,7 @@ static bool drm_target_preferred(struct drm_device *dev,
continue; continue;
} }
DRM_DEBUG("looking for preferred mode on connector %d\n", DRM_DEBUG_KMS("looking for preferred mode on connector %d\n",
connector->base.id); connector->base.id);
modes[i] = drm_has_preferred_mode(connector, width, height); modes[i] = drm_has_preferred_mode(connector, width, height);
...@@ -351,7 +353,7 @@ static bool drm_target_preferred(struct drm_device *dev, ...@@ -351,7 +353,7 @@ static bool drm_target_preferred(struct drm_device *dev,
list_for_each_entry(modes[i], &connector->modes, head) list_for_each_entry(modes[i], &connector->modes, head)
break; break;
} }
DRM_DEBUG("found mode %s\n", modes[i] ? modes[i]->name : DRM_DEBUG_KMS("found mode %s\n", modes[i] ? modes[i]->name :
"none"); "none");
i++; i++;
} }
...@@ -452,7 +454,7 @@ static void drm_setup_crtcs(struct drm_device *dev) ...@@ -452,7 +454,7 @@ static void drm_setup_crtcs(struct drm_device *dev)
int width, height; int width, height;
int i, ret; int i, ret;
DRM_DEBUG("\n"); DRM_DEBUG_KMS("\n");
width = dev->mode_config.max_width; width = dev->mode_config.max_width;
height = dev->mode_config.max_height; height = dev->mode_config.max_height;
...@@ -475,7 +477,7 @@ static void drm_setup_crtcs(struct drm_device *dev) ...@@ -475,7 +477,7 @@ static void drm_setup_crtcs(struct drm_device *dev)
if (!ret) if (!ret)
DRM_ERROR("Unable to find initial modes\n"); DRM_ERROR("Unable to find initial modes\n");
DRM_DEBUG("picking CRTCs for %dx%d config\n", width, height); DRM_DEBUG_KMS("picking CRTCs for %dx%d config\n", width, height);
drm_pick_crtcs(dev, crtcs, modes, 0, width, height); drm_pick_crtcs(dev, crtcs, modes, 0, width, height);
...@@ -490,7 +492,7 @@ static void drm_setup_crtcs(struct drm_device *dev) ...@@ -490,7 +492,7 @@ static void drm_setup_crtcs(struct drm_device *dev)
} }
if (mode && crtc) { if (mode && crtc) {
DRM_DEBUG("desired mode %s set on crtc %d\n", DRM_DEBUG_KMS("desired mode %s set on crtc %d\n",
mode->name, crtc->base.id); mode->name, crtc->base.id);
crtc->desired_mode = mode; crtc->desired_mode = mode;
connector->encoder->crtc = crtc; connector->encoder->crtc = crtc;
...@@ -713,7 +715,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -713,7 +715,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
struct drm_crtc_helper_funcs *crtc_funcs; struct drm_crtc_helper_funcs *crtc_funcs;
int ret = 0; int ret = 0;
DRM_DEBUG("\n"); DRM_DEBUG_KMS("\n");
if (!set) if (!set)
return -EINVAL; return -EINVAL;
...@@ -726,7 +728,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -726,7 +728,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
crtc_funcs = set->crtc->helper_private; crtc_funcs = set->crtc->helper_private;
DRM_DEBUG("crtc: %p %d fb: %p connectors: %p num_connectors: %d (x, y) (%i, %i)\n", DRM_DEBUG_KMS("crtc: %p %d fb: %p connectors: %p num_connectors:"
" %d (x, y) (%i, %i)\n",
set->crtc, set->crtc->base.id, set->fb, set->connectors, set->crtc, set->crtc->base.id, set->fb, set->connectors,
(int)set->num_connectors, set->x, set->y); (int)set->num_connectors, set->x, set->y);
...@@ -756,7 +759,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -756,7 +759,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
if (set->crtc->fb != set->fb) { if (set->crtc->fb != set->fb) {
/* If we have no fb then treat it as a full mode set */ /* If we have no fb then treat it as a full mode set */
if (set->crtc->fb == NULL) { if (set->crtc->fb == NULL) {
DRM_DEBUG("crtc has no fb, full mode set\n"); DRM_DEBUG_KMS("crtc has no fb, full mode set\n");
mode_changed = true; mode_changed = true;
} else if ((set->fb->bits_per_pixel != } else if ((set->fb->bits_per_pixel !=
set->crtc->fb->bits_per_pixel) || set->crtc->fb->bits_per_pixel) ||
...@@ -770,7 +773,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -770,7 +773,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
fb_changed = true; fb_changed = true;
if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) { if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) {
DRM_DEBUG("modes are different, full mode set\n"); DRM_DEBUG_KMS("modes are different, full mode set\n");
drm_mode_debug_printmodeline(&set->crtc->mode); drm_mode_debug_printmodeline(&set->crtc->mode);
drm_mode_debug_printmodeline(set->mode); drm_mode_debug_printmodeline(set->mode);
mode_changed = true; mode_changed = true;
...@@ -796,7 +799,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -796,7 +799,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
} }
if (new_encoder != connector->encoder) { if (new_encoder != connector->encoder) {
DRM_DEBUG("encoder changed, full mode switch\n"); DRM_DEBUG_KMS("encoder changed, full mode switch\n");
mode_changed = true; mode_changed = true;
connector->encoder = new_encoder; connector->encoder = new_encoder;
} }
...@@ -831,11 +834,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -831,11 +834,11 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
goto fail_set_mode; goto fail_set_mode;
} }
if (new_crtc != connector->encoder->crtc) { if (new_crtc != connector->encoder->crtc) {
DRM_DEBUG("crtc changed, full mode switch\n"); DRM_DEBUG_KMS("crtc changed, full mode switch\n");
mode_changed = true; mode_changed = true;
connector->encoder->crtc = new_crtc; connector->encoder->crtc = new_crtc;
} }
DRM_DEBUG("setting connector %d crtc to %p\n", DRM_DEBUG_KMS("setting connector %d crtc to %p\n",
connector->base.id, new_crtc); connector->base.id, new_crtc);
} }
...@@ -848,7 +851,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -848,7 +851,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
set->crtc->fb = set->fb; set->crtc->fb = set->fb;
set->crtc->enabled = (set->mode != NULL); set->crtc->enabled = (set->mode != NULL);
if (set->mode != NULL) { if (set->mode != NULL) {
DRM_DEBUG("attempting to set mode from userspace\n"); DRM_DEBUG_KMS("attempting to set mode from"
" userspace\n");
drm_mode_debug_printmodeline(set->mode); drm_mode_debug_printmodeline(set->mode);
if (!drm_crtc_helper_set_mode(set->crtc, set->mode, if (!drm_crtc_helper_set_mode(set->crtc, set->mode,
set->x, set->y, set->x, set->y,
...@@ -901,7 +905,7 @@ EXPORT_SYMBOL(drm_crtc_helper_set_config); ...@@ -901,7 +905,7 @@ EXPORT_SYMBOL(drm_crtc_helper_set_config);
bool drm_helper_plugged_event(struct drm_device *dev) bool drm_helper_plugged_event(struct drm_device *dev)
{ {
DRM_DEBUG("\n"); DRM_DEBUG_KMS("\n");
drm_helper_probe_connector_modes(dev, dev->mode_config.max_width, drm_helper_probe_connector_modes(dev, dev->mode_config.max_width,
dev->mode_config.max_height); dev->mode_config.max_height);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment