* [PATCH] drm/ast: Fix start address computation
@ 2023-02-07 10:53 Jocelyn Falempe
2023-02-07 11:17 ` Thomas Zimmermann
0 siblings, 1 reply; 4+ messages in thread
From: Jocelyn Falempe @ 2023-02-07 10:53 UTC (permalink / raw)
To: dri-devel, tzimmermann, airlied, kuohsiang_chou, jammy_huang
Cc: Jocelyn Falempe
During the driver conversion to shmem, there is a missing page shift when
computing the start address in GPU memory.
This leads to graphic garbage when connecting to the remote BMC, depending
on the PCI start address.
Tested on a sr645 affected by this bug.
Fixes: f2fa5a99ca81 ("drm/ast: Convert ast to SHMEM")
Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
---
drivers/gpu/drm/ast/ast_mode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index c7443317c747..d75e4a7611b3 100644
--- a/drivers/gpu/drm/ast/ast_mode.c
+++ b/drivers/gpu/drm/ast/ast_mode.c
@@ -714,7 +714,7 @@ static int ast_primary_plane_init(struct ast_private *ast)
struct ast_plane *ast_primary_plane = &ast->primary_plane;
struct drm_plane *primary_plane = &ast_primary_plane->base;
void __iomem *vaddr = ast->vram;
- u64 offset = ast->vram_base;
+ u64 offset = ast->vram_base << PAGE_SHIFT;
unsigned long cursor_size = roundup(AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE, PAGE_SIZE);
unsigned long size = ast->vram_fb_available - cursor_size;
int ret;
--
2.39.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/ast: Fix start address computation
2023-02-07 10:53 [PATCH] drm/ast: Fix start address computation Jocelyn Falempe
@ 2023-02-07 11:17 ` Thomas Zimmermann
2023-02-07 11:36 ` Jocelyn Falempe
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Zimmermann @ 2023-02-07 11:17 UTC (permalink / raw)
To: Jocelyn Falempe, dri-devel, airlied, kuohsiang_chou, jammy_huang
[-- Attachment #1.1: Type: text/plain, Size: 1837 bytes --]
Hi
Am 07.02.23 um 11:53 schrieb Jocelyn Falempe:
> During the driver conversion to shmem, there is a missing page shift when
> computing the start address in GPU memory.
> This leads to graphic garbage when connecting to the remote BMC, depending
> on the PCI start address.
>
> Tested on a sr645 affected by this bug.
>
> Fixes: f2fa5a99ca81 ("drm/ast: Convert ast to SHMEM")
> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
> ---
> drivers/gpu/drm/ast/ast_mode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index c7443317c747..d75e4a7611b3 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -714,7 +714,7 @@ static int ast_primary_plane_init(struct ast_private *ast)
> struct ast_plane *ast_primary_plane = &ast->primary_plane;
> struct drm_plane *primary_plane = &ast_primary_plane->base;
> void __iomem *vaddr = ast->vram;
> - u64 offset = ast->vram_base;
> + u64 offset = ast->vram_base << PAGE_SHIFT;
That can't be the problem, I think. vram_base is already an address.
[1] In the old code, drm_gem_vram_pg_offset() returned a page index. So
shifting it to the left here is most likely incorrect.
Can you verify that the new offset is the same as the old one?
Best regards
Thomas
[1]
https://elixir.bootlin.com/linux/v6.2-rc7/source/drivers/gpu/drm/ast/ast_mm.c#L96
> unsigned long cursor_size = roundup(AST_HWC_SIZE + AST_HWC_SIGNATURE_SIZE, PAGE_SIZE);
> unsigned long size = ast->vram_fb_available - cursor_size;
> int ret;
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/ast: Fix start address computation
2023-02-07 11:17 ` Thomas Zimmermann
@ 2023-02-07 11:36 ` Jocelyn Falempe
2023-02-09 9:11 ` Jocelyn Falempe
0 siblings, 1 reply; 4+ messages in thread
From: Jocelyn Falempe @ 2023-02-07 11:36 UTC (permalink / raw)
To: Thomas Zimmermann, dri-devel, airlied, kuohsiang_chou, jammy_huang
On 07/02/2023 12:17, Thomas Zimmermann wrote:
> Hi
>
> Am 07.02.23 um 11:53 schrieb Jocelyn Falempe:
>> During the driver conversion to shmem, there is a missing page shift when
>> computing the start address in GPU memory.
>> This leads to graphic garbage when connecting to the remote BMC,
>> depending
>> on the PCI start address.
>>
>> Tested on a sr645 affected by this bug.
>>
>> Fixes: f2fa5a99ca81 ("drm/ast: Convert ast to SHMEM")
>> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
>> ---
>> drivers/gpu/drm/ast/ast_mode.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/ast/ast_mode.c
>> b/drivers/gpu/drm/ast/ast_mode.c
>> index c7443317c747..d75e4a7611b3 100644
>> --- a/drivers/gpu/drm/ast/ast_mode.c
>> +++ b/drivers/gpu/drm/ast/ast_mode.c
>> @@ -714,7 +714,7 @@ static int ast_primary_plane_init(struct
>> ast_private *ast)
>> struct ast_plane *ast_primary_plane = &ast->primary_plane;
>> struct drm_plane *primary_plane = &ast_primary_plane->base;
>> void __iomem *vaddr = ast->vram;
>> - u64 offset = ast->vram_base;
>> + u64 offset = ast->vram_base << PAGE_SHIFT;
>
> That can't be the problem, I think. vram_base is already an address. [1]
> In the old code, drm_gem_vram_pg_offset() returned a page index. So
> shifting it to the left here is most likely incorrect.
>
> Can you verify that the new offset is the same as the old one?
Yes, I was also a bit unsure about this fix.
In my case, with the old code:
PCI base address is 0xce000000
with old code:
start address (which is 24bits) was 0
with shmem code:
start address is 0x800000
So the additional page shift makes it 0, which fixes the display.
I was wondering if this start address is not an offset in the GPU
memory, and in this case the primary plane offset should always be 0 ?
Best regards,
>
> Best regards
> Thomas
>
> [1]
> https://elixir.bootlin.com/linux/v6.2-rc7/source/drivers/gpu/drm/ast/ast_mm.c#L96
>
>> unsigned long cursor_size = roundup(AST_HWC_SIZE +
>> AST_HWC_SIGNATURE_SIZE, PAGE_SIZE);
>> unsigned long size = ast->vram_fb_available - cursor_size;
>> int ret;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/ast: Fix start address computation
2023-02-07 11:36 ` Jocelyn Falempe
@ 2023-02-09 9:11 ` Jocelyn Falempe
0 siblings, 0 replies; 4+ messages in thread
From: Jocelyn Falempe @ 2023-02-09 9:11 UTC (permalink / raw)
To: Thomas Zimmermann, dri-devel, airlied, kuohsiang_chou, jammy_huang
On 07/02/2023 12:36, Jocelyn Falempe wrote:
> On 07/02/2023 12:17, Thomas Zimmermann wrote:
>> Hi
>>
>
> I was wondering if this start address is not an offset in the GPU
> memory, and in this case the primary plane offset should always be 0 ?
I think it's the case, so I will send a v2 shortly.
>
> Best regards,
>
>>
>> Best regards
>> Thomas
>>
>> [1]
>> https://elixir.bootlin.com/linux/v6.2-rc7/source/drivers/gpu/drm/ast/ast_mm.c#L96
>>
>>> unsigned long cursor_size = roundup(AST_HWC_SIZE +
>>> AST_HWC_SIGNATURE_SIZE, PAGE_SIZE);
>>> unsigned long size = ast->vram_fb_available - cursor_size;
>>> int ret;
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-09 9:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-07 10:53 [PATCH] drm/ast: Fix start address computation Jocelyn Falempe
2023-02-07 11:17 ` Thomas Zimmermann
2023-02-07 11:36 ` Jocelyn Falempe
2023-02-09 9:11 ` Jocelyn Falempe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).