[Mesa-dev] [PATCH 2/4] i965: Use drm_intel_get_aperture_sizes instead of hard-coded 2GiB

Daniel Vetter daniel at ffwll.ch
Mon Nov 11 14:30:08 PST 2013


On Mon, Nov 11, 2013 at 01:45:43PM -0800, Ian Romanick wrote:
> On 11/11/2013 01:35 PM, Daniel Vetter wrote:
> > On Mon, Nov 11, 2013 at 11:19:07AM -0800, Ian Romanick wrote:
> >> From: Ian Romanick <ian.d.romanick at intel.com>
> >>
> >> Systems with little physical memory installed will report less than
> >> 2GiB, and some systems may (hypothetically?) have a larger address space
> >> for the GPU.  My IVB still reports 1534.
> >>
> >> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> >> Cc: Daniel Vetter <daniel at ffwll.ch>
> >> Cc: "10.0" <mesa-stable at lists.freedesktop.org>
> >> ---
> >>  src/mesa/drivers/dri/i965/intel_screen.c | 10 +++++++---
> >>  1 file changed, 7 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
> >> index e39d654..592150b 100644
> >> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> >> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> >> @@ -823,10 +823,14 @@ brw_query_renderer_integer(__DRIscreen *psp, int param, int *value)
> >>        /* Once a batch uses more than 75% of the maximum mappable size, we
> >>         * assume that there's some fragmentation, and we start doing extra
> >>         * flushing, etc.  That's the big cliff apps will care about.
> >> -       *
> >> -       * Can only map 2G onto the GPU through the GTT.
> >>         */
> >> -      const unsigned gpu_mappable_megabytes = 2 * 1024 * 3 / 4;
> >> +      size_t aper_size;
> >> +      size_t mappable_size;
> >> +
> >> +      drm_intel_get_aperture_sizes(psp->fd, &mappable_size, &aper_size);
> > 
> > Hm, I haven't seen the (presumably) libdrm patch that adds this yet float
> > by, but you really want to match the uint64_t libdrm uses internally for
> > gtt_size here ... ;-)
> > 
> > With that fixed both patches are
> > Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> > I'll look at the wrapper as soon as it hits my inbox.
> 
> Eh... drm_intel_get_aperture_sizes has been around for almost 2.5 years.
> 
> commit 9d77603d8b95aee4f2408e437c55af15ee05b608
> Author:     Chris Wilson <chris at chris-wilson.co.uk>
> AuthorDate: Sat Jun 4 12:47:19 2011 +0100
> Commit:     Chris Wilson <chris at chris-wilson.co.uk>
> CommitDate: Sat Jun 4 13:01:11 2011 +0100
> 
>     intel: Add interface to query aperture sizes.
> 
>     Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

Oops, indeed. I seem to be blind.

> Should I submit a libdrm patch to change it's interface from size_t to
> uint64_t?

Would be an abi break I think (at least on 32 bit), so not worth the
trouble. I'll scowl a bit at Chris for failing to predict the future and
add it to the list of things to fix for bdw. Patches are r-b as is.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the mesa-dev mailing list