Skip to content

Commit 27321ae

Browse files
mlankhorstdanvet
authored andcommitted
drm/i915: Use the disable callback for disabling planes.
This allows disabling all planes affecting a crtc without caring what type it is. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent a8ad0d8 commit 27321ae

File tree

2 files changed

+20
-76
lines changed

2 files changed

+20
-76
lines changed

drivers/gpu/drm/i915/i915_drv.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ enum hpd_pin {
238238
#define for_each_crtc(dev, crtc) \
239239
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
240240

241+
#define for_each_intel_plane(dev, intel_plane) \
242+
list_for_each_entry(intel_plane, \
243+
&dev->mode_config.plane_list, \
244+
base.head)
245+
241246
#define for_each_intel_crtc(dev, intel_crtc) \
242247
list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, base.head)
243248

drivers/gpu/drm/i915/intel_display.c

Lines changed: 15 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,32 +2254,6 @@ static void intel_enable_primary_hw_plane(struct drm_plane *plane,
22542254
intel_wait_for_vblank(dev, intel_crtc->pipe);
22552255
}
22562256

2257-
/**
2258-
* intel_disable_primary_hw_plane - disable the primary hardware plane
2259-
* @plane: plane to be disabled
2260-
* @crtc: crtc for the plane
2261-
*
2262-
* Disable @plane on @crtc, making sure that the pipe is running first.
2263-
*/
2264-
static void intel_disable_primary_hw_plane(struct drm_plane *plane,
2265-
struct drm_crtc *crtc)
2266-
{
2267-
struct drm_device *dev = plane->dev;
2268-
struct drm_i915_private *dev_priv = dev->dev_private;
2269-
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2270-
2271-
if (WARN_ON(!intel_crtc->active))
2272-
return;
2273-
2274-
if (!intel_crtc->primary_enabled)
2275-
return;
2276-
2277-
intel_crtc->primary_enabled = false;
2278-
2279-
dev_priv->display.update_primary_plane(crtc, plane->fb,
2280-
crtc->x, crtc->y);
2281-
}
2282-
22832257
static bool need_vtd_wa(struct drm_device *dev)
22842258
{
22852259
#ifdef CONFIG_INTEL_IOMMU
@@ -4645,38 +4619,6 @@ static void intel_enable_sprite_planes(struct drm_crtc *crtc)
46454619
}
46464620
}
46474621

4648-
/*
4649-
* Disable a plane internally without actually modifying the plane's state.
4650-
* This will allow us to easily restore the plane later by just reprogramming
4651-
* its state.
4652-
*/
4653-
static void disable_plane_internal(struct drm_plane *plane)
4654-
{
4655-
struct intel_plane *intel_plane = to_intel_plane(plane);
4656-
struct drm_plane_state *state =
4657-
plane->funcs->atomic_duplicate_state(plane);
4658-
struct intel_plane_state *intel_state = to_intel_plane_state(state);
4659-
4660-
intel_state->visible = false;
4661-
intel_plane->commit_plane(plane, intel_state);
4662-
4663-
intel_plane_destroy_state(plane, state);
4664-
}
4665-
4666-
static void intel_disable_sprite_planes(struct drm_crtc *crtc)
4667-
{
4668-
struct drm_device *dev = crtc->dev;
4669-
enum pipe pipe = to_intel_crtc(crtc)->pipe;
4670-
struct drm_plane *plane;
4671-
struct intel_plane *intel_plane;
4672-
4673-
drm_for_each_legacy_plane(plane, &dev->mode_config.plane_list) {
4674-
intel_plane = to_intel_plane(plane);
4675-
if (plane->fb && intel_plane->pipe == pipe)
4676-
disable_plane_internal(plane);
4677-
}
4678-
}
4679-
46804622
void hsw_enable_ips(struct intel_crtc *crtc)
46814623
{
46824624
struct drm_device *dev = crtc->base.dev;
@@ -4830,6 +4772,7 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc)
48304772
struct drm_device *dev = crtc->dev;
48314773
struct drm_i915_private *dev_priv = dev->dev_private;
48324774
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
4775+
struct intel_plane *intel_plane;
48334776
int pipe = intel_crtc->pipe;
48344777

48354778
intel_crtc_wait_for_pending_flips(crtc);
@@ -4840,9 +4783,15 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc)
48404783
hsw_disable_ips(intel_crtc);
48414784

48424785
intel_crtc_dpms_overlay(intel_crtc, false);
4843-
intel_crtc_update_cursor(crtc, false);
4844-
intel_disable_sprite_planes(crtc);
4845-
intel_disable_primary_hw_plane(crtc->primary, crtc);
4786+
intel_crtc->primary_enabled = false;
4787+
for_each_intel_plane(dev, intel_plane) {
4788+
if (intel_plane->pipe == pipe) {
4789+
struct drm_crtc *from = intel_plane->base.crtc;
4790+
4791+
intel_plane->disable_plane(&intel_plane->base,
4792+
from ?: crtc, true);
4793+
}
4794+
}
48464795

48474796
/*
48484797
* FIXME: Once we grow proper nuclear flip support out of this we need
@@ -13357,24 +13306,14 @@ intel_commit_primary_plane(struct drm_plane *plane,
1335713306
crtc->y = src->y1 >> 16;
1335813307

1335913308
if (intel_crtc->active) {
13360-
if (state->visible) {
13309+
intel_crtc->primary_enabled = state->visible;
13310+
13311+
if (state->visible)
1336113312
/* FIXME: kill this fastboot hack */
1336213313
intel_update_pipe_size(intel_crtc);
1336313314

13364-
intel_crtc->primary_enabled = true;
13365-
13366-
dev_priv->display.update_primary_plane(crtc, plane->fb,
13367-
crtc->x, crtc->y);
13368-
} else {
13369-
/*
13370-
* If clipping results in a non-visible primary plane,
13371-
* we'll disable the primary plane. Note that this is
13372-
* a bit different than what happens if userspace
13373-
* explicitly disables the plane by passing fb=0
13374-
* because plane->fb still gets set and pinned.
13375-
*/
13376-
intel_disable_primary_hw_plane(plane, crtc);
13377-
}
13315+
dev_priv->display.update_primary_plane(crtc, plane->fb,
13316+
crtc->x, crtc->y);
1337813317
}
1337913318
}
1338013319

0 commit comments

Comments
 (0)