dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Sui JIngfeng <sui.jingfeng@linux.dev>
To: Huacai Chen <chenhuacai@loongson.cn>,
	David Airlie <airlied@gmail.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Huacai Chen <chenhuacai@kernel.org>
Cc: "loongson-kernel@lists.loongnix.cn"
	<loongson-kernel@lists.loongnix.cn>,
	dri-devel@lists.freedesktop.org
Subject: Re: drm/loongson: Error out if no VRAM detected
Date: Sat, 20 Jan 2024 00:18:49 +0800	[thread overview]
Message-ID: <1ead2284-dbc1-4938-bdce-66971c70ef1e@linux.dev> (raw)
In-Reply-To: <20240119104049.335449-1-chenhuacai@loongson.cn>

Hi,

Thanks a lot for contribution.

On 2024/1/19 18:40, Huacai Chen wrote:
> If there is no VRAM (it is true if there is a discreted card),


Why the dedicated VRAM is gone whenthere is a discrete card?

As far as I know, this is only possible on Loongson 3C5000 + aspeed BMC 
server hardware platform where the dedicated VRAM chip of Loongson 
Graphics is NOT soldered on the motherboard. Probably for cost reason, 
but then, the platform BIOS(either UEFI or PMON) should turn off the 
Loongson integrated graphics.

Because without dedicated VRAM, this driver can not work correctly. Or carve out
part of system RAM as VRAM, and write the base address and size to the BAR 2 of
the GPU PCI device.
This is NOT true  for Loongson 3A5000/3A6000  desktop hardware, because I have do
a lot test on various platform[1] before this driver was merged. It never happens
on a sane hardware configuration. Please update the commit message and limit the
scope.

[1] https://github.com/loongson-gfx/loongson_boards

> we get
> such an error and Xorg fails to start:


Yeah, If there is no dedicated VRAM, the driver can't allocate memory for framebuffer.
But this is probably more about the hardware configuration issue, not a driver issue.


> [  136.401131] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [  137.444342] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [  138.871166] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [  140.444078] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [  142.403993] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [  143.970625] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
> [  145.862013] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed
>
> So in lsdc_get_dedicated_vram() we error out if no VRAM (or VRAM is less
> than 1MB which is also an unusable case) detected.


This is not expected, if you want this driver be there and run normally.
You should guarantee that there have at least 64MiB dedicated VRAM.

I'm OK if this patch is strongly requested, but this is a kind of error handling.
Please give more details about the hardware in using and explain why there is no
dedicated VRAM available for your hardware.


> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
>   drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
> index 89ccc0c43169..d8ff60b46abe 100644
> --- a/drivers/gpu/drm/loongson/lsdc_drv.c
> +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
> @@ -184,7 +184,7 @@ static int lsdc_get_dedicated_vram(struct lsdc_device *ldev,
>   	drm_info(ddev, "Dedicated vram start: 0x%llx, size: %uMiB\n",
>   		 (u64)base, (u32)(size >> 20));
>   
> -	return 0;
> +	return (size > SZ_1M) ? 0 : -ENODEV;
>   }
>   
>   static struct lsdc_device *

  reply	other threads:[~2024-01-19 16:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 10:40 [PATCH] drm/loongson: Error out if no VRAM detected Huacai Chen
2024-01-19 16:18 ` Sui JIngfeng [this message]
2024-01-20 10:15   ` Katyusha
2024-01-20 12:01   ` Katyusha
2024-01-20 21:28     ` Sui JIngfeng
2024-01-21  7:07       ` Katyusha
2024-01-23 13:10         ` Sui Jingfeng
2024-01-20 16:07   ` yetist
2024-01-20 21:09     ` Sui JIngfeng
2024-01-21  8:45       ` yetist
2024-01-24 10:06   ` Huacai Chen
2024-01-23  1:21 ` [PATCH] " Shi Pujin
2024-02-02 17:24 ` Sui Jingfeng
2024-02-06  4:05   ` Huacai Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ead2284-dbc1-4938-bdce-66971c70ef1e@linux.dev \
    --to=sui.jingfeng@linux.dev \
    --cc=airlied@gmail.com \
    --cc=chenhuacai@kernel.org \
    --cc=chenhuacai@loongson.cn \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=loongson-kernel@lists.loongnix.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).