<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <div class="moz-text-html" lang="x-unicode">
      <p><font face="Times New Roman">Hi,</font></p>
      <p><font face="Times New Roman"><span style="font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">This patch works fine with my Loongson 3A5000M laptop (L71), which has a 7A1000 chipset without VRAM.</span></font></p>
      <p><font face="Times New Roman"><span style="color: rgb(55, 65, 81); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-wrap; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">
</span></font></p>
    </div>
    <p></p>
    <div class="moz-cite-prefix">On 2024/1/20 0:18, Sui JIngfeng wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:1ead2284-dbc1-4938-bdce-66971c70ef1e@linux.dev">Hi,
      <br>
      <br>
      Thanks a lot for contribution.
      <br>
      <br>
      On 2024/1/19 18:40, Huacai Chen wrote:
      <br>
      <blockquote type="cite">If there is no VRAM (it is true if there
        is a discreted card),
        <br>
      </blockquote>
      <br>
      <br>
      Why the dedicated VRAM is gone whenthere is a discrete card?
      <br>
      <br>
      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.
      <br>
      <br>
      Because without dedicated VRAM, this driver can not work
      correctly. Or carve out
      <br>
      part of system RAM as VRAM, and write the base address and size to
      the BAR 2 of
      <br>
      the GPU PCI device.
      <br>
      This is NOT true  for Loongson 3A5000/3A6000  desktop hardware,
      because I have do
      <br>
      a lot test on various platform[1] before this driver was merged.
      It never happens
      <br>
      on a sane hardware configuration. Please update the commit message
      and limit the
      <br>
      scope.
      <br>
      <br>
      [1] <a class="moz-txt-link-freetext" href="https://github.com/loongson-gfx/loongson_boards">https://github.com/loongson-gfx/loongson_boards</a>
      <br>
      <br>
      <blockquote type="cite">we get
        <br>
        such an error and Xorg fails to start:
        <br>
      </blockquote>
      <br>
      <br>
      Yeah, If there is no dedicated VRAM, the driver can't allocate
      memory for framebuffer.
      <br>
      But this is probably more about the hardware configuration issue,
      not a driver issue.
      <br>
      <br>
      <br>
      <blockquote type="cite">[  136.401131] loongson 0000:00:06.1:
        [drm] *ERROR* Requesting(0MiB) failed
        <br>
        [  137.444342] loongson 0000:00:06.1: [drm] *ERROR*
        Requesting(0MiB) failed
        <br>
        [  138.871166] loongson 0000:00:06.1: [drm] *ERROR*
        Requesting(0MiB) failed
        <br>
        [  140.444078] loongson 0000:00:06.1: [drm] *ERROR*
        Requesting(0MiB) failed
        <br>
        [  142.403993] loongson 0000:00:06.1: [drm] *ERROR*
        Requesting(0MiB) failed
        <br>
        [  143.970625] loongson 0000:00:06.1: [drm] *ERROR*
        Requesting(0MiB) failed
        <br>
        [  145.862013] loongson 0000:00:06.1: [drm] *ERROR*
        Requesting(0MiB) failed
        <br>
        <br>
        So in lsdc_get_dedicated_vram() we error out if no VRAM (or VRAM
        is less
        <br>
        than 1MB which is also an unusable case) detected.
        <br>
      </blockquote>
      <br>
      <br>
      This is not expected, if you want this driver be there and run
      normally.
      <br>
      You should guarantee that there have at least 64MiB dedicated
      VRAM.
      <br>
      <br>
      I'm OK if this patch is strongly requested, but this is a kind of
      error handling.
      <br>
      Please give more details about the hardware in using and explain
      why there is no
      <br>
      dedicated VRAM available for your hardware.
      <br>
      <br>
      <br>
      <blockquote type="cite">Signed-off-by: Huacai Chen
        <a class="moz-txt-link-rfc2396E" href="mailto:chenhuacai@loongson.cn"><chenhuacai@loongson.cn></a>
        <br>
        ---
        <br>
          drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
        <br>
          1 file changed, 1 insertion(+), 1 deletion(-)
        <br>
        <br>
        diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c
        b/drivers/gpu/drm/loongson/lsdc_drv.c
        <br>
        index 89ccc0c43169..d8ff60b46abe 100644
        <br>
        --- a/drivers/gpu/drm/loongson/lsdc_drv.c
        <br>
        +++ b/drivers/gpu/drm/loongson/lsdc_drv.c
        <br>
        @@ -184,7 +184,7 @@ static int lsdc_get_dedicated_vram(struct
        lsdc_device *ldev,
        <br>
              drm_info(ddev, "Dedicated vram start: 0x%llx, size:
        %uMiB\n",
        <br>
                   (u64)base, (u32)(size >> 20));
        <br>
          -    return 0;
        <br>
        +    return (size > SZ_1M) ? 0 : -ENODEV;
        <br>
          }
        <br>
            static struct lsdc_device *
        <br>
      </blockquote>
      <br>
    </blockquote>
  </body>
</html>