* [PATCH 2/4] drm: Keep coordinates in the typical x, y, w, h order instead of x, y, h, w
2015-11-16 15:02 [PATCH 1/4] drm: Fix primary plane size for stereo doubled modes for legacy setcrtc ville.syrjala
@ 2015-11-16 15:02 ` ville.syrjala
2015-11-16 16:08 ` Alex Deucher
2015-11-16 15:02 ` [PATCH 3/4] drm: Add "prefix" parameter to drm_rect_debug_print() ville.syrjala
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: ville.syrjala @ 2015-11-16 15:02 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/drm_atomic_helper.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 7857163..d5693b7 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -1477,12 +1477,12 @@ retry:
drm_atomic_set_fb_for_plane(plane_state, fb);
plane_state->crtc_x = crtc_x;
plane_state->crtc_y = crtc_y;
- plane_state->crtc_h = crtc_h;
plane_state->crtc_w = crtc_w;
+ plane_state->crtc_h = crtc_h;
plane_state->src_x = src_x;
plane_state->src_y = src_y;
- plane_state->src_h = src_h;
plane_state->src_w = src_w;
+ plane_state->src_h = src_h;
if (plane == crtc->cursor)
state->legacy_cursor_update = true;
@@ -1598,12 +1598,12 @@ int __drm_atomic_helper_disable_plane(struct drm_plane *plane,
drm_atomic_set_fb_for_plane(plane_state, NULL);
plane_state->crtc_x = 0;
plane_state->crtc_y = 0;
- plane_state->crtc_h = 0;
plane_state->crtc_w = 0;
+ plane_state->crtc_h = 0;
plane_state->src_x = 0;
plane_state->src_y = 0;
- plane_state->src_h = 0;
plane_state->src_w = 0;
+ plane_state->src_h = 0;
if (plane->crtc && (plane == plane->crtc->cursor))
plane_state->state->legacy_cursor_update = true;
@@ -1789,16 +1789,16 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
drm_atomic_set_fb_for_plane(primary_state, set->fb);
primary_state->crtc_x = 0;
primary_state->crtc_y = 0;
- primary_state->crtc_h = vdisplay;
primary_state->crtc_w = hdisplay;
+ primary_state->crtc_h = vdisplay;
primary_state->src_x = set->x << 16;
primary_state->src_y = set->y << 16;
if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
- primary_state->src_h = hdisplay << 16;
primary_state->src_w = vdisplay << 16;
+ primary_state->src_h = hdisplay << 16;
} else {
- primary_state->src_h = vdisplay << 16;
primary_state->src_w = hdisplay << 16;
+ primary_state->src_h = vdisplay << 16;
}
commit:
--
2.4.10
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 2/4] drm: Keep coordinates in the typical x, y, w, h order instead of x, y, h, w
2015-11-16 15:02 ` [PATCH 2/4] drm: Keep coordinates in the typical x, y, w, h order instead of x, y, h, w ville.syrjala
@ 2015-11-16 16:08 ` Alex Deucher
0 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2015-11-16 16:08 UTC (permalink / raw)
To: Ville Syrjälä
Cc: Intel Graphics Development, Maling list - DRI developers
On Mon, Nov 16, 2015 at 10:02 AM, <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 7857163..d5693b7 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1477,12 +1477,12 @@ retry:
> drm_atomic_set_fb_for_plane(plane_state, fb);
> plane_state->crtc_x = crtc_x;
> plane_state->crtc_y = crtc_y;
> - plane_state->crtc_h = crtc_h;
> plane_state->crtc_w = crtc_w;
> + plane_state->crtc_h = crtc_h;
> plane_state->src_x = src_x;
> plane_state->src_y = src_y;
> - plane_state->src_h = src_h;
> plane_state->src_w = src_w;
> + plane_state->src_h = src_h;
>
> if (plane == crtc->cursor)
> state->legacy_cursor_update = true;
> @@ -1598,12 +1598,12 @@ int __drm_atomic_helper_disable_plane(struct drm_plane *plane,
> drm_atomic_set_fb_for_plane(plane_state, NULL);
> plane_state->crtc_x = 0;
> plane_state->crtc_y = 0;
> - plane_state->crtc_h = 0;
> plane_state->crtc_w = 0;
> + plane_state->crtc_h = 0;
> plane_state->src_x = 0;
> plane_state->src_y = 0;
> - plane_state->src_h = 0;
> plane_state->src_w = 0;
> + plane_state->src_h = 0;
>
> if (plane->crtc && (plane == plane->crtc->cursor))
> plane_state->state->legacy_cursor_update = true;
> @@ -1789,16 +1789,16 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
> drm_atomic_set_fb_for_plane(primary_state, set->fb);
> primary_state->crtc_x = 0;
> primary_state->crtc_y = 0;
> - primary_state->crtc_h = vdisplay;
> primary_state->crtc_w = hdisplay;
> + primary_state->crtc_h = vdisplay;
> primary_state->src_x = set->x << 16;
> primary_state->src_y = set->y << 16;
> if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
> - primary_state->src_h = hdisplay << 16;
> primary_state->src_w = vdisplay << 16;
> + primary_state->src_h = hdisplay << 16;
> } else {
> - primary_state->src_h = vdisplay << 16;
> primary_state->src_w = hdisplay << 16;
> + primary_state->src_h = vdisplay << 16;
> }
>
> commit:
> --
> 2.4.10
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/4] drm: Add "prefix" parameter to drm_rect_debug_print()
2015-11-16 15:02 [PATCH 1/4] drm: Fix primary plane size for stereo doubled modes for legacy setcrtc ville.syrjala
2015-11-16 15:02 ` [PATCH 2/4] drm: Keep coordinates in the typical x, y, w, h order instead of x, y, h, w ville.syrjala
@ 2015-11-16 15:02 ` ville.syrjala
2015-11-16 15:02 ` [PATCH 4/4] drm: Print the src/dst/clip rectangles in error in drm_plane_helper ville.syrjala
2015-11-17 10:54 ` [PATCH 1/4] drm: Fix primary plane size for stereo doubled modes for legacy setcrtc Daniel Vetter
3 siblings, 0 replies; 7+ messages in thread
From: ville.syrjala @ 2015-11-16 15:02 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
Allow the caller to specify a "prefix" string to drm_rect_debug_print()
to make it easier to see which drm_rect is being printed.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/drm_rect.c | 7 ++++---
drivers/gpu/drm/i915/intel_sprite.c | 8 ++++----
include/drm/drm_rect.h | 3 ++-
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index 531ac4c..a8e2c86 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -275,22 +275,23 @@ EXPORT_SYMBOL(drm_rect_calc_vscale_relaxed);
/**
* drm_rect_debug_print - print the rectangle information
+ * @prefix: prefix string
* @r: rectangle to print
* @fixed_point: rectangle is in 16.16 fixed point format
*/
-void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point)
+void drm_rect_debug_print(const char *prefix, const struct drm_rect *r, bool fixed_point)
{
int w = drm_rect_width(r);
int h = drm_rect_height(r);
if (fixed_point)
- DRM_DEBUG_KMS("%d.%06ux%d.%06u%+d.%06u%+d.%06u\n",
+ DRM_DEBUG_KMS("%s%d.%06ux%d.%06u%+d.%06u%+d.%06u\n", prefix,
w >> 16, ((w & 0xffff) * 15625) >> 10,
h >> 16, ((h & 0xffff) * 15625) >> 10,
r->x1 >> 16, ((r->x1 & 0xffff) * 15625) >> 10,
r->y1 >> 16, ((r->y1 & 0xffff) * 15625) >> 10);
else
- DRM_DEBUG_KMS("%dx%d%+d%+d\n", w, h, r->x1, r->y1);
+ DRM_DEBUG_KMS("%s%dx%d%+d%+d\n", prefix, w, h, r->x1, r->y1);
}
EXPORT_SYMBOL(drm_rect_debug_print);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index a2c15f8..2b96f33 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -817,8 +817,8 @@ intel_check_sprite_plane(struct drm_plane *plane,
hscale = drm_rect_calc_hscale(src, dst, min_scale, max_scale);
if (hscale < 0) {
DRM_DEBUG_KMS("Horizontal scaling factor out of limits\n");
- drm_rect_debug_print(src, true);
- drm_rect_debug_print(dst, false);
+ drm_rect_debug_print("src: ", src, true);
+ drm_rect_debug_print("dst: ", dst, false);
return hscale;
}
@@ -826,8 +826,8 @@ intel_check_sprite_plane(struct drm_plane *plane,
vscale = drm_rect_calc_vscale(src, dst, min_scale, max_scale);
if (vscale < 0) {
DRM_DEBUG_KMS("Vertical scaling factor out of limits\n");
- drm_rect_debug_print(src, true);
- drm_rect_debug_print(dst, false);
+ drm_rect_debug_print("src: ", src, true);
+ drm_rect_debug_print("dst: ", dst, false);
return vscale;
}
diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
index 26bb55e..83bb156 100644
--- a/include/drm/drm_rect.h
+++ b/include/drm/drm_rect.h
@@ -162,7 +162,8 @@ int drm_rect_calc_hscale_relaxed(struct drm_rect *src,
int drm_rect_calc_vscale_relaxed(struct drm_rect *src,
struct drm_rect *dst,
int min_vscale, int max_vscale);
-void drm_rect_debug_print(const struct drm_rect *r, bool fixed_point);
+void drm_rect_debug_print(const char *prefix,
+ const struct drm_rect *r, bool fixed_point);
void drm_rect_rotate(struct drm_rect *r,
int width, int height,
unsigned int rotation);
--
2.4.10
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/4] drm: Print the src/dst/clip rectangles in error in drm_plane_helper
2015-11-16 15:02 [PATCH 1/4] drm: Fix primary plane size for stereo doubled modes for legacy setcrtc ville.syrjala
2015-11-16 15:02 ` [PATCH 2/4] drm: Keep coordinates in the typical x, y, w, h order instead of x, y, h, w ville.syrjala
2015-11-16 15:02 ` [PATCH 3/4] drm: Add "prefix" parameter to drm_rect_debug_print() ville.syrjala
@ 2015-11-16 15:02 ` ville.syrjala
2015-11-17 10:54 ` [PATCH 1/4] drm: Fix primary plane size for stereo doubled modes for legacy setcrtc Daniel Vetter
3 siblings, 0 replies; 7+ messages in thread
From: ville.syrjala @ 2015-11-16 15:02 UTC (permalink / raw)
To: dri-devel; +Cc: intel-gfx
From: Ville Syrjälä <ville.syrjala@linux.intel.com>
To aid in debugging failures, print the src,dst,clip rectangles
when drm_plane_helper_check_update() fails.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/drm_plane_helper.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index d384ebc..a6983d4 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -164,6 +164,8 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
vscale = drm_rect_calc_vscale(src, dest, min_scale, max_scale);
if (hscale < 0 || vscale < 0) {
DRM_DEBUG_KMS("Invalid scaling of plane\n");
+ drm_rect_debug_print("src: ", src, true);
+ drm_rect_debug_print("dst: ", dest, false);
return -ERANGE;
}
@@ -180,6 +182,8 @@ int drm_plane_helper_check_update(struct drm_plane *plane,
if (!can_position && !drm_rect_equals(dest, clip)) {
DRM_DEBUG_KMS("Plane must cover entire CRTC\n");
+ drm_rect_debug_print("dst: ", dest, false);
+ drm_rect_debug_print("clip: ", clip, false);
return -EINVAL;
}
--
2.4.10
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 1/4] drm: Fix primary plane size for stereo doubled modes for legacy setcrtc
2015-11-16 15:02 [PATCH 1/4] drm: Fix primary plane size for stereo doubled modes for legacy setcrtc ville.syrjala
` (2 preceding siblings ...)
2015-11-16 15:02 ` [PATCH 4/4] drm: Print the src/dst/clip rectangles in error in drm_plane_helper ville.syrjala
@ 2015-11-17 10:54 ` Daniel Vetter
2015-11-17 14:26 ` Jani Nikula
3 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2015-11-17 10:54 UTC (permalink / raw)
To: ville.syrjala; +Cc: dri-devel, intel-gfx, Daniel Vetter, stable
On Mon, Nov 16, 2015 at 05:02:34PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Properly double the hdisplay/vdisplay timings that we use as the primary
> plane size with stereo doubled modes. Otherwise the modeset gets
> rejected on machines where the primary plane must be fullscreen, and on
> the rest only the first eye would get a visible plane.
>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: stable@vger.kernel.org
> Fixes: 042652ed9599 ("drm/atomic-helper: implementatations for legacy interfaces")
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Testcase: igt/kms_3d
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
To avoid conflicts with patches 2-4 I applied all of them to drm-misc, but
we need to cherry-pick this one to drm-fixes too.
-Daniel
> ---
> drivers/gpu/drm/drm_atomic_helper.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 9870c70..7857163 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -1741,6 +1741,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
> struct drm_crtc_state *crtc_state;
> struct drm_plane_state *primary_state;
> struct drm_crtc *crtc = set->crtc;
> + int hdisplay, vdisplay;
> int ret;
>
> crtc_state = drm_atomic_get_crtc_state(state, crtc);
> @@ -1783,19 +1784,21 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
> if (ret != 0)
> return ret;
>
> + drm_crtc_get_hv_timing(set->mode, &hdisplay, &vdisplay);
> +
> drm_atomic_set_fb_for_plane(primary_state, set->fb);
> primary_state->crtc_x = 0;
> primary_state->crtc_y = 0;
> - primary_state->crtc_h = set->mode->vdisplay;
> - primary_state->crtc_w = set->mode->hdisplay;
> + primary_state->crtc_h = vdisplay;
> + primary_state->crtc_w = hdisplay;
> primary_state->src_x = set->x << 16;
> primary_state->src_y = set->y << 16;
> if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
> - primary_state->src_h = set->mode->hdisplay << 16;
> - primary_state->src_w = set->mode->vdisplay << 16;
> + primary_state->src_h = hdisplay << 16;
> + primary_state->src_w = vdisplay << 16;
> } else {
> - primary_state->src_h = set->mode->vdisplay << 16;
> - primary_state->src_w = set->mode->hdisplay << 16;
> + primary_state->src_h = vdisplay << 16;
> + primary_state->src_w = hdisplay << 16;
> }
>
> commit:
> --
> 2.4.10
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 1/4] drm: Fix primary plane size for stereo doubled modes for legacy setcrtc
2015-11-17 10:54 ` [PATCH 1/4] drm: Fix primary plane size for stereo doubled modes for legacy setcrtc Daniel Vetter
@ 2015-11-17 14:26 ` Jani Nikula
0 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2015-11-17 14:26 UTC (permalink / raw)
To: Daniel Vetter, ville.syrjala; +Cc: Daniel Vetter, intel-gfx, dri-devel, stable
On Tue, 17 Nov 2015, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Mon, Nov 16, 2015 at 05:02:34PM +0200, ville.syrjala@linux.intel.com wrote:
>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>
>> Properly double the hdisplay/vdisplay timings that we use as the primary
>> plane size with stereo doubled modes. Otherwise the modeset gets
>> rejected on machines where the primary plane must be fullscreen, and on
>> the rest only the first eye would get a visible plane.
>>
>> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Cc: stable@vger.kernel.org
>> Fixes: 042652ed9599 ("drm/atomic-helper: implementatations for legacy interfaces")
>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Testcase: igt/kms_3d
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> To avoid conflicts with patches 2-4 I applied all of them to drm-misc, but
> we need to cherry-pick this one to drm-fixes too.
Picked up in topic/drm-fixes.
BR,
Jani.
> -Daniel
>
>> ---
>> drivers/gpu/drm/drm_atomic_helper.c | 15 +++++++++------
>> 1 file changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
>> index 9870c70..7857163 100644
>> --- a/drivers/gpu/drm/drm_atomic_helper.c
>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
>> @@ -1741,6 +1741,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
>> struct drm_crtc_state *crtc_state;
>> struct drm_plane_state *primary_state;
>> struct drm_crtc *crtc = set->crtc;
>> + int hdisplay, vdisplay;
>> int ret;
>>
>> crtc_state = drm_atomic_get_crtc_state(state, crtc);
>> @@ -1783,19 +1784,21 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
>> if (ret != 0)
>> return ret;
>>
>> + drm_crtc_get_hv_timing(set->mode, &hdisplay, &vdisplay);
>> +
>> drm_atomic_set_fb_for_plane(primary_state, set->fb);
>> primary_state->crtc_x = 0;
>> primary_state->crtc_y = 0;
>> - primary_state->crtc_h = set->mode->vdisplay;
>> - primary_state->crtc_w = set->mode->hdisplay;
>> + primary_state->crtc_h = vdisplay;
>> + primary_state->crtc_w = hdisplay;
>> primary_state->src_x = set->x << 16;
>> primary_state->src_y = set->y << 16;
>> if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
>> - primary_state->src_h = set->mode->hdisplay << 16;
>> - primary_state->src_w = set->mode->vdisplay << 16;
>> + primary_state->src_h = hdisplay << 16;
>> + primary_state->src_w = vdisplay << 16;
>> } else {
>> - primary_state->src_h = set->mode->vdisplay << 16;
>> - primary_state->src_w = set->mode->hdisplay << 16;
>> + primary_state->src_h = vdisplay << 16;
>> + primary_state->src_w = hdisplay << 16;
>> }
>>
>> commit:
>> --
>> 2.4.10
>>
--
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 7+ messages in thread