Skip to content

Commit

Permalink
drm/i915: Combine scratch members into a struct
Browse files Browse the repository at this point in the history
There isn't any special reason to do this other than it makes it obvious
that the two members are connected.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Ben Widawsky authored and Daniel Vetter committed Jul 1, 2013
1 parent 84f1356 commit 6716724
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
6 changes: 4 additions & 2 deletions drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,10 @@ struct i915_gtt {
void __iomem *gsm;

bool do_idle_maps;
dma_addr_t scratch_page_dma;
struct page *scratch_page;
struct {
dma_addr_t addr;
struct page *page;
} scratch;

/* global gtt ops */
int (*gtt_probe)(struct drm_device *dev, size_t *gtt_total,
Expand Down
17 changes: 8 additions & 9 deletions drivers/gpu/drm/i915/i915_gem_gtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static void gen6_ppgtt_clear_range(struct i915_hw_ppgtt *ppgtt,
unsigned last_pte, i;

scratch_pte = ppgtt->pte_encode(ppgtt->dev,
dev_priv->gtt.scratch_page_dma,
dev_priv->gtt.scratch.addr,
I915_CACHE_LLC);

while (num_entries) {
Expand Down Expand Up @@ -521,8 +521,7 @@ static void gen6_ggtt_clear_range(struct drm_device *dev,
first_entry, num_entries, max_entries))
num_entries = max_entries;

scratch_pte = dev_priv->gtt.pte_encode(dev,
dev_priv->gtt.scratch_page_dma,
scratch_pte = dev_priv->gtt.pte_encode(dev, dev_priv->gtt.scratch.addr,
I915_CACHE_LLC);
for (i = 0; i < num_entries; i++)
iowrite32(scratch_pte, &gtt_base[i]);
Expand Down Expand Up @@ -727,20 +726,20 @@ static int setup_scratch_page(struct drm_device *dev)
#else
dma_addr = page_to_phys(page);
#endif
dev_priv->gtt.scratch_page = page;
dev_priv->gtt.scratch_page_dma = dma_addr;
dev_priv->gtt.scratch.page = page;
dev_priv->gtt.scratch.addr = dma_addr;

return 0;
}

static void teardown_scratch_page(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
set_pages_wb(dev_priv->gtt.scratch_page, 1);
pci_unmap_page(dev->pdev, dev_priv->gtt.scratch_page_dma,
set_pages_wb(dev_priv->gtt.scratch.page, 1);
pci_unmap_page(dev->pdev, dev_priv->gtt.scratch.addr,
PAGE_SIZE, PCI_DMA_BIDIRECTIONAL);
put_page(dev_priv->gtt.scratch_page);
__free_page(dev_priv->gtt.scratch_page);
put_page(dev_priv->gtt.scratch.page);
__free_page(dev_priv->gtt.scratch.page);
}

static inline unsigned int gen6_get_total_gtt_size(u16 snb_gmch_ctl)
Expand Down

0 comments on commit 6716724

Please sign in to comment.