Commit 851f15fe authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Stash DRRS state under intel_crtc

Ger rid of one more ugly crtc->config usage by storing the DRRS
state under intel_crtc. intel_drrs_enable() copies what it needs
from the crtc state, after which DRRS can be blissfully ignorant
of anything going on around it.

This also lets multiple pipes do DRRS simultanously and entirely
independently.

v2: Split out some stuff (Jani)
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220311172428.14685-13-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
parent ba770ce3
......@@ -24,6 +24,7 @@
#include "intel_display_debugfs.h"
#include "intel_display_trace.h"
#include "intel_display_types.h"
#include "intel_drrs.h"
#include "intel_dsi.h"
#include "intel_pipe_crc.h"
#include "intel_psr.h"
......@@ -367,6 +368,7 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
intel_color_init(crtc);
intel_crtc_drrs_init(crtc);
intel_crtc_crc_init(crtc);
cpu_latency_qos_add_request(&crtc->vblank_pm_qos, PM_QOS_DEFAULT_VALUE);
......
......@@ -3013,10 +3013,12 @@ static void intel_ddi_update_pipe_dp(struct intel_atomic_state *state,
const struct intel_crtc_state *crtc_state,
const struct drm_connector_state *conn_state)
{
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
intel_ddi_set_dp_msa(crtc_state, conn_state);
intel_dp_set_infoframes(encoder, true, crtc_state, conn_state);
intel_drrs_update(crtc_state);
intel_drrs_update(state, crtc);
intel_backlight_update(state, encoder, crtc_state, conn_state);
drm_connector_update_privacy_screen(conn_state);
......
......@@ -1229,7 +1229,7 @@ static void intel_post_plane_update(struct intel_atomic_state *state,
hsw_ips_post_update(state, crtc);
intel_fbc_post_update(state, crtc);
intel_drrs_page_flip(state, crtc);
intel_drrs_page_flip(crtc);
if (needs_async_flip_vtd_wa(old_crtc_state) &&
!needs_async_flip_vtd_wa(new_crtc_state))
......
......@@ -1138,20 +1138,15 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
return 0;
}
static void drrs_status_per_crtc(struct seq_file *m,
struct drm_device *dev,
struct intel_crtc *crtc)
static int i915_drrs_status(struct seq_file *m, void *unused)
{
struct drm_i915_private *dev_priv = to_i915(dev);
struct i915_drrs *drrs = &dev_priv->drrs;
struct intel_connector *connector;
struct drm_i915_private *dev_priv = node_to_i915(m->private);
struct drm_connector_list_iter conn_iter;
struct intel_connector *connector;
struct intel_crtc *crtc;
drm_connector_list_iter_begin(dev, &conn_iter);
drm_connector_list_iter_begin(&dev_priv->drm, &conn_iter);
for_each_intel_connector_iter(connector, &conn_iter) {
if (connector->base.state->crtc != &crtc->base)
continue;
seq_printf(m, "[CONNECTOR:%d:%s] DRRS type: %s\n",
connector->base.base.id, connector->base.name,
intel_drrs_type_str(intel_panel_drrs_type(connector)));
......@@ -1160,56 +1155,25 @@ static void drrs_status_per_crtc(struct seq_file *m,
seq_puts(m, "\n");
if (to_intel_crtc_state(crtc->base.state)->has_drrs) {
mutex_lock(&drrs->mutex);
/* DRRS Supported */
seq_puts(m, "\tDRRS Enabled: Yes\n");
for_each_intel_crtc(&dev_priv->drm, crtc) {
seq_printf(m, "[CRTC:%d:%s]:\n",
crtc->base.base.id, crtc->base.name);
/* disable_drrs() will make drrs->dp NULL */
if (!drrs->crtc) {
seq_puts(m, "Idleness DRRS: Disabled\n");
mutex_unlock(&drrs->mutex);
return;
}
mutex_lock(&crtc->drrs.mutex);
seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X",
drrs->busy_frontbuffer_bits);
/* DRRS Supported */
seq_printf(m, "\tDRRS Enabled: %s\n",
str_yes_no(intel_drrs_is_enabled(crtc)));
seq_puts(m, "\n\t\t");
seq_printf(m, "\tBusy_frontbuffer_bits: 0x%X\n",
crtc->drrs.busy_frontbuffer_bits);
seq_printf(m, "DRRS refresh rate: %s\n",
drrs->refresh_rate == DRRS_REFRESH_RATE_LOW ?
crtc->drrs.refresh_rate == DRRS_REFRESH_RATE_LOW ?
"low" : "high");
seq_puts(m, "\n\t\t");
mutex_unlock(&drrs->mutex);
} else {
/* DRRS not supported. Print the VBT parameter*/
seq_puts(m, "\tDRRS Enabled : No");
}
seq_puts(m, "\n");
}
static int i915_drrs_status(struct seq_file *m, void *unused)
{
struct drm_i915_private *dev_priv = node_to_i915(m->private);
struct drm_device *dev = &dev_priv->drm;
struct intel_crtc *crtc;
int active_crtc_cnt = 0;
drm_modeset_lock_all(dev);
for_each_intel_crtc(dev, crtc) {
if (crtc->base.state->active) {
active_crtc_cnt++;
seq_printf(m, "\nCRTC %d: ", active_crtc_cnt);
drrs_status_per_crtc(m, dev, crtc);
}
mutex_unlock(&crtc->drrs.mutex);
}
drm_modeset_unlock_all(dev);
if (!active_crtc_cnt)
seq_puts(m, "No active crtc found\n");
return 0;
}
......
......@@ -1252,6 +1252,11 @@ enum intel_pipe_crc_source {
INTEL_PIPE_CRC_SOURCE_MAX,
};
enum drrs_refresh_rate {
DRRS_REFRESH_RATE_HIGH,
DRRS_REFRESH_RATE_LOW,
};
#define INTEL_PIPE_CRC_ENTRIES_NR 128
struct intel_pipe_crc {
spinlock_t lock;
......@@ -1294,6 +1299,15 @@ struct intel_crtc {
} active;
} wm;
struct {
struct mutex mutex;
struct delayed_work work;
enum drrs_refresh_rate refresh_rate;
unsigned int busy_frontbuffer_bits;
enum transcoder cpu_transcoder;
struct intel_link_m_n m_n, m2_n2;
} drrs;
int scanline_offset;
struct {
......
This diff is collapsed.
......@@ -16,18 +16,20 @@ struct intel_crtc_state;
struct intel_connector;
const char *intel_drrs_type_str(enum drrs_type drrs_type);
bool intel_drrs_is_enabled(struct intel_crtc *crtc);
void intel_drrs_enable(const struct intel_crtc_state *crtc_state);
void intel_drrs_disable(const struct intel_crtc_state *crtc_state);
void intel_drrs_update(const struct intel_crtc_state *crtc_state);
void intel_drrs_update(struct intel_atomic_state *state,
struct intel_crtc *crtc);
void intel_drrs_invalidate(struct drm_i915_private *dev_priv,
unsigned int frontbuffer_bits);
void intel_drrs_flush(struct drm_i915_private *dev_priv,
unsigned int frontbuffer_bits);
void intel_drrs_page_flip(struct intel_atomic_state *state,
struct intel_crtc *crtc);
void intel_drrs_page_flip(struct intel_crtc *crtc);
void intel_drrs_compute_config(struct intel_connector *connector,
struct intel_crtc_state *pipe_config,
int output_bpp, bool constant_n);
void intel_crtc_drrs_init(struct intel_crtc *crtc);
struct drm_display_mode *intel_drrs_init(struct intel_connector *connector,
const struct drm_display_mode *fixed_mode);
......
......@@ -196,25 +196,12 @@ struct drm_i915_display_funcs {
#define I915_COLOR_UNEVICTABLE (-1) /* a non-vma sharing the address space */
enum drrs_refresh_rate {
DRRS_REFRESH_RATE_HIGH,
DRRS_REFRESH_RATE_LOW,
};
enum drrs_type {
DRRS_TYPE_NONE,
DRRS_TYPE_STATIC,
DRRS_TYPE_SEAMLESS,
};
struct i915_drrs {
struct mutex mutex;
struct delayed_work work;
struct intel_crtc *crtc;
unsigned busy_frontbuffer_bits;
enum drrs_refresh_rate refresh_rate;
};
#define QUIRK_LVDS_SSC_DISABLE (1<<1)
#define QUIRK_INVERT_BRIGHTNESS (1<<2)
#define QUIRK_BACKLIGHT_PRESENT (1<<3)
......@@ -536,7 +523,6 @@ struct drm_i915_private {
struct i915_hotplug hotplug;
struct intel_fbc *fbc[I915_MAX_FBCS];
struct i915_drrs drrs;
struct intel_opregion opregion;
struct intel_vbt_data vbt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment