Skip to content

Commit 455a680

Browse files
Gustavo Padovandanvet
authored andcommitted
drm/i915: remove intel_pipe_set_base() (v4)
After some refactor intel_primary_plane_setplane() does the same as intel_pipe_set_base() so we can get rid of it and replace the calls with intel_primary_plane_setplane(). v2: take Ville's comments: - get the right arguments for update_plane() - use drm_crtc_get_hv_timing() v3 (by Matt): - Rebase to latest di-nightly codebase - Use primary->funcs->update_plane() in __intel_set_mode() - Use primary->funcs->disable_plane() in intel_crtc_disable() v4 (by Matt): - Drop redundant calls to intel_crtc_wait_for_pending_flips() before calling update_plane() (Ville) Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Acked-and-mourned-by: Jesse Barnes <jbarnes@virtuousgeek.org> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent a912f12 commit 455a680

File tree

1 file changed

+28
-101
lines changed

1 file changed

+28
-101
lines changed

drivers/gpu/drm/i915/intel_display.c

Lines changed: 28 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -2954,71 +2954,6 @@ static void intel_update_pipe_size(struct intel_crtc *crtc)
29542954
crtc->config.pipe_src_h = adjusted_mode->crtc_vdisplay;
29552955
}
29562956

2957-
static int
2958-
intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
2959-
struct drm_framebuffer *fb)
2960-
{
2961-
struct drm_device *dev = crtc->dev;
2962-
struct drm_i915_private *dev_priv = dev->dev_private;
2963-
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2964-
enum pipe pipe = intel_crtc->pipe;
2965-
struct drm_framebuffer *old_fb = crtc->primary->fb;
2966-
struct drm_i915_gem_object *old_obj = intel_fb_obj(old_fb);
2967-
int ret;
2968-
2969-
if (intel_crtc_has_pending_flip(crtc)) {
2970-
DRM_ERROR("pipe is still busy with an old pageflip\n");
2971-
return -EBUSY;
2972-
}
2973-
2974-
/* no fb bound */
2975-
if (!fb) {
2976-
DRM_ERROR("No FB bound\n");
2977-
return 0;
2978-
}
2979-
2980-
if (intel_crtc->plane > INTEL_INFO(dev)->num_pipes) {
2981-
DRM_ERROR("no plane for crtc: plane %c, num_pipes %d\n",
2982-
plane_name(intel_crtc->plane),
2983-
INTEL_INFO(dev)->num_pipes);
2984-
return -EINVAL;
2985-
}
2986-
2987-
mutex_lock(&dev->struct_mutex);
2988-
ret = intel_pin_and_fence_fb_obj(crtc->primary, fb, NULL);
2989-
if (ret == 0)
2990-
i915_gem_track_fb(old_obj, intel_fb_obj(fb),
2991-
INTEL_FRONTBUFFER_PRIMARY(pipe));
2992-
mutex_unlock(&dev->struct_mutex);
2993-
if (ret != 0) {
2994-
DRM_ERROR("pin & fence failed\n");
2995-
return ret;
2996-
}
2997-
2998-
dev_priv->display.update_primary_plane(crtc, fb, x, y);
2999-
3000-
if (intel_crtc->active)
3001-
intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_PRIMARY(pipe));
3002-
3003-
crtc->primary->fb = fb;
3004-
crtc->x = x;
3005-
crtc->y = y;
3006-
3007-
if (old_fb) {
3008-
if (intel_crtc->active && old_fb != fb)
3009-
intel_wait_for_vblank(dev, intel_crtc->pipe);
3010-
mutex_lock(&dev->struct_mutex);
3011-
intel_unpin_fb_obj(old_obj);
3012-
mutex_unlock(&dev->struct_mutex);
3013-
}
3014-
3015-
mutex_lock(&dev->struct_mutex);
3016-
intel_update_fbc(dev);
3017-
mutex_unlock(&dev->struct_mutex);
3018-
3019-
return 0;
3020-
}
3021-
30222957
static void intel_fdi_normal_train(struct drm_crtc *crtc)
30232958
{
30242959
struct drm_device *dev = crtc->dev;
@@ -5312,23 +5247,14 @@ static void intel_crtc_disable(struct drm_crtc *crtc)
53125247
struct drm_device *dev = crtc->dev;
53135248
struct drm_connector *connector;
53145249
struct drm_i915_private *dev_priv = dev->dev_private;
5315-
struct drm_i915_gem_object *old_obj = intel_fb_obj(crtc->primary->fb);
5316-
enum pipe pipe = to_intel_crtc(crtc)->pipe;
53175250

53185251
/* crtc should still be enabled when we disable it. */
53195252
WARN_ON(!crtc->enabled);
53205253

53215254
dev_priv->display.crtc_disable(crtc);
53225255
dev_priv->display.off(crtc);
53235256

5324-
if (crtc->primary->fb) {
5325-
mutex_lock(&dev->struct_mutex);
5326-
intel_unpin_fb_obj(old_obj);
5327-
i915_gem_track_fb(old_obj, NULL,
5328-
INTEL_FRONTBUFFER_PRIMARY(pipe));
5329-
mutex_unlock(&dev->struct_mutex);
5330-
crtc->primary->fb = NULL;
5331-
}
5257+
crtc->primary->funcs->disable_plane(crtc->primary);
53325258

53335259
/* Update computed state. */
53345260
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
@@ -9691,6 +9617,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
96919617
struct drm_framebuffer *old_fb = crtc->primary->fb;
96929618
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
96939619
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
9620+
struct drm_plane *primary = crtc->primary;
9621+
struct intel_plane *intel_plane = to_intel_plane(primary);
96949622
enum pipe pipe = intel_crtc->pipe;
96959623
struct intel_unpin_work *work;
96969624
struct intel_engine_cs *ring;
@@ -9849,8 +9777,15 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
98499777

98509778
if (ret == -EIO) {
98519779
out_hang:
9852-
intel_crtc_wait_for_pending_flips(crtc);
9853-
ret = intel_pipe_set_base(crtc, crtc->x, crtc->y, fb);
9780+
ret = primary->funcs->update_plane(primary, crtc, fb,
9781+
intel_plane->crtc_x,
9782+
intel_plane->crtc_y,
9783+
intel_plane->crtc_h,
9784+
intel_plane->crtc_w,
9785+
intel_plane->src_x,
9786+
intel_plane->src_y,
9787+
intel_plane->src_h,
9788+
intel_plane->src_w);
98549789
if (ret == 0 && event) {
98559790
spin_lock_irq(&dev->event_lock);
98569791
drm_send_vblank_event(dev, pipe, event);
@@ -11079,26 +11014,15 @@ static int __intel_set_mode(struct drm_crtc *crtc,
1107911014
* on the DPLL.
1108011015
*/
1108111016
for_each_intel_crtc_masked(dev, modeset_pipes, intel_crtc) {
11082-
struct drm_framebuffer *old_fb = crtc->primary->fb;
11083-
struct drm_i915_gem_object *old_obj = intel_fb_obj(old_fb);
11084-
struct drm_i915_gem_object *obj = intel_fb_obj(fb);
11017+
struct drm_plane *primary = intel_crtc->base.primary;
11018+
int vdisplay, hdisplay;
1108511019

11086-
mutex_lock(&dev->struct_mutex);
11087-
ret = intel_pin_and_fence_fb_obj(crtc->primary, fb, NULL);
11088-
if (ret != 0) {
11089-
DRM_ERROR("pin & fence failed\n");
11090-
mutex_unlock(&dev->struct_mutex);
11091-
goto done;
11092-
}
11093-
if (old_fb)
11094-
intel_unpin_fb_obj(old_obj);
11095-
i915_gem_track_fb(old_obj, obj,
11096-
INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe));
11097-
mutex_unlock(&dev->struct_mutex);
11098-
11099-
crtc->primary->fb = fb;
11100-
crtc->x = x;
11101-
crtc->y = y;
11020+
drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay);
11021+
ret = primary->funcs->update_plane(primary, &intel_crtc->base,
11022+
fb, 0, 0,
11023+
hdisplay, vdisplay,
11024+
x << 16, y << 16,
11025+
hdisplay << 16, vdisplay << 16);
1110211026
}
1110311027

1110411028
/* Now enable the clocks, plane, pipe, and connectors that we set up. */
@@ -11564,11 +11488,14 @@ static int intel_crtc_set_config(struct drm_mode_set *set)
1156411488
disable_pipes);
1156511489
} else if (config->fb_changed) {
1156611490
struct intel_crtc *intel_crtc = to_intel_crtc(set->crtc);
11567-
11568-
intel_crtc_wait_for_pending_flips(set->crtc);
11569-
11570-
ret = intel_pipe_set_base(set->crtc,
11571-
set->x, set->y, set->fb);
11491+
struct drm_plane *primary = set->crtc->primary;
11492+
int vdisplay, hdisplay;
11493+
11494+
drm_crtc_get_hv_timing(set->mode, &hdisplay, &vdisplay);
11495+
ret = primary->funcs->update_plane(primary, set->crtc, set->fb,
11496+
0, 0, hdisplay, vdisplay,
11497+
set->x << 16, set->y << 16,
11498+
hdisplay << 16, vdisplay << 16);
1157211499

1157311500
/*
1157411501
* We need to make sure the primary plane is re-enabled if it

0 commit comments

Comments
 (0)