[PATCH 2/2] drm/amd/display: add cursor pitch check
Replace the width check with a pitch check, which matches DM internals. Add a new check to make sure the pitch (in pixels) matches the width. Signed-off-by: Simon Ser Cc: Alex Deucher Cc: Harry Wentland Cc: Nicholas Kazlauskas --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 9e328101187e..862a59703060 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -8988,6 +8988,7 @@ static int dm_update_plane_state(struct dc *dc, struct amdgpu_crtc *new_acrtc; bool needs_reset; int ret = 0; + unsigned int pitch; new_plane_crtc = new_plane_state->crtc; @@ -9021,15 +9022,25 @@ static int dm_update_plane_state(struct dc *dc, return -EINVAL; } - switch (new_plane_state->fb->width) { + /* Pitch in pixels */ + pitch = new_plane_state->fb->pitches[0] / new_plane_state->fb->format->cpp[0]; + + if (new_plane_state->fb->width != pitch) { + DRM_DEBUG_ATOMIC("Cursor FB width %d doesn't match pitch %d", +new_plane_state->fb->width, +pitch); + return -EINVAL; + } + + switch (pitch) { case 64: case 128: case 256: - /* FB width is supported by cursor plane */ + /* FB pitch is supported by cursor plane */ break; default: - DRM_DEBUG_ATOMIC("Bad cursor FB width %d\n", -new_plane_state->fb->width); + DRM_DEBUG_ATOMIC("Bad cursor FB pitch %d px\n", +pitch); return -EINVAL; } } -- 2.29.2 ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amd/display: add cursor pitch check
On 2020-12-02 4:09 p.m., Simon Ser wrote: Replace the width check with a pitch check, which matches DM internals. Add a new check to make sure the pitch (in pixels) matches the width. Signed-off-by: Simon Ser Cc: Alex Deucher Cc: Harry Wentland Cc: Nicholas Kazlauskas Series is: Reviewed-by: Nicholas Kazlauskas Regards, Nicholas Kazlauskas --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 9e328101187e..862a59703060 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -8988,6 +8988,7 @@ static int dm_update_plane_state(struct dc *dc, struct amdgpu_crtc *new_acrtc; bool needs_reset; int ret = 0; + unsigned int pitch; new_plane_crtc = new_plane_state->crtc; @@ -9021,15 +9022,25 @@ static int dm_update_plane_state(struct dc *dc, return -EINVAL; } - switch (new_plane_state->fb->width) { + /* Pitch in pixels */ + pitch = new_plane_state->fb->pitches[0] / new_plane_state->fb->format->cpp[0]; + + if (new_plane_state->fb->width != pitch) { + DRM_DEBUG_ATOMIC("Cursor FB width %d doesn't match pitch %d", +new_plane_state->fb->width, +pitch); + return -EINVAL; + } + + switch (pitch) { case 64: case 128: case 256: - /* FB width is supported by cursor plane */ + /* FB pitch is supported by cursor plane */ break; default: - DRM_DEBUG_ATOMIC("Bad cursor FB width %d\n", -new_plane_state->fb->width); + DRM_DEBUG_ATOMIC("Bad cursor FB pitch %d px\n", +pitch); return -EINVAL; } } ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amd/display: add cursor pitch check
On Wed, Dec 2, 2020 at 4:33 PM Kazlauskas, Nicholas wrote: > > On 2020-12-02 4:09 p.m., Simon Ser wrote: > > Replace the width check with a pitch check, which matches DM internals. > > Add a new check to make sure the pitch (in pixels) matches the width. > > > > Signed-off-by: Simon Ser > > Cc: Alex Deucher > > Cc: Harry Wentland > > Cc: Nicholas Kazlauskas > > Series is: > > Reviewed-by: Nicholas Kazlauskas Applied. Thanks! Alex > > Regards, > Nicholas Kazlauskas > > > --- > > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 19 +++ > > 1 file changed, 15 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > index 9e328101187e..862a59703060 100644 > > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > @@ -8988,6 +8988,7 @@ static int dm_update_plane_state(struct dc *dc, > > struct amdgpu_crtc *new_acrtc; > > bool needs_reset; > > int ret = 0; > > + unsigned int pitch; > > > > > > new_plane_crtc = new_plane_state->crtc; > > @@ -9021,15 +9022,25 @@ static int dm_update_plane_state(struct dc *dc, > > return -EINVAL; > > } > > > > - switch (new_plane_state->fb->width) { > > + /* Pitch in pixels */ > > + pitch = new_plane_state->fb->pitches[0] / > > new_plane_state->fb->format->cpp[0]; > > + > > + if (new_plane_state->fb->width != pitch) { > > + DRM_DEBUG_ATOMIC("Cursor FB width %d doesn't > > match pitch %d", > > + new_plane_state->fb->width, > > + pitch); > > + return -EINVAL; > > + } > > + > > + switch (pitch) { > > case 64: > > case 128: > > case 256: > > - /* FB width is supported by cursor plane */ > > + /* FB pitch is supported by cursor plane */ > > break; > > default: > > - DRM_DEBUG_ATOMIC("Bad cursor FB width %d\n", > > - new_plane_state->fb->width); > > + DRM_DEBUG_ATOMIC("Bad cursor FB pitch %d > > px\n", > > + pitch); > > return -EINVAL; > > } > > } > > > > ___ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 2/2] drm/amd/display: add cursor pitch check
[AMD Public Use] Hi Simon, It looks to me I'm kinda late to the party to look at your questions under https://lists.freedesktop.org/archives/amd-gfx/2020-November/056032.html... Does the commit below and https://lists.freedesktop.org/archives/amd-gfx/2020-December/057048.html mean the above issue is now on its way to resolution? Thanks, Nikola -Original Message- From: amd-gfx On Behalf Of Alex Deucher Sent: Wednesday, December 2, 2020 5:25 PM To: Kazlauskas, Nicholas Cc: Deucher, Alexander ; Simon Ser ; Wentland, Harry ; amd-gfx list Subject: Re: [PATCH 2/2] drm/amd/display: add cursor pitch check On Wed, Dec 2, 2020 at 4:33 PM Kazlauskas, Nicholas wrote: > > On 2020-12-02 4:09 p.m., Simon Ser wrote: > > Replace the width check with a pitch check, which matches DM internals. > > Add a new check to make sure the pitch (in pixels) matches the width. > > > > Signed-off-by: Simon Ser > > Cc: Alex Deucher > > Cc: Harry Wentland > > Cc: Nicholas Kazlauskas > > Series is: > > Reviewed-by: Nicholas Kazlauskas Applied. Thanks! Alex > > Regards, > Nicholas Kazlauskas > > > --- > > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 19 +++ > > 1 file changed, 15 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > index 9e328101187e..862a59703060 100644 > > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > > @@ -8988,6 +8988,7 @@ static int dm_update_plane_state(struct dc *dc, > > struct amdgpu_crtc *new_acrtc; > > bool needs_reset; > > int ret = 0; > > + unsigned int pitch; > > > > > > new_plane_crtc = new_plane_state->crtc; @@ -9021,15 +9022,25 > > @@ static int dm_update_plane_state(struct dc *dc, > > return -EINVAL; > > } > > > > - switch (new_plane_state->fb->width) { > > + /* Pitch in pixels */ > > + pitch = new_plane_state->fb->pitches[0] / > > + new_plane_state->fb->format->cpp[0]; > > + > > + if (new_plane_state->fb->width != pitch) { > > + DRM_DEBUG_ATOMIC("Cursor FB width %d doesn't > > match pitch %d", > > + new_plane_state->fb->width, > > + pitch); > > + return -EINVAL; > > + } > > + > > + switch (pitch) { > > case 64: > > case 128: > > case 256: > > - /* FB width is supported by cursor plane */ > > + /* FB pitch is supported by cursor > > + plane */ > > break; > > default: > > - DRM_DEBUG_ATOMIC("Bad cursor FB width %d\n", > > - new_plane_state->fb->width); > > + DRM_DEBUG_ATOMIC("Bad cursor FB pitch %d > > px\n", > > + pitch); > > return -EINVAL; > > } > > } > > > > ___ > amd-gfx mailing list > amd-gfx@lists.freedesktop.org > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist > s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cni > kola.cornij%40amd.com%7C0837b50ac7d6455eef1b08d897111300%7C3dd8961fe48 > 84e608e11a82d994e183d%7C0%7C0%7C637425446939520218%7CUnknown%7CTWFpbGZ > sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3 > D%7C1000&sdata=DVh%2FvXWkMo%2FQiuV3OclCptN1ctSWpJaPR1sND3jXvHc%3D& > amp;reserved=0 ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cnikola.cornij%40amd.com%7C0837b50ac7d6455eef1b08d897111300%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637425446939520218%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=DVh%2FvXWkMo%2FQiuV3OclCptN1ctSWpJaPR1sND3jXvHc%3D&reserved=0 ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 2/2] drm/amd/display: add cursor pitch check
Hi Nikola, On Tuesday, December 8th, 2020 at 2:36 AM, Cornij, Nikola wrote: > [AMD Public Use] > > Hi Simon, > > It looks to me I'm kinda late to the party to look at your questions under > https://lists.freedesktop.org/archives/amd-gfx/2020-November/056032.html... > > Does the commit below and > https://lists.freedesktop.org/archives/amd-gfx/2020-December/057048.html mean > the above issue is now on its way to resolution? Yes, I've figured everything out about the cursor, thanks! If you have time, another thing I need feedback about is overlay planes. I have some bug reports [1] [2] about corruption when using a small 24x24 buffer near the edges of the screen. However everything works fine with a bigger 256x256 buffer. Is there a minimum buffer size for the overlay plane? Simon [1]: https://gitlab.freedesktop.org/drm/amd/-/issues/1385 [2]: https://gitlab.freedesktop.org/drm/amd/-/issues/1386 ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 2/2] drm/amd/display: add cursor pitch check
[AMD Public Use] Very good, thanks! I'll take a look at the overlay ones, then. -Original Message- From: Simon Ser Sent: Tuesday, December 8, 2020 7:00 AM To: Cornij, Nikola Cc: Alex Deucher ; Kazlauskas, Nicholas ; Deucher, Alexander ; Wentland, Harry ; amd-gfx list Subject: RE: [PATCH 2/2] drm/amd/display: add cursor pitch check Hi Nikola, On Tuesday, December 8th, 2020 at 2:36 AM, Cornij, Nikola wrote: > [AMD Public Use] > > Hi Simon, > > It looks to me I'm kinda late to the party to look at your questions > under > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Farchives%2Famd-gfx%2F2020-November%2F056032.html&data=04%7C01%7CNikola.Cornij%40amd.com%7C6a860bd758d044c4a3bf08d89b70d628%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637430256236209108%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=T5ijUId6nrrKK3R7c62wVllZ1rEhKdmi95Foijvjf5M%3D&reserved=0... > > Does the commit below and > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist > s.freedesktop.org%2Farchives%2Famd-gfx%2F2020-December%2F057048.html&data=04%7C01%7CNikola.Cornij%40amd.com%7C6a860bd758d044c4a3bf08d89b70d628%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637430256236209108%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=6GKjptsf0S%2FWzg9CwSnp89EkaQoMxgyq9JvVcVhJIyU%3D&reserved=0 > mean the above issue is now on its way to resolution? Yes, I've figured everything out about the cursor, thanks! If you have time, another thing I need feedback about is overlay planes. I have some bug reports [1] [2] about corruption when using a small 24x24 buffer near the edges of the screen. However everything works fine with a bigger 256x256 buffer. Is there a minimum buffer size for the overlay plane? Simon [1]: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1385&data=04%7C01%7CNikola.Cornij%40amd.com%7C6a860bd758d044c4a3bf08d89b70d628%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637430256236209108%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=rXhMSAySLeVbVP7Pw6vw2B0%2BnrNcKqsveeFKRYMWNhE%3D&reserved=0 [2]: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.freedesktop.org%2Fdrm%2Famd%2F-%2Fissues%2F1386&data=04%7C01%7CNikola.Cornij%40amd.com%7C6a860bd758d044c4a3bf08d89b70d628%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637430256236209108%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=gD%2FTWuBAVM8AuEfbY7c6tp%2Byns6I6hd9SihTKrO4so0%3D&reserved=0 ___ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx