All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: simplify ppgtt setup
@ 2012-04-10 14:25 Daniel Vetter
  2012-04-10 14:35 ` Chris Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2012-04-10 14:25 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

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.

Noticed-by: Konstantin Belousov <kostikbel@gmail.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 4fb875d..bea6187 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -98,9 +98,9 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 			goto err_pt_alloc;
 	}
 
-	for (i = 0; i < ppgtt->num_pd_entries; i++) {
+	if (dev_priv->mm.gtt->needs_dmar) {
+		for (i = 0; i < ppgtt->num_pd_entries; i++) {
 		dma_addr_t pt_addr;
-		if (dev_priv->mm.gtt->needs_dmar) {
 			pt_addr = pci_map_page(dev->pdev, ppgtt->pt_pages[i],
 					       0, 4096,
 					       PCI_DMA_BIDIRECTIONAL);
@@ -112,8 +112,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 
 			}
 			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;
-- 
1.7.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/i915: simplify ppgtt setup
  2012-04-10 14:25 [PATCH] drm/i915: simplify ppgtt setup Daniel Vetter
@ 2012-04-10 14:35 ` Chris Wilson
  2012-04-10 15:04   ` Daniel Vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2012-04-10 14:35 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

On Tue, 10 Apr 2012 16:25:54 +0200, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> 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.
> 
> Noticed-by: Konstantin Belousov <kostikbel@gmail.com>
> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c |    7 +++----
>  1 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 4fb875d..bea6187 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -98,9 +98,9 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
>  			goto err_pt_alloc;
>  	}
>  
> -	for (i = 0; i < ppgtt->num_pd_entries; i++) {
> +	if (dev_priv->mm.gtt->needs_dmar) {
> +		for (i = 0; i < ppgtt->num_pd_entries; i++) {
>  		dma_addr_t pt_addr;
Whitespace damage.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] drm/i915: simplify ppgtt setup
  2012-04-10 14:35 ` Chris Wilson
@ 2012-04-10 15:04   ` Daniel Vetter
  2012-04-10 15:10     ` Chris Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2012-04-10 15:04 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

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.

Noticed-by: Konstantin Belousov <kostikbel@gmail.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 4fb875d..5f75660 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -98,9 +98,10 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 			goto err_pt_alloc;
 	}
 
-	for (i = 0; i < ppgtt->num_pd_entries; i++) {
-		dma_addr_t pt_addr;
-		if (dev_priv->mm.gtt->needs_dmar) {
+	if (dev_priv->mm.gtt->needs_dmar) {
+		for (i = 0; i < ppgtt->num_pd_entries; i++) {
+			dma_addr_t pt_addr;
+
 			pt_addr = pci_map_page(dev->pdev, ppgtt->pt_pages[i],
 					       0, 4096,
 					       PCI_DMA_BIDIRECTIONAL);
@@ -112,8 +113,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 
 			}
 			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;
-- 
1.7.9

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/i915: simplify ppgtt setup
  2012-04-10 15:04   ` Daniel Vetter
@ 2012-04-10 15:10     ` Chris Wilson
  2012-04-10 15:29       ` daniel.vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2012-04-10 15:10 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

On Tue, 10 Apr 2012 17:04:35 +0200, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> 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.
> 
> Noticed-by: Konstantin Belousov <kostikbel@gmail.com>
> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 4fb875d..5f75660 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -98,9 +98,10 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
>  			goto err_pt_alloc;
>  	}
>  
> -	for (i = 0; i < ppgtt->num_pd_entries; i++) {
> -		dma_addr_t pt_addr;
> -		if (dev_priv->mm.gtt->needs_dmar) {
> +	if (dev_priv->mm.gtt->needs_dmar) {
Now just delete the preceding 3 lines...  ;-)
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] drm/i915: simplify ppgtt setup
  2012-04-10 15:10     ` Chris Wilson
@ 2012-04-10 15:29       ` daniel.vetter
  2012-04-10 15:33         ` Chris Wilson
  0 siblings, 1 reply; 7+ messages in thread
From: daniel.vetter @ 2012-04-10 15:29 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

From: Daniel Vetter <daniel.vetter@ffwll.ch>

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: Konstantin Belousov <kostikbel@gmail.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 4fb875d..25c8bf9 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -96,11 +96,10 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 					     GFP_KERNEL);
 		if (!ppgtt->pt_dma_addr)
 			goto err_pt_alloc;
-	}
 
-	for (i = 0; i < ppgtt->num_pd_entries; i++) {
-		dma_addr_t pt_addr;
-		if (dev_priv->mm.gtt->needs_dmar) {
+		for (i = 0; i < ppgtt->num_pd_entries; i++) {
+			dma_addr_t pt_addr;
+
 			pt_addr = pci_map_page(dev->pdev, ppgtt->pt_pages[i],
 					       0, 4096,
 					       PCI_DMA_BIDIRECTIONAL);
@@ -112,8 +111,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 
 			}
 			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;
-- 
1.7.9

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/i915: simplify ppgtt setup
  2012-04-10 15:29       ` daniel.vetter
@ 2012-04-10 15:33         ` Chris Wilson
  2012-04-11  9:55           ` Daniel Vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Chris Wilson @ 2012-04-10 15:33 UTC (permalink / raw)
  To: Intel Graphics Development; +Cc: Daniel Vetter

On Tue, 10 Apr 2012 17:29:17 +0200, daniel.vetter@ffwll.ch wrote:
> From: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> 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: Konstantin Belousov <kostikbel@gmail.com>
> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Reviewed-by: Chris Wilson <chris@chris-wislon.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] drm/i915: simplify ppgtt setup
  2012-04-10 15:33         ` Chris Wilson
@ 2012-04-11  9:55           ` Daniel Vetter
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2012-04-11  9:55 UTC (permalink / raw)
  To: Chris Wilson; +Cc: daniel.vetter, Intel Graphics Development

On Tue, Apr 10, 2012 at 04:33:38PM +0100, Chris Wilson wrote:
> On Tue, 10 Apr 2012 17:29:17 +0200, daniel.vetter@ffwll.ch wrote:
> > From: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > 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: Konstantin Belousov <kostikbel@gmail.com>
> > Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Reviewed-by: Chris Wilson <chris@chris-wislon.co.uk>
Queued for -next, thanks for the review.
-Daniel
-- 
Daniel Vetter
Mail: daniel@ffwll.ch
Mobile: +41 (0)79 365 57 48

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-11  9:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-10 14:25 [PATCH] drm/i915: simplify ppgtt setup Daniel Vetter
2012-04-10 14:35 ` Chris Wilson
2012-04-10 15:04   ` Daniel Vetter
2012-04-10 15:10     ` Chris Wilson
2012-04-10 15:29       ` daniel.vetter
2012-04-10 15:33         ` Chris Wilson
2012-04-11  9:55           ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.