提交 93314b5b 编写于 作者: C Chris Wilson 提交者: Daniel Vetter

drm/i915: Switch off FBC when disabling the primary plane when obscured

As we switch on/off the primary plane if it is completely obscured by an
overlapping video sprite, we also nee to make sure that we update the
FBC configuration at the same time.

v2: Not all crtcs are intel_crtcs, as spotted by Daniel.
v3: Boot testing rules.

References: https://bugs.freedesktop.org/show_bug.cgi?id=50238Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: NJesse Barnes <jbarnes@virtuousgeek.org>
Reviewed-by: NJani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
上级 e188719a
...@@ -169,6 +169,7 @@ struct intel_crtc { ...@@ -169,6 +169,7 @@ struct intel_crtc {
u8 lut_r[256], lut_g[256], lut_b[256]; u8 lut_r[256], lut_g[256], lut_b[256];
int dpms_mode; int dpms_mode;
bool active; /* is the crtc on? independent of the dpms mode */ bool active; /* is the crtc on? independent of the dpms mode */
bool primary_disabled; /* is the crtc obscured by a plane? */
bool busy; /* is scanout buffer being updated frequently? */ bool busy; /* is scanout buffer being updated frequently? */
struct timer_list idle_timer; struct timer_list idle_timer;
bool lowfreq_avail; bool lowfreq_avail;
...@@ -191,7 +192,6 @@ struct intel_plane { ...@@ -191,7 +192,6 @@ struct intel_plane {
struct drm_plane base; struct drm_plane base;
enum pipe pipe; enum pipe pipe;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
bool primary_disabled;
int max_downscale; int max_downscale;
u32 lut_r[1024], lut_g[1024], lut_b[1024]; u32 lut_r[1024], lut_g[1024], lut_b[1024];
void (*update_plane)(struct drm_plane *plane, void (*update_plane)(struct drm_plane *plane,
......
...@@ -405,7 +405,9 @@ void intel_update_fbc(struct drm_device *dev) ...@@ -405,7 +405,9 @@ void intel_update_fbc(struct drm_device *dev)
* - going to an unsupported config (interlace, pixel multiply, etc.) * - going to an unsupported config (interlace, pixel multiply, etc.)
*/ */
list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) { list_for_each_entry(tmp_crtc, &dev->mode_config.crtc_list, head) {
if (tmp_crtc->enabled && tmp_crtc->fb) { if (tmp_crtc->enabled &&
!to_intel_crtc(tmp_crtc)->primary_disabled &&
tmp_crtc->fb) {
if (crtc) { if (crtc) {
DRM_DEBUG_KMS("more than one pipe active, disabling compression\n"); DRM_DEBUG_KMS("more than one pipe active, disabling compression\n");
dev_priv->no_fbc_reason = FBC_MULTIPLE_PIPES; dev_priv->no_fbc_reason = FBC_MULTIPLE_PIPES;
......
...@@ -326,6 +326,12 @@ intel_enable_primary(struct drm_crtc *crtc) ...@@ -326,6 +326,12 @@ intel_enable_primary(struct drm_crtc *crtc)
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
int reg = DSPCNTR(intel_crtc->plane); int reg = DSPCNTR(intel_crtc->plane);
if (!intel_crtc->primary_disabled)
return;
intel_crtc->primary_disabled = false;
intel_update_fbc(dev);
I915_WRITE(reg, I915_READ(reg) | DISPLAY_PLANE_ENABLE); I915_WRITE(reg, I915_READ(reg) | DISPLAY_PLANE_ENABLE);
} }
...@@ -337,7 +343,13 @@ intel_disable_primary(struct drm_crtc *crtc) ...@@ -337,7 +343,13 @@ intel_disable_primary(struct drm_crtc *crtc)
struct intel_crtc *intel_crtc = to_intel_crtc(crtc); struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
int reg = DSPCNTR(intel_crtc->plane); int reg = DSPCNTR(intel_crtc->plane);
if (intel_crtc->primary_disabled)
return;
I915_WRITE(reg, I915_READ(reg) & ~DISPLAY_PLANE_ENABLE); I915_WRITE(reg, I915_READ(reg) & ~DISPLAY_PLANE_ENABLE);
intel_crtc->primary_disabled = true;
intel_update_fbc(dev);
} }
static int static int
...@@ -485,18 +497,14 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, ...@@ -485,18 +497,14 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
* Be sure to re-enable the primary before the sprite is no longer * Be sure to re-enable the primary before the sprite is no longer
* covering it fully. * covering it fully.
*/ */
if (!disable_primary && intel_plane->primary_disabled) { if (!disable_primary)
intel_enable_primary(crtc); intel_enable_primary(crtc);
intel_plane->primary_disabled = false;
}
intel_plane->update_plane(plane, fb, obj, crtc_x, crtc_y, intel_plane->update_plane(plane, fb, obj, crtc_x, crtc_y,
crtc_w, crtc_h, x, y, src_w, src_h); crtc_w, crtc_h, x, y, src_w, src_h);
if (disable_primary) { if (disable_primary)
intel_disable_primary(crtc); intel_disable_primary(crtc);
intel_plane->primary_disabled = true;
}
/* Unpin old obj after new one is active to avoid ugliness */ /* Unpin old obj after new one is active to avoid ugliness */
if (old_obj) { if (old_obj) {
...@@ -527,11 +535,8 @@ intel_disable_plane(struct drm_plane *plane) ...@@ -527,11 +535,8 @@ intel_disable_plane(struct drm_plane *plane)
struct intel_plane *intel_plane = to_intel_plane(plane); struct intel_plane *intel_plane = to_intel_plane(plane);
int ret = 0; int ret = 0;
if (intel_plane->primary_disabled) { if (plane->crtc)
intel_enable_primary(plane->crtc); intel_enable_primary(plane->crtc);
intel_plane->primary_disabled = false;
}
intel_plane->disable_plane(plane); intel_plane->disable_plane(plane);
if (!intel_plane->obj) if (!intel_plane->obj)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册