drm/i915: Do not do fb src adjustments for NV12
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): F653A0A18852B74D88578FA2EB7094EAB6850B06@BGSMSX108.gar.corp.intel.com
Lets move this to intel-gfx to get more eyes on it.
Quoted 129 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 47 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct
Quoted 19 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst <[email protected]>
Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@ intel_check_primary_plane(struct
intel_plane*plane,Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c +5
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state); if (INTEL_GEN(dev_priv) >= 9) { /* use scaler when colorkey is not required */ @@ -13001,6 +13005,13 @@ intel_check_primary_plane(struct intel_plane *plane, if (!state->base.fb) return 0;Quoted 12 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +6
-0+if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond the screen.
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of 4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane.
This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.Quoted 3 lines
skl_check_plane_surfacecould do all the fixups and is allowed to return an error code, so we could put all SKL specific NV12 handling inthere.
Quoted 44 lines
It doesn't matter that we calculate potentially illegal values, if we never program them and return
-EINVALthere. If it turns out we've been too paranoid we could relax the condition.This would mean unified handling for NV12 for primary and sprite. :)
drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct intel_plane
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +0
-0if (INTEL_GEN (dev_priv) >=9 ) { ret =skl_check_plane_surface (crtc_state, state);if (ret)drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -1035,11 +1035,20 @@ intel_check_sprite_plane(struct intel_plane*plane,
drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct intel_plane · line 1042
Quoted 8 lines
drivers/gpu/drm/i915/intel_sprite.c +5
-0return vscale; } +if (fb->format->format ==DRM_FORMAT_NV12 ) { +if (src->x2 >>16 ==16 ) + src->x2 =16 <<16 ; +if (src->y2 >>16 ==16 ) + src->y2 =16 <<16 ;This part doesn't look required, the magic below for the nv12 format is similar.. Just conditionally call
adjust_sizefor format != NV12. :)drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct intel_plane · line 1046
Quoted 4 lines
drivers/gpu/drm/i915/intel_sprite.c +3
-0+ goto nv12_min_no_clip; + } +/* Make the source viewport size an exact multiple of the scaling factors. */
drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct intel_plane · line 1048
Quoted 2 lines
drivers/gpu/drm/i915/intel_sprite.c +0
-0drm_rect_adjust_size(src, drm_rect_width(dst) * hscale -
drm_rect_width(src),drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct intel_plane · line 1049
Quoted 1 line
drivers/gpu/drm/i915/intel_sprite.c +0
-0drm_rect_height(dst) * vscale -
drm_rect_height(src));drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct intel_plane
Quoted 6 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-0+nv12_min_no_clip:drm_rect_rotate_inv (src, fb->width <<16 , fb->height <<16 , state->base.rotation);@@ -1105,6 +1114,12 @@ intel_check_sprite_plane(struct intel_plane*plane,
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_sprite.c intel_check_sprite_plane(struct intel_plane · line 1122
Quoted 9 lines
drivers/gpu/drm/i915/intel_sprite.c +6
-0src->x2 = (src_x + src_w) <<16 ; src->y1 = src_y <<16 ; src->y2 = (src_y + src_h) <<16 ; +if (fb->format->format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 80 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 78 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 47 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct
Quoted 19 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst <[email protected]>
Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@ intel_check_primary_plane(struct
intel_plane*plane,Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c +5
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state); if (INTEL_GEN(dev_priv) >= 9) { /* use scaler when colorkey is not required */ @@ -13001,6 +13005,13 @@ intel_check_primary_plane(struct intel_plane *plane, if (!state->base.fb) return 0;Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +6
-0+if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond the screen.
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of 4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane.
This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.
Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before adjustment.. plane_state->src_x/y/w/h is the property set by the user, while the plane_state->src rect is set and fixed up in the kernel.
Rejecting clipping with positive coordinates if pipe_src w/h
is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which is what userspace wants there.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 96 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected]; intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 82 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 80 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 48 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct
Quoted 19 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst <[email protected]>
Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@ intel_check_primary_plane(struct
intel_plane*plane,Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c +5
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state); if (INTEL_GEN(dev_priv) >= 9) { /* use scaler when colorkey is not required */ @@ -13001,6 +13005,13 @@ intel_check_primary_plane(struct intel_plane *plane, if (!state->base.fb) return 0;Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +6
-0+if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond the screen.
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of 4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane.
This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.
Quoted 9 lines
Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before adjustment.. plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which is what userspace wants there.
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing (mult of 4 later). Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 99 lines
Quoted 99 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected]; intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 82 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 80 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 48 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct
Quoted 19 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst <[email protected]>
Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@ intel_check_primary_plane(struct
intel_plane*plane,Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c +5
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state); if (INTEL_GEN(dev_priv) >= 9) { /* use scaler when colorkey is not required */ @@ -13001,6 +13005,13 @@ intel_check_primary_plane(struct intel_plane *plane, if (!state->base.fb) return 0;Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +6
-0+if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond the screen.
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of 4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane.
This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before adjustment.. plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.
Quoted 9 lines
Quoted 4 lines
Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which is what userspace wants there.Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing (mult of 4 later). Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 120 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 69 lines
Quoted 69 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected]; intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 56 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 54 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 42 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct
Quoted 19 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst <[email protected]>
Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@ intel_check_primary_plane(struct
intel_plane*plane,Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +4
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state);Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct · line 12987
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +0
-0if (INTEL_GEN (dev_priv) >=9 ) { /* use scaler when colorkey is not required */ @@ -13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_plane*plane,
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +6
-0if (!state->base.fb)return 0 ; +if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond the screen.
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of
4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane. This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.Quoted 8 lines
Quoted 8 lines
Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before adjustment.. plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 1 line
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.
Apologies for asking again. The adjustments are done in check_plane (both primary and sprite) And towards the end of check_plane we call the skl_check_plane_surface.
I got your point that we will reject the user requested values if they are not multiple of 4. But before we reach skl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enter skl_check_plane_surface. Please correct me if I am wrong or I am missing in understanding something here :(
I can add the add conversion to multiple of 4 in skl_check_plane_surface but rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment code to skl_check_plane_surface?
Regards
Vidya
Quoted 2 lines
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 156 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 1:32 PM
To: 'Maarten Lankhorst' <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 81 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 71 lines
Quoted 71 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected]; intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 58 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 56 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 44 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct
Quoted 20 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst
<[email protected]>Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@ intel_check_primary_plane(struct
intel_plane*plane,Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +4
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state);Quoted 19 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct · line 12987
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +0
-0if (INTEL_GEN (dev_priv) >=9 ) { /* use scaler when colorkey is not required */ @@ -13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_plane*plane,
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +6
-0if (!state->base.fb)return 0 ; +if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond thescreen.
Quoted 23 lines
Quoted 15 lines
Quoted 15 lines
Quoted 10 lines
Quoted 10 lines
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of
4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane. This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before adjustment.. plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.Quoted 4 lines
Quoted 4 lines
Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 3 lines
Quoted 1 line
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
Quoted 7 lines
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.Apologies for asking again. The adjustments are done in
check_plane(both primary and sprite) And towards the end ofcheck_planewe call theskl_check_plane_surface.
I got your point that we will reject the user requested values if they are not multiple of 4.
But before we reachskl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enterskl_check_plane_surface.
Please correct me if I am wrong or I am missing in understanding something here :(
Quoted 4 lines
I can add the add conversion to multiple of 4 in
skl_check_plane_surfacebut rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment code toskl_check_plane_surface?
Sorry, I got it. You said, we don’t do adjustments in case of NV12 in sprite and move The handling to skl_check_plane_surface. I will do the change and submit. Sorry. Thank you.
Quoted 4 lines
Regards
VidyaQuoted 2 lines
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Op 17-04-18 om 10:09 schreef Srinivas, Vidya:
Quoted 152 lines
Quoted 152 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 1:32 PM
To: 'Maarten Lankhorst' <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 80 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 70 lines
Quoted 70 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected]; intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 58 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 56 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 44 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct
Quoted 20 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst
<[email protected]>Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@ intel_check_primary_plane(struct
intel_plane*plane,Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +4
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state);Quoted 19 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct · line 12987
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +0
-0if (INTEL_GEN (dev_priv) >=9 ) { /* use scaler when colorkey is not required */ @@ -13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_plane*plane,
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +6
-0if (!state->base.fb)return 0 ; +if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond thescreen.
Quoted 22 lines
Quoted 15 lines
Quoted 15 lines
Quoted 10 lines
Quoted 10 lines
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of
4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane. This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before adjustment.. plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.Quoted 4 lines
Quoted 4 lines
Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 2 lines
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
Quoted 7 lines
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.Apologies for asking again. The adjustments are done in
check_plane(both primary and sprite) And towards the end ofcheck_planewe call theskl_check_plane_surface.
I got your point that we will reject the user requested values if they are not multiple of 4.
But before we reachskl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enterskl_check_plane_surface.
Please correct me if I am wrong or I am missing in understanding something here :(
Quoted 8 lines
Quoted 4 lines
I can add the add conversion to multiple of 4 in
skl_check_plane_surfacebut rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment code toskl_check_plane_surface?Sorry, I got it. You said, we don’t do adjustments in case of NV12 in sprite and move The handling to
skl_check_plane_surface. I will do the change and submit. Sorry. Thank you.
Something like below? Untested..
We should probably also restrict NV12 fb creation to not allow CCS formats.
~Maarten
drivers/gpu/drm/i915/intel_display.c +38 -0
@@ -3090,6 +3090,38 @@ static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,return 0 ; } +static int skl_check_nv12_surface (const struct intel_crtc_state *crtc_state, +struct intel_plane_state *plane_state) +{ +int crtc_x2 = plane_state->base.crtc_x + plane_state->base.crtc_w; +int crtc_y2 = plane_state->base.crtc_y + plane_state->base.crtc_h; + +/* Are the unadjusted coordinates passed in valid? */ +if ((plane_state->base.src_x >>16 ) %4 || + (plane_state->base.src_y >>16 ) %4 || + (plane_state->base.src_w >>16 ) %4 || + (plane_state->base.src_h >>16 ) %4 ) { +DRM_DEBUG_KMS ("Source coordinates must be a multiple of 4 for NV12\n" ); +return -EINVAL ; + } + +/* Clipping would cause a 1-3 pixel gap at the edge of the screen? */ +if ((crtc_x2 > crtc_state->pipe_src_w && crtc_state->pipe_src_w %4 ) || + (crtc_y2 > crtc_state->pipe_src_h && crtc_state->pipe_src_h %4 )) { +DRM_DEBUG_KMS ("It's not possible to clip %u,%u to %u,%u\n" , + crtc_x2, crtc_y2, + crtc_state->pipe_src_w, crtc_state->pipe_src_h); +return -EINVAL ; + } + +/* Make adjusted src coordinates a multiple of 4. */ + plane_state->base.src.x1 =DIV_ROUND_CLOSEST (plane_state->base.src.x1,1 <<18 ) <<18 ; + plane_state->base.src.y1 =DIV_ROUND_CLOSEST (plane_state->base.src.y1,1 <<18 ) <<18 ; + plane_state->base.src.x2 =DIV_ROUND_CLOSEST (plane_state->base.src.x2,1 <<18 ) <<18 ; + plane_state->base.src.y2 =DIV_ROUND_CLOSEST (plane_state->base.src.y2,1 <<18 ) <<18 ; +return 0 ; +} +static int skl_check_nv12_aux_surface (struct intel_plane_state *plane_state) {const struct drm_framebuffer *fb = plane_state->base.fb;
@@ -3162,6 +3194,12 @@ int skl_check_plane_surface(const struct intel_crtc_state *crtc_state,if (!plane_state->base.visible)return 0 ; +if (fb->format->format ==DRM_FORMAT_NV12 ) { + ret =skl_check_nv12_surface (crtc_state, plane_state); +if (ret) +return ret; + } +/* Rotate src coordinates to match rotated GTT view */ if (drm_rotation_90_or_270 (rotation)) drm_rect_rotate(&plane_state->base.src,
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 229 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:04 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Op 17-04-18 om 10:09 schreef Srinivas, Vidya:
Quoted 156 lines
Quoted 156 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 1:32 PM
To: 'Maarten Lankhorst' <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 82 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 71 lines
Quoted 71 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected];
intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 58 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 56 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 44 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct
Quoted 20 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst
<[email protected]>Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@ intel_check_primary_plane(struct
intel_plane*plane,Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +4
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state);Quoted 19 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct · line 12987
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +0
-0if (INTEL_GEN (dev_priv) >=9 ) { /* use scaler when colorkey is not required */ @@ -13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_plane*plane,
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +6
-0if (!state->base.fb)return 0 ; +if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond thescreen.
Quoted 22 lines
Quoted 15 lines
Quoted 15 lines
Quoted 10 lines
Quoted 10 lines
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of
4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane. This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before adjustment.. plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.Quoted 4 lines
Quoted 4 lines
Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 2 lines
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
Quoted 7 lines
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.Apologies for asking again. The adjustments are done in
check_plane(both primary and sprite) And towards the end ofcheck_planewe call theskl_check_plane_surface.
I got your point that we will reject the user requested values if they are not multiple of 4.
But before we reachskl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enterskl_check_plane_surface.
Please correct me if I am wrong or I am missing in understanding something here :(Quoted 3 lines
Quoted 3 lines
I can add the add conversion to multiple of 4 in
skl_check_plane_surfacebut rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment codeto
skl_check_plane_surface?Quoted 3 lines
Quoted 1 line
Sorry, I got it. You said, we don’t do adjustments in case of NV12 in sprite and move The handling to
skl_check_plane_surface. I will do thechange and submit. Sorry.
Quoted 2 lines
Thank you.
Something like below? Untested..
We should probably also restrict NV12 fb creation to not allow CCS formats.~Maarten
drivers/gpu/drm/i915/intel_display.c +16
-0@@ -3090,6 +3090,38 @@ static int skl_check_main_surface(const structintel_crtc_state *crtc_state, return 0; } +static int skl_check_nv12_surface(const struct intel_crtc_state *crtc_state, + struct intel_plane_state *plane_state) { + int crtc_x2 = plane_state->base.crtc_x + plane_state->base.crtc_w; + int crtc_y2 = plane_state->base.crtc_y + plane_state->base.crtc_h; + + /* Are the unadjusted coordinates passed in valid? */ + if ((plane_state->base.src_x >> 16) % 4 || + (plane_state->base.src_y >> 16) % 4 || + (plane_state->base.src_w >> 16) % 4 || + (plane_state->base.src_h >> 16) % 4) { + DRM_DEBUG_KMS("Source coordinates must be a multiple of 4 for NV12\n"); + return -EINVAL; + } + + /* Clipping would cause a 1-3 pixel gap at the edge of the screen? */ + if ((crtc_x2 > crtc_state->pipe_src_w && crtc_state->pipe_src_w %4) ||
drivers/gpu/drm/i915/intel_display.c +1
-0+ (crtc_y2 > crtc_state->pipe_src_h && crtc_state->pipe_src_h % 4)){
drivers/gpu/drm/i915/intel_display.c +1
-0+ DRM_DEBUG_KMS("It's not possible to clip %u,%u to%u,%u\n",
drivers/gpu/drm/i915/intel_display.c +7
-0+ crtc_x2, crtc_y2, + crtc_state->pipe_src_w, crtc_state->pipe_src_h); +return -EINVAL ; + } + +/* Make adjusted src coordinates a multiple of 4. */ + plane_state->base.src.x1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.x2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state, · line 3124
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +3
-0+return 0 ; +} +
Thank you so much :) Only one problem. The primary plane clipping happens inside the drm layer in drm_atomic_helper_check_plane_state So, clipping-clamping test passes coordinates 0, 257, 0, 159 to check_plane. And there before adjusting we reject. So for primary alone, can I retain the make multiple of 4 code in primary itself?
Quoted 7 lines
static int skl_check_nv12_aux_surface(struct
intel_plane_state*plane_state) {
const structdrm_framebuffer*fb =plane_state->base.fb; @@ -
3162,6 +3194,12 @@ int skl_check_plane_surface(const structintel_crtc_state*crtc_state,drivers/gpu/drm/i915/intel_display.c +0
-0if (!plane_state->base.visible)return 0 ;
drivers/gpu/drm/i915/intel_display.c int skl_check_plane_surface(const struct intel_crtc_state *crtc_state, · line 3205
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +6
-0+if (fb->format->format ==DRM_FORMAT_NV12 ) { + ret =skl_check_nv12_surface (crtc_state, plane_state); +if (ret) +return ret; + } +/* Rotate src coordinates to match rotated GTT view */ if (drm_rotation_90_or_270 (rotation)) drm_rect_rotate(&plane_state->base.src,
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Op 17-04-18 om 11:42 schreef Srinivas, Vidya:
Quoted 226 lines
Quoted 226 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:04 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Op 17-04-18 om 10:09 schreef Srinivas, Vidya:
Quoted 155 lines
Quoted 155 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 1:32 PM
To: 'Maarten Lankhorst' <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 82 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 71 lines
Quoted 71 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected];
intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 58 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 56 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 44 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct
Quoted 20 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst
<[email protected]>Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@ intel_check_primary_plane(struct
intel_plane*plane,Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +4
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state);Quoted 19 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c intel_check_primary_plane(struct · line 12987
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +0
-0if (INTEL_GEN (dev_priv) >=9 ) { /* use scaler when colorkey is not required */ @@ -13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_plane*plane,
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +6
-0if (!state->base.fb)return 0 ; +if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond thescreen.
Quoted 22 lines
Quoted 15 lines
Quoted 15 lines
Quoted 10 lines
Quoted 10 lines
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of
4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane. This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before adjustment.. plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.Quoted 4 lines
Quoted 4 lines
Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 2 lines
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
Quoted 7 lines
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.Apologies for asking again. The adjustments are done in
check_plane(both primary and sprite) And towards the end ofcheck_planewe call theskl_check_plane_surface.
I got your point that we will reject the user requested values if they are not multiple of 4.
But before we reachskl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enterskl_check_plane_surface.
Please correct me if I am wrong or I am missing in understanding something here :(Quoted 3 lines
Quoted 3 lines
I can add the add conversion to multiple of 4 in
skl_check_plane_surfacebut rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment codeto
skl_check_plane_surface?Quoted 2 lines
Sorry, I got it. You said, we don’t do adjustments in case of NV12 in sprite and move The handling to
skl_check_plane_surface. I will do thechange and submit. Sorry.
Quoted 2 lines
Thank you.
Something like below? Untested..
We should probably also restrict NV12 fb creation to not allow CCS formats.~Maarten
drivers/gpu/drm/i915/intel_display.c +16
-0@@ -3090,6 +3090,38 @@ static int skl_check_main_surface(const structintel_crtc_state *crtc_state, return 0; } +static int skl_check_nv12_surface(const struct intel_crtc_state *crtc_state, + struct intel_plane_state *plane_state) { + int crtc_x2 = plane_state->base.crtc_x + plane_state->base.crtc_w; + int crtc_y2 = plane_state->base.crtc_y + plane_state->base.crtc_h; + + /* Are the unadjusted coordinates passed in valid? */ + if ((plane_state->base.src_x >> 16) % 4 || + (plane_state->base.src_y >> 16) % 4 || + (plane_state->base.src_w >> 16) % 4 || + (plane_state->base.src_h >> 16) % 4) { + DRM_DEBUG_KMS("Source coordinates must be a multiple of 4 for NV12\n"); + return -EINVAL; + } + + /* Clipping would cause a 1-3 pixel gap at the edge of the screen? */ + if ((crtc_x2 > crtc_state->pipe_src_w && crtc_state->pipe_src_w %4) ||
drivers/gpu/drm/i915/intel_display.c +1
-0+ (crtc_y2 > crtc_state->pipe_src_h && crtc_state->pipe_src_h % 4)){
drivers/gpu/drm/i915/intel_display.c +1
-0+ DRM_DEBUG_KMS("It's not possible to clip %u,%u to%u,%u\n",
drivers/gpu/drm/i915/intel_display.c +7
-0+ crtc_x2, crtc_y2, + crtc_state->pipe_src_w, crtc_state->pipe_src_h); +return -EINVAL ; + } + +/* Make adjusted src coordinates a multiple of 4. */ + plane_state->base.src.x1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.x2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y2, 1 << 18) << 18;
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state, · line 3124
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +3
-0+return 0 ; +} +Thank you so much :) Only one problem. The primary plane clipping happens inside the drm layer in
drm_atomic_helper_check_plane_stateSo, clipping-clamping test passes coordinates 0, 257, 0, 159 tocheck_plane. And there before adjusting we reject. So for primary alone, can I retain the make multiple of 4 code in primary itself?
The clipping affects plane_state->src.{x1, y1, x2, y2}, not plane_state->src_{x,y,w,h}. They're different. The last set of coordinates will not be rotated or anything, the first set of coordinates are what we end up programming into the hardware. The patch I put above should be correctly rounding to a multiple of 4. :)
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 259 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:32 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Op 17-04-18 om 11:42 schreef Srinivas, Vidya:
Quoted 93 lines
Quoted 93 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:04 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 10:09 schreef Srinivas, Vidya:
Quoted 81 lines
Quoted 81 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 1:32 PM
To: 'Maarten Lankhorst' <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 68 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 57 lines
Quoted 57 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected];
intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 43 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 41 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 29 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
Quoted 14 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst
<[email protected]>Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@intel_check_primary_plane(struct
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
intel_plane*plane,Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +4
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state);Quoted 20 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c line 12987
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +0
-0if (INTEL_GEN (dev_priv) >=9 ) { /* use scaler when colorkey is not required */ @@ -13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_plane*plane,
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +6
-0if (!state->base.fb)return 0 ; +if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond thescreen.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of
4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane. This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before
adjustment..
Quoted 33 lines
Quoted 33 lines
Quoted 28 lines
Quoted 28 lines
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 2 lines
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
Quoted 7 lines
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.Apologies for asking again. The adjustments are done in
check_plane(both primary and sprite) And towards the end ofcheck_planewe call theskl_check_plane_surface.
I got your point that we will reject the user requested values if they are not multiple of 4.
But before we reachskl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enterskl_check_plane_surface.
Please correct me if I am wrong or I am missing in understanding something here :(Quoted 4 lines
Quoted 4 lines
I can add the add conversion to multiple of 4 in
skl_check_plane_surfacebut rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment codeto
skl_check_plane_surface?Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Sorry, I got it. You said, we don’t do adjustments in case of NV12 in sprite and move The handling to
skl_check_plane_surface. I will do thechange and submit. Sorry.
Quoted 2 lines
Thank you.
Something like below? Untested..
We should probably also restrict NV12 fb creation to not allow CCSformats.
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const
Quoted 9 lines
~Maarten
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -3090,6 +3090,38 @@ static int skl_check_main_surface(conststruct
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0intel_crtc_state *crtc_state, return 0; } +static int skl_check_nv12_surface(const struct intel_crtc_state
*crtc_state,Quoted 34 lines
Quoted 34 lines
drivers/gpu/drm/i915/intel_display.c +15
-0+ struct intel_plane_state *plane_state) { + int crtc_x2 = plane_state->base.crtc_x + plane_state->base.crtc_w; + int crtc_y2 = plane_state->base.crtc_y + plane_state->base.crtc_h; + + /* Are the unadjusted coordinates passed in valid? */ + if ((plane_state->base.src_x >> 16) % 4 || + (plane_state->base.src_y >> 16) % 4 || + (plane_state->base.src_w >> 16) % 4 || + (plane_state->base.src_h >> 16) % 4) { + DRM_DEBUG_KMS("Source coordinates must be a multiple of 4 for NV12\n"); + return -EINVAL; + } + + /* Clipping would cause a 1-3 pixel gap at the edge of the screen? */ + if ((crtc_x2 > crtc_state->pipe_src_w && crtc_state->pipe_src_w %4) ||
drivers/gpu/drm/i915/intel_display.c +2
-0+ (crtc_y2 > crtc_state->pipe_src_h && crtc_state->pipe_src_h % +4)){
drivers/gpu/drm/i915/intel_display.c +1
-0+ DRM_DEBUG_KMS("It's not possible to clip %u,%u to%u,%u\n",
drivers/gpu/drm/i915/intel_display.c +7
-0+ crtc_x2, crtc_y2, + crtc_state->pipe_src_w, crtc_state->pipe_src_h); +return -EINVAL ; + } + +/* Make adjusted src coordinates a multiple of 4. */ + plane_state->base.src.x1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.x2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x2, 1 << 18) << 18;
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state, · line 3124
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +3
-0+return 0 ; +} +Thank you so much :) Only one problem. The primary plane clipping happens inside the drm layer in
drm_atomic_helper_check_plane_stateSo, clipping-clamping test passes coordinates 0, 257, 0, 159 to
check_plane.Quoted 2 lines
And there before adjusting we reject. So for primary alone, can I retain the make multiple of 4 code in primary itself?
Quoted 6 lines
The clipping affects plane_state->src.{x1, y1, x2, y2}, not plane_state-
Quoted 1 line
src_{x,y,w,h}.
They're different. The last set of coordinates will not be rotated or anything, the first set of coordinates are what we end up programming into the hardware. The patch I put above should be correctly rounding to a multiple of 4. :)
Oh sorry. I will put this patch. Thanks so much.
Quoted 2 lines
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 191 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:32 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Op 17-04-18 om 11:42 schreef Srinivas, Vidya:
Quoted 93 lines
Quoted 93 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:04 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 10:09 schreef Srinivas, Vidya:
Quoted 81 lines
Quoted 81 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 1:32 PM
To: 'Maarten Lankhorst' <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 68 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 57 lines
Quoted 57 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected];
intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 43 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 41 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 29 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
Quoted 14 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst
<[email protected]>Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@intel_check_primary_plane(struct
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
intel_plane*plane,Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +4
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state);Quoted 20 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c line 12987
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +0
-0if (INTEL_GEN (dev_priv) >=9 ) { /* use scaler when colorkey is not required */ @@ -13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_plane*plane,
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +6
-0if (!state->base.fb)return 0 ; +if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond thescreen.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of
4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane. This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before
adjustment..
Quoted 36 lines
Quoted 36 lines
Quoted 28 lines
Quoted 28 lines
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 2 lines
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
Quoted 7 lines
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.Apologies for asking again. The adjustments are done in
check_plane(both primary and sprite) And towards the end ofcheck_planewe call theskl_check_plane_surface.
I got your point that we will reject the user requested values if they are not multiple of 4.
But before we reachskl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enterskl_check_plane_surface.
Please correct me if I am wrong or I am missing in understanding something here :(Quoted 4 lines
Quoted 4 lines
I can add the add conversion to multiple of 4 in
skl_check_plane_surfacebut rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment codeto
skl_check_plane_surface?Quoted 3 lines
Sorry, I got it. You said, we don’t do adjustments in case of NV12 in sprite and move The handling to
skl_check_plane_surface. I will do the
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
change and submit. Sorry.
Quoted 2 lines
Thank you.
Something like below? Untested..
We should probably also restrict NV12 fb creation to not allow CCSformats.
Thank you so much. Have submitted the changes to trybot
https://patchwork.freedesktop.org/series/41532/
PS: fb creation to not allow CCS - not done in this series
Regards
Vidya
Quoted 62 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const
Quoted 9 lines
~Maarten
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -3090,6 +3090,38 @@ static int skl_check_main_surface(conststruct
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0intel_crtc_state *crtc_state, return 0; } +static int skl_check_nv12_surface(const struct intel_crtc_state
*crtc_state,Quoted 34 lines
Quoted 34 lines
drivers/gpu/drm/i915/intel_display.c +15
-0+ struct intel_plane_state *plane_state) { + int crtc_x2 = plane_state->base.crtc_x + plane_state->base.crtc_w; + int crtc_y2 = plane_state->base.crtc_y + plane_state->base.crtc_h; + + /* Are the unadjusted coordinates passed in valid? */ + if ((plane_state->base.src_x >> 16) % 4 || + (plane_state->base.src_y >> 16) % 4 || + (plane_state->base.src_w >> 16) % 4 || + (plane_state->base.src_h >> 16) % 4) { + DRM_DEBUG_KMS("Source coordinates must be a multiple of 4 for NV12\n"); + return -EINVAL; + } + + /* Clipping would cause a 1-3 pixel gap at the edge of the screen? */ + if ((crtc_x2 > crtc_state->pipe_src_w && crtc_state->pipe_src_w %4) ||
drivers/gpu/drm/i915/intel_display.c +2
-0+ (crtc_y2 > crtc_state->pipe_src_h && crtc_state->pipe_src_h % +4)){
drivers/gpu/drm/i915/intel_display.c +1
-0+ DRM_DEBUG_KMS("It's not possible to clip %u,%u to%u,%u\n",
drivers/gpu/drm/i915/intel_display.c +7
-0+ crtc_x2, crtc_y2, + crtc_state->pipe_src_w, crtc_state->pipe_src_h); +return -EINVAL ; + } + +/* Make adjusted src coordinates a multiple of 4. */ + plane_state->base.src.x1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.x2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x2, 1 << 18) << 18;
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state, · line 3124
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +3
-0+return 0 ; +} +Thank you so much :) Only one problem. The primary plane clipping happens inside the drm layer in
drm_atomic_helper_check_plane_stateSo, clipping-clamping test passes coordinates 0, 257, 0, 159 to
check_plane.Quoted 2 lines
And there before adjusting we reject. So for primary alone, can I retain the make multiple of 4 code in primary itself?
Quoted 8 lines
The clipping affects plane_state->src.{x1, y1, x2, y2}, not plane_state-
Quoted 1 line
src_{x,y,w,h}.
They're different. The last set of coordinates will not be rotated or anything, the first set of coordinates are what we end up programming into the hardware. The patch I put above should be correctly rounding to a multiple of 4. :)
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
HI,
Quoted 208 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 13.49
To: Maarten Lankhorst <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 9 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:32 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 93 lines
Op 17-04-18 om 11:42 schreef Srinivas, Vidya:
Quoted 92 lines
Quoted 92 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:04 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 10:09 schreef Srinivas, Vidya:
Quoted 80 lines
Quoted 80 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 1:32 PM
To: 'Maarten Lankhorst' <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 67 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 55 lines
Quoted 55 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected];
intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 41 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 39 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 27 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
Quoted 12 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly.
Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst
<[email protected]>
Signed-off-by: Vidya Srinivas <[email protected]>
---
drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++
drivers/gpu/drm/i915/intel_sprite.c | 15+++++++++++++++
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
2 files changed, 26 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_display.c
b/drivers/gpu/drm/i915/intel_display.c
index bc83f10..f64708f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12978,6 +12978,10 @@intel_check_primary_plane(struct
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
intel_plane*plane,Quoted 4 lines
bool can_position = false;
int ret;
uint32_t pixel_format = 0;
+ struct drm_plane_state *plane_state = &state-base;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+ struct drm_rect *src = &plane_state->src;
+
+ *src = drm_plane_state_src(plane_state);if (INTEL_GEN(dev_priv) >= 9) {
/* use scaler when colorkey is not required*/ @@ -
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_planeQuoted 70 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 16 lines
*plane,
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 9 lines
if (!state->base.fb)
return 0;+ if (pixel_format == DRM_FORMAT_NV12) {
+ src->x1 = (((src->x1 >> 16)/4)*4) << 16;
+ src->x2 = (((src->x2 >> 16)/4)*4) << 16;
+ src->y1 = (((src->y1 >> 16)/4)*4) << 16;
+ src->y2 = (((src->y2 >> 16)/4)*4) << 16;
+ }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond thescreen.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of
4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane. This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with
16x16 like rotation will fail due to it getting adjusted.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before
adjustment..
Quoted 39 lines
Quoted 39 lines
Quoted 28 lines
Quoted 28 lines
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 2 lines
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
Quoted 7 lines
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.Apologies for asking again. The adjustments are done in
check_plane(both primary and sprite) And towards the end ofcheck_planewe call theskl_check_plane_surface.
I got your point that we will reject the user requested values if they are not multiple of 4.
But before we reachskl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enterskl_check_plane_surface.
Please correct me if I am wrong or I am missing in understanding something here :(Quoted 4 lines
Quoted 4 lines
I can add the add conversion to multiple of 4 in
skl_check_plane_surfacebut rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment codeto
skl_check_plane_surface?Quoted 3 lines
Sorry, I got it. You said, we don’t do adjustments in case of NV12 in sprite and move The handling to
skl_check_plane_surface. I will do thechange and submit. Sorry.
Quoted 2 lines
Thank you.
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Something like below? Untested..
We should probably also restrict NV12 fb creation to not allow CCSformats.
Thank you so much. Have submitted the changes to trybot
https://patchwork.freedesktop.org/series/41532/
PS: fb creation to not allow CCS - not done in this series
Why not directly to intel-gfx?
Quoted 76 lines
Regards
VidyaQuoted 72 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const
Quoted 9 lines
~Maarten
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -3090,6 +3090,38 @@ static int skl_check_main_surface(conststruct
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0intel_crtc_state *crtc_state, return 0; } +static int skl_check_nv12_surface(const struct intel_crtc_state
*crtc_state,Quoted 35 lines
Quoted 35 lines
drivers/gpu/drm/i915/intel_display.c +16
-0+ struct intel_plane_state *plane_state) { + int crtc_x2 = plane_state->base.crtc_x + plane_state->base.crtc_w; + int crtc_y2 = plane_state->base.crtc_y + +plane_state->base.crtc_h; + + /* Are the unadjusted coordinates passed in valid? */ + if ((plane_state->base.src_x >> 16) % 4 || + (plane_state->base.src_y >> 16) % 4 || + (plane_state->base.src_w >> 16) % 4 || + (plane_state->base.src_h >> 16) % 4) { + DRM_DEBUG_KMS("Source coordinates must be a multiple of 4 for NV12\n"); + return -EINVAL; + } + + /* Clipping would cause a 1-3 pixel gap at the edge of the screen? */ + if ((crtc_x2 > crtc_state->pipe_src_w && crtc_state->pipe_src_w %4) ||
drivers/gpu/drm/i915/intel_display.c +2
-0+ (crtc_y2 > crtc_state->pipe_src_h && crtc_state->pipe_src_h % +4)){
drivers/gpu/drm/i915/intel_display.c +1
-0+ DRM_DEBUG_KMS("It's not possible to clip %u,%u to%u,%u\n",
drivers/gpu/drm/i915/intel_display.c +7
-0+ crtc_x2, crtc_y2, + crtc_state->pipe_src_w, crtc_state->pipe_src_h); +return -EINVAL ; + } + +/* Make adjusted src coordinates a multiple of 4. */ + plane_state->base.src.x1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.x2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x2, 1 << 18) << 18;
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state, · line 3124
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +3
-0+return 0 ; +} +Thank you so much :) Only one problem. The primary plane clipping happens inside the drm layer in
drm_atomic_helper_check_plane_stateSo, clipping-clamping test passes coordinates 0, 257, 0, 159 to
check_plane.Quoted 2 lines
And there before adjusting we reject. So for primary alone, can I retain the make multiple of 4 code in primary itself?
The clipping affects plane_state->src.{x1, y1, x2, y2}, not plane_state-
Quoted 1 line
src_{x,y,w,h}.
They're different. The last set of coordinates will not be rotated or anything, the first set of coordinates are what we end up programming into the hardware. The patch I put above should be correctly rounding to a multiple of 4. :)
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 226 lines
-----Original Message-----
From: Saarinen, Jani
Sent: Tuesday, April 17, 2018 4:23 PM
To: Srinivas, Vidya <[email protected]>; Maarten Lankhorst <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12HI,
Quoted 214 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 13.49
To: Maarten Lankhorst <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 10 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:32 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 94 lines
Op 17-04-18 om 11:42 schreef Srinivas, Vidya:
Quoted 93 lines
Quoted 93 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:04 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 10:09 schreef Srinivas, Vidya:
Quoted 80 lines
Quoted 80 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 1:32 PM
To: 'Maarten Lankhorst' <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 67 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 55 lines
Quoted 55 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected];
intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 41 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 39 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 27 lines
-----Original Message-----
From: Maarten Lankhorst
[mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>;
intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen,
Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src
adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
We skip src trunction/adjustments for
NV12 case and handle the sizes directly.
Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst
<[email protected]>
Signed-off-by: Vidya Srinivas <[email protected]>
---
drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++
drivers/gpu/drm/i915/intel_sprite.c | 15+++++++++++++++
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
2 files changed, 26 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_display.c
b/drivers/gpu/drm/i915/intel_display.c
index bc83f10..f64708f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12978,6 +12978,10 @@intel_check_primary_plane(struct
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
intel_plane *plane,
bool can_position = false;
int ret;
uint32_t pixel_format = 0;
+ struct drm_plane_state *plane_state = &state-base;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+ struct drm_rect *src = &plane_state->src;
+
+ *src = drm_plane_state_src(plane_state);if (INTEL_GEN(dev_priv) >= 9) {
/* use scaler when colorkey is not required*/ @@ -
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_planeQuoted 73 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Quoted 16 lines
*plane,
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
if (!state->base.fb)
return 0;+ if (pixel_format == DRM_FORMAT_NV12) {
+ src->x1 = (((src->x1 >> 16)/4)*4) << 16;
+ src->x2 = (((src->x2 >> 16)/4)*4) << 16;
+ src->y1 = (((src->y1 >> 16)/4)*4) << 16;
+ src->y2 = (((src->y2 >> 16)/4)*4) << 16;
+ }
Lets reject non multiple of 4 coordinates for
plane_state's src_x and src_y, and before adjustment also
reject non multiple of 4 src_w/src_h.fter that we can
also reject clipping to the right/bottom edge of the
screen, if the pipe_src_w/h is not a multiple of 4. That
way an application trying to go beyond thescreen.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of
4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane. This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with
16x16 like rotation will fail due to it getting adjusted.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before
adjustment..
Quoted 42 lines
Quoted 42 lines
Quoted 28 lines
Quoted 28 lines
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 2 lines
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
Quoted 7 lines
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.Apologies for asking again. The adjustments are done in
check_plane(both primary and sprite) And towards the end ofcheck_planewe call theskl_check_plane_surface.
I got your point that we will reject the user requested values if they are not multiple of 4.
But before we reachskl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enterskl_check_plane_surface.
Please correct me if I am wrong or I am missing in understanding something here :(Quoted 4 lines
Quoted 4 lines
I can add the add conversion to multiple of 4 in
skl_check_plane_surfacebut rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment codeto
skl_check_plane_surface?Quoted 3 lines
Sorry, I got it. You said, we don’t do adjustments in case of NV12 in sprite and move The handling to
skl_check_plane_surface. I will do thechange and submit. Sorry.
Quoted 2 lines
Thank you.
Something like below? Untested..
We should probably also restrict NV12 fb creation to not allow CCS
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
formats.
Thank you so much. Have submitted the changes to trybot
https://patchwork.freedesktop.org/series/41532/
PS: fb creation to not allow CCS - not done in this seriesWhy not directly to intel-gfx?
Sure, I thought I had to send to trybot first. Will send it today.
Thanks
Vidya
Quoted 64 lines
Quoted 16 lines
Regards
VidyaQuoted 10 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const
Quoted 9 lines
~Maarten
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -3090,6 +3090,38 @@ static int skl_check_main_surface(conststruct
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0intel_crtc_state *crtc_state, return 0; } +static int skl_check_nv12_surface(const struct intel_crtc_state
*crtc_state,Quoted 1 line
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const · line 3095
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+struct intel_plane_state
*plane_state) {Quoted 11 lines
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const · line 3096
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+ int crtc_x2 = plane_state->base.crtc_x + plane_state-base.crtc_w;
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +9
-0+int crtc_y2 = plane_state->base.crtc_y + +plane_state->base.crtc_h; + +/* Are the unadjusted coordinates passed in valid? */ +if ((plane_state->base.src_x >>16 ) %4 || + (plane_state->base.src_y >>16 ) %4 || + (plane_state->base.src_w >>16 ) %4 || + (plane_state->base.src_h >>16 ) %4 ) { + DRM_DEBUG_KMS("Source coordinates must be amultiple
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +4
-0of 4 for NV12\n"); + return -EINVAL ; + } + +/* Clipping would cause a 1-3 pixel gap at the edge of the screen? */
Quoted 10 lines
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const · line 3111
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+ if ((crtc_x2 > crtc_state->pipe_src_w && crtc_state-
pipe_src_wQuoted 3 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +1
-0+%4) ||
drivers/gpu/drm/i915/intel_display.c +1
-0+ (crtc_y2 > crtc_state->pipe_src_h && crtc_state-
pipe_src_hQuoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 4 lines
+%
+4))
{drivers/gpu/drm/i915/intel_display.c +1
-0+ DRM_DEBUG_KMS("It's not possible to clip %u,%uto
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 3 lines
%u,%u\n",
drivers/gpu/drm/i915/intel_display.c +2
-0+ crtc_x2, crtc_y2, + crtc_state->pipe_src_w, crtc_state-
pipe_src_h);Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+return -EINVAL ; + } + +/* Make adjusted src coordinates a multiple of 4. */ + plane_state->base.src.x1 =DIV_ROUND_CLOSEST(plane_state-
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
base.src.x1, 1 << 18) << 18;
Quoted 29 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y1 =DIV_ROUND_CLOSEST(plane_state-
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 2 lines
Quoted 1 line
base.src.y1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.x2 =DIV_ROUND_CLOSEST(plane_state-
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 2 lines
Quoted 1 line
base.src.x2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y2 =DIV_ROUND_CLOSEST(plane_state-
Quoted 21 lines
Quoted 21 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state, · line 3124
Quoted 4 lines
Quoted 1 line
base.src.y2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +3
-0+return 0 ; +} +Thank you so much :) Only one problem. The primary plane clipping happens inside the drm layer in
drm_atomic_helper_check_plane_state
So, clipping-clamping test passes coordinates 0, 257, 0, 159 to
check_plane.Quoted 2 lines
And there before adjusting we reject. So for primary alone, can I retain the make multiple of 4 code in primary itself?
The clipping affects plane_state->src.{x1, y1, x2, y2}, not plane_state-
Quoted 1 line
src_{x,y,w,h}.
They're different. The last set of coordinates will not be rotated or anything, the first set of coordinates are what we end up programming into the hardware. The patch I put above should be correctly rounding to a multiple of 4. :)
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi,
Quoted 241 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: keskiviikko 18. huhtikuuta 2018 6.56
To: Saarinen, Jani <[email protected]>; Maarten Lankhorst <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 9 lines
-----Original Message-----
From: Saarinen, Jani
Sent: Tuesday, April 17, 2018 4:23 PM
To: Srinivas, Vidya <[email protected]>; Maarten Lankhorst <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 171 lines
HI,
Quoted 170 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 13.49
To: Maarten Lankhorst <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 10 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:32 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 98 lines
Op 17-04-18 om 11:42 schreef Srinivas, Vidya:
Quoted 97 lines
Quoted 97 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:04 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 10:09 schreef Srinivas, Vidya:
Quoted 84 lines
Quoted 84 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 1:32 PM
To: 'Maarten Lankhorst' <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 71 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 58 lines
Quoted 58 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected];
intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 44 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 42 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst
<[email protected]>;
intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen,
Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src
adjustments for NV12-----Original Message-----
From: Maarten Lankhorst
[mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>;
intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen,
Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src
adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
We skip src trunction/adjustments for
NV12 case and handle the sizes directly.
Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of
4Credits-to: Maarten Lankhorst
<[email protected]>
Signed-off-by: Vidya Srinivas
<[email protected]>
---
drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++
drivers/gpu/drm/i915/intel_sprite.c | 15+++++++++++++++
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
2 files changed, 26 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_display.c
b/drivers/gpu/drm/i915/intel_display.c
index bc83f10..f64708f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12978,6 +12978,10 @@intel_check_primary_plane(struct
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
intel_plane *plane,
bool can_position = false;
int ret;
uint32_t pixel_format = 0;
+ struct drm_plane_state *plane_state = &state-base;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+ struct drm_rect *src = &plane_state->src;
+
+ *src = drm_plane_state_src(plane_state);if (INTEL_GEN(dev_priv) >= 9) {
/* use scaler when colorkey is not required*/ @@ -
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_planeQuoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 16 lines
*plane,
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
if (!state->base.fb)
return 0;+ if (pixel_format == DRM_FORMAT_NV12) {
+ src->x1 = (((src->x1 >> 16)/4)*4) << 16;
+ src->x2 = (((src->x2 >> 16)/4)*4) << 16;
+ src->y1 = (((src->y1 >> 16)/4)*4) << 16;
+ src->y2 = (((src->y2 >> 16)/4)*4) << 16;
+ }
Lets reject non multiple of 4 coordinates for
plane_state's src_x and src_y, and before adjustment
also reject non multiple of 4 src_w/src_h.fter that we
can also reject clipping to the right/bottom edge of
the screen, if the pipe_src_w/h is not a multiple of 4.
That way an application trying to go beyond thescreen.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
kms_plane_scaling and some other tests during execution
generate lots of non mult of 4 buffer width/height. All
these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be
multiple of
4 before the Adjustment (say our 16x16 buffer), this
after adjustment becomes a 15 in
intel_check_sprite_plane.Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
This again would cause underrun. If we reject non
multiple of 4s in our skl_update_scaler also, then even
simple tests with
16x16 like rotation will fail due to it getting adjusted.Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before
adjustment..
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in thekernel.
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 26 lines
Quoted 26 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 2 lines
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
Quoted 7 lines
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.Apologies for asking again. The adjustments are done in
check_plane(both primary and sprite) And towards the end ofcheck_planewe call theskl_check_plane_surface.
I got your point that we will reject the user requested values if they are not multiple of 4.
But before we reachskl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enterskl_check_plane_surface.
Please correct me if I am wrong or I am missing in understanding something here :(Quoted 4 lines
Quoted 4 lines
I can add the add conversion to multiple of 4 in
skl_check_plane_surfacebut rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment codeto
skl_check_plane_surface?Quoted 3 lines
Sorry, I got it. You said, we don’t do adjustments in case of NV12 in sprite and move The handling to
skl_check_plane_surface. I will do thechange and submit. Sorry.
Quoted 2 lines
Thank you.
Something like below? Untested..
We should probably also restrict NV12 fb creation to not allow CCS
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
formats.
Thank you so much. Have submitted the changes to trybot
https://patchwork.freedesktop.org/series/41532/
PS: fb creation to not allow CCS - not done in this seriesWhy not directly to intel-gfx?
Sure, I thought I had to send to trybot first. Will send it today.
I see trybot for patches as test for RFC to see if solution is even near satisfactory in the beginning but for patches that has sent several times no need to send to trybot.
Quoted 97 lines
Thanks
VidyaQuoted 94 lines
Quoted 16 lines
Regards
VidyaQuoted 10 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const
Quoted 9 lines
~Maarten
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -3090,6 +3090,38 @@ static int skl_check_main_surface(conststruct
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +2
-0intel_crtc_state *crtc_state, return 0; } +static int skl_check_nv12_surface (const struct +intel_crtc_state
*crtc_state,Quoted 1 line
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const · line 3096
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+struct intel_plane_state
*plane_state) {Quoted 11 lines
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const · line 3097
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+ int crtc_x2 = plane_state->base.crtc_x + plane_state-base.crtc_w;
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +9
-0+int crtc_y2 = plane_state->base.crtc_y + +plane_state->base.crtc_h; + +/* Are the unadjusted coordinates passed in valid? */ +if ((plane_state->base.src_x >>16 ) %4 || + (plane_state->base.src_y >>16 ) %4 || + (plane_state->base.src_w >>16 ) %4 || + (plane_state->base.src_h >>16 ) %4 ) { + DRM_DEBUG_KMS("Source coordinates must be amultiple
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +4
-0of 4 for NV12\n"); + return -EINVAL ; + } + +/* Clipping would cause a 1-3 pixel gap at the edge of the screen? */
Quoted 10 lines
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const · line 3112
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+ if ((crtc_x2 > crtc_state->pipe_src_w && crtc_state-
pipe_src_wQuoted 3 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +1
-0+%4) ||
drivers/gpu/drm/i915/intel_display.c +1
-0+ (crtc_y2 > crtc_state->pipe_src_h && crtc_state-
pipe_src_hQuoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 4 lines
+%
+4))
{drivers/gpu/drm/i915/intel_display.c +1
-0+ DRM_DEBUG_KMS("It's not possible to clip %u,%uto
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 3 lines
%u,%u\n",
drivers/gpu/drm/i915/intel_display.c +2
-0+ crtc_x2, crtc_y2, + crtc_state->pipe_src_w, crtc_state-
pipe_src_h);Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+return -EINVAL ; + } + +/* Make adjusted src coordinates a multiple of 4. */ + plane_state->base.src.x1 =DIV_ROUND_CLOSEST(plane_state-
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 2 lines
Quoted 1 line
base.src.x1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y1 =DIV_ROUND_CLOSEST(plane_state-
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 2 lines
Quoted 1 line
base.src.y1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.x2 =DIV_ROUND_CLOSEST(plane_state-
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 2 lines
Quoted 1 line
base.src.x2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y2 =DIV_ROUND_CLOSEST(plane_state-
Quoted 21 lines
Quoted 21 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state, · line 3124
Quoted 4 lines
Quoted 1 line
base.src.y2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +3
-0+return 0 ; +} +Thank you so much :) Only one problem. The primary plane clipping happens inside the drm layer in
drm_atomic_helper_check_plane_state
So, clipping-clamping test passes coordinates 0, 257, 0, 159 to
check_plane.Quoted 2 lines
And there before adjusting we reject. So for primary alone, can I retain the make multiple of 4 code in primary itself?
The clipping affects plane_state->src.{x1, y1, x2, y2}, not plane_state-
Quoted 1 line
src_{x,y,w,h}.
They're different. The last set of coordinates will not be rotated or anything, the first set of coordinates are what we end up programming into the hardware. The patch I put above should be correctly rounding to a multiple of 4. :)
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 268 lines
-----Original Message-----
From: Saarinen, Jani
Sent: Wednesday, April 18, 2018 11:07 AM
To: Srinivas, Vidya <[email protected]>; Maarten Lankhorst <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Hi,
Quoted 194 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: keskiviikko 18. huhtikuuta 2018 6.56
To: Saarinen, Jani <[email protected]>; Maarten Lankhorst <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 183 lines
-----Original Message-----
From: Saarinen, Jani
Sent: Tuesday, April 17, 2018 4:23 PM
To: Srinivas, Vidya <[email protected]>; Maarten Lankhorst <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12HI,
Quoted 172 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 13.49
To: Maarten Lankhorst <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 11 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:32 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 102 lines
Op 17-04-18 om 11:42 schreef Srinivas, Vidya:
Quoted 101 lines
Quoted 101 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:04 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 10:09 schreef Srinivas, Vidya:
Quoted 87 lines
Quoted 87 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 1:32 PM
To: 'Maarten Lankhorst' <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 73 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 60 lines
Quoted 60 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected];
intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 46 lines
Lets move this to intel-gfx to get more eyes on it.
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst
<[email protected]>;
intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen,
Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src
adjustments for NV12-----Original Message-----
From: Maarten Lankhorst
[mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>;
intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen,
Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb
src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
We skip src trunction/adjustments for
NV12 case and handle the sizes directly.
Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier
of
4Credits-to: Maarten Lankhorst
<[email protected]>
Signed-off-by: Vidya Srinivas
<[email protected]>
---
drivers/gpu/drm/i915/intel_display.c | 11
+++++++++++ drivers/gpu/drm/i915/intel_sprite.c |
15+++++++++++++++
Quoted 15 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
2 files changed, 26 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_display.c
b/drivers/gpu/drm/i915/intel_display.c
index bc83f10..f64708f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12978,6 +12978,10 @@intel_check_primary_plane(struct
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
intel_plane *plane,
bool can_position = false;
int ret;
uint32_t pixel_format = 0;
+ struct drm_plane_state *plane_state = &state-base;
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
+ struct drm_rect *src = &plane_state->src;
+
+ *src = drm_plane_state_src(plane_state);if (INTEL_GEN(dev_priv) >= 9) {
/* use scaler when colorkey is not required*/ @@ -
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_planeQuoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 16 lines
*plane,
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
if (!state->base.fb)
return 0;+ if (pixel_format == DRM_FORMAT_NV12) {
+ src->x1 = (((src->x1 >> 16)/4)*4) << 16;
+ src->x2 = (((src->x2 >> 16)/4)*4) << 16;
+ src->y1 = (((src->y1 >> 16)/4)*4) << 16;
+ src->y2 = (((src->y2 >> 16)/4)*4) << 16;
+ }
Lets reject non multiple of 4 coordinates for
plane_state's src_x and src_y, and before adjustment
also reject non multiple of 4 src_w/src_h.fter that
we can also reject clipping to the right/bottom edge
of the screen, if the pipe_src_w/h is not a multiple of 4.
That way an application trying to go beyond thescreen.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
kms_plane_scaling and some other tests during
execution generate lots of non mult of 4 buffer
width/height. All these tests will show fail in the IGTBAT.
Quoted 9 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
In some cases, even thought the width and height will
be multiple of
4 before the Adjustment (say our 16x16 buffer), this
after adjustment becomes a 15 in
intel_check_sprite_plane.Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
This again would cause underrun. If we reject non
multiple of 4s in our skl_update_scaler also, then
even simple tests with
16x16 like rotation will fail due to it getting adjusted.Quoted 41 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before
adjustment..
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in thekernel.
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 34 lines
Quoted 26 lines
Quoted 26 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 2 lines
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
Quoted 7 lines
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.Apologies for asking again. The adjustments are done in
check_plane(both primary and sprite) And towards the end ofcheck_planewe call theskl_check_plane_surface. I got your point that we will reject the user requested values if they are not multiple of 4.
But before we reachskl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enterskl_check_plane_surface. Please correct me if I am wrong or I am missing in understanding something here :(Quoted 4 lines
Quoted 4 lines
I can add the add conversion to multiple of 4 in
skl_check_plane_surfacebut rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment codeto
skl_check_plane_surface?Quoted 3 lines
Sorry, I got it. You said, we don’t do adjustments in case of
NV12 in sprite and move The handling to
skl_check_plane_surface.Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
I will do the
change and submit. Sorry.
Quoted 2 lines
Thank you.
Something like below? Untested..
We should probably also restrict NV12 fb creation to not allow CCSformats.
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Thank you so much. Have submitted the changes to trybot
https://patchwork.freedesktop.org/series/41532/
PS: fb creation to not allow CCS - not done in this seriesWhy not directly to intel-gfx?
Sure, I thought I had to send to trybot first. Will send it today.
I see trybot for patches as test for RFC to see if solution is even near satisfactory in the beginning but for patches that has sent several times no need to send to trybot.
Oh okay. Sure, thank you so much.
Regards
Vidya
Quoted 95 lines
Quoted 95 lines
Thanks
VidyaQuoted 89 lines
Quoted 17 lines
Regards
VidyaQuoted 11 lines
Quoted 10 lines
Quoted 10 lines
~Maarten
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -3090,6 +3090,38 @@ static intskl_check_main_surface(const
struct
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 6 lines
intel_crtc_state*crtc_state,drivers/gpu/drm/i915/intel_display.c +2
-0return 0 ; } +static int skl_check_nv12_surface (const struct +intel_crtc_state
*crtc_state,Quoted 1 line
drivers/gpu/drm/i915/intel_display.c
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+struct intel_plane_state
*plane_state) {Quoted 11 lines
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+ int crtc_x2 = plane_state->base.crtc_x + plane_state-base.crtc_w;
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +9
-0+int crtc_y2 = plane_state->base.crtc_y + +plane_state->base.crtc_h; + +/* Are the unadjusted coordinates passed in valid? */ +if ((plane_state->base.src_x >>16 ) %4 || + (plane_state->base.src_y >>16 ) %4 || + (plane_state->base.src_w >>16 ) %4 || + (plane_state->base.src_h >>16 ) %4 ) { + DRM_DEBUG_KMS("Source coordinates must be amultiple
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 5 lines
of 4 for NV12\n");
drivers/gpu/drm/i915/intel_display.c +4
-0+return -EINVAL ; + } + +/* Clipping would cause a 1-3 pixel gap at the edge of the screen? */
Quoted 10 lines
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c
Quoted 1 line
drivers/gpu/drm/i915/intel_display.c +1
-0+ if ((crtc_x2 > crtc_state->pipe_src_w && crtc_state-
pipe_src_wQuoted 3 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 3 lines
+%
4) ||drivers/gpu/drm/i915/intel_display.c +1
-0+ (crtc_y2 > crtc_state->pipe_src_h && crtc_state-
pipe_src_hQuoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 4 lines
+%
+4))
{drivers/gpu/drm/i915/intel_display.c +1
-0+ DRM_DEBUG_KMS("It's not possible to clip %u,%uto
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 3 lines
%u,%u\n",
drivers/gpu/drm/i915/intel_display.c +2
-0+ crtc_x2, crtc_y2, + crtc_state->pipe_src_w, crtc_state-
pipe_src_h);Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +5
-0+return -EINVAL ; + } + +/* Make adjusted src coordinates a multiple of 4. */ + plane_state->base.src.x1 =DIV_ROUND_CLOSEST(plane_state-
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 2 lines
Quoted 1 line
base.src.x1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y1 =DIV_ROUND_CLOSEST(plane_state-
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 2 lines
Quoted 1 line
base.src.y1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.x2 =DIV_ROUND_CLOSEST(plane_state-
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 2 lines
Quoted 1 line
base.src.x2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y2 =DIV_ROUND_CLOSEST(plane_state-
Quoted 15 lines
Quoted 15 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 4 lines
Quoted 1 line
base.src.y2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +3
-0+return 0 ; +} +Thank you so much :) Only one problem. The primary plane clipping happens inside the drm layer in
drm_atomic_helper_check_plane_state
So, clipping-clamping test passes coordinates 0, 257, 0, 159 to
check_plane.Quoted 2 lines
And there before adjusting we reject. So for primary alone, can I retain the make multiple of 4 code in primary itself?
The clipping affects plane_state->src.{x1, y1, x2, y2}, not plane_state-
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
src_{x,y,w,h}.
They're different. The last set of coordinates will not be rotated or anything, the first set of coordinates are what we end up programming into the hardware. The patch I put above should be correctly rounding to a multiple of 4. :)
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 191 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:32 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Op 17-04-18 om 11:42 schreef Srinivas, Vidya:
Quoted 93 lines
Quoted 93 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 3:04 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 10:09 schreef Srinivas, Vidya:
Quoted 81 lines
Quoted 81 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 1:32 PM
To: 'Maarten Lankhorst' <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Quoted 68 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 1:21 PM
To: Srinivas, Vidya <[email protected]>; Saarinen, Jani <[email protected]>; [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 09:38 schreef Srinivas, Vidya:
Quoted 57 lines
Quoted 57 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Tuesday, April 17, 2018 12:55 PM
To: Saarinen, Jani <[email protected]>; Srinivas, Vidya <[email protected]>; [email protected];
intel- [email protected]
Cc: Kamath, Sunil <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Op 17-04-18 om 08:03 schreef Saarinen, Jani:
Quoted 43 lines
Lets move this to intel-gfx to get more eyes on it.
Quoted 41 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 5.47
To: Maarten Lankhorst <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 29 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]]
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]>; intel-gfx- [email protected]
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
Quoted 14 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly. Without this, pipe fifo underruns are seen on APL/KBL.v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst
<[email protected]>Signed-off-by Vidya Srinivas <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++ drivers/gpu/drm/i915/intel_sprite.c | 15 +++++++++++++++ 2 files changed, 26 insertions(+)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12978,6 +12978,10 @@intel_check_primary_plane(struct
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 40 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
intel_plane*plane,Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +4
-0bool can_position = false;int ret;uint32_t pixel_format =0 ; +struct drm_plane_state *plane_state = &state->base; +struct drm_rect *src = &plane_state->src; + + *src =drm_plane_state_src (plane_state);Quoted 20 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c line 12987
Quoted 2 lines
drivers/gpu/drm/i915/intel_display.c +0
-0if (INTEL_GEN (dev_priv) >=9 ) { /* use scaler when colorkey is not required */ @@ -13001,6
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
+13005,13 @@ intel_check_primary_plane(struct
intel_plane*plane,
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
drivers/gpu/drm/i915/intel_display.c
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +6
-0if (!state->base.fb)return 0 ; +if (pixel_format ==DRM_FORMAT_NV12 ) { + src->x1 = (((src->x1 >>16 )/4 )*4 ) <<16 ; + src->x2 = (((src->x2 >>16 )/4 )*4 ) <<16 ; + src->y1 = (((src->y1 >>16 )/4 )*4 ) <<16 ; + src->y2 = (((src->y2 >>16 )/4 )*4 ) <<16 ; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandsrc_y, and before adjustment also reject non multiple of 4 src_w/src_h.fter that we can also reject clipping to the right/bottom edge of the screen, if the pipe_src_w/h is not a multiple of 4. That way an application trying to go beyond thescreen.
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
kms_plane_scalingand some other tests during execution generate lots of non mult of 4 buffer width/height. All these tests will show fail in the IGT BAT.
In some cases, even thought the width and height will be multiple of
4 before the Adjustment (say our 16x16 buffer), this after adjustment becomes a 15 inintel_check_sprite_plane. This again would cause underrun. If we reject non multiple of 4s in ourskl_update_scaleralso, then even simple tests with 16x16 like rotation will fail due to it getting adjusted.Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Correct. This is why we fix up to a multiple of 4 after adjustments, and reject user passed coordinates before
adjustment..
Quoted 36 lines
Quoted 36 lines
Quoted 28 lines
Quoted 28 lines
Quoted 10 lines
Quoted 7 lines
Quoted 7 lines
plane_state->src_x/y/w/h is the property set by the user, while the
plane_state->srcrect is set and fixed up in the kernel.Rejecting clipping with positive coordinates if
pipe_srcw/h is not a multiple of 4 will fix a border case that shouldn't affect most modes, where the plane wouldn't extend to the crtc borders, which iswhat userspace wants there.
Quoted 2 lines
Thank you. Oh okay. Sorry. I thought we just reject and not do the fixing
Quoted 7 lines
(mult of 4 later).
Quoted 4 lines
Sure, I will change the patch to also reject the coordinates before adjustment (if its not Mult of 4).
This can be done in
skl_check_plane_surface, plane_state->src_{x,y,w,h} contains the user requested values.Apologies for asking again. The adjustments are done in
check_plane(both primary and sprite) And towards the end ofcheck_planewe call theskl_check_plane_surface.
I got your point that we will reject the user requested values if they are not multiple of 4.
But before we reachskl_check_plane_surface, they would’ve been adjusted/clipped etc They wont remain user requested as is when they enterskl_check_plane_surface.
Please correct me if I am wrong or I am missing in understanding something here :(Quoted 4 lines
Quoted 4 lines
I can add the add conversion to multiple of 4 in
skl_check_plane_surfacebut rejection should be done before the clipping/adjustment Or else, I move the entire clipping/adjustment codeto
skl_check_plane_surface?Quoted 3 lines
Sorry, I got it. You said, we don’t do adjustments in case of NV12 in sprite and move The handling to
skl_check_plane_surface. I will do the
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
change and submit. Sorry.
Quoted 2 lines
Thank you.
Something like below? Untested..
We should probably also restrict NV12 fb creation to not allow CCSformats.
Thank you for all the help. Have floated the series with your RB. Have also included the change you mentioned in framebuffer_init Not to allow CCS formats. However, when I checked code in framebuffer_init If the modifier is CCS, only RGB8888 related are allowed. Please have a check. If you have any suggestion, I will change it.
https://patchwork.freedesktop.org/series/41674/ Rev2
Regards
Vidya
Quoted 62 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const
Quoted 9 lines
~Maarten
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -3090,6 +3090,38 @@ static int skl_check_main_surface(conststruct
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state,
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0intel_crtc_state *crtc_state, return 0; } +static int skl_check_nv12_surface(const struct intel_crtc_state
*crtc_state,Quoted 34 lines
Quoted 34 lines
drivers/gpu/drm/i915/intel_display.c +15
-0+ struct intel_plane_state *plane_state) { + int crtc_x2 = plane_state->base.crtc_x + plane_state->base.crtc_w; + int crtc_y2 = plane_state->base.crtc_y + plane_state->base.crtc_h; + + /* Are the unadjusted coordinates passed in valid? */ + if ((plane_state->base.src_x >> 16) % 4 || + (plane_state->base.src_y >> 16) % 4 || + (plane_state->base.src_w >> 16) % 4 || + (plane_state->base.src_h >> 16) % 4) { + DRM_DEBUG_KMS("Source coordinates must be a multiple of 4 for NV12\n"); + return -EINVAL; + } + + /* Clipping would cause a 1-3 pixel gap at the edge of the screen? */ + if ((crtc_x2 > crtc_state->pipe_src_w && crtc_state->pipe_src_w %4) ||
drivers/gpu/drm/i915/intel_display.c +2
-0+ (crtc_y2 > crtc_state->pipe_src_h && crtc_state->pipe_src_h % +4)){
drivers/gpu/drm/i915/intel_display.c +1
-0+ DRM_DEBUG_KMS("It's not possible to clip %u,%u to%u,%u\n",
drivers/gpu/drm/i915/intel_display.c +7
-0+ crtc_x2, crtc_y2, + crtc_state->pipe_src_w, crtc_state->pipe_src_h); +return -EINVAL ; + } + +/* Make adjusted src coordinates a multiple of 4. */ + plane_state->base.src.x1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y1 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y1, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.x2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.x2, 1 << 18) << 18;
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c static int skl_check_main_surface(const struct intel_crtc_state *crtc_state, · line 3124
Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1
-0+ plane_state->base.src.y2 = DIV_ROUND_CLOSEST(plane_state-Quoted 1 line
base.src.y2, 1 << 18) << 18;
drivers/gpu/drm/i915/intel_display.c +3
-0+return 0 ; +} +Thank you so much :) Only one problem. The primary plane clipping happens inside the drm layer in
drm_atomic_helper_check_plane_stateSo, clipping-clamping test passes coordinates 0, 257, 0, 159 to
check_plane.Quoted 2 lines
And there before adjusting we reject. So for primary alone, can I retain the make multiple of 4 code in primary itself?
Quoted 8 lines
The clipping affects plane_state->src.{x1, y1, x2, y2}, not plane_state-
Quoted 1 line
src_{x,y,w,h}.
They're different. The last set of coordinates will not be rotated or anything, the first set of coordinates are what we end up programming into the hardware. The patch I put above should be correctly rounding to a multiple of 4. :)
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
A message that is not in the archive (sent off-list or not yet received): F653A0A18852B74D88578FA2EB7094EAB6850CA9@BGSMSX108.gar.corp.intel.com
+wider-list.
Quoted 305 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: tiistai 17. huhtikuuta 2018 7.59
To: 'Maarten Lankhorst' <[email protected]>; 'intel-gfx- [email protected]' <[email protected]>
Cc: Kamath, Sunil <[email protected]>; Saarinen, Jani <[email protected]>
Subject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for NV12Quoted 10 lines
-----Original Message-----
From: Srinivas, Vidya
Sent: Tuesday, April 17, 2018 8:17 AM
To: Maarten Lankhorst <[email protected]>; intel-gfx-
Quoted 17 lines
Cc Kamath, Sunil <[email protected]>; Saarinen, JaniSubject: RE: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12
Quoted 3 lines
-----Original Message-----
From: Maarten Lankhorst [mailto:[email protected]
<mailto:[email protected]> ]
Quoted 3 lines
Quoted 3 lines
Sent: Monday, April 16, 2018 8:00 PM
To: Srinivas, Vidya <[email protected]
<mailto:[email protected]> >; intel-gfx-
Quoted 3 lines
Quoted 3 lines
[email protected] <mailto:[email protected]>
Cc Kamath, Sunil <[email protected]<mailto:[email protected]> >; Saarinen, Jani
Quoted 22 lines
Quoted 21 lines
<[email protected] <mailto:[email protected]> >
Subject: Re: [PATCH v2 6/6] drm/i915: Do not do fb src adjustments for
NV12
Hmm, more thought about src adjustments...
Op 13-04-18 om 07:22 schreef Vidya Srinivas:
Quoted 7 lines
We skip src trunction/adjustments for
NV12 case and handle the sizes directly.
Without this, pipe fifo underruns are seen on APL/KBL.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
v2: For NV12, making the src coordinates multiplier of 4
Credits-to: Maarten Lankhorst <[email protected]
<mailto:[email protected]> >
Quoted 1 line
Quoted 1 line
Quoted 1 line
Signed-off-by Vidya Srinivas <[email protected]<mailto:[email protected]> >
Quoted 88 lines
Quoted 68 lines
Review intel_check_primary_plane(struct
Quoted 21 lines
---
drivers/gpu/drm/i915/intel_display.c | 11 +++++++++++
drivers/gpu/drm/i915/intel_sprite.c| 15 +++++++++++++++2 files changed, 26 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_display.cindex bc83f10..f64708f 100644
---
a/drivers/gpu/drm/i915/intel_display.c+++
b/drivers/gpu/drm/i915/intel_display.c(quoted diff) +0
-0@@ -12978,6 +12978,10 @@ intel_check_primary_plane(struct
intel_plane*plane,Quoted 29 lines
(quoted diff) +6
-0bool can_position = false; int ret; uint32_t pixel_format = 0; + struct drm_plane_state *plane_state = &state->base; + struct drm_rect *src = &plane_state->src; + + *src = drm_plane_state_src(plane_state); if (INTEL_GEN(dev_priv) >= 9) { /* use scaler when colorkey is not required */ @@ -13001,6 +13005,13 @@ intel_check_primary_plane(struct intel_plane *plane, if (!state->base.fb) return 0; + if (pixel_format == DRM_FORMAT_NV12) {Review intel_check_primary_plane(struct
Quoted 10 lines
(quoted diff) +5
-0+ src->x1 = (((src->x1 >> 16)/4)*4) << 16; + src->x2 = (((src->x2 >> 16)/4)*4) << 16; + src->y1 = (((src->y1 >> 16)/4)*4) << 16; + src->y2 = (((src->y2 >> 16)/4)*4) << 16; + }Lets reject non multiple of 4 coordinates for plane_state's
src_xandQuoted 7 lines
src_y, and before adjustment also reject non multiple of 4src_w/src_h.fter that we can also reject clipping to the right/bottom
edge of the screen, if the pipe_src_w/h is not a multiple of 4. That
way an application trying to go beyond the screen.
kms_plane_scalingand some other tests during execution generate lots ofnon mult of 4 buffer width/height. All these tests will show fail in the IGT
BAT.
In some cases, even thought the width and height will be multiple of 4
before the Adjustment (say our 16x16 buffer), this after adjustment
Quoted 7 lines
becomes a 15 in
intel_check_sprite_plane.This again would cause underrun. If we reject non multiple of 4s in our
skl_update_scaleralso, then even simple tests with 16x16 like rotation willfail due to it getting adjusted.
Example:
During kms_plane_scaling-with-rotation execution - print cooridinates here:
src->x1,src->x2,src->y1,src->y2[ 43.542044] [drm:intel_check_sprite_plane] *ERROR* Before adjust: 1040:0 16 0 16
[ 43.542054] [drm:intel_check_sprite_plane] *ERROR* After adjust: 1054: 015 0 15
[ 43.542058] [drm:intel_check_sprite_plane] *ERROR* Before check planesurface: 1135: 0 15 0 15
[ 43.570827] [drm:intel_cpu_fifo_underrun_irq_handler] *ERROR* CPUpipe A FIFO underrun
16x16 becomes 15x15 after rect adjustment in
check_sprite_planeDuring kms_plane_scaling-with-clipping-clamping – print coordinates here
src->x1,src->x2,src->y1,src->y2[ 125.432029] [drm:intel_check_primary_plane] *ERROR* Before checkplane state: 12998: 0 300 0 300
[ 125.432041] [drm:intel_check_primary_plane] *ERROR* After check planestate: 13004: 0 257 0 159
[ 128.057081] [drm:intel_cpu_fifo_underrun_irq_handler] *ERROR* CPUpipe A FIFO underrun
300x300 after primary plane clipping becomes 257 in
check_primary_planeAll these generate fifo underruns. In the first example here, 16x16, before adjustment we check if it is multiplier
of 4, and since it is, we allow. But after
rect_adjustit becomes 15x15In example 2, clipping clamping, 300x300 is the value before clipping in primary plane, since it is a multiple of 4, we allow
But after clipping it becomes 257x159.
Quoted 4 lines
Quoted 3 lines
Quoted 57 lines
Quoted 3 lines
skl_check_plane_surfacecould do all the fixups and is allowed toreturn an error code, so we could put all SKL specific NV12 handling in
there.
Quoted 51 lines
It doesn't matter that we calculate potentially illegal values, if we
never program them and return
-EINVALthere. If it turns out we'vebeen too paranoid we could relax the condition.
This would mean unified handling for NV12 for primary and sprite. :)
Review intel_check_sprite_plane(struct intel_plane
Quoted 17 lines
if (INTEL_GEN(dev_priv) >= 9) { ret = skl_check_plane_surface(crtc_state, state); if (ret)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/intel_sprite.cindex 8b7947d..c1dd85e 100644
---
a/drivers/gpu/drm/i915/intel_sprite.c+++
b/drivers/gpu/drm/i915/intel_sprite.c(quoted diff) +0
-0@@ -1035,11 +1035,20 @@ intel_check_sprite_plane(struct intel_plane*plane,
Quoted 5 lines
(quoted diff) +0
-0return vscale; }Review intel_check_sprite_plane(struct intel_plane · line 1049
Quoted 10 lines
(quoted diff) +5
-0+ if (fb->format->format == DRM_FORMAT_NV12) { + if (src->x2 >> 16 == 16) + src->x2 = 16 << 16; + if (src->y2 >> 16 == 16) + src->y2 = 16 << 16;This part doesn't look required, the magic below for the nv12 format
is similar.. Just conditionally call
adjust_sizefor format != NV12.
Quoted 65 lines
This part is required only if we retain 16x16 buffer, Because after
adjust_sizeit becomes15x15 as I have mentioned above. Then our minimum criteria for NV12 fails and our igt buffer
As of now is 16x16. To get a IGT pass I had added this work around.
Quoted 53 lines
Quoted 53 lines
:)
Review intel_check_sprite_plane(struct intel_plane
Quoted 7 lines
(quoted diff) +3
-0+ goto nv12_min_no_clip; + } + /* Make the source viewport size an exact multiple of thescaling factors. */
Quoted 3 lines
drm_rect_adjust_size(src,
drm_rect_width(dst)* hscale -
drm_rect_width(src),Quoted 1 line
drm_rect_height(dst)* vscale -
drm_rect_height(src));Review intel_check_sprite_plane(struct intel_plane
Quoted 11 lines
(quoted diff) +1
-0+nv12_min_no_clip: drm_rect_rotate_inv(src, fb->width << 16, fb->height << 16, state->base.rotation);@@ -1105,6 +1114,12 @@ intel_check_sprite_plane(struct intel_plane*plane,
Quoted 17 lines
(quoted diff) +6
-0src->x2 = (src_x + src_w) << 16; src->y1 = src_y << 16; src->y2 = (src_y + src_h) << 16; + if (fb->format->format == DRM_FORMAT_NV12) { + src->x1 = (((src->x1 >> 16)/4)*4) << 16; + src->x2 = (((src->x2 >> 16)/4)*4) << 16; + src->y1 = (((src->y1 >> 16)/4)*4) << 16; + src->y2 = (((src->y2 >> 16)/4)*4) << 16; + }
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx