Commit 7733b49b authored by Paulo Zanoni's avatar Paulo Zanoni Committed by Daniel Vetter

drm/i915: use dev_priv for the FBC functions

Because the cool kids use dev_priv and FBC wants to be cool too.

We've been historically using struct drm_device on the FBC function
arguments, but we only really need it for intel_vgpu_active(): we can
use dev_priv everywhere else. So let's fully switch to dev_priv since
I'm getting tired of adding "struct drm_device *dev = dev_priv->dev"
everywhere.

If I get a NACK here I'll propose the opposite: convert all the
functions that currently take dev_priv to take dev.
Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent ff2a3117
...@@ -1635,7 +1635,7 @@ static int i915_fbc_status(struct seq_file *m, void *unused) ...@@ -1635,7 +1635,7 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
intel_runtime_pm_get(dev_priv); intel_runtime_pm_get(dev_priv);
mutex_lock(&dev_priv->fbc.lock); mutex_lock(&dev_priv->fbc.lock);
if (intel_fbc_enabled(dev)) if (intel_fbc_enabled(dev_priv))
seq_puts(m, "FBC enabled\n"); seq_puts(m, "FBC enabled\n");
else else
seq_printf(m, "FBC disabled: %s\n", seq_printf(m, "FBC disabled: %s\n",
......
...@@ -1123,7 +1123,7 @@ int i915_driver_unload(struct drm_device *dev) ...@@ -1123,7 +1123,7 @@ int i915_driver_unload(struct drm_device *dev)
i915_gem_cleanup_ringbuffer(dev); i915_gem_cleanup_ringbuffer(dev);
i915_gem_context_fini(dev); i915_gem_context_fini(dev);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
intel_fbc_cleanup_cfb(dev); intel_fbc_cleanup_cfb(dev_priv);
i915_gem_cleanup_stolen(dev); i915_gem_cleanup_stolen(dev);
intel_csr_ucode_fini(dev); intel_csr_ucode_fini(dev);
......
...@@ -937,9 +937,9 @@ struct i915_fbc { ...@@ -937,9 +937,9 @@ struct i915_fbc {
FBC_ROTATION, /* rotation is not supported */ FBC_ROTATION, /* rotation is not supported */
} no_fbc_reason; } no_fbc_reason;
bool (*fbc_enabled)(struct drm_device *dev); bool (*fbc_enabled)(struct drm_i915_private *dev_priv);
void (*enable_fbc)(struct drm_crtc *crtc); void (*enable_fbc)(struct drm_crtc *crtc);
void (*disable_fbc)(struct drm_device *dev); void (*disable_fbc)(struct drm_i915_private *dev_priv);
}; };
/** /**
......
...@@ -92,7 +92,7 @@ static void i915_restore_display(struct drm_device *dev) ...@@ -92,7 +92,7 @@ static void i915_restore_display(struct drm_device *dev)
} }
/* only restore FBC info on the platform that supports FBC*/ /* only restore FBC info on the platform that supports FBC*/
intel_fbc_disable(dev); intel_fbc_disable(dev_priv);
/* restore FBC interval */ /* restore FBC interval */
if (HAS_FBC(dev) && INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev)) if (HAS_FBC(dev) && INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev))
......
...@@ -3135,7 +3135,7 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb, ...@@ -3135,7 +3135,7 @@ intel_pipe_set_base_atomic(struct drm_crtc *crtc, struct drm_framebuffer *fb,
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
if (dev_priv->fbc.disable_fbc) if (dev_priv->fbc.disable_fbc)
dev_priv->fbc.disable_fbc(dev); dev_priv->fbc.disable_fbc(dev_priv);
dev_priv->display.update_primary_plane(crtc, fb, x, y); dev_priv->display.update_primary_plane(crtc, fb, x, y);
...@@ -4734,6 +4734,7 @@ static void intel_post_plane_update(struct intel_crtc *crtc) ...@@ -4734,6 +4734,7 @@ static void intel_post_plane_update(struct intel_crtc *crtc)
{ {
struct intel_crtc_atomic_commit *atomic = &crtc->atomic; struct intel_crtc_atomic_commit *atomic = &crtc->atomic;
struct drm_device *dev = crtc->base.dev; struct drm_device *dev = crtc->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_plane *plane; struct drm_plane *plane;
if (atomic->wait_vblank) if (atomic->wait_vblank)
...@@ -4748,7 +4749,7 @@ static void intel_post_plane_update(struct intel_crtc *crtc) ...@@ -4748,7 +4749,7 @@ static void intel_post_plane_update(struct intel_crtc *crtc)
intel_update_watermarks(&crtc->base); intel_update_watermarks(&crtc->base);
if (atomic->update_fbc) if (atomic->update_fbc)
intel_fbc_update(dev); intel_fbc_update(dev_priv);
if (atomic->post_enable_primary) if (atomic->post_enable_primary)
intel_post_enable_primary(&crtc->base); intel_post_enable_primary(&crtc->base);
...@@ -10688,13 +10689,14 @@ static void intel_unpin_work_fn(struct work_struct *__work) ...@@ -10688,13 +10689,14 @@ static void intel_unpin_work_fn(struct work_struct *__work)
container_of(__work, struct intel_unpin_work, work); container_of(__work, struct intel_unpin_work, work);
struct intel_crtc *crtc = to_intel_crtc(work->crtc); struct intel_crtc *crtc = to_intel_crtc(work->crtc);
struct drm_device *dev = crtc->base.dev; struct drm_device *dev = crtc->base.dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_plane *primary = crtc->base.primary; struct drm_plane *primary = crtc->base.primary;
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
intel_unpin_fb_obj(work->old_fb, primary->state); intel_unpin_fb_obj(work->old_fb, primary->state);
drm_gem_object_unreference(&work->pending_flip_obj->base); drm_gem_object_unreference(&work->pending_flip_obj->base);
intel_fbc_update(dev); intel_fbc_update(dev_priv);
if (work->flip_queued_req) if (work->flip_queued_req)
i915_gem_request_assign(&work->flip_queued_req, NULL); i915_gem_request_assign(&work->flip_queued_req, NULL);
...@@ -11469,7 +11471,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc, ...@@ -11469,7 +11471,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
to_intel_plane(primary)->frontbuffer_bit); to_intel_plane(primary)->frontbuffer_bit);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
intel_fbc_disable(dev); intel_fbc_disable(dev_priv);
intel_frontbuffer_flip_prepare(dev, intel_frontbuffer_flip_prepare(dev,
to_intel_plane(primary)->frontbuffer_bit); to_intel_plane(primary)->frontbuffer_bit);
...@@ -15045,7 +15047,7 @@ void intel_modeset_init(struct drm_device *dev) ...@@ -15045,7 +15047,7 @@ void intel_modeset_init(struct drm_device *dev)
intel_setup_outputs(dev); intel_setup_outputs(dev);
/* Just in case the BIOS is doing something questionable. */ /* Just in case the BIOS is doing something questionable. */
intel_fbc_disable(dev); intel_fbc_disable(dev_priv);
drm_modeset_lock_all(dev); drm_modeset_lock_all(dev);
intel_modeset_setup_hw_state(dev, false); intel_modeset_setup_hw_state(dev, false);
...@@ -15599,7 +15601,7 @@ void intel_modeset_cleanup(struct drm_device *dev) ...@@ -15599,7 +15601,7 @@ void intel_modeset_cleanup(struct drm_device *dev)
intel_unregister_dsm_handler(); intel_unregister_dsm_handler();
intel_fbc_disable(dev); intel_fbc_disable(dev_priv);
/* flush any delayed tasks or pending work */ /* flush any delayed tasks or pending work */
flush_scheduled_work(); flush_scheduled_work();
......
...@@ -1248,10 +1248,10 @@ static inline void intel_fbdev_restore_mode(struct drm_device *dev) ...@@ -1248,10 +1248,10 @@ static inline void intel_fbdev_restore_mode(struct drm_device *dev)
#endif #endif
/* intel_fbc.c */ /* intel_fbc.c */
bool intel_fbc_enabled(struct drm_device *dev); bool intel_fbc_enabled(struct drm_i915_private *dev_priv);
void intel_fbc_update(struct drm_device *dev); void intel_fbc_update(struct drm_i915_private *dev_priv);
void intel_fbc_init(struct drm_i915_private *dev_priv); void intel_fbc_init(struct drm_i915_private *dev_priv);
void intel_fbc_disable(struct drm_device *dev); void intel_fbc_disable(struct drm_i915_private *dev_priv);
void intel_fbc_disable_crtc(struct intel_crtc *crtc); void intel_fbc_disable_crtc(struct intel_crtc *crtc);
void intel_fbc_invalidate(struct drm_i915_private *dev_priv, void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
unsigned int frontbuffer_bits, unsigned int frontbuffer_bits,
...@@ -1259,7 +1259,7 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv, ...@@ -1259,7 +1259,7 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
void intel_fbc_flush(struct drm_i915_private *dev_priv, void intel_fbc_flush(struct drm_i915_private *dev_priv,
unsigned int frontbuffer_bits); unsigned int frontbuffer_bits);
const char *intel_no_fbc_reason_str(enum no_fbc_reason reason); const char *intel_no_fbc_reason_str(enum no_fbc_reason reason);
void intel_fbc_cleanup_cfb(struct drm_device *dev); void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv);
/* intel_hdmi.c */ /* intel_hdmi.c */
void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port); void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port);
......
This diff is collapsed.
...@@ -2479,6 +2479,7 @@ static void ilk_wm_merge(struct drm_device *dev, ...@@ -2479,6 +2479,7 @@ static void ilk_wm_merge(struct drm_device *dev,
const struct ilk_wm_maximums *max, const struct ilk_wm_maximums *max,
struct intel_pipe_wm *merged) struct intel_pipe_wm *merged)
{ {
struct drm_i915_private *dev_priv = dev->dev_private;
int level, max_level = ilk_wm_max_level(dev); int level, max_level = ilk_wm_max_level(dev);
int last_enabled_level = max_level; int last_enabled_level = max_level;
...@@ -2519,7 +2520,8 @@ static void ilk_wm_merge(struct drm_device *dev, ...@@ -2519,7 +2520,8 @@ static void ilk_wm_merge(struct drm_device *dev,
* What we should check here is whether FBC can be * What we should check here is whether FBC can be
* enabled sometime later. * enabled sometime later.
*/ */
if (IS_GEN5(dev) && !merged->fbc_wm_enabled && intel_fbc_enabled(dev)) { if (IS_GEN5(dev) && !merged->fbc_wm_enabled &&
intel_fbc_enabled(dev_priv)) {
for (level = 2; level <= max_level; level++) { for (level = 2; level <= max_level; level++) {
struct intel_wm_level *wm = &merged->wm[level]; struct intel_wm_level *wm = &merged->wm[level];
......
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