[igt-dev] [PATCH i-g-t v6 8/9] Remove static variables from mapping version function
Antonio Argenziano
antonio.argenziano at intel.com
Thu Jun 13 21:54:47 UTC 2019
---
lib/i915/gem_mman.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c
index 2b3947de..4d08a01e 100644
--- a/lib/i915/gem_mman.c
+++ b/lib/i915/gem_mman.c
@@ -50,22 +50,17 @@
*/
static int gem_mmap__gtt_version(int fd)
{
- static int gtt_version = ~0;
+ int gtt_version = ~0;
+ struct drm_i915_getparam gp;
- if (gtt_version == ~0) {
- struct drm_i915_getparam gp;
+ memset(&gp, 0, sizeof(gp));
+ gp.param = I915_PARAM_MMAP_GTT_VERSION;
+ gp.value = >t_version;
- gtt_version = 0;
+ if(ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp) && errno == -ENODEV)
+ gtt_version = -1; /* No mappable aperture */
- memset(&gp, 0, sizeof(gp));
- gp.param = I915_PARAM_MMAP_GTT_VERSION;
- gp.value = >t_version;
-
- if(ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp) && errno == -ENODEV)
- gtt_version = -1; /* No mappable aperture */
-
- errno = 0;
- }
+ errno = 0;
return gtt_version;
}
--
2.21.0
More information about the igt-dev
mailing list