[i-g-t,v3,2/4] lib/igt_dummyload: use gem_mmap__cpu and gem_mmap__wc when applicable

Submitted by Lukasz Kalamarz on Jan. 11, 2019, 4:15 p.m.

Details

Message ID 20190111161548.15732-2-lukasz.kalamarz@intel.com
State New
Series "Series without cover letter"
Headers show

Commit Message

Lukasz Kalamarz Jan. 11, 2019, 4:15 p.m.
We had some duplicates in code that are using direct call to
__gem_mmap__cpu or __gem_mmap__wc and then assert it result, which is what
gem_mmap__cpu and gem_mmap__wc is taking care for us.
v2: Rebased and reordered this patch in series

Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Cc: Katarzyna Dec <katarzyna.dec@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/igt_dummyload.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
index 2027a4b7..982906f2 100644
--- a/lib/igt_dummyload.c
+++ b/lib/igt_dummyload.c
@@ -148,14 +148,13 @@  emit_recursive_batch(igt_spin_t *spin,
 
 		if (__gem_set_caching(fd, spin->poll_handle,
 				      I915_CACHING_CACHED) == 0)
-			spin->running = __gem_mmap__cpu(fd, spin->poll_handle,
-							0, 4096,
-							PROT_READ | PROT_WRITE);
+			spin->running = gem_mmap__cpu(fd, spin->poll_handle,
+						      0, 4096,
+						      PROT_READ | PROT_WRITE);
 		else
-			spin->running = __gem_mmap__wc(fd, spin->poll_handle,
-						       0, 4096,
-						       PROT_READ | PROT_WRITE);
-		igt_assert(spin->running);
+			spin->running = gem_mmap__wc(fd, spin->poll_handle,
+						     0, 4096,
+						     PROT_READ | PROT_WRITE);
 		igt_assert_eq(*spin->running, 0);
 
 		*batch++ = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0);

Comments

Daniele Ceraolo Spurio Jan. 11, 2019, 5:26 p.m.
On 01/11/2019 08:15 AM, Lukasz Kalamarz wrote:
> We had some duplicates in code that are using direct call to
> __gem_mmap__cpu or __gem_mmap__wc and then assert it result, which is what
> gem_mmap__cpu and gem_mmap__wc is taking care for us.
> v2: Rebased and reordered this patch in series
> 
> Signed-off-by: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Cc: Michal Winiarski <michal.winiarski@intel.com>
> Cc: Katarzyna Dec <katarzyna.dec@intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---

Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>

>   lib/igt_dummyload.c | 13 ++++++-------
>   1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/igt_dummyload.c b/lib/igt_dummyload.c
> index 2027a4b7..982906f2 100644
> --- a/lib/igt_dummyload.c
> +++ b/lib/igt_dummyload.c
> @@ -148,14 +148,13 @@ emit_recursive_batch(igt_spin_t *spin,
>   
>   		if (__gem_set_caching(fd, spin->poll_handle,
>   				      I915_CACHING_CACHED) == 0)
> -			spin->running = __gem_mmap__cpu(fd, spin->poll_handle,
> -							0, 4096,
> -							PROT_READ | PROT_WRITE);
> +			spin->running = gem_mmap__cpu(fd, spin->poll_handle,
> +						      0, 4096,
> +						      PROT_READ | PROT_WRITE);
>   		else
> -			spin->running = __gem_mmap__wc(fd, spin->poll_handle,
> -						       0, 4096,
> -						       PROT_READ | PROT_WRITE);
> -		igt_assert(spin->running);
> +			spin->running = gem_mmap__wc(fd, spin->poll_handle,
> +						     0, 4096,
> +						     PROT_READ | PROT_WRITE);
>   		igt_assert_eq(*spin->running, 0);
>   
>   		*batch++ = MI_STORE_DWORD_IMM | (gen < 6 ? 1 << 22 : 0);
>