[Nouveau] [PATCH v3 1/6] make RAM device optional

Ben Skeggs
2015-02-19T02:20:03Z

On 18 Feb 2015 17:08, "Alexandre Courbot" <gnurou at gmail.com>
wrote:
>
> On Wed, Feb 18, 2015 at 8:01 AM, Ben Skeggs <skeggsb at gmail.com>
wrote:
> > On Tue, Feb 17, 2015 at 5:47 PM, Alexandre Courbot <acourbot at
nvidia.com>
wrote:
> >> Having a RAM device does not make sense for chips like GK20A which
have
> >> no dedicated video memory. The dummy RAM device that we used so
far
> >> works as a temporary band-aid, but in the long-term it is
desirable for
> >> the driver to be able to work without any kind of VRAM.
> >>
> >> This patch adds a few conditionals in places where a RAM device
was
> >> assumed to be present and allows some more objects to be allocated
from
> >> the TT domain, allowing Nouveau to handle GPUs for which
> >> pfb->ram == NULL.
> >>
> >> Signed-off-by: Alexandre Courbot <acourbot at nvidia.com>
> >> ---
> >>  drm/nouveau/nouveau_display.c         |  8 +++++++-
> >>  drm/nouveau/nouveau_ttm.c             |  3 +++
> >>  drm/nouveau/nv84_fence.c              | 14 +++++++++++---
> >>  drm/nouveau/nvkm/engine/device/base.c |  9 ++++++---
> >>  drm/nouveau/nvkm/subdev/clk/base.c    |  2 +-
> >>  drm/nouveau/nvkm/subdev/fb/base.c     | 26
++++++++++++++++++--------
> >>  drm/nouveau/nvkm/subdev/ltc/gf100.c   | 10 +++++++++-
> >>  7 files changed, 55 insertions(+), 17 deletions(-)
> >>
> >> diff --git a/drm/nouveau/nouveau_display.c
b/drm/nouveau/nouveau_display.c
> >> index 860b0e2d4181..68ee0af22eea 100644
> >> --- a/drm/nouveau/nouveau_display.c
> >> +++ b/drm/nouveau/nouveau_display.c
> >> @@ -869,13 +869,19 @@ nouveau_display_dumb_create(struct drm_file
*file_priv, struct drm_device *dev,
> >>                             struct drm_mode_create_dumb *args)
> >>  {
> >>         struct nouveau_bo *bo;
> >> +       uint32_t domain;
> >>         int ret;
> >>
> >>         args->pitch = roundup(args->width * (args->bpp /
8), 256);
> >>         args->size = args->pitch * args->height;
> >>         args->size = roundup(args->size, PAGE_SIZE);
> >>
> >> -       ret = nouveau_gem_new(dev, args->size, 0,
NOUVEAU_GEM_DOMAIN_VRAM, 0, 0, &bo);
> >> +       if (nvxx_fb(&nouveau_drm(dev)->device)->ram)
> > For these checks in the drm, it's probably better to use
> > nouveau_drm(dev)->device.info.ram_size.
>
> I wonder - in other places (e.g. clock, ltc) we don't have access to
> nouveau_drm, so IIUC we need to rely on pfb->ram there.
Correct.

>Wouldn't it be
> more confusing to use two different ways to check the presence of VRAM
> when we could stick to a single one?
It's best to think of nvkm/ as a separate entity, and it will be at some
point (drm load on its own, inside a vm), and drm might not be able to
access it's internal structures.

That's not the case now, so the code is fine as-is for the moment. But
it's
worth keeping in mind.

Thanks,
Ben.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.freedesktop.org/archives/nouveau/attachments/20150219/2357e962/attachment.html>