Browse Source

drm/i915/perf: check the value of PROP_SAMPLE_OA uapi parameter

We've been a bit loose about this opening parameter. We should only
add the flag for writing OA reports when the value of this parameter
is != 0.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180326090831.22686-3-lionel.g.landwerlin@intel.com
Lionel Landwerlin 7 years ago
parent
commit
b6dd47b9c8
1 changed files with 2 additions and 1 deletions
  1. 2 1
      drivers/gpu/drm/i915/i915_perf.c

+ 2 - 1
drivers/gpu/drm/i915/i915_perf.c

@@ -2746,7 +2746,8 @@ static int read_properties_unlocked(struct drm_i915_private *dev_priv,
 			props->ctx_handle = value;
 			props->ctx_handle = value;
 			break;
 			break;
 		case DRM_I915_PERF_PROP_SAMPLE_OA:
 		case DRM_I915_PERF_PROP_SAMPLE_OA:
-			props->sample_flags |= SAMPLE_OA_REPORT;
+			if (value)
+				props->sample_flags |= SAMPLE_OA_REPORT;
 			break;
 			break;
 		case DRM_I915_PERF_PROP_OA_METRICS_SET:
 		case DRM_I915_PERF_PROP_OA_METRICS_SET:
 			if (value == 0) {
 			if (value == 0) {