[Intel-gfx] [PATCH 07/13] drm/i915: Stop using gtt_total_entries

Ben Widawsky ben at bwidawsk.net
Fri Jan 18 01:10:57 CET 2013


On Fri, 18 Jan 2013 00:04:24 +0100
Daniel Vetter <daniel at ffwll.ch> wrote:

> On Thu, Jan 17, 2013 at 12:45:18PM -0800, Ben Widawsky wrote:
> > Similar to gtt_mappable_entries we don't usually want the entries,
> > it's easy enough to calculate it when you need.
> > 
> > v2: Move relevant fields above pre-gen6 init
> > 
> > Reviewed-by: Rodrigo Vivi <rodrigo.vivi at gmail.com>
> > Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> 
> [snip]
> 
> > @@ -687,11 +690,18 @@ int i915_gem_gtt_init(struct drm_device *dev)
> >  {
> >  	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	phys_addr_t gtt_bus_addr;
> > +	u32 gtt_size;
> >  	u16 snb_gmch_ctl;
> >  	int ret;
> >  
> > +	if (!pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(40)))
> > +		pci_set_consistent_dma_mask(dev->pdev, DMA_BIT_MASK(40));
> > +
> > +	pci_read_config_word(dev->pdev, SNB_GMCH_CTRL, &snb_gmch_ctl);
> >  	dev_priv->gtt.mappable_base = pci_resource_start(dev->pdev, 2);
> >  	dev_priv->gtt.mappable_end = pci_resource_len(dev->pdev, 2);
> > +	gtt_size = gen6_get_total_gtt_size(snb_gmch_ctl);
> 
> Calculating gtt size like this doesn't work too well on pre-gen6.
> -Daniel


Cc Chris in case he has an opinion.

Daniel, you're right as usual. I botched this again. We actually care
about those values in so few places, I thought it might be okay, but it
looks like it's not.

Just to update others on our private IRC conversation, my plan unless it
turns out too ugly is to create a vtable with a gmch probing function.
The vtable is required for other stuff coming soon (more below).

Something like:
int (*gmch_probe)(dev, *mappable_size, *gtt_size, *stolen_size);
and then add/update the relevant code in agp/intel-gtt.c.

This allows me to still kill intel_gtt, which for whatever reason I'm
pretty gung-ho on killing. I'll need the vtable for things like
clear_range, and write_entry among some others I know of and probably a
few I haven't yet discovered.

-- 
Ben Widawsky, Intel Open Source Technology Center



More information about the Intel-gfx mailing list