diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-01-21 17:16:10 -0800 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-01-21 17:16:10 -0800 | 
| commit | 36ada25026357c855d5839166f78017509824b77 (patch) | |
| tree | a474f5a1032996d75bfcd3ba6896cb6765470d6a /drivers/gpu/drm/i915/i915_request.h | |
| parent | 9f29bd8b2e7132b409178d1367dae1813017bd0e (diff) | |
| parent | 06ee38dc2aab3b5a09feb74128cf7326a490b788 (diff) | |
Merge tag 'drm-fixes-2021-01-22' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie:
 "Regular fixes pull, nothing too major in here, just some core fixes,
  one vc4, bunch of i915 and a bunch of amdgpu.
  core:
   - atomic: Release state on error
   - syncobj: Fix use-after-free
   - ttm: Don't use GFP_TRANSHUGE_LIGTH
   - vram-helper: Fix memory leak in vmap
  vc4:
   - Unify driver naming for PCM
  i915:
   - HDCP fixes
   - PMU wakeref fix
   - Fix HWSP validity race
   - Fix DP protocol converter accidental 4:4:4->4:2:0 conversion for RGB
  amdgpu:
   - Green Sardine fixes
   - Vangogh fixes
   - Renoir fixes
   - Misc display fixes"
* tag 'drm-fixes-2021-01-22' of git://anongit.freedesktop.org/drm/drm: (21 commits)
  drm/amdgpu: update mmhub mgcg&ls for mmhub_v2_3
  drm/amdgpu: modify GCR_GENERAL_CNTL for Vangogh
  drm/amdgpu/pm: no need GPU status set since mmnbif_gpu_BIF_DOORBELL_FENCE_CNTL added in FSDL
  drm/amd/display: Fixed corruptions on HPDRX link loss restore
  drm/amd/display: Use hardware sequencer functions for PG control
  drm/amd/display: Change function decide_dp_link_settings to avoid infinite looping
  drm/amd/display: Allow PSTATE chnage when no displays are enabled
  drm/amd/display: Update dram_clock_change_latency for DCN2.1
  drm/amdgpu: remove gpu info firmware of green sardine
  drm/amd/display: DCN2X Find Secondary Pipe properly in MPO + ODM Case
  drm/syncobj: Fix use-after-free
  drm/vram-helper: Reuse existing page mappings in vmap
  drm/atomic: put state on error path
  drm/i915: Only enable DFP 4:4:4->4:2:0 conversion when outputting YCbCr 4:4:4
  drm/i915: Check for rq->hwsp validity after acquiring RCU lock
  drm/i915/pmu: Don't grab wakeref when enabling events
  drm/i915/gt: Prevent use of engine->wa_ctx after error
  drm/vc4: Unify PCM card's driver_name
  drm/ttm: stop using GFP_TRANSHUGE_LIGHT
  drm/i915/hdcp: Get conn while content_type changed
  ...
Diffstat (limited to 'drivers/gpu/drm/i915/i915_request.h')
| -rw-r--r-- | drivers/gpu/drm/i915/i915_request.h | 37 | 
1 files changed, 32 insertions, 5 deletions
| diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h index 620b6fab2c5c..92adfee30c7c 100644 --- a/drivers/gpu/drm/i915/i915_request.h +++ b/drivers/gpu/drm/i915/i915_request.h @@ -434,7 +434,7 @@ static inline u32 hwsp_seqno(const struct i915_request *rq)  static inline bool __i915_request_has_started(const struct i915_request *rq)  { -	return i915_seqno_passed(hwsp_seqno(rq), rq->fence.seqno - 1); +	return i915_seqno_passed(__hwsp_seqno(rq), rq->fence.seqno - 1);  }  /** @@ -465,11 +465,19 @@ static inline bool __i915_request_has_started(const struct i915_request *rq)   */  static inline bool i915_request_started(const struct i915_request *rq)  { +	bool result; +  	if (i915_request_signaled(rq))  		return true; -	/* Remember: started but may have since been preempted! */ -	return __i915_request_has_started(rq); +	result = true; +	rcu_read_lock(); /* the HWSP may be freed at runtime */ +	if (likely(!i915_request_signaled(rq))) +		/* Remember: started but may have since been preempted! */ +		result = __i915_request_has_started(rq); +	rcu_read_unlock(); + +	return result;  }  /** @@ -482,10 +490,16 @@ static inline bool i915_request_started(const struct i915_request *rq)   */  static inline bool i915_request_is_running(const struct i915_request *rq)  { +	bool result; +  	if (!i915_request_is_active(rq))  		return false; -	return __i915_request_has_started(rq); +	rcu_read_lock(); +	result = __i915_request_has_started(rq) && i915_request_is_active(rq); +	rcu_read_unlock(); + +	return result;  }  /** @@ -509,12 +523,25 @@ static inline bool i915_request_is_ready(const struct i915_request *rq)  	return !list_empty(&rq->sched.link);  } +static inline bool __i915_request_is_complete(const struct i915_request *rq) +{ +	return i915_seqno_passed(__hwsp_seqno(rq), rq->fence.seqno); +} +  static inline bool i915_request_completed(const struct i915_request *rq)  { +	bool result; +  	if (i915_request_signaled(rq))  		return true; -	return i915_seqno_passed(hwsp_seqno(rq), rq->fence.seqno); +	result = true; +	rcu_read_lock(); /* the HWSP may be freed at runtime */ +	if (likely(!i915_request_signaled(rq))) +		result = __i915_request_is_complete(rq); +	rcu_read_unlock(); + +	return result;  }  static inline void i915_request_mark_complete(struct i915_request *rq) | 
