Merge tag 'drm-intel-next-2019-12-23' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
i915 features for v5.6: - Separate hardware and uapi state (Maarten) - Expose a number of sprite and plane formats (Ville) - DDC symlink in HDMI connector sysfs directory (Andrzej Pietrasiewicz) - Improve obj->mm.lock nesting lock annotation (Daniel) (Includes lockdep changes) - Selftest improvements across the board (Chris) - ICL/TGL VDSC support on DSI (Jani, Vandita) - TGL DSB fixes (Animesh, Lucas, Tvrtko) - VBT parsing improvements and fixes (Lucas, Matt, José, Jani, Dan Carpenter) - Fix LPSS vs. PMIC PWM backlight use on BYT/CHT (Hans) (Includes ACPI+MFD changes) - Display state, crtc, plane code refactoring (Ville) - Set opregion chpd value to indicate the driver handles hotplug (Hans de Goede) - DSI updates and fixes, TGL pipe D support, port mapping (José, Jani, Vandita) - Make HDCP 2.2 support cover CFL (Juston Li) - Fix CML PCI IDs and ULT (Shawn Lee) - CMP-V PCH fix (Imre) - TGL: Add another TGL PCH ID (James) - EHL/JSL: Add new PCI IDs (James) - Rename pipe update tracepoints (Ville) - Fix FBC on GLK+ (Ville) - GuC fixes and improvements (Daniele, Don Hiatt, Stuart Summers, Matthew Brost) - Display debugfs improvements (Ville) - Hotplug/irq fixes (Matt) - PSR fixes and improvements (José) - DRM_I915_GEM_MMAP_OFFSET ioctl (Abdiel) - Static analysis fixes (Colin Ian King) - Register sysctl path globally (Venkata Sandeep Dhanalakota) - Introduce new macros for tracing (Venkata Sandeep Dhanalakota) - Migrate gt towards intel_uncore_read/write (Andi) - Add rps frequency translation helpers (Andi) - Fix TGL transcoder clock off sequence (José) - Fix TGL port A audio (Kai Vehmanen) - TGL render decompression (DK) - GEM/GT improvements and fixes across the board (Chris) - Couple of backmerges (Jani) Signed-off-by: Dave Airlie <airlied@redhat.com> # gpg: Signature made Tue 24 Dec 2019 03:20:48 AM AEST # gpg: using RSA key D398079D26ABEE6F # gpg: Good signature from "Jani Nikula <jani.nikula@intel.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 1565 A65B 77B0 632E 1124 E59C D398 079D 26AB EE6F # Conflicts: # drivers/gpu/drm/i915/display/intel_fbc.c # drivers/gpu/drm/i915/gt/intel_lrc.c # drivers/gpu/drm/i915/i915_gem.c From: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/87lfr3rkry.fsf@intel.com
This commit is contained in:
@@ -463,7 +463,7 @@ static const int pessimal_latency_ns = 5000;
|
||||
|
||||
static void vlv_get_fifo_size(struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
struct vlv_fifo_state *fifo_state = &crtc_state->wm.vlv.fifo_state;
|
||||
enum pipe pipe = crtc->pipe;
|
||||
@@ -794,10 +794,10 @@ static int intel_wm_num_levels(struct drm_i915_private *dev_priv)
|
||||
static bool intel_wm_plane_visible(const struct intel_crtc_state *crtc_state,
|
||||
const struct intel_plane_state *plane_state)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
|
||||
/* FIXME check the 'enable' instead */
|
||||
if (!crtc_state->base.active)
|
||||
if (!crtc_state->hw.active)
|
||||
return false;
|
||||
|
||||
/*
|
||||
@@ -809,9 +809,28 @@ static bool intel_wm_plane_visible(const struct intel_crtc_state *crtc_state,
|
||||
* around this problem with the watermark code.
|
||||
*/
|
||||
if (plane->id == PLANE_CURSOR)
|
||||
return plane_state->base.fb != NULL;
|
||||
return plane_state->hw.fb != NULL;
|
||||
else
|
||||
return plane_state->base.visible;
|
||||
return plane_state->uapi.visible;
|
||||
}
|
||||
|
||||
static bool intel_crtc_active(struct intel_crtc *crtc)
|
||||
{
|
||||
/* Be paranoid as we can arrive here with only partial
|
||||
* state retrieved from the hardware during setup.
|
||||
*
|
||||
* We can ditch the adjusted_mode.crtc_clock check as soon
|
||||
* as Haswell has gained clock readout/fastboot support.
|
||||
*
|
||||
* We can ditch the crtc->primary->state->fb check as soon as we can
|
||||
* properly reconstruct framebuffers.
|
||||
*
|
||||
* FIXME: The intel_crtc->active here should be switched to
|
||||
* crtc->state->active once we have proper CRTC states wired up
|
||||
* for atomic.
|
||||
*/
|
||||
return crtc->active && crtc->base.primary->state->fb &&
|
||||
crtc->config->hw.adjusted_mode.crtc_clock;
|
||||
}
|
||||
|
||||
static struct intel_crtc *single_enabled_crtc(struct drm_i915_private *dev_priv)
|
||||
@@ -850,7 +869,7 @@ static void pineview_update_wm(struct intel_crtc *unused_crtc)
|
||||
crtc = single_enabled_crtc(dev_priv);
|
||||
if (crtc) {
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&crtc->config->base.adjusted_mode;
|
||||
&crtc->config->hw.adjusted_mode;
|
||||
const struct drm_framebuffer *fb =
|
||||
crtc->base.primary->state->fb;
|
||||
int cpp = fb->format->cpp[0];
|
||||
@@ -1083,10 +1102,10 @@ static u16 g4x_compute_wm(const struct intel_crtc_state *crtc_state,
|
||||
const struct intel_plane_state *plane_state,
|
||||
int level)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&crtc_state->base.adjusted_mode;
|
||||
&crtc_state->hw.adjusted_mode;
|
||||
unsigned int latency = dev_priv->wm.pri_latency[level] * 10;
|
||||
unsigned int clock, htotal, cpp, width, wm;
|
||||
|
||||
@@ -1096,7 +1115,7 @@ static u16 g4x_compute_wm(const struct intel_crtc_state *crtc_state,
|
||||
if (!intel_wm_plane_visible(crtc_state, plane_state))
|
||||
return 0;
|
||||
|
||||
cpp = plane_state->base.fb->format->cpp[0];
|
||||
cpp = plane_state->hw.fb->format->cpp[0];
|
||||
|
||||
/*
|
||||
* Not 100% sure which way ELK should go here as the
|
||||
@@ -1116,7 +1135,7 @@ static u16 g4x_compute_wm(const struct intel_crtc_state *crtc_state,
|
||||
clock = adjusted_mode->crtc_clock;
|
||||
htotal = adjusted_mode->crtc_htotal;
|
||||
|
||||
width = drm_rect_width(&plane_state->base.dst);
|
||||
width = drm_rect_width(&plane_state->uapi.dst);
|
||||
|
||||
if (plane->id == PLANE_CURSOR) {
|
||||
wm = intel_wm_method2(clock, htotal, width, cpp, latency);
|
||||
@@ -1143,7 +1162,7 @@ static u16 g4x_compute_wm(const struct intel_crtc_state *crtc_state,
|
||||
static bool g4x_raw_plane_wm_set(struct intel_crtc_state *crtc_state,
|
||||
int level, enum plane_id plane_id, u16 value)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
bool dirty = false;
|
||||
|
||||
for (; level < intel_wm_num_levels(dev_priv); level++) {
|
||||
@@ -1159,7 +1178,7 @@ static bool g4x_raw_plane_wm_set(struct intel_crtc_state *crtc_state,
|
||||
static bool g4x_raw_fbc_wm_set(struct intel_crtc_state *crtc_state,
|
||||
int level, u16 value)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
bool dirty = false;
|
||||
|
||||
/* NORMAL level doesn't have an FBC watermark */
|
||||
@@ -1182,7 +1201,7 @@ static u32 ilk_compute_fbc_wm(const struct intel_crtc_state *crtc_state,
|
||||
static bool g4x_raw_plane_wm_compute(struct intel_crtc_state *crtc_state,
|
||||
const struct intel_plane_state *plane_state)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
int num_levels = intel_wm_num_levels(to_i915(plane->base.dev));
|
||||
enum plane_id plane_id = plane->id;
|
||||
bool dirty = false;
|
||||
@@ -1261,7 +1280,7 @@ static bool g4x_raw_plane_wm_is_valid(const struct intel_crtc_state *crtc_state,
|
||||
static bool g4x_raw_crtc_wm_is_valid(const struct intel_crtc_state *crtc_state,
|
||||
int level)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
|
||||
if (level > dev_priv->wm.max_level)
|
||||
return false;
|
||||
@@ -1299,9 +1318,9 @@ static void g4x_invalidate_wms(struct intel_crtc *crtc,
|
||||
|
||||
static int g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
|
||||
struct intel_atomic_state *state =
|
||||
to_intel_atomic_state(crtc_state->base.state);
|
||||
to_intel_atomic_state(crtc_state->uapi.state);
|
||||
struct g4x_wm_state *wm_state = &crtc_state->wm.g4x.optimal;
|
||||
int num_active_planes = hweight8(crtc_state->active_planes &
|
||||
~BIT(PLANE_CURSOR));
|
||||
@@ -1316,8 +1335,8 @@ static int g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state)
|
||||
for_each_oldnew_intel_plane_in_state(state, plane,
|
||||
old_plane_state,
|
||||
new_plane_state, i) {
|
||||
if (new_plane_state->base.crtc != &crtc->base &&
|
||||
old_plane_state->base.crtc != &crtc->base)
|
||||
if (new_plane_state->hw.crtc != &crtc->base &&
|
||||
old_plane_state->hw.crtc != &crtc->base)
|
||||
continue;
|
||||
|
||||
if (g4x_raw_plane_wm_compute(crtc_state, new_plane_state))
|
||||
@@ -1388,17 +1407,17 @@ static int g4x_compute_pipe_wm(struct intel_crtc_state *crtc_state)
|
||||
|
||||
static int g4x_compute_intermediate_wm(struct intel_crtc_state *new_crtc_state)
|
||||
{
|
||||
struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->base.crtc);
|
||||
struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc);
|
||||
struct g4x_wm_state *intermediate = &new_crtc_state->wm.g4x.intermediate;
|
||||
const struct g4x_wm_state *optimal = &new_crtc_state->wm.g4x.optimal;
|
||||
struct intel_atomic_state *intel_state =
|
||||
to_intel_atomic_state(new_crtc_state->base.state);
|
||||
to_intel_atomic_state(new_crtc_state->uapi.state);
|
||||
const struct intel_crtc_state *old_crtc_state =
|
||||
intel_atomic_get_old_crtc_state(intel_state, crtc);
|
||||
const struct g4x_wm_state *active = &old_crtc_state->wm.g4x.optimal;
|
||||
enum plane_id plane_id;
|
||||
|
||||
if (!new_crtc_state->base.active || drm_atomic_crtc_needs_modeset(&new_crtc_state->base)) {
|
||||
if (!new_crtc_state->hw.active || drm_atomic_crtc_needs_modeset(&new_crtc_state->uapi)) {
|
||||
*intermediate = *optimal;
|
||||
|
||||
intermediate->cxsr = false;
|
||||
@@ -1528,10 +1547,11 @@ static void g4x_program_watermarks(struct drm_i915_private *dev_priv)
|
||||
}
|
||||
|
||||
static void g4x_initial_watermarks(struct intel_atomic_state *state,
|
||||
struct intel_crtc_state *crtc_state)
|
||||
struct intel_crtc *crtc)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
const struct intel_crtc_state *crtc_state =
|
||||
intel_atomic_get_new_crtc_state(state, crtc);
|
||||
|
||||
mutex_lock(&dev_priv->wm.wm_mutex);
|
||||
crtc->wm.active.g4x = crtc_state->wm.g4x.intermediate;
|
||||
@@ -1540,10 +1560,11 @@ static void g4x_initial_watermarks(struct intel_atomic_state *state,
|
||||
}
|
||||
|
||||
static void g4x_optimize_watermarks(struct intel_atomic_state *state,
|
||||
struct intel_crtc_state *crtc_state)
|
||||
struct intel_crtc *crtc)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
const struct intel_crtc_state *crtc_state =
|
||||
intel_atomic_get_new_crtc_state(state, crtc);
|
||||
|
||||
if (!crtc_state->wm.need_postvbl_update)
|
||||
return;
|
||||
@@ -1589,10 +1610,10 @@ static u16 vlv_compute_wm_level(const struct intel_crtc_state *crtc_state,
|
||||
const struct intel_plane_state *plane_state,
|
||||
int level)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&crtc_state->base.adjusted_mode;
|
||||
&crtc_state->hw.adjusted_mode;
|
||||
unsigned int clock, htotal, cpp, width, wm;
|
||||
|
||||
if (dev_priv->wm.pri_latency[level] == 0)
|
||||
@@ -1601,7 +1622,7 @@ static u16 vlv_compute_wm_level(const struct intel_crtc_state *crtc_state,
|
||||
if (!intel_wm_plane_visible(crtc_state, plane_state))
|
||||
return 0;
|
||||
|
||||
cpp = plane_state->base.fb->format->cpp[0];
|
||||
cpp = plane_state->hw.fb->format->cpp[0];
|
||||
clock = adjusted_mode->crtc_clock;
|
||||
htotal = adjusted_mode->crtc_htotal;
|
||||
width = crtc_state->pipe_src_w;
|
||||
@@ -1630,7 +1651,7 @@ static bool vlv_need_sprite0_fifo_workaround(unsigned int active_planes)
|
||||
|
||||
static int vlv_compute_fifo(struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
|
||||
const struct g4x_pipe_wm *raw =
|
||||
&crtc_state->wm.vlv.raw[VLV_WM_LEVEL_PM2];
|
||||
struct vlv_fifo_state *fifo_state = &crtc_state->wm.vlv.fifo_state;
|
||||
@@ -1742,7 +1763,7 @@ static u16 vlv_invert_wm_value(u16 wm, u16 fifo_size)
|
||||
static bool vlv_raw_plane_wm_set(struct intel_crtc_state *crtc_state,
|
||||
int level, enum plane_id plane_id, u16 value)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
int num_levels = intel_wm_num_levels(dev_priv);
|
||||
bool dirty = false;
|
||||
|
||||
@@ -1759,7 +1780,7 @@ static bool vlv_raw_plane_wm_set(struct intel_crtc_state *crtc_state,
|
||||
static bool vlv_raw_plane_wm_compute(struct intel_crtc_state *crtc_state,
|
||||
const struct intel_plane_state *plane_state)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
enum plane_id plane_id = plane->id;
|
||||
int num_levels = intel_wm_num_levels(to_i915(plane->base.dev));
|
||||
int level;
|
||||
@@ -1817,16 +1838,16 @@ static bool vlv_raw_crtc_wm_is_valid(const struct intel_crtc_state *crtc_state,
|
||||
|
||||
static int vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
struct intel_atomic_state *state =
|
||||
to_intel_atomic_state(crtc_state->base.state);
|
||||
to_intel_atomic_state(crtc_state->uapi.state);
|
||||
struct vlv_wm_state *wm_state = &crtc_state->wm.vlv.optimal;
|
||||
const struct vlv_fifo_state *fifo_state =
|
||||
&crtc_state->wm.vlv.fifo_state;
|
||||
int num_active_planes = hweight8(crtc_state->active_planes &
|
||||
~BIT(PLANE_CURSOR));
|
||||
bool needs_modeset = drm_atomic_crtc_needs_modeset(&crtc_state->base);
|
||||
bool needs_modeset = drm_atomic_crtc_needs_modeset(&crtc_state->uapi);
|
||||
const struct intel_plane_state *old_plane_state;
|
||||
const struct intel_plane_state *new_plane_state;
|
||||
struct intel_plane *plane;
|
||||
@@ -1837,8 +1858,8 @@ static int vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state)
|
||||
for_each_oldnew_intel_plane_in_state(state, plane,
|
||||
old_plane_state,
|
||||
new_plane_state, i) {
|
||||
if (new_plane_state->base.crtc != &crtc->base &&
|
||||
old_plane_state->base.crtc != &crtc->base)
|
||||
if (new_plane_state->hw.crtc != &crtc->base &&
|
||||
old_plane_state->hw.crtc != &crtc->base)
|
||||
continue;
|
||||
|
||||
if (vlv_raw_plane_wm_compute(crtc_state, new_plane_state))
|
||||
@@ -1923,11 +1944,12 @@ static int vlv_compute_pipe_wm(struct intel_crtc_state *crtc_state)
|
||||
(((value) << DSPARB_ ## plane ## _SHIFT_VLV) & DSPARB_ ## plane ## _MASK_VLV)
|
||||
|
||||
static void vlv_atomic_update_fifo(struct intel_atomic_state *state,
|
||||
struct intel_crtc_state *crtc_state)
|
||||
struct intel_crtc *crtc)
|
||||
{
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
struct intel_uncore *uncore = &dev_priv->uncore;
|
||||
const struct intel_crtc_state *crtc_state =
|
||||
intel_atomic_get_new_crtc_state(state, crtc);
|
||||
const struct vlv_fifo_state *fifo_state =
|
||||
&crtc_state->wm.vlv.fifo_state;
|
||||
int sprite0_start, sprite1_start, fifo_size;
|
||||
@@ -2021,17 +2043,17 @@ static void vlv_atomic_update_fifo(struct intel_atomic_state *state,
|
||||
|
||||
static int vlv_compute_intermediate_wm(struct intel_crtc_state *new_crtc_state)
|
||||
{
|
||||
struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->base.crtc);
|
||||
struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc);
|
||||
struct vlv_wm_state *intermediate = &new_crtc_state->wm.vlv.intermediate;
|
||||
const struct vlv_wm_state *optimal = &new_crtc_state->wm.vlv.optimal;
|
||||
struct intel_atomic_state *intel_state =
|
||||
to_intel_atomic_state(new_crtc_state->base.state);
|
||||
to_intel_atomic_state(new_crtc_state->uapi.state);
|
||||
const struct intel_crtc_state *old_crtc_state =
|
||||
intel_atomic_get_old_crtc_state(intel_state, crtc);
|
||||
const struct vlv_wm_state *active = &old_crtc_state->wm.vlv.optimal;
|
||||
int level;
|
||||
|
||||
if (!new_crtc_state->base.active || drm_atomic_crtc_needs_modeset(&new_crtc_state->base)) {
|
||||
if (!new_crtc_state->hw.active || drm_atomic_crtc_needs_modeset(&new_crtc_state->uapi)) {
|
||||
*intermediate = *optimal;
|
||||
|
||||
intermediate->cxsr = false;
|
||||
@@ -2147,10 +2169,11 @@ static void vlv_program_watermarks(struct drm_i915_private *dev_priv)
|
||||
}
|
||||
|
||||
static void vlv_initial_watermarks(struct intel_atomic_state *state,
|
||||
struct intel_crtc_state *crtc_state)
|
||||
struct intel_crtc *crtc)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
const struct intel_crtc_state *crtc_state =
|
||||
intel_atomic_get_new_crtc_state(state, crtc);
|
||||
|
||||
mutex_lock(&dev_priv->wm.wm_mutex);
|
||||
crtc->wm.active.vlv = crtc_state->wm.vlv.intermediate;
|
||||
@@ -2159,10 +2182,11 @@ static void vlv_initial_watermarks(struct intel_atomic_state *state,
|
||||
}
|
||||
|
||||
static void vlv_optimize_watermarks(struct intel_atomic_state *state,
|
||||
struct intel_crtc_state *crtc_state)
|
||||
struct intel_crtc *crtc)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
const struct intel_crtc_state *crtc_state =
|
||||
intel_atomic_get_new_crtc_state(state, crtc);
|
||||
|
||||
if (!crtc_state->wm.need_postvbl_update)
|
||||
return;
|
||||
@@ -2187,7 +2211,7 @@ static void i965_update_wm(struct intel_crtc *unused_crtc)
|
||||
/* self-refresh has much higher latency */
|
||||
static const int sr_latency_ns = 12000;
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&crtc->config->base.adjusted_mode;
|
||||
&crtc->config->hw.adjusted_mode;
|
||||
const struct drm_framebuffer *fb =
|
||||
crtc->base.primary->state->fb;
|
||||
int clock = adjusted_mode->crtc_clock;
|
||||
@@ -2268,7 +2292,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
|
||||
crtc = intel_get_crtc_for_plane(dev_priv, PLANE_A);
|
||||
if (intel_crtc_active(crtc)) {
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&crtc->config->base.adjusted_mode;
|
||||
&crtc->config->hw.adjusted_mode;
|
||||
const struct drm_framebuffer *fb =
|
||||
crtc->base.primary->state->fb;
|
||||
int cpp;
|
||||
@@ -2295,7 +2319,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
|
||||
crtc = intel_get_crtc_for_plane(dev_priv, PLANE_B);
|
||||
if (intel_crtc_active(crtc)) {
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&crtc->config->base.adjusted_mode;
|
||||
&crtc->config->hw.adjusted_mode;
|
||||
const struct drm_framebuffer *fb =
|
||||
crtc->base.primary->state->fb;
|
||||
int cpp;
|
||||
@@ -2343,7 +2367,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
|
||||
/* self-refresh has much higher latency */
|
||||
static const int sr_latency_ns = 6000;
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&enabled->config->base.adjusted_mode;
|
||||
&enabled->config->hw.adjusted_mode;
|
||||
const struct drm_framebuffer *fb =
|
||||
enabled->base.primary->state->fb;
|
||||
int clock = adjusted_mode->crtc_clock;
|
||||
@@ -2401,7 +2425,7 @@ static void i845_update_wm(struct intel_crtc *unused_crtc)
|
||||
if (crtc == NULL)
|
||||
return;
|
||||
|
||||
adjusted_mode = &crtc->config->base.adjusted_mode;
|
||||
adjusted_mode = &crtc->config->hw.adjusted_mode;
|
||||
planea_wm = intel_calculate_wm(adjusted_mode->crtc_clock,
|
||||
&i845_wm_info,
|
||||
dev_priv->display.get_fifo_size(dev_priv, PLANE_A),
|
||||
@@ -2483,7 +2507,7 @@ static u32 ilk_compute_pri_wm(const struct intel_crtc_state *crtc_state,
|
||||
if (!intel_wm_plane_visible(crtc_state, plane_state))
|
||||
return 0;
|
||||
|
||||
cpp = plane_state->base.fb->format->cpp[0];
|
||||
cpp = plane_state->hw.fb->format->cpp[0];
|
||||
|
||||
method1 = ilk_wm_method1(crtc_state->pixel_rate, cpp, mem_value);
|
||||
|
||||
@@ -2491,8 +2515,8 @@ static u32 ilk_compute_pri_wm(const struct intel_crtc_state *crtc_state,
|
||||
return method1;
|
||||
|
||||
method2 = ilk_wm_method2(crtc_state->pixel_rate,
|
||||
crtc_state->base.adjusted_mode.crtc_htotal,
|
||||
drm_rect_width(&plane_state->base.dst),
|
||||
crtc_state->hw.adjusted_mode.crtc_htotal,
|
||||
drm_rect_width(&plane_state->uapi.dst),
|
||||
cpp, mem_value);
|
||||
|
||||
return min(method1, method2);
|
||||
@@ -2515,12 +2539,12 @@ static u32 ilk_compute_spr_wm(const struct intel_crtc_state *crtc_state,
|
||||
if (!intel_wm_plane_visible(crtc_state, plane_state))
|
||||
return 0;
|
||||
|
||||
cpp = plane_state->base.fb->format->cpp[0];
|
||||
cpp = plane_state->hw.fb->format->cpp[0];
|
||||
|
||||
method1 = ilk_wm_method1(crtc_state->pixel_rate, cpp, mem_value);
|
||||
method2 = ilk_wm_method2(crtc_state->pixel_rate,
|
||||
crtc_state->base.adjusted_mode.crtc_htotal,
|
||||
drm_rect_width(&plane_state->base.dst),
|
||||
crtc_state->hw.adjusted_mode.crtc_htotal,
|
||||
drm_rect_width(&plane_state->uapi.dst),
|
||||
cpp, mem_value);
|
||||
return min(method1, method2);
|
||||
}
|
||||
@@ -2541,11 +2565,11 @@ static u32 ilk_compute_cur_wm(const struct intel_crtc_state *crtc_state,
|
||||
if (!intel_wm_plane_visible(crtc_state, plane_state))
|
||||
return 0;
|
||||
|
||||
cpp = plane_state->base.fb->format->cpp[0];
|
||||
cpp = plane_state->hw.fb->format->cpp[0];
|
||||
|
||||
return ilk_wm_method2(crtc_state->pixel_rate,
|
||||
crtc_state->base.adjusted_mode.crtc_htotal,
|
||||
drm_rect_width(&plane_state->base.dst),
|
||||
crtc_state->hw.adjusted_mode.crtc_htotal,
|
||||
drm_rect_width(&plane_state->uapi.dst),
|
||||
cpp, mem_value);
|
||||
}
|
||||
|
||||
@@ -2559,9 +2583,10 @@ static u32 ilk_compute_fbc_wm(const struct intel_crtc_state *crtc_state,
|
||||
if (!intel_wm_plane_visible(crtc_state, plane_state))
|
||||
return 0;
|
||||
|
||||
cpp = plane_state->base.fb->format->cpp[0];
|
||||
cpp = plane_state->hw.fb->format->cpp[0];
|
||||
|
||||
return ilk_wm_fbc(pri_val, drm_rect_width(&plane_state->base.dst), cpp);
|
||||
return ilk_wm_fbc(pri_val, drm_rect_width(&plane_state->uapi.dst),
|
||||
cpp);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
@@ -2766,12 +2791,12 @@ static u32
|
||||
hsw_compute_linetime_wm(const struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
const struct intel_atomic_state *intel_state =
|
||||
to_intel_atomic_state(crtc_state->base.state);
|
||||
to_intel_atomic_state(crtc_state->uapi.state);
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&crtc_state->base.adjusted_mode;
|
||||
&crtc_state->hw.adjusted_mode;
|
||||
u32 linetime, ips_linetime;
|
||||
|
||||
if (!crtc_state->base.active)
|
||||
if (!crtc_state->hw.active)
|
||||
return 0;
|
||||
if (WARN_ON(adjusted_mode->crtc_clock == 0))
|
||||
return 0;
|
||||
@@ -3081,11 +3106,9 @@ static bool ilk_validate_pipe_wm(const struct drm_i915_private *dev_priv,
|
||||
/* Compute new watermarks for the pipe */
|
||||
static int ilk_compute_pipe_wm(struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct drm_atomic_state *state = crtc_state->base.state;
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->uapi.crtc);
|
||||
struct intel_pipe_wm *pipe_wm;
|
||||
struct drm_device *dev = state->dev;
|
||||
const struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
struct intel_plane *plane;
|
||||
const struct intel_plane_state *plane_state;
|
||||
const struct intel_plane_state *pristate = NULL;
|
||||
@@ -3105,12 +3128,12 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *crtc_state)
|
||||
curstate = plane_state;
|
||||
}
|
||||
|
||||
pipe_wm->pipe_enabled = crtc_state->base.active;
|
||||
pipe_wm->pipe_enabled = crtc_state->hw.active;
|
||||
if (sprstate) {
|
||||
pipe_wm->sprites_enabled = sprstate->base.visible;
|
||||
pipe_wm->sprites_scaled = sprstate->base.visible &&
|
||||
(drm_rect_width(&sprstate->base.dst) != drm_rect_width(&sprstate->base.src) >> 16 ||
|
||||
drm_rect_height(&sprstate->base.dst) != drm_rect_height(&sprstate->base.src) >> 16);
|
||||
pipe_wm->sprites_enabled = sprstate->uapi.visible;
|
||||
pipe_wm->sprites_scaled = sprstate->uapi.visible &&
|
||||
(drm_rect_width(&sprstate->uapi.dst) != drm_rect_width(&sprstate->uapi.src) >> 16 ||
|
||||
drm_rect_height(&sprstate->uapi.dst) != drm_rect_height(&sprstate->uapi.src) >> 16);
|
||||
}
|
||||
|
||||
usable_level = max_level;
|
||||
@@ -3162,11 +3185,11 @@ static int ilk_compute_pipe_wm(struct intel_crtc_state *crtc_state)
|
||||
*/
|
||||
static int ilk_compute_intermediate_wm(struct intel_crtc_state *newstate)
|
||||
{
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(newstate->base.crtc);
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(newstate->uapi.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
|
||||
struct intel_pipe_wm *a = &newstate->wm.ilk.intermediate;
|
||||
struct intel_atomic_state *intel_state =
|
||||
to_intel_atomic_state(newstate->base.state);
|
||||
to_intel_atomic_state(newstate->uapi.state);
|
||||
const struct intel_crtc_state *oldstate =
|
||||
intel_atomic_get_old_crtc_state(intel_state, intel_crtc);
|
||||
const struct intel_pipe_wm *b = &oldstate->wm.ilk.optimal;
|
||||
@@ -3178,7 +3201,7 @@ static int ilk_compute_intermediate_wm(struct intel_crtc_state *newstate)
|
||||
* and after the vblank.
|
||||
*/
|
||||
*a = newstate->wm.ilk.optimal;
|
||||
if (!newstate->base.active || drm_atomic_crtc_needs_modeset(&newstate->base) ||
|
||||
if (!newstate->hw.active || drm_atomic_crtc_needs_modeset(&newstate->uapi) ||
|
||||
intel_state->skip_intermediate_wm)
|
||||
return 0;
|
||||
|
||||
@@ -3588,10 +3611,8 @@ static void ilk_write_wm_values(struct drm_i915_private *dev_priv,
|
||||
dev_priv->wm.hw = *results;
|
||||
}
|
||||
|
||||
bool ilk_disable_lp_wm(struct drm_device *dev)
|
||||
bool ilk_disable_lp_wm(struct drm_i915_private *dev_priv)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
|
||||
return _ilk_disable_lp_wm(dev_priv, WM_DIRTY_LP_ALL);
|
||||
}
|
||||
|
||||
@@ -3780,7 +3801,7 @@ bool intel_can_enable_sagv(struct intel_atomic_state *state)
|
||||
crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
|
||||
crtc_state = to_intel_crtc_state(crtc->base.state);
|
||||
|
||||
if (crtc->base.state->adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE)
|
||||
if (crtc_state->hw.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE)
|
||||
return false;
|
||||
|
||||
for_each_intel_plane_on_crtc(dev, crtc, plane) {
|
||||
@@ -3830,7 +3851,7 @@ static u16 intel_get_ddb_size(struct drm_i915_private *dev_priv,
|
||||
if (INTEL_GEN(dev_priv) < 11)
|
||||
return ddb_size - 4; /* 4 blocks for bypass path allocation */
|
||||
|
||||
adjusted_mode = &crtc_state->base.adjusted_mode;
|
||||
adjusted_mode = &crtc_state->hw.adjusted_mode;
|
||||
total_data_bw = total_data_rate * drm_mode_vrefresh(adjusted_mode);
|
||||
|
||||
/*
|
||||
@@ -3859,16 +3880,16 @@ skl_ddb_get_pipe_allocation_limits(struct drm_i915_private *dev_priv,
|
||||
struct skl_ddb_entry *alloc, /* out */
|
||||
int *num_active /* out */)
|
||||
{
|
||||
struct drm_atomic_state *state = crtc_state->base.state;
|
||||
struct drm_atomic_state *state = crtc_state->uapi.state;
|
||||
struct intel_atomic_state *intel_state = to_intel_atomic_state(state);
|
||||
struct drm_crtc *for_crtc = crtc_state->base.crtc;
|
||||
struct drm_crtc *for_crtc = crtc_state->uapi.crtc;
|
||||
const struct intel_crtc *crtc;
|
||||
u32 pipe_width = 0, total_width = 0, width_before_pipe = 0;
|
||||
enum pipe for_pipe = to_intel_crtc(for_crtc)->pipe;
|
||||
u16 ddb_size;
|
||||
u32 i;
|
||||
|
||||
if (WARN_ON(!state) || !crtc_state->base.active) {
|
||||
if (WARN_ON(!state) || !crtc_state->hw.active) {
|
||||
alloc->start = 0;
|
||||
alloc->end = 0;
|
||||
*num_active = hweight8(dev_priv->active_pipes);
|
||||
@@ -3907,11 +3928,11 @@ skl_ddb_get_pipe_allocation_limits(struct drm_i915_private *dev_priv,
|
||||
*/
|
||||
for_each_new_intel_crtc_in_state(intel_state, crtc, crtc_state, i) {
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&crtc_state->base.adjusted_mode;
|
||||
&crtc_state->hw.adjusted_mode;
|
||||
enum pipe pipe = crtc->pipe;
|
||||
int hdisplay, vdisplay;
|
||||
|
||||
if (!crtc_state->base.enable)
|
||||
if (!crtc_state->hw.enable)
|
||||
continue;
|
||||
|
||||
drm_mode_get_hv_timing(adjusted_mode, &hdisplay, &vdisplay);
|
||||
@@ -3942,7 +3963,7 @@ static unsigned int
|
||||
skl_cursor_allocation(const struct intel_crtc_state *crtc_state,
|
||||
int num_active)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
int level, max_level = ilk_wm_max_level(dev_priv);
|
||||
struct skl_wm_level wm = {};
|
||||
int ret, min_ddb_alloc = 0;
|
||||
@@ -4082,10 +4103,10 @@ skl_plane_downscale_amount(const struct intel_crtc_state *crtc_state,
|
||||
*
|
||||
* n.b., src is 16.16 fixed point, dst is whole integer.
|
||||
*/
|
||||
src_w = drm_rect_width(&plane_state->base.src) >> 16;
|
||||
src_h = drm_rect_height(&plane_state->base.src) >> 16;
|
||||
dst_w = drm_rect_width(&plane_state->base.dst);
|
||||
dst_h = drm_rect_height(&plane_state->base.dst);
|
||||
src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
|
||||
src_h = drm_rect_height(&plane_state->uapi.src) >> 16;
|
||||
dst_w = drm_rect_width(&plane_state->uapi.dst);
|
||||
dst_h = drm_rect_height(&plane_state->uapi.dst);
|
||||
|
||||
fp_w_ratio = div_fixed16(src_w, dst_w);
|
||||
fp_h_ratio = div_fixed16(src_h, dst_h);
|
||||
@@ -4100,21 +4121,21 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *crtc_state,
|
||||
const struct intel_plane_state *plane_state,
|
||||
int color_plane)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
|
||||
const struct drm_framebuffer *fb = plane_state->base.fb;
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
u32 data_rate;
|
||||
u32 width = 0, height = 0;
|
||||
uint_fixed_16_16_t down_scale_amount;
|
||||
u64 rate;
|
||||
|
||||
if (!plane_state->base.visible)
|
||||
if (!plane_state->uapi.visible)
|
||||
return 0;
|
||||
|
||||
if (plane->id == PLANE_CURSOR)
|
||||
return 0;
|
||||
|
||||
if (color_plane == 1 &&
|
||||
!drm_format_info_is_yuv_semiplanar(fb->format))
|
||||
!intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
@@ -4122,8 +4143,8 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *crtc_state,
|
||||
* the 90/270 degree plane rotation cases (to match the
|
||||
* GTT mapping), hence no need to account for rotation here.
|
||||
*/
|
||||
width = drm_rect_width(&plane_state->base.src) >> 16;
|
||||
height = drm_rect_height(&plane_state->base.src) >> 16;
|
||||
width = drm_rect_width(&plane_state->uapi.src) >> 16;
|
||||
height = drm_rect_height(&plane_state->uapi.src) >> 16;
|
||||
|
||||
/* UV plane does 1/2 pixel sub-sampling */
|
||||
if (color_plane == 1) {
|
||||
@@ -4146,7 +4167,7 @@ skl_get_total_relative_data_rate(struct intel_crtc_state *crtc_state,
|
||||
u64 *plane_data_rate,
|
||||
u64 *uv_plane_data_rate)
|
||||
{
|
||||
struct drm_atomic_state *state = crtc_state->base.state;
|
||||
struct drm_atomic_state *state = crtc_state->uapi.state;
|
||||
struct intel_plane *plane;
|
||||
const struct intel_plane_state *plane_state;
|
||||
u64 total_data_rate = 0;
|
||||
@@ -4181,7 +4202,7 @@ icl_get_total_relative_data_rate(struct intel_crtc_state *crtc_state,
|
||||
const struct intel_plane_state *plane_state;
|
||||
u64 total_data_rate = 0;
|
||||
|
||||
if (WARN_ON(!crtc_state->base.state))
|
||||
if (WARN_ON(!crtc_state->uapi.state))
|
||||
return 0;
|
||||
|
||||
/* Calculate and cache data rate for each plane */
|
||||
@@ -4225,8 +4246,8 @@ static int
|
||||
skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state,
|
||||
struct skl_ddb_allocation *ddb /* out */)
|
||||
{
|
||||
struct drm_atomic_state *state = crtc_state->base.state;
|
||||
struct drm_crtc *crtc = crtc_state->base.crtc;
|
||||
struct drm_atomic_state *state = crtc_state->uapi.state;
|
||||
struct drm_crtc *crtc = crtc_state->uapi.crtc;
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->dev);
|
||||
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
|
||||
struct skl_ddb_entry *alloc = &crtc_state->wm.skl.ddb;
|
||||
@@ -4248,7 +4269,7 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state,
|
||||
if (WARN_ON(!state))
|
||||
return 0;
|
||||
|
||||
if (!crtc_state->base.active) {
|
||||
if (!crtc_state->hw.active) {
|
||||
alloc->start = alloc->end = 0;
|
||||
return 0;
|
||||
}
|
||||
@@ -4291,8 +4312,8 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *crtc_state,
|
||||
&crtc_state->wm.skl.optimal.planes[plane_id];
|
||||
|
||||
if (plane_id == PLANE_CURSOR) {
|
||||
if (WARN_ON(wm->wm[level].min_ddb_alloc >
|
||||
total[PLANE_CURSOR])) {
|
||||
if (wm->wm[level].min_ddb_alloc > total[PLANE_CURSOR]) {
|
||||
WARN_ON(wm->wm[level].min_ddb_alloc != U16_MAX);
|
||||
blocks = U32_MAX;
|
||||
break;
|
||||
}
|
||||
@@ -4490,7 +4511,7 @@ intel_get_linetime_us(const struct intel_crtc_state *crtc_state)
|
||||
u32 crtc_htotal;
|
||||
uint_fixed_16_16_t linetime_us;
|
||||
|
||||
if (!crtc_state->base.active)
|
||||
if (!crtc_state->hw.active)
|
||||
return u32_to_fixed16(0);
|
||||
|
||||
pixel_rate = crtc_state->pixel_rate;
|
||||
@@ -4498,7 +4519,7 @@ intel_get_linetime_us(const struct intel_crtc_state *crtc_state)
|
||||
if (WARN_ON(pixel_rate == 0))
|
||||
return u32_to_fixed16(0);
|
||||
|
||||
crtc_htotal = crtc_state->base.adjusted_mode.crtc_htotal;
|
||||
crtc_htotal = crtc_state->hw.adjusted_mode.crtc_htotal;
|
||||
linetime_us = div_fixed16(crtc_htotal * 1000, pixel_rate);
|
||||
|
||||
return linetime_us;
|
||||
@@ -4533,12 +4554,13 @@ skl_compute_wm_params(const struct intel_crtc_state *crtc_state,
|
||||
u32 plane_pixel_rate, struct skl_wm_params *wp,
|
||||
int color_plane)
|
||||
{
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
u32 interm_pbpl;
|
||||
|
||||
/* only planar format has two planes */
|
||||
if (color_plane == 1 && !drm_format_info_is_yuv_semiplanar(format)) {
|
||||
if (color_plane == 1 &&
|
||||
!intel_format_info_is_yuv_semiplanar(format, modifier)) {
|
||||
DRM_DEBUG_KMS("Non planar format have single plane\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -4550,7 +4572,7 @@ skl_compute_wm_params(const struct intel_crtc_state *crtc_state,
|
||||
wp->x_tiled = modifier == I915_FORMAT_MOD_X_TILED;
|
||||
wp->rc_surface = modifier == I915_FORMAT_MOD_Y_TILED_CCS ||
|
||||
modifier == I915_FORMAT_MOD_Yf_TILED_CCS;
|
||||
wp->is_planar = drm_format_info_is_yuv_semiplanar(format);
|
||||
wp->is_planar = intel_format_info_is_yuv_semiplanar(format, modifier);
|
||||
|
||||
wp->width = width;
|
||||
if (color_plane == 1 && wp->is_planar)
|
||||
@@ -4622,7 +4644,7 @@ skl_compute_plane_wm_params(const struct intel_crtc_state *crtc_state,
|
||||
const struct intel_plane_state *plane_state,
|
||||
struct skl_wm_params *wp, int color_plane)
|
||||
{
|
||||
const struct drm_framebuffer *fb = plane_state->base.fb;
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
int width;
|
||||
|
||||
/*
|
||||
@@ -4630,11 +4652,11 @@ skl_compute_plane_wm_params(const struct intel_crtc_state *crtc_state,
|
||||
* the 90/270 degree plane rotation cases (to match the
|
||||
* GTT mapping), hence no need to account for rotation here.
|
||||
*/
|
||||
width = drm_rect_width(&plane_state->base.src) >> 16;
|
||||
width = drm_rect_width(&plane_state->uapi.src) >> 16;
|
||||
|
||||
return skl_compute_wm_params(crtc_state, width,
|
||||
fb->format, fb->modifier,
|
||||
plane_state->base.rotation,
|
||||
plane_state->hw.rotation,
|
||||
skl_adjusted_plane_pixel_rate(crtc_state, plane_state),
|
||||
wp, color_plane);
|
||||
}
|
||||
@@ -4654,7 +4676,7 @@ static void skl_compute_plane_wm(const struct intel_crtc_state *crtc_state,
|
||||
const struct skl_wm_level *result_prev,
|
||||
struct skl_wm_level *result /* out */)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
u32 latency = dev_priv->wm.skl_latency[level];
|
||||
uint_fixed_16_16_t method1, method2;
|
||||
uint_fixed_16_16_t selected_result;
|
||||
@@ -4680,14 +4702,14 @@ static void skl_compute_plane_wm(const struct intel_crtc_state *crtc_state,
|
||||
method1 = skl_wm_method1(dev_priv, wp->plane_pixel_rate,
|
||||
wp->cpp, latency, wp->dbuf_block_size);
|
||||
method2 = skl_wm_method2(wp->plane_pixel_rate,
|
||||
crtc_state->base.adjusted_mode.crtc_htotal,
|
||||
crtc_state->hw.adjusted_mode.crtc_htotal,
|
||||
latency,
|
||||
wp->plane_blocks_per_line);
|
||||
|
||||
if (wp->y_tiled) {
|
||||
selected_result = max_fixed16(method2, wp->y_tile_minimum);
|
||||
} else {
|
||||
if ((wp->cpp * crtc_state->base.adjusted_mode.crtc_htotal /
|
||||
if ((wp->cpp * crtc_state->hw.adjusted_mode.crtc_htotal /
|
||||
wp->dbuf_block_size < 1) &&
|
||||
(wp->plane_bytes_per_line / wp->dbuf_block_size < 1)) {
|
||||
selected_result = method2;
|
||||
@@ -4778,7 +4800,7 @@ skl_compute_wm_levels(const struct intel_crtc_state *crtc_state,
|
||||
const struct skl_wm_params *wm_params,
|
||||
struct skl_wm_level *levels)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
int level, max_level = ilk_wm_max_level(dev_priv);
|
||||
struct skl_wm_level *result_prev = &levels[0];
|
||||
|
||||
@@ -4795,7 +4817,7 @@ skl_compute_wm_levels(const struct intel_crtc_state *crtc_state,
|
||||
static u32
|
||||
skl_compute_linetime_wm(const struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct drm_atomic_state *state = crtc_state->base.state;
|
||||
struct drm_atomic_state *state = crtc_state->uapi.state;
|
||||
struct drm_i915_private *dev_priv = to_i915(state->dev);
|
||||
uint_fixed_16_16_t linetime_us;
|
||||
u32 linetime_wm;
|
||||
@@ -4814,7 +4836,7 @@ static void skl_compute_transition_wm(const struct intel_crtc_state *crtc_state,
|
||||
const struct skl_wm_params *wp,
|
||||
struct skl_plane_wm *wm)
|
||||
{
|
||||
struct drm_device *dev = crtc_state->base.crtc->dev;
|
||||
struct drm_device *dev = crtc_state->uapi.crtc->dev;
|
||||
const struct drm_i915_private *dev_priv = to_i915(dev);
|
||||
u16 trans_min, trans_y_tile_min;
|
||||
const u16 trans_amount = 10; /* This is configurable amount */
|
||||
@@ -4912,8 +4934,8 @@ static int skl_build_plane_wm_uv(struct intel_crtc_state *crtc_state,
|
||||
static int skl_build_plane_wm(struct intel_crtc_state *crtc_state,
|
||||
const struct intel_plane_state *plane_state)
|
||||
{
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
|
||||
const struct drm_framebuffer *fb = plane_state->base.fb;
|
||||
struct intel_plane *plane = to_intel_plane(plane_state->uapi.plane);
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
enum plane_id plane_id = plane->id;
|
||||
int ret;
|
||||
|
||||
@@ -4938,7 +4960,7 @@ static int skl_build_plane_wm(struct intel_crtc_state *crtc_state,
|
||||
static int icl_build_plane_wm(struct intel_crtc_state *crtc_state,
|
||||
const struct intel_plane_state *plane_state)
|
||||
{
|
||||
enum plane_id plane_id = to_intel_plane(plane_state->base.plane)->id;
|
||||
enum plane_id plane_id = to_intel_plane(plane_state->uapi.plane)->id;
|
||||
int ret;
|
||||
|
||||
/* Watermarks calculated in master */
|
||||
@@ -4946,7 +4968,7 @@ static int icl_build_plane_wm(struct intel_crtc_state *crtc_state,
|
||||
return 0;
|
||||
|
||||
if (plane_state->planar_linked_plane) {
|
||||
const struct drm_framebuffer *fb = plane_state->base.fb;
|
||||
const struct drm_framebuffer *fb = plane_state->hw.fb;
|
||||
enum plane_id y_plane_id = plane_state->planar_linked_plane->id;
|
||||
|
||||
WARN_ON(!intel_wm_plane_visible(crtc_state, plane_state));
|
||||
@@ -4974,7 +4996,7 @@ static int icl_build_plane_wm(struct intel_crtc_state *crtc_state,
|
||||
|
||||
static int skl_build_pipe_wm(struct intel_crtc_state *crtc_state)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev);
|
||||
struct skl_pipe_wm *pipe_wm = &crtc_state->wm.skl.optimal;
|
||||
struct intel_plane *plane;
|
||||
const struct intel_plane_state *plane_state;
|
||||
@@ -5151,8 +5173,8 @@ static int
|
||||
skl_ddb_add_affected_planes(const struct intel_crtc_state *old_crtc_state,
|
||||
struct intel_crtc_state *new_crtc_state)
|
||||
{
|
||||
struct intel_atomic_state *state = to_intel_atomic_state(new_crtc_state->base.state);
|
||||
struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->base.crtc);
|
||||
struct intel_atomic_state *state = to_intel_atomic_state(new_crtc_state->uapi.state);
|
||||
struct intel_crtc *crtc = to_intel_crtc(new_crtc_state->uapi.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
struct intel_plane *plane;
|
||||
|
||||
@@ -5356,7 +5378,7 @@ skl_ddb_add_affected_pipes(struct intel_atomic_state *state)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
state->active_pipe_changes = ~0;
|
||||
state->active_pipe_changes = INTEL_INFO(dev_priv)->pipe_mask;
|
||||
|
||||
/*
|
||||
* We usually only initialize state->active_pipes if we
|
||||
@@ -5382,7 +5404,7 @@ skl_ddb_add_affected_pipes(struct intel_atomic_state *state)
|
||||
* to grab the lock on *all* CRTC's.
|
||||
*/
|
||||
if (state->active_pipe_changes || state->modeset) {
|
||||
state->wm_results.dirty_pipes = ~0;
|
||||
state->wm_results.dirty_pipes = INTEL_INFO(dev_priv)->pipe_mask;
|
||||
|
||||
ret = intel_add_all_pipes(state);
|
||||
if (ret)
|
||||
@@ -5436,7 +5458,7 @@ static int skl_wm_add_affected_planes(struct intel_atomic_state *state,
|
||||
* power well the hardware state will go out of sync
|
||||
* with the software state.
|
||||
*/
|
||||
if (!drm_atomic_crtc_needs_modeset(&new_crtc_state->base) &&
|
||||
if (!drm_atomic_crtc_needs_modeset(&new_crtc_state->uapi) &&
|
||||
skl_plane_wm_equals(dev_priv,
|
||||
&old_crtc_state->wm.skl.optimal.planes[plane_id],
|
||||
&new_crtc_state->wm.skl.optimal.planes[plane_id]))
|
||||
@@ -5500,11 +5522,12 @@ skl_compute_wm(struct intel_atomic_state *state)
|
||||
}
|
||||
|
||||
static void skl_atomic_update_crtc_wm(struct intel_atomic_state *state,
|
||||
struct intel_crtc_state *crtc_state)
|
||||
struct intel_crtc *crtc)
|
||||
{
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
|
||||
struct skl_pipe_wm *pipe_wm = &crtc_state->wm.skl.optimal;
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
const struct intel_crtc_state *crtc_state =
|
||||
intel_atomic_get_new_crtc_state(state, crtc);
|
||||
const struct skl_pipe_wm *pipe_wm = &crtc_state->wm.skl.optimal;
|
||||
enum pipe pipe = crtc->pipe;
|
||||
|
||||
if ((state->wm_results.dirty_pipes & BIT(crtc->pipe)) == 0)
|
||||
@@ -5514,10 +5537,11 @@ static void skl_atomic_update_crtc_wm(struct intel_atomic_state *state,
|
||||
}
|
||||
|
||||
static void skl_initial_wm(struct intel_atomic_state *state,
|
||||
struct intel_crtc_state *crtc_state)
|
||||
struct intel_crtc *crtc)
|
||||
{
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
const struct intel_crtc_state *crtc_state =
|
||||
intel_atomic_get_new_crtc_state(state, crtc);
|
||||
struct skl_ddb_values *results = &state->wm_results;
|
||||
|
||||
if ((results->dirty_pipes & BIT(crtc->pipe)) == 0)
|
||||
@@ -5525,8 +5549,8 @@ static void skl_initial_wm(struct intel_atomic_state *state,
|
||||
|
||||
mutex_lock(&dev_priv->wm.wm_mutex);
|
||||
|
||||
if (crtc_state->base.active_changed)
|
||||
skl_atomic_update_crtc_wm(state, crtc_state);
|
||||
if (crtc_state->uapi.active_changed)
|
||||
skl_atomic_update_crtc_wm(state, crtc);
|
||||
|
||||
mutex_unlock(&dev_priv->wm.wm_mutex);
|
||||
}
|
||||
@@ -5582,10 +5606,11 @@ static void ilk_program_watermarks(struct drm_i915_private *dev_priv)
|
||||
}
|
||||
|
||||
static void ilk_initial_watermarks(struct intel_atomic_state *state,
|
||||
struct intel_crtc_state *crtc_state)
|
||||
struct intel_crtc *crtc)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
const struct intel_crtc_state *crtc_state =
|
||||
intel_atomic_get_new_crtc_state(state, crtc);
|
||||
|
||||
mutex_lock(&dev_priv->wm.wm_mutex);
|
||||
crtc->wm.active.ilk = crtc_state->wm.ilk.intermediate;
|
||||
@@ -5594,10 +5619,11 @@ static void ilk_initial_watermarks(struct intel_atomic_state *state,
|
||||
}
|
||||
|
||||
static void ilk_optimize_watermarks(struct intel_atomic_state *state,
|
||||
struct intel_crtc_state *crtc_state)
|
||||
struct intel_crtc *crtc)
|
||||
{
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc_state->base.crtc->dev);
|
||||
struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
|
||||
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
|
||||
const struct intel_crtc_state *crtc_state =
|
||||
intel_atomic_get_new_crtc_state(state, crtc);
|
||||
|
||||
if (!crtc_state->wm.need_postvbl_update)
|
||||
return;
|
||||
@@ -5938,7 +5964,7 @@ void g4x_wm_sanitize(struct drm_i915_private *dev_priv)
|
||||
enum plane_id plane_id = plane->id;
|
||||
int level;
|
||||
|
||||
if (plane_state->base.visible)
|
||||
if (plane_state->uapi.visible)
|
||||
continue;
|
||||
|
||||
for (level = 0; level < 3; level++) {
|
||||
@@ -6093,7 +6119,7 @@ void vlv_wm_sanitize(struct drm_i915_private *dev_priv)
|
||||
enum plane_id plane_id = plane->id;
|
||||
int level;
|
||||
|
||||
if (plane_state->base.visible)
|
||||
if (plane_state->uapi.visible)
|
||||
continue;
|
||||
|
||||
for (level = 0; level < wm_state->num_levels; level++) {
|
||||
@@ -6369,7 +6395,6 @@ static void cpt_init_clock_gating(struct drm_i915_private *dev_priv)
|
||||
val &= ~TRANS_CHICKEN2_FDI_POLARITY_REVERSED;
|
||||
if (dev_priv->vbt.fdi_rx_polarity_inverted)
|
||||
val |= TRANS_CHICKEN2_FDI_POLARITY_REVERSED;
|
||||
val &= ~TRANS_CHICKEN2_FRAME_START_DELAY_MASK;
|
||||
val &= ~TRANS_CHICKEN2_DISABLE_DEEP_COLOR_COUNTER;
|
||||
val &= ~TRANS_CHICKEN2_DISABLE_DEEP_COLOR_MODESWITCH;
|
||||
I915_WRITE(TRANS_CHICKEN2(pipe), val);
|
||||
|
Reference in New Issue
Block a user