Skip to contentSkip to conversation

drm: Print erroneous hscale/vscale on failure

PATCH In review Sean Paul 3 participants 4 messages Sep 5, 2018 – Sep 6, 2018

Subsystems (2)
lore
Share & tools
lore

Sean Paul

author
#0 lore raw

PATCH 1/1 drm: Print erroneous hscale/vscale on failure

From: Sean Paul <[email protected]>

I ran across this last week when I was trying to get this function to work. It's useful to have the scale values in the log upon failure.

---
 drivers/gpu/drm/drm_atomic_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +2 -1
index 2c23a48482da..1725546d5105 100644
@@ -758,7 +758,8 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
 	hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
 	vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
 	if (hscale < 0 || vscale < 0) {
-		DRM_DEBUG_KMS("Invalid scaling of plane\n");
+		DRM_DEBUG_KMS("Invalid scaling of plane (%d/%d)\n",
+			      hscale, vscale);
 		drm_rect_debug_print("src: ", &plane_state->src, true);
 		drm_rect_debug_print("dst: ", &plane_state->dst, false);
 		return -ERANGE;
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Sean Paul

From: Sean Paul <[email protected]>

I ran across this last week when I was trying to get this function to work. It's useful to have the scale values in the log upon failure.

Quoted 25 lines
---
 drivers/gpu/drm/drm_atomic_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +2 -1
index 2c23a48482da..1725546d5105 100644
@@ -758,7 +758,8 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
 	hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
 	vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
 	if (hscale < 0 || vscale < 0) {
-		DRM_DEBUG_KMS("Invalid scaling of plane\n");
+		DRM_DEBUG_KMS("Invalid scaling of plane (%d/%d)\n",
+			      hscale, vscale);
 		drm_rect_debug_print("src: ", &plane_state->src, true);
 		drm_rect_debug_print("dst: ", &plane_state->dst, false);
 		return -ERANGE;
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
In reply to Sean Paul
Quoted 15 lines · Sean Paul

From: Sean Paul <[email protected]>

I ran across this last week when I was trying to get this function to work. It's useful to have the scale values in the log upon failure.

---
 drivers/gpu/drm/drm_atomic_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +0 -0
index 2c23a48482da..1725546d5105 100644

drivers/gpu/drm/drm_atomic_helper.c int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, · line 762

Quoted 6 lines
drivers/gpu/drm/drm_atomic_helper.c +2 -1
@@ -758,7 +758,8 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
 	hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
 	vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
 	if (hscale < 0 || vscale < 0) {
-		DRM_DEBUG_KMS("Invalid scaling of plane\n");
+		DRM_DEBUG_KMS("Invalid scaling of plane (%d/%d)\n",
+			      hscale, vscale);

I think it's just going to be -ERANGE for at least one of them. So not quite sure what extra benefit we get from this. What might be more helpful is printing the actual computed scale factor and the min/max.

Quoted 10 lines
drivers/gpu/drm/drm_atomic_helper.c +0 -0
 		drm_rect_debug_print("src: ", &plane_state->src, true);
 		drm_rect_debug_print("dst: ", &plane_state->dst, false);
 		return -ERANGE;
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#3 lore raw
Quoted 11 lines · Ville Syrjälä
Quoted 10 lines · Sean Paul

From: Sean Paul <[email protected]>

I ran across this last week when I was trying to get this function to work. It's useful to have the scale values in the log upon failure.

---
 drivers/gpu/drm/drm_atomic_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 16 lines

drivers/gpu/drm/drm_atomic_helper.c int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state, · line 762

Quoted 11 lines
drivers/gpu/drm/drm_atomic_helper.c +2 -1
index 2c23a48482da..1725546d5105 100644
@@ -758,7 +758,8 @@ int drm_atomic_helper_check_plane_state(struct drm_plane_state *plane_state,
 	hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
 	vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
 	if (hscale < 0 || vscale < 0) {
-		DRM_DEBUG_KMS("Invalid scaling of plane\n");
+		DRM_DEBUG_KMS("Invalid scaling of plane (%d/%d)\n",
+			      hscale, vscale);

I think it's just going to be -ERANGE for at least one of them. So not quite sure what extra benefit we get from this. What might be more helpful is printing the actual computed scale factor and the min/max.

Good point, it will tell you which scale is invalid, but not necessarily why. I'll tweak the args for drm_rect_calc_*scale to return -errno and pass *scale by pointer.

v2 incoming

Sean

Quoted 15 lines
Quoted 11 lines
drivers/gpu/drm/drm_atomic_helper.c +0 -0
 		drm_rect_debug_print("src: ", &plane_state->src, true);
 		drm_rect_debug_print("dst: ", &plane_state->dst, false);
 		return -ERANGE;
Signature · 6 lines
Sean Paul, Software Engineer, Google / Chromium OS

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 2 lines
Ville Syrjälä
Intel
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel