Commit 9440106b authored by Jerome Glisse's avatar Jerome Glisse Committed by Dave Airlie

drm: unify crtc,connector,encoder,fb debug printing

Unify debug printing so it easier to track what's happening
while debugging.
Signed-off-by: default avatarJerome Glisse <jglisse@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 86a1b9d1
...@@ -1126,7 +1126,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data, ...@@ -1126,7 +1126,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_KMS("CRTC ID is %d\n", crtc->base.id); DRM_DEBUG_KMS("[CRTC:%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;
...@@ -1154,8 +1154,8 @@ int drm_mode_getresources(struct drm_device *dev, void *data, ...@@ -1154,8 +1154,8 @@ 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_KMS("ENCODER ID is %d\n", DRM_DEBUG_KMS("[ENCODER:%d:%s]\n", encoder->base.id,
encoder->base.id); drm_get_encoder_name(encoder));
if (put_user(encoder->base.id, encoder_id + if (put_user(encoder->base.id, encoder_id +
copied)) { copied)) {
ret = -EFAULT; ret = -EFAULT;
...@@ -1185,8 +1185,9 @@ int drm_mode_getresources(struct drm_device *dev, void *data, ...@@ -1185,8 +1185,9 @@ 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_KMS("CONNECTOR ID is %d\n", DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
connector->base.id); connector->base.id,
drm_get_connector_name(connector));
if (put_user(connector->base.id, if (put_user(connector->base.id,
connector_id + copied)) { connector_id + copied)) {
ret = -EFAULT; ret = -EFAULT;
...@@ -1209,7 +1210,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data, ...@@ -1209,7 +1210,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_KMS("Counted %d %d %d\n", card_res->count_crtcs, DRM_DEBUG_KMS("CRTC[%d] CONNECTORS[%d] ENCODERS[%d]\n", card_res->count_crtcs,
card_res->count_connectors, card_res->count_encoders); card_res->count_connectors, card_res->count_encoders);
out: out:
...@@ -1312,7 +1313,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, ...@@ -1312,7 +1313,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_KMS("connector id %d:\n", out_resp->connector_id); DRM_DEBUG_KMS("[CONNECTOR:%d:?]\n", out_resp->connector_id);
mutex_lock(&dev->mode_config.mutex); mutex_lock(&dev->mode_config.mutex);
...@@ -1493,6 +1494,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -1493,6 +1494,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
goto out; goto out;
} }
crtc = obj_to_crtc(obj); crtc = obj_to_crtc(obj);
DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id);
if (crtc_req->mode_valid) { if (crtc_req->mode_valid) {
/* If we have a mode we need a framebuffer. */ /* If we have a mode we need a framebuffer. */
...@@ -1569,6 +1571,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, ...@@ -1569,6 +1571,9 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
goto out; goto out;
} }
connector = obj_to_connector(obj); connector = obj_to_connector(obj);
DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
connector->base.id,
drm_get_connector_name(connector));
connector_set[i] = connector; connector_set[i] = connector;
} }
...@@ -1684,6 +1689,7 @@ int drm_mode_addfb(struct drm_device *dev, ...@@ -1684,6 +1689,7 @@ int drm_mode_addfb(struct drm_device *dev,
r->fb_id = fb->base.id; r->fb_id = fb->base.id;
list_add(&fb->filp_head, &file_priv->fbs); list_add(&fb->filp_head, &file_priv->fbs);
DRM_DEBUG_KMS("[FB:%d]\n", fb->base.id);
out: out:
mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&dev->mode_config.mutex);
......
...@@ -86,7 +86,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, ...@@ -86,7 +86,8 @@ 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_KMS("%s\n", drm_get_connector_name(connector)); DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id,
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,8 +103,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, ...@@ -102,8 +103,8 @@ 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_KMS("%s is disconnected\n", DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
drm_get_connector_name(connector)); connector->base.id, drm_get_connector_name(connector));
drm_mode_connector_update_edid_property(connector, NULL); drm_mode_connector_update_edid_property(connector, NULL);
goto prune; goto prune;
} }
...@@ -141,8 +142,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, ...@@ -141,8 +142,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
drm_mode_sort(&connector->modes); drm_mode_sort(&connector->modes);
DRM_DEBUG_KMS("Probed modes for %s\n", DRM_DEBUG_KMS("[CONNECTOR:%d:%s] probed modes :\n", connector->base.id,
drm_get_connector_name(connector)); 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);
...@@ -374,6 +375,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, ...@@ -374,6 +375,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
if (!(ret = crtc_funcs->mode_fixup(crtc, mode, adjusted_mode))) { if (!(ret = crtc_funcs->mode_fixup(crtc, mode, adjusted_mode))) {
goto done; goto done;
} }
DRM_DEBUG_KMS("[CRTC:%d]\n", crtc->base.id);
/* Prepare the encoders and CRTCs before setting the mode. */ /* Prepare the encoders and CRTCs before setting the mode. */
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
...@@ -401,8 +403,9 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc, ...@@ -401,8 +403,9 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
if (encoder->crtc != crtc) if (encoder->crtc != crtc)
continue; continue;
DRM_DEBUG("%s: set mode %s %x\n", drm_get_encoder_name(encoder), DRM_DEBUG_KMS("[ENCODER:%d:%s] set [MODE:%d:%s]\n",
mode->name, mode->base.id); encoder->base.id, drm_get_encoder_name(encoder),
mode->base.id, mode->name);
encoder_funcs = encoder->helper_private; encoder_funcs = encoder->helper_private;
encoder_funcs->mode_set(encoder, mode, adjusted_mode); encoder_funcs->mode_set(encoder, mode, adjusted_mode);
} }
...@@ -478,10 +481,15 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -478,10 +481,15 @@ 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_KMS("crtc: %p %d fb: %p connectors: %p num_connectors:" if (set->fb) {
" %d (x, y) (%i, %i)\n", DRM_DEBUG_KMS("[CRTC:%d] [FB:%d] #connectors=%d (x y) (%i %i)\n",
set->crtc, set->crtc->base.id, set->fb, set->connectors, set->crtc->base.id, set->fb->base.id,
(int)set->num_connectors, set->x, set->y); (int)set->num_connectors, set->x, set->y);
} else {
DRM_DEBUG_KMS("[CRTC:%d] [NOFB] #connectors=%d (x y) (%i %i)\n",
set->crtc->base.id, (int)set->num_connectors,
set->x, set->y);
}
dev = set->crtc->dev; dev = set->crtc->dev;
...@@ -610,8 +618,14 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -610,8 +618,14 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
mode_changed = true; mode_changed = true;
connector->encoder->crtc = new_crtc; connector->encoder->crtc = new_crtc;
} }
DRM_DEBUG_KMS("setting connector %d crtc to %p\n", if (new_crtc) {
connector->base.id, new_crtc); DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [CRTC:%d]\n",
connector->base.id, drm_get_connector_name(connector),
new_crtc->base.id);
} else {
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] to [NOCRTC]\n",
connector->base.id, drm_get_connector_name(connector));
}
} }
/* mode_set_base is not a required function */ /* mode_set_base is not a required function */
...@@ -629,8 +643,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) ...@@ -629,8 +643,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
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,
old_fb)) { old_fb)) {
DRM_ERROR("failed to set mode on crtc %p\n", DRM_ERROR("failed to set mode on [CRTC:%d]\n",
set->crtc); set->crtc->base.id);
ret = -EINVAL; ret = -EINVAL;
goto fail; goto fail;
} }
......
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