Commit 524d4f71 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-intel-fixes-2020-07-15' of...

Merge tag 'drm-intel-fixes-2020-07-15' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes

drm/i915 fixes for v5.8-rc6:
- FBC w/a stride fix
- Fix use-after-free fix on module reload
- Ignore irq enabling on the virtual engines to fix device sleep
- Use GTT when saving/restoring engine GPR
- Fix selftest sort function
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87ft9t0vtt.fsf@intel.com
parents 03d54ef0 92e0575b
...@@ -719,6 +719,25 @@ static bool intel_fbc_cfb_size_changed(struct drm_i915_private *dev_priv) ...@@ -719,6 +719,25 @@ static bool intel_fbc_cfb_size_changed(struct drm_i915_private *dev_priv)
fbc->compressed_fb.size * fbc->threshold; fbc->compressed_fb.size * fbc->threshold;
} }
static u16 intel_fbc_gen9_wa_cfb_stride(struct drm_i915_private *dev_priv)
{
struct intel_fbc *fbc = &dev_priv->fbc;
struct intel_fbc_state_cache *cache = &fbc->state_cache;
if ((IS_GEN9_BC(dev_priv) || IS_BROXTON(dev_priv)) &&
cache->fb.modifier != I915_FORMAT_MOD_X_TILED)
return DIV_ROUND_UP(cache->plane.src_w, 32 * fbc->threshold) * 8;
else
return 0;
}
static bool intel_fbc_gen9_wa_cfb_stride_changed(struct drm_i915_private *dev_priv)
{
struct intel_fbc *fbc = &dev_priv->fbc;
return fbc->params.gen9_wa_cfb_stride != intel_fbc_gen9_wa_cfb_stride(dev_priv);
}
static bool intel_fbc_can_enable(struct drm_i915_private *dev_priv) static bool intel_fbc_can_enable(struct drm_i915_private *dev_priv)
{ {
struct intel_fbc *fbc = &dev_priv->fbc; struct intel_fbc *fbc = &dev_priv->fbc;
...@@ -877,6 +896,7 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc, ...@@ -877,6 +896,7 @@ static void intel_fbc_get_reg_params(struct intel_crtc *crtc,
params->crtc.i9xx_plane = to_intel_plane(crtc->base.primary)->i9xx_plane; params->crtc.i9xx_plane = to_intel_plane(crtc->base.primary)->i9xx_plane;
params->fb.format = cache->fb.format; params->fb.format = cache->fb.format;
params->fb.modifier = cache->fb.modifier;
params->fb.stride = cache->fb.stride; params->fb.stride = cache->fb.stride;
params->cfb_size = intel_fbc_calculate_cfb_size(dev_priv, cache); params->cfb_size = intel_fbc_calculate_cfb_size(dev_priv, cache);
...@@ -906,6 +926,9 @@ static bool intel_fbc_can_flip_nuke(const struct intel_crtc_state *crtc_state) ...@@ -906,6 +926,9 @@ static bool intel_fbc_can_flip_nuke(const struct intel_crtc_state *crtc_state)
if (params->fb.format != cache->fb.format) if (params->fb.format != cache->fb.format)
return false; return false;
if (params->fb.modifier != cache->fb.modifier)
return false;
if (params->fb.stride != cache->fb.stride) if (params->fb.stride != cache->fb.stride)
return false; return false;
...@@ -1185,7 +1208,8 @@ void intel_fbc_enable(struct intel_atomic_state *state, ...@@ -1185,7 +1208,8 @@ void intel_fbc_enable(struct intel_atomic_state *state,
if (fbc->crtc) { if (fbc->crtc) {
if (fbc->crtc != crtc || if (fbc->crtc != crtc ||
!intel_fbc_cfb_size_changed(dev_priv)) (!intel_fbc_cfb_size_changed(dev_priv) &&
!intel_fbc_gen9_wa_cfb_stride_changed(dev_priv)))
goto out; goto out;
__intel_fbc_disable(dev_priv); __intel_fbc_disable(dev_priv);
...@@ -1207,12 +1231,7 @@ void intel_fbc_enable(struct intel_atomic_state *state, ...@@ -1207,12 +1231,7 @@ void intel_fbc_enable(struct intel_atomic_state *state,
goto out; goto out;
} }
if ((IS_GEN9_BC(dev_priv) || IS_BROXTON(dev_priv)) && cache->gen9_wa_cfb_stride = intel_fbc_gen9_wa_cfb_stride(dev_priv);
plane_state->hw.fb->modifier != I915_FORMAT_MOD_X_TILED)
cache->gen9_wa_cfb_stride =
DIV_ROUND_UP(cache->plane.src_w, 32 * fbc->threshold) * 8;
else
cache->gen9_wa_cfb_stride = 0;
drm_dbg_kms(&dev_priv->drm, "Enabling FBC on pipe %c\n", drm_dbg_kms(&dev_priv->drm, "Enabling FBC on pipe %c\n",
pipe_name(crtc->pipe)); pipe_name(crtc->pipe));
......
...@@ -2867,19 +2867,13 @@ intel_hdmi_connector_register(struct drm_connector *connector) ...@@ -2867,19 +2867,13 @@ intel_hdmi_connector_register(struct drm_connector *connector)
return ret; return ret;
} }
static void intel_hdmi_destroy(struct drm_connector *connector) static void intel_hdmi_connector_unregister(struct drm_connector *connector)
{ {
struct cec_notifier *n = intel_attached_hdmi(to_intel_connector(connector))->cec_notifier; struct cec_notifier *n = intel_attached_hdmi(to_intel_connector(connector))->cec_notifier;
cec_notifier_conn_unregister(n); cec_notifier_conn_unregister(n);
intel_connector_destroy(connector);
}
static void intel_hdmi_connector_unregister(struct drm_connector *connector)
{
intel_hdmi_remove_i2c_symlink(connector); intel_hdmi_remove_i2c_symlink(connector);
intel_connector_unregister(connector); intel_connector_unregister(connector);
} }
...@@ -2891,7 +2885,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = { ...@@ -2891,7 +2885,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
.atomic_set_property = intel_digital_connector_atomic_set_property, .atomic_set_property = intel_digital_connector_atomic_set_property,
.late_register = intel_hdmi_connector_register, .late_register = intel_hdmi_connector_register,
.early_unregister = intel_hdmi_connector_unregister, .early_unregister = intel_hdmi_connector_unregister,
.destroy = intel_hdmi_destroy, .destroy = intel_connector_destroy,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
.atomic_duplicate_state = intel_digital_connector_duplicate_state, .atomic_duplicate_state = intel_digital_connector_duplicate_state,
}; };
......
...@@ -5396,13 +5396,8 @@ static void virtual_engine_initial_hint(struct virtual_engine *ve) ...@@ -5396,13 +5396,8 @@ static void virtual_engine_initial_hint(struct virtual_engine *ve)
* typically be the first we inspect for submission. * typically be the first we inspect for submission.
*/ */
swp = prandom_u32_max(ve->num_siblings); swp = prandom_u32_max(ve->num_siblings);
if (!swp) if (swp)
return;
swap(ve->siblings[swp], ve->siblings[0]); swap(ve->siblings[swp], ve->siblings[0]);
if (!intel_engine_has_relative_mmio(ve->siblings[0]))
virtual_update_register_offsets(ve->context.lrc_reg_state,
ve->siblings[0]);
} }
static int virtual_context_alloc(struct intel_context *ce) static int virtual_context_alloc(struct intel_context *ce)
...@@ -5415,15 +5410,9 @@ static int virtual_context_alloc(struct intel_context *ce) ...@@ -5415,15 +5410,9 @@ static int virtual_context_alloc(struct intel_context *ce)
static int virtual_context_pin(struct intel_context *ce) static int virtual_context_pin(struct intel_context *ce)
{ {
struct virtual_engine *ve = container_of(ce, typeof(*ve), context); struct virtual_engine *ve = container_of(ce, typeof(*ve), context);
int err;
/* Note: we must use a real engine class for setting up reg state */ /* Note: we must use a real engine class for setting up reg state */
err = __execlists_context_pin(ce, ve->siblings[0]); return __execlists_context_pin(ce, ve->siblings[0]);
if (err)
return err;
virtual_engine_initial_hint(ve);
return 0;
} }
static void virtual_context_enter(struct intel_context *ce) static void virtual_context_enter(struct intel_context *ce)
...@@ -5688,6 +5677,7 @@ intel_execlists_create_virtual(struct intel_engine_cs **siblings, ...@@ -5688,6 +5677,7 @@ intel_execlists_create_virtual(struct intel_engine_cs **siblings,
intel_engine_init_active(&ve->base, ENGINE_VIRTUAL); intel_engine_init_active(&ve->base, ENGINE_VIRTUAL);
intel_engine_init_breadcrumbs(&ve->base); intel_engine_init_breadcrumbs(&ve->base);
intel_engine_init_execlists(&ve->base); intel_engine_init_execlists(&ve->base);
ve->base.breadcrumbs.irq_armed = true; /* fake HW, used for irq_work */
ve->base.cops = &virtual_context_ops; ve->base.cops = &virtual_context_ops;
ve->base.request_alloc = execlists_request_alloc; ve->base.request_alloc = execlists_request_alloc;
...@@ -5769,6 +5759,7 @@ intel_execlists_create_virtual(struct intel_engine_cs **siblings, ...@@ -5769,6 +5759,7 @@ intel_execlists_create_virtual(struct intel_engine_cs **siblings,
ve->base.flags |= I915_ENGINE_IS_VIRTUAL; ve->base.flags |= I915_ENGINE_IS_VIRTUAL;
virtual_engine_initial_hint(ve);
return &ve->context; return &ve->context;
err_put: err_put:
......
...@@ -44,9 +44,9 @@ static int cmp_u64(const void *A, const void *B) ...@@ -44,9 +44,9 @@ static int cmp_u64(const void *A, const void *B)
{ {
const u64 *a = A, *b = B; const u64 *a = A, *b = B;
if (a < b) if (*a < *b)
return -1; return -1;
else if (a > b) else if (*a > *b)
return 1; return 1;
else else
return 0; return 0;
...@@ -56,9 +56,9 @@ static int cmp_u32(const void *A, const void *B) ...@@ -56,9 +56,9 @@ static int cmp_u32(const void *A, const void *B)
{ {
const u32 *a = A, *b = B; const u32 *a = A, *b = B;
if (a < b) if (*a < *b)
return -1; return -1;
else if (a > b) else if (*a > *b)
return 1; return 1;
else else
return 0; return 0;
......
...@@ -440,6 +440,7 @@ struct intel_fbc { ...@@ -440,6 +440,7 @@ struct intel_fbc {
struct { struct {
const struct drm_format_info *format; const struct drm_format_info *format;
unsigned int stride; unsigned int stride;
u64 modifier;
} fb; } fb;
int cfb_size; int cfb_size;
......
...@@ -1592,6 +1592,7 @@ static u32 *save_restore_register(struct i915_perf_stream *stream, u32 *cs, ...@@ -1592,6 +1592,7 @@ static u32 *save_restore_register(struct i915_perf_stream *stream, u32 *cs,
u32 d; u32 d;
cmd = save ? MI_STORE_REGISTER_MEM : MI_LOAD_REGISTER_MEM; cmd = save ? MI_STORE_REGISTER_MEM : MI_LOAD_REGISTER_MEM;
cmd |= MI_SRM_LRM_GLOBAL_GTT;
if (INTEL_GEN(stream->perf->i915) >= 8) if (INTEL_GEN(stream->perf->i915) >= 8)
cmd++; cmd++;
......
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