Commit 211c568b authored by Daniel Vetter's avatar Daniel Vetter

drm/i915: simplify ppgtt setup

We don't need the pt_addr for the !dmar case, so drop the else and
move the if (dmar) condition out of the loop.

v2: Fixup whitespace damage noticed by Chris Wilson.

v3: Collapse the two identical if blocks. Chris Wilson makes me look
like a moron right now ...
Noticed-by: default avatarKonstantin Belousov <kostikbel@gmail.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wislon.co.uk>
Signed-Off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent e3aef172
...@@ -96,11 +96,10 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) ...@@ -96,11 +96,10 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
GFP_KERNEL); GFP_KERNEL);
if (!ppgtt->pt_dma_addr) if (!ppgtt->pt_dma_addr)
goto err_pt_alloc; goto err_pt_alloc;
}
for (i = 0; i < ppgtt->num_pd_entries; i++) { for (i = 0; i < ppgtt->num_pd_entries; i++) {
dma_addr_t pt_addr; dma_addr_t pt_addr;
if (dev_priv->mm.gtt->needs_dmar) {
pt_addr = pci_map_page(dev->pdev, ppgtt->pt_pages[i], pt_addr = pci_map_page(dev->pdev, ppgtt->pt_pages[i],
0, 4096, 0, 4096,
PCI_DMA_BIDIRECTIONAL); PCI_DMA_BIDIRECTIONAL);
...@@ -112,8 +111,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) ...@@ -112,8 +111,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
} }
ppgtt->pt_dma_addr[i] = pt_addr; ppgtt->pt_dma_addr[i] = pt_addr;
} else }
pt_addr = page_to_phys(ppgtt->pt_pages[i]);
} }
ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma; ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment