All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] drm/ast: Fix start address computation
@ 2023-02-09  9:44 Jocelyn Falempe
  2023-02-09  9:55 ` Thomas Zimmermann
  0 siblings, 1 reply; 4+ messages in thread
From: Jocelyn Falempe @ 2023-02-09  9:44 UTC (permalink / raw)
  To: dri-devel, tzimmermann, airlied, kuohsiang_chou, jammy_huang
  Cc: Jocelyn Falempe

During the driver conversion to shmem, the start address for the
scanout buffer was set to the base PCI address.
In most cases it works because only the lower 24bits are used, and
due to alignment it was almost always 0.
But on some unlucky hardware, it's not the case, and some unitilized
memory is displayed on the BMC.
With shmem, the primary plane is always at offset 0 in GPU memory.

 * v2: rewrite the patch to set the offset to 0. (Thomas Zimmermann)
 * v3: move the change to plane_init() and also fix the cursor plane.
       (Jammy Huang)

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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
index c7443317c747..66a4a41c3fe9 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 = 0; /* with shmem, the primary plane is always at offset 0 */
 	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;
@@ -972,7 +972,7 @@ static int ast_cursor_plane_init(struct ast_private *ast)
 		return -ENOMEM;
 
 	vaddr = ast->vram + ast->vram_fb_available - size;
-	offset = ast->vram_base + ast->vram_fb_available - size;
+	offset = ast->vram_fb_available - size;
 
 	ret = ast_plane_init(dev, ast_cursor_plane, vaddr, offset, size,
 			     0x01, &ast_cursor_plane_funcs,
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] drm/ast: Fix start address computation
  2023-02-09  9:44 [PATCH v3] drm/ast: Fix start address computation Jocelyn Falempe
@ 2023-02-09  9:55 ` Thomas Zimmermann
  2023-02-10  0:33   ` Jammy Huang
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Zimmermann @ 2023-02-09  9:55 UTC (permalink / raw)
  To: Jocelyn Falempe, dri-devel, airlied, kuohsiang_chou, jammy_huang


[-- Attachment #1.1: Type: text/plain, Size: 2314 bytes --]



Am 09.02.23 um 10:44 schrieb Jocelyn Falempe:
> During the driver conversion to shmem, the start address for the
> scanout buffer was set to the base PCI address.
> In most cases it works because only the lower 24bits are used, and
> due to alignment it was almost always 0.
> But on some unlucky hardware, it's not the case, and some unitilized

'uninitialized'

> memory is displayed on the BMC.
> With shmem, the primary plane is always at offset 0 in GPU memory.
> 
>   * v2: rewrite the patch to set the offset to 0. (Thomas Zimmermann)
>   * v3: move the change to plane_init() and also fix the cursor plane.
>         (Jammy Huang)
> 
> Tested on a sr645 affected by this bug.
> 
> Fixes: f2fa5a99ca81 ("drm/ast: Convert ast to SHMEM")
> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/gpu/drm/ast/ast_mode.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index c7443317c747..66a4a41c3fe9 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 = 0; /* with shmem, the primary plane is always at offset 0 */
>   	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;
> @@ -972,7 +972,7 @@ static int ast_cursor_plane_init(struct ast_private *ast)
>   		return -ENOMEM;
>   
>   	vaddr = ast->vram + ast->vram_fb_available - size;
> -	offset = ast->vram_base + ast->vram_fb_available - size;
> +	offset = ast->vram_fb_available - size;
>   
>   	ret = ast_plane_init(dev, ast_cursor_plane, vaddr, offset, size,
>   			     0x01, &ast_cursor_plane_funcs,

-- 
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 v3] drm/ast: Fix start address computation
  2023-02-09  9:55 ` Thomas Zimmermann
@ 2023-02-10  0:33   ` Jammy Huang
  2023-02-10 15:02     ` Jocelyn Falempe
  0 siblings, 1 reply; 4+ messages in thread
From: Jammy Huang @ 2023-02-10  0:33 UTC (permalink / raw)
  To: Thomas Zimmermann, Jocelyn Falempe, dri-devel, airlied, kuohsiang_chou

[-- Attachment #1: Type: text/plain, Size: 2412 bytes --]


On 2023/2/9 下午 05:55, Thomas Zimmermann wrote:
>
>
> Am 09.02.23 um 10:44 schrieb Jocelyn Falempe:
>> During the driver conversion to shmem, the start address for the
>> scanout buffer was set to the base PCI address.
>> In most cases it works because only the lower 24bits are used, and
>> due to alignment it was almost always 0.
>> But on some unlucky hardware, it's not the case, and some unitilized
>
> 'uninitialized'
>
>> memory is displayed on the BMC.
>> With shmem, the primary plane is always at offset 0 in GPU memory.
>>
>>   * v2: rewrite the patch to set the offset to 0. (Thomas Zimmermann)
>>   * v3: move the change to plane_init() and also fix the cursor plane.
>>         (Jammy Huang)
>>
>> Tested on a sr645 affected by this bug.
>>
>> Fixes: f2fa5a99ca81 ("drm/ast: Convert ast to SHMEM")
>> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Reviewed-by: Jammy Huang <jammy_huang@aspeedtech.com>

>
>> ---
>>   drivers/gpu/drm/ast/ast_mode.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ast/ast_mode.c 
>> b/drivers/gpu/drm/ast/ast_mode.c
>> index c7443317c747..66a4a41c3fe9 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 = 0; /* with shmem, the primary plane is always at 
>> offset 0 */
>>       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;
>> @@ -972,7 +972,7 @@ static int ast_cursor_plane_init(struct 
>> ast_private *ast)
>>           return -ENOMEM;
>>         vaddr = ast->vram + ast->vram_fb_available - size;
>> -    offset = ast->vram_base + ast->vram_fb_available - size;
>> +    offset = ast->vram_fb_available - size;
>>         ret = ast_plane_init(dev, ast_cursor_plane, vaddr, offset, size,
>>                    0x01, &ast_cursor_plane_funcs,
>
-- 
Best Regards
Jammy

[-- Attachment #2: Type: text/html, Size: 40101 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] drm/ast: Fix start address computation
  2023-02-10  0:33   ` Jammy Huang
@ 2023-02-10 15:02     ` Jocelyn Falempe
  0 siblings, 0 replies; 4+ messages in thread
From: Jocelyn Falempe @ 2023-02-10 15:02 UTC (permalink / raw)
  To: Jammy Huang, Thomas Zimmermann, dri-devel, airlied, kuohsiang_chou

On 10/02/2023 01:33, Jammy Huang wrote:
> 
> On 2023/2/9 下午 05:55, Thomas Zimmermann wrote:
>>
>>
>> Am 09.02.23 um 10:44 schrieb Jocelyn Falempe:
>>> During the driver conversion to shmem, the start address for the
>>> scanout buffer was set to the base PCI address.
>>> In most cases it works because only the lower 24bits are used, and
>>> due to alignment it was almost always 0.
>>> But on some unlucky hardware, it's not the case, and some unitilized
>>
>> 'uninitialized'
>>
>>> memory is displayed on the BMC.
>>> With shmem, the primary plane is always at offset 0 in GPU memory.
>>>
>>>   * v2: rewrite the patch to set the offset to 0. (Thomas Zimmermann)
>>>   * v3: move the change to plane_init() and also fix the cursor plane.
>>>         (Jammy Huang)
>>>
>>> Tested on a sr645 affected by this bug.
>>>
>>> Fixes: f2fa5a99ca81 ("drm/ast: Convert ast to SHMEM")
>>> Signed-off-by: Jocelyn Falempe <jfalempe@redhat.com>
>>
>> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> Reviewed-by: Jammy Huang <jammy_huang@aspeedtech.com>

I just pushed it to drm-misc-fixes.

Thanks a lot,

-- 

Jocelyn



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-10 15:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-09  9:44 [PATCH v3] drm/ast: Fix start address computation Jocelyn Falempe
2023-02-09  9:55 ` Thomas Zimmermann
2023-02-10  0:33   ` Jammy Huang
2023-02-10 15:02     ` Jocelyn Falempe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.