Re: [PATCH v3] drm: Add UAPI for the Asahi driver

Alyssa Rosenzweig
2025-03-24T14:11:01Z

> >>>> + /**
> >>>> + * @DRM_ASAHI_BIND_SINGLE_PAGE: Map a single page of the BO repeatedly
> >>>> + * across the VA range.
> >>>> + *
> >>>> + * This is useful to fill a VA range with scratch pages or zero pages.
> >>>> + * It is intended as a mechanism to accelerate sparse.
> >>>> + */
> >>>> + DRM_ASAHI_BIND_SINGLE_PAGE = (1L << 2),
> >>
> >> Does this require the BO to be a single page? If so, does it require offset==0? Or does it just take whatever page is at the specified offset?
> >
> > I believe the intention is that it takes whatever page is at the
> > specified offset and just maps that a bunch of times. HK doesn't use
> > this yet though it probably should (this was added to help reduce
> > overhead when emulating sparse with scratch/zero pages, which is still
> > very new functionality in hk).
> >
> > Accelerating this properly involves GPUVM patches - although even without
> > that, moving the loop into the kernel so it's only a single ioctl
> > (user-kernel roundtrip) seems worth keeping the flag for.
>
> FYI: I will be posting a patch for the GPUVM abstraction soon.

Great to hear :) Although in this case, I meant that accelerating
DRM_ASAHI_BIND_SINGLE_PAGE requires patches to extend the actual C
implementation of drm/gpuvm, not just the Rust abstraction. Which is a
bit annoying for non-essential functionality with regards to upstreaming
things...