Skip to content

Commit a93fad0

Browse files
Vandana Kannandanvet
authored andcommitted
drm/i915: DRRS calls based on frontbuffer
Calls have been added to invalidate/flush DRRS whenever invalidate/flush is called as part of frontbuffer tracking. Apart from calls as a result of GEM tracking to fb invalidate/flush, a call has been added to invalidate fb obj from crtc_page_flip as well. This is to track busyness through flip calls. The call to fb_obj_invalidate (in flip) is placed before queuing flip for this obj. drrs_invalidate() and drrs_flush() check for drrs.dp which would be NULL if it was setup in drrs_enable(). This covers for the condition when DRRS is not supported. v2: Removing the call to invalidate_drrs from page_flip. This has not been tested on Android yet, but, in case DRRS transtions do not work as expected, check by adding back this call in page_flip. Signed-off-by: Vandana Kannan <vandana.kannan@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent c395578 commit a93fad0

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

‎drivers/gpu/drm/i915/intel_dp.c‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4908,6 +4908,57 @@ static void intel_edp_drrs_downclock_work(struct work_struct *work)
49084908
mutex_unlock(&dev_priv->drrs.mutex);
49094909
}
49104910

4911+
void intel_edp_drrs_invalidate(struct drm_device *dev,
4912+
unsigned frontbuffer_bits)
4913+
{
4914+
struct drm_i915_private *dev_priv = dev->dev_private;
4915+
struct drm_crtc *crtc;
4916+
enum pipe pipe;
4917+
4918+
if (!dev_priv->drrs.dp)
4919+
return;
4920+
4921+
mutex_lock(&dev_priv->drrs.mutex);
4922+
crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
4923+
pipe = to_intel_crtc(crtc)->pipe;
4924+
4925+
if (dev_priv->drrs.refresh_rate_type == DRRS_LOW_RR) {
4926+
cancel_delayed_work_sync(&dev_priv->drrs.work);
4927+
intel_dp_set_drrs_state(dev_priv->dev,
4928+
dev_priv->drrs.dp->attached_connector->panel.
4929+
fixed_mode->vrefresh);
4930+
}
4931+
4932+
frontbuffer_bits &= INTEL_FRONTBUFFER_ALL_MASK(pipe);
4933+
4934+
dev_priv->drrs.busy_frontbuffer_bits |= frontbuffer_bits;
4935+
mutex_unlock(&dev_priv->drrs.mutex);
4936+
}
4937+
4938+
void intel_edp_drrs_flush(struct drm_device *dev,
4939+
unsigned frontbuffer_bits)
4940+
{
4941+
struct drm_i915_private *dev_priv = dev->dev_private;
4942+
struct drm_crtc *crtc;
4943+
enum pipe pipe;
4944+
4945+
if (!dev_priv->drrs.dp)
4946+
return;
4947+
4948+
mutex_lock(&dev_priv->drrs.mutex);
4949+
crtc = dp_to_dig_port(dev_priv->drrs.dp)->base.base.crtc;
4950+
pipe = to_intel_crtc(crtc)->pipe;
4951+
dev_priv->drrs.busy_frontbuffer_bits &= ~frontbuffer_bits;
4952+
4953+
cancel_delayed_work_sync(&dev_priv->drrs.work);
4954+
4955+
if (dev_priv->drrs.refresh_rate_type != DRRS_LOW_RR &&
4956+
!dev_priv->drrs.busy_frontbuffer_bits)
4957+
schedule_delayed_work(&dev_priv->drrs.work,
4958+
msecs_to_jiffies(1000));
4959+
mutex_unlock(&dev_priv->drrs.mutex);
4960+
}
4961+
49114962
static struct drm_display_mode *
49124963
intel_dp_drrs_init(struct intel_connector *intel_connector,
49134964
struct drm_display_mode *fixed_mode)

‎drivers/gpu/drm/i915/intel_drv.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,9 @@ int intel_disable_plane(struct drm_plane *plane);
10321032
void intel_plane_destroy(struct drm_plane *plane);
10331033
void intel_edp_drrs_enable(struct intel_dp *intel_dp);
10341034
void intel_edp_drrs_disable(struct intel_dp *intel_dp);
1035+
void intel_edp_drrs_invalidate(struct drm_device *dev,
1036+
unsigned frontbuffer_bits);
1037+
void intel_edp_drrs_flush(struct drm_device *dev, unsigned frontbuffer_bits);
10351038

10361039
/* intel_dp_mst.c */
10371040
int intel_dp_mst_encoder_init(struct intel_digital_port *intel_dig_port, int conn_id);

‎drivers/gpu/drm/i915/intel_frontbuffer.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ void intel_fb_obj_invalidate(struct drm_i915_gem_object *obj,
157157
intel_mark_fb_busy(dev, obj->frontbuffer_bits, ring);
158158

159159
intel_psr_invalidate(dev, obj->frontbuffer_bits);
160+
intel_edp_drrs_invalidate(dev, obj->frontbuffer_bits);
160161
}
161162

162163
/**
@@ -182,6 +183,7 @@ void intel_frontbuffer_flush(struct drm_device *dev,
182183

183184
intel_mark_fb_busy(dev, frontbuffer_bits, NULL);
184185

186+
intel_edp_drrs_flush(dev, frontbuffer_bits);
185187
intel_psr_flush(dev, frontbuffer_bits);
186188

187189
/*

0 commit comments

Comments
 (0)