i915 atomic plane helper conversion (v2)
Subsystems (3)
cover i915 atomic plane helper conversion (v2)
Another iteration of the i915 atomic plane helper conversion. This iteration is based on the display refactoring series I sent to the mailing list last night, so the actual transition to atomic here should be a little bit easier to understand. This set also fixes v1's problem with performing sleepable operations with interrupts disabled (during vblank evasion).
Depends on series:
[PATCH 0/9] i915 display refactoring (v3)
http://lists.freedesktop.org/archives/intel-gfx/2014-November/056149.html
Previous version of this patchset:
http://lists.freedesktop.org/archives/intel-gfx/2014-November/055454.htmlMatt Roper (10):
drm/i915: Ensure state->crtc is non-NULL for plane updates drm/i915: Make all plane disables use 'update_plane' drm/i915: Refactor work that can sleep out of commit drm/i915: Move vblank evasion to commit drm/i915: Clarify sprite plane function names (v2) drm/i915: Make intel_crtc_has_pending_flip() non-static drm/i915: Prepare for atomic plane helpers (v3) drm/i915: Switch plane handling to atomic helpers (v4) drm/i915: Drop unused position fields
drm/i915: Integrate kerneldoc for atomic plane helpers
Documentation/DocBook/drm.tmpl | 5 + drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_atomic_plane.c | 209 +++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 359 +++++++++++++----------------- drivers/gpu/drm/i915/intel_drv.h | 35 ++- drivers/gpu/drm/i915/intel_sprite.c | 235 +++++++------------ 6 files changed, 476 insertions(+), 368 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_atomic_plane.c
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/10 drm/i915: Ensure state->crtc is non-NULL for plane updates
When disabling a plane, it is legal to pass crtc = NULL. Since planes on Intel hardware are tied to a fixed CRTC, go ahead and set state->crtc to the appropriate crtc in cases where it is passed to us as NULL.
In a future patch, we will start using the update handler for plane disables, so this will help ensure we always have a non-NULL crtc pointer to work with.
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -11784,7 +11784,7 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int ret; - state.base.crtc = crtc; + state.base.crtc = crtc ? crtc : plane->crtc; state.base.fb = fb;/* sample coordinates in 16.16 fixed point */
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/10 drm/i915: Make all plane disables use 'update_plane'
In reply to Matt RoperIf we extend the commit_plane handlers for each plane type to be able to handle fb=0, then we can easily implement plane disable via the update_plane handler. The cursor plane already works this way, and this is the direction we need to go to integrate with the atomic plane handler. We can now kill off the type-specific disable functions, as well as the redundant intel_plane_disable() (not to be confused with intel_disable_plane()).
Note that prepare_plane_fb() only gets called as part of update_plane when fb!=NULL (by design, to match the semantics of the atomic plane helpers); this means that our commit_plane handlers need to handle the frontbuffer tracking for the disable case, even though they don't handle it for normal updates.
--- drivers/gpu/drm/i915/intel_display.c | 102 ++++++++++++++--------------------- drivers/gpu/drm/i915/intel_drv.h | 2 +- drivers/gpu/drm/i915/intel_sprite.c | 71 +++++++----------------- 3 files changed, 60 insertions(+), 115 deletions(-)
drivers/gpu/drm/i915/intel_display.c +41 -61
@@ -3996,7 +3996,7 @@ static void intel_disable_planes(struct drm_crtc *crtc)drm_for_each_legacy_plane (plane, &dev->mode_config.plane_list) { intel_plane =to_intel_plane (plane);if (intel_plane->pipe == pipe) -intel_plane_disable (&intel_plane->base); + plane->funcs->disable_plane (plane); } }
@@ -11535,45 +11535,6 @@ static void intel_shared_dpll_init(struct drm_device *dev)BUG_ON (dev_priv->num_shared_dpll >I915_NUM_PLLS ); } -static int -intel_primary_plane_disable (struct drm_plane *plane) -{ -struct drm_device *dev = plane->dev; -struct intel_crtc *intel_crtc; - -if (!plane->fb) -return 0 ; - -BUG_ON (!plane->crtc); - - intel_crtc =to_intel_crtc (plane->crtc); - -/* -* Even though we checked plane->fb above, it's still possible that -* the primary plane has been implicitly disabled because the crtc -* coordinates given weren't visible, or because we detected -* that it was 100% covered by a sprite plane. Or, the CRTC may be -* off and we've set a fb, but haven't actually turned on the CRTC yet. -* In either case, we need to unpin the FB and let the fb pointer get -* updated, but otherwise we don't need to touch the hardware. -*/ -if (!intel_crtc->primary_enabled) - goto disable_unpin; - -intel_crtc_wait_for_pending_flips (plane->crtc); -intel_disable_primary_hw_plane (plane, plane->crtc); - -disable_unpin: -mutex_lock (&dev->struct_mutex); -i915_gem_track_fb (intel_fb_obj (plane->fb),NULL , -INTEL_FRONTBUFFER_PRIMARY (intel_crtc->pipe)); -intel_unpin_fb_obj (intel_fb_obj (plane->fb)); -mutex_unlock (&dev->struct_mutex); - plane->fb =NULL ; - -return 0 ; -} -/** * intel_prepare_plane_fb - Prepare fb for usage on plane * @plane: drm plane to prepare for
@@ -11678,10 +11639,12 @@ intel_check_primary_plane(struct drm_plane *plane,if (ret)return ret; -intel_crtc_wait_for_pending_flips (crtc); -if (intel_crtc_has_pending_flip (crtc)) { -DRM_ERROR ("pipe is still busy with an old pageflip\n" ); -return -EBUSY ; +if (plane->crtc) { +intel_crtc_wait_for_pending_flips (plane->crtc); +if (intel_crtc_has_pending_flip (plane->crtc)) { +DRM_ERROR ("pipe is still busy with an old pageflip\n" ); +return -EBUSY ; + } }return 0 ;
@@ -11696,12 +11659,23 @@ intel_commit_primary_plane(struct drm_plane *plane,struct drm_device *dev = plane->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -enum pipe pipe = intel_crtc->pipe;struct drm_i915_gem_object *obj =intel_fb_obj (fb);struct intel_plane *intel_plane =to_intel_plane (plane);struct drm_rect *src = &state->src; +enum pipe pipe = intel_plane->pipe; - crtc->primary->fb = fb; +if (!fb) { +/* +* 'prepare' is never called when plane is being disabled, so +* we need to handle frontbuffer tracking here +*/ +mutex_lock (&dev->struct_mutex); +i915_gem_track_fb (intel_fb_obj (plane->fb),NULL , +INTEL_FRONTBUFFER_PRIMARY (pipe)); +mutex_unlock (&dev->struct_mutex); + } + + plane->fb = fb; crtc->x = src->x1 >>16 ; crtc->y = src->y1 >>16 ;
@@ -11759,7 +11733,7 @@ intel_commit_primary_plane(struct drm_plane *plane,* explicitly disables the plane by passing fb=0 * because plane->fb still gets set and pinned. */ -intel_disable_primary_hw_plane (plane, crtc); +intel_disable_primary_hw_plane (plane, plane->crtc); }intel_frontbuffer_flip (dev,INTEL_FRONTBUFFER_PRIMARY (pipe));
@@ -11831,6 +11805,24 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,return 0 ; } +/** +* intel_disable_plane - disable a plane +* @plane: plane to disable +* +* General disable handler for all plane types. +*/ +int +intel_disable_plane (struct drm_plane *plane) +{ +if (!plane->fb) +return 0 ; + +BUG_ON (!plane->crtc); + +return plane->funcs->update_plane (plane, plane->crtc,NULL , +0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ); +} +/* Common destruction function for both primary and cursor planes */ static void intel_plane_destroy (struct drm_plane *plane) {
@@ -11841,7 +11833,7 @@ static void intel_plane_destroy(struct drm_plane *plane)static const struct drm_plane_funcs intel_primary_plane_funcs = { .update_plane = intel_update_plane, - .disable_plane = intel_primary_plane_disable, + .disable_plane = intel_disable_plane, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property };
@@ -11896,18 +11888,6 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev, }static int -intel_cursor_plane_disable (struct drm_plane *plane) -{ -if (!plane->fb) -return 0 ; - -BUG_ON (!plane->crtc); - -return plane->funcs->update_plane (plane, plane->crtc,NULL , -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ); -} - -static int intel_check_cursor_plane (struct drm_plane *plane,struct intel_plane_state *state) {
@@ -12030,7 +12010,7 @@ update:static const struct drm_plane_funcs intel_cursor_plane_funcs = { .update_plane = intel_update_plane, - .disable_plane = intel_cursor_plane_disable, + .disable_plane = intel_disable_plane, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, };
drivers/gpu/drm/i915/intel_drv.h +1 -1
@@ -1021,6 +1021,7 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h); +int intel_disable_plane (struct drm_plane *plane);/* intel_dp_mst.c */ int intel_dp_mst_encoder_init (struct intel_digital_port *intel_dig_port,int conn_id);
@@ -1201,7 +1202,6 @@ int intel_plane_set_property(struct drm_plane *plane,struct drm_property *prop, uint64_t val);int intel_plane_restore (struct drm_plane *plane); -void intel_plane_disable (struct drm_plane *plane);int intel_sprite_set_colorkey (struct drm_device *dev,void *data,struct drm_file *file_priv); int intel_sprite_get_colorkey(struct drm_device *dev, void *data,
drivers/gpu/drm/i915/intel_sprite.c +18 -53
101 lines not on this page · raw message
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/10 drm/i915: Refactor work that can sleep out of commit
In reply to Matt RoperOnce we integrate our work into the atomic pipeline, plane commit operations will need to happen with interrupts disabled, due to vblank evasion. Create new 'pre_commit' and 'post_commit' handlers to cover hardware programming operations that can sleep and thus must happen outside the vblank evasion window.
--- drivers/gpu/drm/i915/intel_display.c | 174 +++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_drv.h | 14 +++ drivers/gpu/drm/i915/intel_sprite.c | 93 +++++++++++-------- 3 files changed, 182 insertions(+), 99 deletions(-)
drivers/gpu/drm/i915/intel_display.c +113 -61
@@ -11647,24 +11647,22 @@ intel_check_primary_plane(struct drm_plane *plane, } } + state->primary_was_enabled =to_intel_crtc (crtc)->primary_enabled; +return 0 ; }static void -intel_commit_primary_plane (struct drm_plane *plane, -struct intel_plane_state *state) +intel_pre_commit_primary (struct drm_plane *plane, +struct intel_plane_state *state) { -struct drm_crtc *crtc = state->base.crtc; -struct drm_framebuffer *fb = state->base.fb;struct drm_device *dev = plane->dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct drm_i915_gem_object *obj =intel_fb_obj (fb);struct intel_plane *intel_plane =to_intel_plane (plane); -struct drm_rect *src = &state->src; -enum pipe pipe = intel_plane->pipe; +struct intel_crtc *intel_crtc =to_intel_crtc (state->base.crtc); +enum pipe pipe = intel_crtc->pipe; -if (!fb) { +if (!state->base.fb) {/* * 'prepare' is never called when plane is being disabled, so * we need to handle frontbuffer tracking here
@@ -11675,20 +11673,6 @@ intel_commit_primary_plane(struct drm_plane *plane,mutex_unlock (&dev->struct_mutex); } - plane->fb = fb; - crtc->x = src->x1 >>16 ; - crtc->y = src->y1 >>16 ; - - intel_plane->crtc_x = state->orig_dst.x1; - intel_plane->crtc_y = state->orig_dst.y1; - intel_plane->crtc_w =drm_rect_width (&state->orig_dst); - intel_plane->crtc_h =drm_rect_height (&state->orig_dst); - intel_plane->src_x = state->orig_src.x1; - intel_plane->src_y = state->orig_src.y1; - intel_plane->src_w =drm_rect_width (&state->orig_src); - intel_plane->src_h =drm_rect_height (&state->orig_src); - intel_plane->obj = obj; -if (intel_crtc->active) {/* * FBC does not work on some platforms for rotated
@@ -11706,10 +11690,65 @@ intel_commit_primary_plane(struct drm_plane *plane, intel_plane->rotation != BIT(DRM_ROTATE_0)) {intel_disable_fbc (dev); } + } +} +static void +intel_post_commit_primary (struct drm_plane *plane, +struct intel_plane_state *state) +{ +struct drm_device *dev = plane->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (state->base.crtc); +enum pipe pipe = intel_crtc->pipe; + +if (intel_crtc->active) {if (state->visible) { -bool was_enabled = intel_crtc->primary_enabled; +/* +* BDW signals flip done immediately if the plane +* is disabled, even if the plane enable is already +* armed to occur at the next vblank :( +*/ +if (IS_BROADWELL (dev) && !state->primary_was_enabled) +intel_wait_for_vblank (dev, intel_crtc->pipe); + } + +intel_frontbuffer_flip (dev,INTEL_FRONTBUFFER_PRIMARY (pipe)); + +mutex_lock (&dev->struct_mutex); +intel_update_fbc (dev); +mutex_unlock (&dev->struct_mutex); + } +} + +static void +intel_commit_primary_plane (struct drm_plane *plane, +struct intel_plane_state *state) +{ +struct drm_crtc *crtc = state->base.crtc; +struct drm_framebuffer *fb = state->base.fb; +struct drm_device *dev = plane->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_i915_gem_object *obj =intel_fb_obj (fb); +struct intel_plane *intel_plane =to_intel_plane (plane); +struct drm_rect *src = &state->src; + + plane->fb = fb; + crtc->x = src->x1 >>16 ; + crtc->y = src->y1 >>16 ; + + intel_plane->crtc_x = state->orig_dst.x1; + intel_plane->crtc_y = state->orig_dst.y1; + intel_plane->crtc_w =drm_rect_width (&state->orig_dst); + intel_plane->crtc_h =drm_rect_height (&state->orig_dst); + intel_plane->src_x = state->orig_src.x1; + intel_plane->src_y = state->orig_src.y1; + intel_plane->src_w =drm_rect_width (&state->orig_src); + intel_plane->src_h =drm_rect_height (&state->orig_src); + intel_plane->obj = obj; +if (intel_crtc->active) { +if (state->visible) {/* FIXME: kill this fastboot hack */ intel_update_pipe_size (intel_crtc);
@@ -11717,14 +11756,6 @@ intel_commit_primary_plane(struct drm_plane *plane, dev_priv->display.update_primary_plane (crtc, plane->fb, crtc->x, crtc->y); - -/* -* BDW signals flip done immediately if the plane -* is disabled, even if the plane enable is already -* armed to occur at the next vblank :( -*/ -if (IS_BROADWELL (dev) && !was_enabled) -intel_wait_for_vblank (dev, intel_crtc->pipe); }else {/* * If clipping results in a non-visible primary plane,
@@ -11735,12 +11766,6 @@ intel_commit_primary_plane(struct drm_plane *plane,*/ intel_disable_primary_hw_plane (plane, plane->crtc); } - -intel_frontbuffer_flip (dev,INTEL_FRONTBUFFER_PRIMARY (pipe)); - -mutex_lock (&dev->struct_mutex); -intel_update_fbc (dev); -mutex_unlock (&dev->struct_mutex); } }
@@ -11753,7 +11778,7 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, {struct drm_device *dev = plane->dev;struct drm_framebuffer *old_fb = plane->fb; -struct intel_plane_state state; +struct intel_plane_state state = {{0 }};struct intel_plane *intel_plane =to_intel_plane (plane);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int ret;
@@ -11791,7 +11816,11 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,return ret; } +if (intel_plane->pre_commit) + intel_plane->pre_commit (plane, &state); intel_plane->commit_plane (plane, &state); +if (intel_plane->post_commit) + intel_plane->post_commit (plane, &state);if (fb != old_fb) {if (intel_crtc->active)
@@ -11856,6 +11885,8 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev, primary->rotation =BIT (DRM_ROTATE_0 ); primary->check_plane = intel_check_primary_plane; primary->commit_plane = intel_commit_primary_plane; + primary->pre_commit = intel_pre_commit_primary; + primary->post_commit = intel_post_commit_primary;if (HAS_FBC (dev) &&INTEL_INFO (dev)->gen <4 ) primary->plane = !pipe;
@@ -11944,6 +11975,46 @@ intel_check_cursor_plane(struct drm_plane *plane, }static void +intel_pre_commit_cursor (struct drm_plane *plane, +struct intel_plane_state *state) +{ +struct drm_device *dev = plane->dev; +struct drm_i915_gem_object *obj =intel_fb_obj (state->base.fb); +struct drm_i915_gem_object *old_obj =intel_fb_obj (plane->fb); +struct intel_crtc *intel_crtc =to_intel_crtc (state->base.crtc); +enum pipe pipe = intel_crtc->pipe; + +/* +* 'prepare' is only called when fb != NULL; we still need to update +* frontbuffer tracking for the 'disable' case here. +*/ +if (!obj) { +mutex_lock (&dev->struct_mutex); +i915_gem_track_fb (old_obj,NULL , +INTEL_FRONTBUFFER_CURSOR (pipe)); +mutex_unlock (&dev->struct_mutex); + } + +if (intel_crtc->active) { +if (intel_crtc->cursor_width != +drm_rect_width (&state->orig_dst)) +intel_update_watermarks (&intel_crtc->base); + } +} + +static void +intel_post_commit_cursor (struct drm_plane *plane, +struct intel_plane_state *state) +{ +struct drm_device *dev = plane->dev; +struct intel_crtc *intel_crtc =to_intel_crtc (state->base.crtc); +enum pipe pipe = intel_crtc->pipe; + +if (intel_crtc->active) +intel_frontbuffer_flip (dev,INTEL_FRONTBUFFER_CURSOR (pipe)); +} + +static void intel_commit_cursor_plane (struct drm_plane *plane,struct intel_plane_state *state) {
@@ -11952,9 +12023,6 @@ intel_commit_cursor_plane(struct drm_plane *plane,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct intel_plane *intel_plane =to_intel_plane (plane);struct drm_i915_gem_object *obj =intel_fb_obj (state->base.fb); -struct drm_i915_gem_object *old_obj =intel_fb_obj (plane->fb); -enum pipe pipe = intel_crtc->pipe; -unsigned old_width;uint32_t addr; crtc->cursor_x = state->orig_dst.x1;
@@ -11973,17 +12041,6 @@ intel_commit_cursor_plane(struct drm_plane *plane,if (intel_crtc->cursor_bo == obj) goto update; -/* -* 'prepare' is only called when fb != NULL; we still need to update -* frontbuffer tracking for the 'disable' case here. -*/ -if (!obj) { -mutex_lock (&dev->struct_mutex); -i915_gem_track_fb (old_obj,NULL , -INTEL_FRONTBUFFER_CURSOR (pipe)); -mutex_unlock (&dev->struct_mutex); - } -if (!obj) addr =0 ;else if (!INTEL_INFO (dev)->cursor_needs_physical)
@@ -11994,18 +12051,11 @@ intel_commit_cursor_plane(struct drm_plane *plane, intel_crtc->cursor_addr = addr; intel_crtc->cursor_bo = obj; update: - old_width = intel_crtc->cursor_width; - intel_crtc->cursor_width =drm_rect_width (&state->orig_dst); intel_crtc->cursor_height =drm_rect_height (&state->orig_dst); -if (intel_crtc->active) { -if (old_width != intel_crtc->cursor_width) -intel_update_watermarks (crtc); +if (intel_crtc->active)intel_crtc_update_cursor (crtc, state->visible); - -intel_frontbuffer_flip (dev,INTEL_FRONTBUFFER_CURSOR (pipe)); - } }static const struct drm_plane_funcs intel_cursor_plane_funcs = {
@@ -12031,6 +12081,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev, cursor->rotation =BIT (DRM_ROTATE_0 ); cursor->check_plane = intel_check_cursor_plane; cursor->commit_plane = intel_commit_cursor_plane; + cursor->pre_commit = intel_pre_commit_cursor; + cursor->post_commit = intel_post_commit_cursor; drm_universal_plane_init(dev, &cursor->base, 0, &intel_cursor_plane_funcs,
drivers/gpu/drm/i915/intel_drv.h +14 -0
@@ -251,6 +251,16 @@ struct intel_plane_state {struct drm_rect orig_src;struct drm_rect orig_dst;bool visible; + +/* +* used only for sprite planes to determine when to implicitly +* enable/disable the primary plane +*/ +bool hides_primary; +bool need_primary_enable; + +/* used only for primary plane */ +bool primary_was_enabled; };struct intel_plane_config {
@@ -513,6 +523,10 @@ struct intel_plane { struct intel_plane_state *state);void (*commit_plane)(struct drm_plane *plane,struct intel_plane_state *state); +void (*pre_commit)(struct drm_plane *plane, +struct intel_plane_state *state); +void (*post_commit)(struct drm_plane *plane, +struct intel_plane_state *state);int (*update_colorkey)(struct drm_plane *plane,struct drm_intel_sprite_colorkey *key); void (*get_colorkey)(struct drm_plane *plane,
drivers/gpu/drm/i915/intel_sprite.c +55 -38
133 lines not on this page · raw message
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/10 drm/i915: Move vblank evasion to commit
In reply to Matt RoperMove the vblank evasion up from the low-level, hw-specific update_plane() handlers to the general plane commit operation. Everything inside commit should now be non-sleeping, so this brings us closer to how vblank evasion will behave once we move over to atomic.
--- drivers/gpu/drm/i915/intel_display.c | 8 +++++++ drivers/gpu/drm/i915/intel_sprite.c | 42 ------------------------------------ 2 files changed, 8 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/intel_display.c +8 -0
@@ -11781,6 +11781,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,struct intel_plane_state state = {{0 }};struct intel_plane *intel_plane =to_intel_plane (plane);struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +unsigned start_vbl_count; +bool atomic_update;int ret; state.base.crtc = crtc ? crtc : plane->crtc;
@@ -11818,7 +11820,13 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,if (intel_plane->pre_commit) intel_plane->pre_commit (plane, &state); + +/* Perform vblank evasion around commit operation */ + atomic_update =intel_pipe_update_start (intel_crtc, &start_vbl_count); intel_plane->commit_plane (plane, &state); +if (atomic_update) +intel_pipe_update_end (intel_crtc, start_vbl_count); +if (intel_plane->post_commit) intel_plane->post_commit (plane, &state);
drivers/gpu/drm/i915/intel_sprite.c +0 -42
132 lines not on this page · raw message
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/i915: Move vblank evasion to commit (v2)
Move the vblank evasion up from the low-level, hw-specific update_plane() handlers to the general plane commit operation. Everything inside commit should now be non-sleeping, so this brings us closer to how vblank evasion will behave once we move over to atomic.
v2: Restore lost intel_crtc->active check on vblank evasion
--- drivers/gpu/drm/i915/intel_display.c | 10 +++++++++ drivers/gpu/drm/i915/intel_sprite.c | 42 ------------------------------------ 2 files changed, 10 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/intel_display.c +10 -0
@@ -11845,6 +11845,8 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,struct intel_plane_state state = {{0 }};struct intel_plane *intel_plane =to_intel_plane (plane);struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +unsigned start_vbl_count; +bool atomic_update = false;int ret; state.base.crtc = crtc ? crtc : plane->crtc;
@@ -11882,7 +11884,15 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,if (intel_plane->pre_commit) intel_plane->pre_commit (plane, &state); + +/* Perform vblank evasion around commit operation */ +if (intel_crtc->active) + atomic_update =intel_pipe_update_start (intel_crtc, + &start_vbl_count); intel_plane->commit_plane (plane, &state); +if (atomic_update) +intel_pipe_update_end (intel_crtc, start_vbl_count); +if (intel_plane->post_commit) intel_plane->post_commit (plane, &state);
drivers/gpu/drm/i915/intel_sprite.c +0 -42
132 lines not on this page · raw message
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/10 drm/i915: Clarify sprite plane function names (v2)
In reply to Matt RoperA few of the sprite-related function names in i915 are very similar (e.g., intel_enable_planes() vs intel_crtc_enable_planes()) and don't make it clear whether they only operate on sprite planes, or whether they also apply to all universal plane types. Rename a few functions to be more consistent with our function naming for primary/cursor planes or to clarify that they apply specifically to sprite planes:
- s/intel_disable_planes/intel_disable_sprite_planes/
- s/intel_enable_planes/intel_enable_sprite_planes/
Also, drop the sprite-specific intel_destroy_plane() and just use the type-agnostic intel_plane_destroy() function. The extra 'disable' call that intel_destroy_plane() did is unnecessary since the plane will already be disabled due to framebuffer destruction by the point it gets called.
v2: Earlier consolidation patches have reduced the number of functions
we need to rename here.
Reviewed-by(v1): Bob Paauwe <[email protected]>
--- drivers/gpu/drm/i915/intel_display.c | 10 +++++----- drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 10 +--------- 3 files changed, 7 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_display.c +5 -5
@@ -3972,7 +3972,7 @@ static void ironlake_pfit_enable(struct intel_crtc *crtc) } } -static void intel_enable_planes (struct drm_crtc *crtc) +static void intel_enable_sprite_planes (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;enum pipe pipe =to_intel_crtc (crtc)->pipe;
@@ -3986,7 +3986,7 @@ static void intel_enable_planes(struct drm_crtc *crtc) } } -static void intel_disable_planes (struct drm_crtc *crtc) +static void intel_disable_sprite_planes (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;enum pipe pipe =to_intel_crtc (crtc)->pipe;
@@ -4130,7 +4130,7 @@ static void intel_crtc_enable_planes(struct drm_crtc *crtc)int pipe = intel_crtc->pipe;intel_enable_primary_hw_plane (crtc->primary, crtc); -intel_enable_planes (crtc); +intel_enable_sprite_planes (crtc);intel_crtc_update_cursor (crtc, true);intel_crtc_dpms_overlay (intel_crtc, true);
@@ -4165,7 +4165,7 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc)intel_crtc_dpms_overlay (intel_crtc, false);intel_crtc_update_cursor (crtc, false); -intel_disable_planes (crtc); +intel_disable_sprite_planes (crtc);intel_disable_primary_hw_plane (crtc->primary, crtc);/*
@@ -11861,7 +11861,7 @@ intel_disable_plane(struct drm_plane *plane) }/* Common destruction function for both primary and cursor planes */ -static void intel_plane_destroy (struct drm_plane *plane) +void intel_plane_destroy (struct drm_plane *plane) {struct intel_plane *intel_plane =to_intel_plane (plane);drm_plane_cleanup (plane);
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -1036,6 +1036,7 @@ int intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h);int intel_disable_plane (struct drm_plane *plane); +void intel_plane_destroy (struct drm_plane *plane);/* intel_dp_mst.c */ int intel_dp_mst_encoder_init (struct intel_digital_port *intel_dig_port,int conn_id);
drivers/gpu/drm/i915/intel_sprite.c +1 -9
@@ -1317,14 +1317,6 @@ intel_commit_sprite_plane(struct drm_plane *plane, } } -static void intel_destroy_plane (struct drm_plane *plane) -{ -struct intel_plane *intel_plane =to_intel_plane (plane); -intel_disable_plane (plane); -drm_plane_cleanup (plane); -kfree (intel_plane); -} -int intel_sprite_set_colorkey (struct drm_device *dev,void *data,struct drm_file *file_priv) {
@@ -1427,7 +1419,7 @@ int intel_plane_restore(struct drm_plane *plane)static const struct drm_plane_funcs intel_plane_funcs = { .update_plane = intel_update_plane, .disable_plane = intel_disable_plane, - .destroy = intel_destroy_plane, + .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, };
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/10 drm/i915: Make intel_crtc_has_pending_flip() non-static
In reply to Matt RoperWe'll want to use this from the atomic plane helpers, so ensure it can be called outside intel_display.c.
--- drivers/gpu/drm/i915/intel_display.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -2833,7 +2833,7 @@ intel_finish_fb(struct drm_framebuffer *old_fb)return ret; } -static bool intel_crtc_has_pending_flip (struct drm_crtc *crtc) +bool intel_crtc_has_pending_flip (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -946,6 +946,7 @@ int intel_prepare_plane_fb(struct drm_plane *plane, struct drm_framebuffer *fb);void intel_cleanup_plane_fb (struct drm_plane *plane,struct drm_framebuffer *fb); +bool intel_crtc_has_pending_flip (struct drm_crtc *crtc);/* shared dpll functions */ struct intel_shared_dpll *intel_crtc_to_shared_dpll (struct intel_crtc *crtc);
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/10 drm/i915: Prepare for atomic plane helpers (v3)
In reply to Matt RoperAdd the new driver entrypoints that will be called by the atomic plane helpers.
This patch does not actually switch over to the new plane helpers yet, so there should be no functional change here. Also note that although plane programming was already split into check/prepare/commit steps, some of the semantics of those individual functions will need to change slightly when we do make the jump so that they match the behavior the plane helpers expect.
v2:
- Renamed file from intel_atomic.c to intel_atomic_plane.c (Daniel)
- Fix a copy/paste comment mistake (Bob)
v3:
- Use prepare/cleanup functions that we've already factored out
- Use newly refactored pre_commit/commit/post_commit to avoid sleeping during vblank evasion
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_atomic_plane.c | 199 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 16 ++- drivers/gpu/drm/i915/intel_drv.h | 11 ++ drivers/gpu/drm/i915/intel_sprite.c | 8 ++ 5 files changed, 234 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/intel_atomic_plane.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -64,6 +64,7 @@ i915-y += dvo_ch7017.o \ dvo_ns2501.o \ dvo_sil164.o \ dvo_tfp410.o \ + intel_atomic_plane.o \ intel_crt.o \ intel_ddi.o \ intel_dp.o \
drivers/gpu/drm/i915/intel_atomic_plane.c new file +199 -0
199 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +15 -1
@@ -9728,6 +9728,8 @@ out_hang:static struct drm_crtc_helper_funcs intel_helper_funcs = { .mode_set_base_atomic = intel_pipe_set_base_atomic, .load_lut = intel_crtc_load_lut, + .atomic_begin = intel_crtc_atomic_begin, + .atomic_flush = intel_crtc_atomic_flush, };/**
@@ -11864,6 +11866,7 @@ intel_disable_plane(struct drm_plane *plane)void intel_plane_destroy (struct drm_plane *plane) {struct intel_plane *intel_plane =to_intel_plane (plane); +intel_plane_destroy_state (plane, plane->state);drm_plane_cleanup (plane);kfree (intel_plane); }
@@ -11872,7 +11875,10 @@ static const struct drm_plane_funcs intel_primary_plane_funcs = { .update_plane = intel_update_plane, .disable_plane = intel_disable_plane, .destroy = intel_plane_destroy, - .set_property = intel_plane_set_property + .set_property = intel_plane_set_property, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, + }; static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
@@ -11886,6 +11892,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,if (primary ==NULL )return NULL ; + primary->base.state =intel_plane_duplicate_state (&primary->base); primary->can_scale = false; primary->max_downscale =1 ; primary->pipe = pipe;
@@ -11923,6 +11930,8 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev, primary->rotation); } +drm_plane_helper_add (&primary->base, &intel_plane_helper_funcs); +return &primary->base; }
@@ -12071,6 +12080,8 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = { .disable_plane = intel_disable_plane, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, }; static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
@@ -12082,6 +12093,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,if (cursor ==NULL )return NULL ; + cursor->base.state =intel_plane_duplicate_state (&cursor->base); cursor->can_scale = false; cursor->max_downscale =1 ; cursor->pipe = pipe;
@@ -12110,6 +12122,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev, cursor->rotation); } +drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs); +return &cursor->base; }
drivers/gpu/drm/i915/intel_drv.h +11 -0
@@ -479,6 +479,8 @@ struct intel_crtc {int scanline_offset;struct intel_mmio_flip mmio_flip; + +uint32_t atomic_vbl_count; };struct intel_plane_wm_parameters {
@@ -557,6 +559,7 @@ struct cxsr_latency {#define to_intel_encoder (x) container_of(x, struct intel_encoder, base)#define to_intel_framebuffer (x) container_of(x, struct intel_framebuffer, base)#define to_intel_plane (x) container_of(x, struct intel_plane, base) +#define to_intel_plane_state (x) container_of(x, struct intel_plane_state, base)#define intel_fb_obj (x) (x ? to_intel_framebuffer(x)->obj : NULL)struct intel_hdmi {
@@ -1229,4 +1232,12 @@ void intel_pipe_update_end(struct intel_crtc *crtc, u32 start_vbl_count);/* intel_tv.c */ void intel_tv_init (struct drm_device *dev); +/* intel_atomic.c */ +struct drm_plane_state *intel_plane_duplicate_state (struct drm_plane *plane); +void intel_plane_destroy_state (struct drm_plane *plane, +struct drm_plane_state *state); +void intel_crtc_atomic_begin (struct drm_crtc *crtc); +void intel_crtc_atomic_flush (struct drm_crtc *crtc); +extern const struct drm_plane_helper_funcs intel_plane_helper_funcs; +#endif /* __INTEL_DRV_H__ */
drivers/gpu/drm/i915/intel_sprite.c +8 -0
@@ -33,6 +33,7 @@#include <drm/drm_crtc.h> #include <drm/drm_fourcc.h> #include <drm/drm_rect.h> +#include <drm/drm_plane_helper.h> #include "intel_drv.h" #include <drm/i915_drm.h> #include "i915_drv.h"
@@ -1421,6 +1422,8 @@ static const struct drm_plane_funcs intel_plane_funcs = { .disable_plane = intel_disable_plane, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, };static uint32_t ilk_plane_formats[] = {
@@ -1482,6 +1485,9 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)if (!intel_plane)return -ENOMEM ; + intel_plane->base.state = +intel_plane_duplicate_state (&intel_plane->base); +switch (INTEL_INFO (dev)->gen) {case 5 :case 6 :
@@ -1577,6 +1583,8 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) dev->mode_config.rotation_property, intel_plane->rotation); +drm_plane_helper_add (&intel_plane->base, &intel_plane_helper_funcs); + out:return ret; }
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/10 drm/i915: Prepare for atomic plane helpers (v4)
Add the new driver entrypoints that will be called by the atomic plane helpers.
This patch does not actually switch over to the new plane helpers yet, so there should be no functional change here. Also note that although plane programming was already split into check/prepare/commit steps, some of the semantics of those individual functions will need to change slightly when we do make the jump so that they match the behavior the plane helpers expect.
v2:
- Renamed file from intel_atomic.c to intel_atomic_plane.c (Daniel)
- Fix a copy/paste comment mistake (Bob)
v3:
- Use prepare/cleanup functions that we've already factored out
- Use newly refactored pre_commit/commit/post_commit to avoid sleeping during vblank evasion
v4:
- Rebase to latest di-nightly requires adding an 'old_state' parameter to atomic_update;
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_atomic_plane.c | 200 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 16 ++- drivers/gpu/drm/i915/intel_drv.h | 11 ++ drivers/gpu/drm/i915/intel_sprite.c | 8 ++ 5 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/intel_atomic_plane.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -64,6 +64,7 @@ i915-y += dvo_ch7017.o \ dvo_ns2501.o \ dvo_sil164.o \ dvo_tfp410.o \ + intel_atomic_plane.o \ intel_crt.o \ intel_ddi.o \ intel_dp.o \
drivers/gpu/drm/i915/intel_atomic_plane.c new file +200 -0
200 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +15 -1
@@ -9792,6 +9792,8 @@ out_hang:static struct drm_crtc_helper_funcs intel_helper_funcs = { .mode_set_base_atomic = intel_pipe_set_base_atomic, .load_lut = intel_crtc_load_lut, + .atomic_begin = intel_crtc_atomic_begin, + .atomic_flush = intel_crtc_atomic_flush, };/**
@@ -11928,6 +11930,7 @@ intel_disable_plane(struct drm_plane *plane)void intel_plane_destroy (struct drm_plane *plane) {struct intel_plane *intel_plane =to_intel_plane (plane); +intel_plane_destroy_state (plane, plane->state);drm_plane_cleanup (plane);kfree (intel_plane); }
@@ -11936,7 +11939,10 @@ static const struct drm_plane_funcs intel_primary_plane_funcs = { .update_plane = intel_update_plane, .disable_plane = intel_disable_plane, .destroy = intel_plane_destroy, - .set_property = intel_plane_set_property + .set_property = intel_plane_set_property, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, + }; static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
@@ -11950,6 +11956,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,if (primary ==NULL )return NULL ; + primary->base.state =intel_plane_duplicate_state (&primary->base); primary->can_scale = false; primary->max_downscale =1 ; primary->pipe = pipe;
@@ -11987,6 +11994,8 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev, primary->rotation); } +drm_plane_helper_add (&primary->base, &intel_plane_helper_funcs); +return &primary->base; }
@@ -12135,6 +12144,8 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = { .disable_plane = intel_disable_plane, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, }; static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
@@ -12146,6 +12157,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,if (cursor ==NULL )return NULL ; + cursor->base.state =intel_plane_duplicate_state (&cursor->base); cursor->can_scale = false; cursor->max_downscale =1 ; cursor->pipe = pipe;
@@ -12174,6 +12186,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev, cursor->rotation); } +drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs); +return &cursor->base; }
drivers/gpu/drm/i915/intel_drv.h +11 -0
@@ -479,6 +479,8 @@ struct intel_crtc {int scanline_offset;struct intel_mmio_flip mmio_flip; + +uint32_t atomic_vbl_count; };struct intel_plane_wm_parameters {
@@ -557,6 +559,7 @@ struct cxsr_latency {#define to_intel_encoder (x) container_of(x, struct intel_encoder, base)#define to_intel_framebuffer (x) container_of(x, struct intel_framebuffer, base)#define to_intel_plane (x) container_of(x, struct intel_plane, base) +#define to_intel_plane_state (x) container_of(x, struct intel_plane_state, base)#define intel_fb_obj (x) (x ? to_intel_framebuffer(x)->obj : NULL)struct intel_hdmi {
@@ -1230,4 +1233,12 @@ void intel_pipe_update_end(struct intel_crtc *crtc, u32 start_vbl_count);/* intel_tv.c */ void intel_tv_init (struct drm_device *dev); +/* intel_atomic.c */ +struct drm_plane_state *intel_plane_duplicate_state (struct drm_plane *plane); +void intel_plane_destroy_state (struct drm_plane *plane, +struct drm_plane_state *state); +void intel_crtc_atomic_begin (struct drm_crtc *crtc); +void intel_crtc_atomic_flush (struct drm_crtc *crtc); +extern const struct drm_plane_helper_funcs intel_plane_helper_funcs; +#endif /* __INTEL_DRV_H__ */
drivers/gpu/drm/i915/intel_sprite.c +8 -0
@@ -33,6 +33,7 @@#include <drm/drm_crtc.h> #include <drm/drm_fourcc.h> #include <drm/drm_rect.h> +#include <drm/drm_plane_helper.h> #include "intel_drv.h" #include <drm/i915_drm.h> #include "i915_drv.h"
@@ -1421,6 +1422,8 @@ static const struct drm_plane_funcs intel_plane_funcs = { .disable_plane = intel_disable_plane, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, };static uint32_t ilk_plane_formats[] = {
@@ -1482,6 +1485,9 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)if (!intel_plane)return -ENOMEM ; + intel_plane->base.state = +intel_plane_duplicate_state (&intel_plane->base); +switch (INTEL_INFO (dev)->gen) {case 5 :case 6 :
@@ -1577,6 +1583,8 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) dev->mode_config.rotation_property, intel_plane->rotation); +drm_plane_helper_add (&intel_plane->base, &intel_plane_helper_funcs); + out:return ret; }
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/i915: Prepare for atomic plane helpers (v5)
Add the new driver entrypoints that will be called by the atomic plane helpers.
This patch does not actually switch over to the new plane helpers yet, so there should be no functional change here. Also note that although plane programming was already split into check/prepare/commit steps, some of the semantics of those individual functions will need to change slightly when we do make the jump so that they match the behavior the plane helpers expect.
v2:
- Renamed file from intel_atomic.c to intel_atomic_plane.c (Daniel)
- Fix a copy/paste comment mistake (Bob)
v3:
- Use prepare/cleanup functions that we've already factored out
- Use newly refactored pre_commit/commit/post_commit to avoid sleeping during vblank evasion
v4:
- Rebase to latest di-nightly requires adding an 'old_state' parameter to atomic_update;
v5:
- Must have botched a rebase somewhere and lost some work. Restore state 'dirty' flag to let begin/end code know which planes to run the pre_commit/post_commit hooks for. This would have actually shown up as broken in the next commit rather than this one.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_atomic_plane.c | 219 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 22 ++- drivers/gpu/drm/i915/intel_drv.h | 12 ++ drivers/gpu/drm/i915/intel_sprite.c | 11 ++ 5 files changed, 264 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/intel_atomic_plane.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -64,6 +64,7 @@ i915-y += dvo_ch7017.o \ dvo_ns2501.o \ dvo_sil164.o \ dvo_tfp410.o \ + intel_atomic_plane.o \ intel_crt.o \ intel_ddi.o \ intel_dp.o \
drivers/gpu/drm/i915/intel_atomic_plane.c new file +219 -0
219 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +21 -1
@@ -9792,6 +9792,8 @@ out_hang:static struct drm_crtc_helper_funcs intel_helper_funcs = { .mode_set_base_atomic = intel_pipe_set_base_atomic, .load_lut = intel_crtc_load_lut, + .atomic_begin = intel_crtc_atomic_begin, + .atomic_flush = intel_crtc_atomic_flush, };/**
@@ -11930,6 +11932,7 @@ intel_disable_plane(struct drm_plane *plane)void intel_plane_destroy (struct drm_plane *plane) {struct intel_plane *intel_plane =to_intel_plane (plane); +intel_plane_destroy_state (plane, plane->state);drm_plane_cleanup (plane);kfree (intel_plane); }
@@ -11938,13 +11941,17 @@ static const struct drm_plane_funcs intel_primary_plane_funcs = { .update_plane = intel_update_plane, .disable_plane = intel_disable_plane, .destroy = intel_plane_destroy, - .set_property = intel_plane_set_property + .set_property = intel_plane_set_property, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, + };static struct drm_plane *intel_primary_plane_create (struct drm_device *dev,int pipe) {struct intel_plane *primary; +struct intel_plane_state *state;const uint32_t *intel_primary_formats;int num_formats;
@@ -11952,6 +11959,9 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,if (primary ==NULL )return NULL ; + primary->base.state =intel_plane_duplicate_state (&primary->base); + state =to_intel_plane_state (primary->base.state); + state->dirty = false; primary->can_scale = false; primary->max_downscale =1 ; primary->pipe = pipe;
@@ -11989,6 +11999,8 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev, primary->rotation); } +drm_plane_helper_add (&primary->base, &intel_plane_helper_funcs); +return &primary->base; }
@@ -12137,17 +12149,23 @@ static const struct drm_plane_funcs intel_cursor_plane_funcs = { .disable_plane = intel_disable_plane, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, };static struct drm_plane *intel_cursor_plane_create (struct drm_device *dev,int pipe) {struct intel_plane *cursor; +struct intel_plane_state *state; cursor =kzalloc (sizeof (*cursor),GFP_KERNEL );if (cursor ==NULL )return NULL ; + cursor->base.state =intel_plane_duplicate_state (&cursor->base); + state =to_intel_plane_state (cursor->base.state); + state->dirty = false; cursor->can_scale = false; cursor->max_downscale =1 ; cursor->pipe = pipe;
@@ -12176,6 +12194,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev, cursor->rotation); } +drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs); +return &cursor->base; }
drivers/gpu/drm/i915/intel_drv.h +12 -0
@@ -251,6 +251,7 @@ struct intel_plane_state {struct drm_rect orig_src;struct drm_rect orig_dst;bool visible; +bool dirty;/* * used only for sprite planes to determine when to implicitly
@@ -479,6 +480,8 @@ struct intel_crtc {int scanline_offset;struct intel_mmio_flip mmio_flip; + +uint32_t atomic_vbl_count; };struct intel_plane_wm_parameters {
@@ -557,6 +560,7 @@ struct cxsr_latency {#define to_intel_encoder (x) container_of(x, struct intel_encoder, base)#define to_intel_framebuffer (x) container_of(x, struct intel_framebuffer, base)#define to_intel_plane (x) container_of(x, struct intel_plane, base) +#define to_intel_plane_state (x) container_of(x, struct intel_plane_state, base)#define intel_fb_obj (x) (x ? to_intel_framebuffer(x)->obj : NULL)struct intel_hdmi {
@@ -1230,4 +1234,12 @@ void intel_pipe_update_end(struct intel_crtc *crtc, u32 start_vbl_count);/* intel_tv.c */ void intel_tv_init (struct drm_device *dev); +/* intel_atomic.c */ +struct drm_plane_state *intel_plane_duplicate_state (struct drm_plane *plane); +void intel_plane_destroy_state (struct drm_plane *plane, +struct drm_plane_state *state); +void intel_crtc_atomic_begin (struct drm_crtc *crtc); +void intel_crtc_atomic_flush (struct drm_crtc *crtc); +extern const struct drm_plane_helper_funcs intel_plane_helper_funcs; +#endif /* __INTEL_DRV_H__ */
drivers/gpu/drm/i915/intel_sprite.c +11 -0
@@ -33,6 +33,7 @@#include <drm/drm_crtc.h> #include <drm/drm_fourcc.h> #include <drm/drm_rect.h> +#include <drm/drm_plane_helper.h> #include "intel_drv.h" #include <drm/i915_drm.h> #include "i915_drv.h"
@@ -1421,6 +1422,8 @@ static const struct drm_plane_funcs intel_plane_funcs = { .disable_plane = intel_disable_plane, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, + .atomic_duplicate_state = intel_plane_duplicate_state, + .atomic_destroy_state = intel_plane_destroy_state, };static uint32_t ilk_plane_formats[] = {
@@ -1470,6 +1473,7 @@ int intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) { struct intel_plane *intel_plane; +struct intel_plane_state *state;unsigned long possible_crtcs;const uint32_t *plane_formats;int num_plane_formats;
@@ -1482,6 +1486,11 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)if (!intel_plane)return -ENOMEM ; + intel_plane->base.state = +intel_plane_duplicate_state (&intel_plane->base); + state =to_intel_plane_state (intel_plane->base.state); + state->dirty = false; +switch (INTEL_INFO (dev)->gen) {case 5 :case 6 :
@@ -1577,6 +1586,8 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) dev->mode_config.rotation_property, intel_plane->rotation); +drm_plane_helper_add (&intel_plane->base, &intel_plane_helper_funcs); + out:return ret; }
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/10 drm/i915: Switch plane handling to atomic helpers (v4)
In reply to Matt RoperNow that we have hooks to enable the atomic plane helpers, we can use the plane helpers for our .update_plane() and .disable_plane() entrypoints.
v2: Fix commit message typo (Bob)
v3: Rebased on top of Gustavo Padovan's patches to kill off
intel_crtc_cursor_set_obj() and intel_pipe_set_base().
v4: Rebase again on latest display refactor series. Now that previous
patches have smoothed the rough edges of the existing display code, the transition here is much less painful.
Testcase: igt/kms_plane
Testcase: igt/kms_universal_plane
Testcase: igt/kms_cursor_crc Acknowledged-by(v2): Bob Paauwe <[email protected]>
--- drivers/gpu/drm/i915/intel_display.c | 115 ++++------------------------------- drivers/gpu/drm/i915/intel_sprite.c | 4 +- 2 files changed, 13 insertions(+), 106 deletions(-)
drivers/gpu/drm/i915/intel_display.c +11 -104
@@ -11771,97 +11771,6 @@ intel_commit_primary_plane(struct drm_plane *plane, } } -int -intel_update_plane (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h) -{ -struct drm_device *dev = plane->dev; -struct drm_framebuffer *old_fb = plane->fb; -struct intel_plane_state state = {{0 }}; -struct intel_plane *intel_plane =to_intel_plane (plane); -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -unsigned start_vbl_count; -bool atomic_update; -int ret; - - state.base.crtc = crtc ? crtc : plane->crtc; - state.base.fb = fb; - -/* sample coordinates in 16.16 fixed point */ - state.src.x1 = src_x; - state.src.x2 = src_x + src_w; - state.src.y1 = src_y; - state.src.y2 = src_y + src_h; - -/* integer pixels */ - state.dst.x1 = crtc_x; - state.dst.x2 = crtc_x + crtc_w; - state.dst.y1 = crtc_y; - state.dst.y2 = crtc_y + crtc_h; - - state.clip.x1 =0 ; - state.clip.y1 =0 ; - state.clip.x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 ; - state.clip.y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 ; - - state.orig_src = state.src; - state.orig_dst = state.dst; - - ret = intel_plane->check_plane (plane, &state); -if (ret) -return ret; - -if (fb != old_fb && fb) { - ret =intel_prepare_plane_fb (plane, fb); -if (ret) -return ret; - } - -if (intel_plane->pre_commit) - intel_plane->pre_commit (plane, &state); - -/* Perform vblank evasion around commit operation */ - atomic_update =intel_pipe_update_start (intel_crtc, &start_vbl_count); - intel_plane->commit_plane (plane, &state); -if (atomic_update) -intel_pipe_update_end (intel_crtc, start_vbl_count); - -if (intel_plane->post_commit) - intel_plane->post_commit (plane, &state); - -if (fb != old_fb) { -if (intel_crtc->active) -intel_wait_for_vblank (dev, intel_crtc->pipe); -if (old_fb) -intel_cleanup_plane_fb (plane, old_fb); - } - - plane->fb = fb; - -return 0 ; -} - -/** -* intel_disable_plane - disable a plane -* @plane: plane to disable -* -* General disable handler for all plane types. -*/ -int -intel_disable_plane (struct drm_plane *plane) -{ -if (!plane->fb) -return 0 ; - -BUG_ON (!plane->crtc); - -return plane->funcs->update_plane (plane, plane->crtc,NULL , -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ); -} -/* Common destruction function for both primary and cursor planes */ void intel_plane_destroy (struct drm_plane *plane) {
@@ -11872,8 +11781,8 @@ void intel_plane_destroy(struct drm_plane *plane) }static const struct drm_plane_funcs intel_primary_plane_funcs = { - .update_plane = intel_update_plane, - .disable_plane = intel_disable_plane, + .update_plane = drm_plane_helper_update, + .disable_plane = drm_plane_helper_disable, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, .atomic_duplicate_state = intel_plane_duplicate_state,
@@ -11946,7 +11855,6 @@ intel_check_cursor_plane(struct drm_plane *plane,struct drm_rect *src = &state->src;const struct drm_rect *clip = &state->clip;struct drm_i915_gem_object *obj =intel_fb_obj (fb); -int crtc_w, crtc_h;unsigned stride;int ret;
@@ -11964,15 +11872,14 @@ intel_check_cursor_plane(struct drm_plane *plane,return 0 ;/* Check for which cursor types we support */ - crtc_w =drm_rect_width (&state->orig_dst); - crtc_h =drm_rect_height (&state->orig_dst); -if (!cursor_size_ok (dev, crtc_w, crtc_h)) { -DRM_DEBUG ("Cursor dimension not supported\n" ); +if (!cursor_size_ok (dev, state->base.crtc_w, state->base.crtc_h)) { +DRM_DEBUG ("Cursor dimension %dx%d not supported\n" , + state->base.crtc_w, state->base.crtc_h);return -EINVAL ; } - stride =roundup_pow_of_two (crtc_w) *4 ; -if (obj->base.size < stride * crtc_h) { + stride =roundup_pow_of_two (state->base.crtc_w) *4 ; +if (obj->base.size < stride * state->base.crtc_h) {DRM_DEBUG_KMS ("buffer is too small\n" );return -ENOMEM ; }
@@ -12042,8 +11949,8 @@ intel_commit_cursor_plane(struct drm_plane *plane,struct drm_i915_gem_object *obj =intel_fb_obj (state->base.fb);uint32_t addr; - crtc->cursor_x = state->orig_dst.x1; - crtc->cursor_y = state->orig_dst.y1; + crtc->cursor_x = state->base.crtc_x; + crtc->cursor_y = state->base.crtc_y; intel_plane->crtc_x = state->orig_dst.x1; intel_plane->crtc_y = state->orig_dst.y1;
@@ -12076,8 +11983,8 @@ update: }static const struct drm_plane_funcs intel_cursor_plane_funcs = { - .update_plane = intel_update_plane, - .disable_plane = intel_disable_plane, + .update_plane = drm_plane_helper_update, + .disable_plane = drm_plane_helper_disable, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, .atomic_duplicate_state = intel_plane_duplicate_state,
drivers/gpu/drm/i915/intel_sprite.c +2 -2
@@ -1418,8 +1418,8 @@ int intel_plane_restore(struct drm_plane *plane) }static const struct drm_plane_funcs intel_plane_funcs = { - .update_plane = intel_update_plane, - .disable_plane = intel_disable_plane, + .update_plane = drm_plane_helper_update, + .disable_plane = drm_plane_helper_disable, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, .atomic_duplicate_state = intel_plane_duplicate_state,
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 drm/i915: Switch plane handling to atomic helpers (v5)
Now that we have hooks to enable the atomic plane helpers, we can use the plane helpers for our .update_plane() and .disable_plane() entrypoints.
v2: Fix commit message typo (Bob)
v3: Rebased on top of Gustavo Padovan's patches to kill off
intel_crtc_cursor_set_obj() and intel_pipe_set_base().
v4: Rebase again on latest display refactor series. Now that previous
patches have smoothed the rough edges of the existing display code, the transition here is much less painful.
v5: Plane helpers will re-prepare the same fb for a plane. Drop the
WARN on this condition.
Testcase: igt/kms_plane
Testcase: igt/kms_universal_plane
Testcase: igt/kms_cursor_crc Acknowledged-by(v2): Bob Paauwe <[email protected]>
--- drivers/gpu/drm/i915/intel_display.c | 119 ++++------------------------------- drivers/gpu/drm/i915/intel_sprite.c | 4 +- 2 files changed, 14 insertions(+), 109 deletions(-)
drivers/gpu/drm/i915/intel_display.c +12 -107
@@ -11625,7 +11625,7 @@ intel_prepare_plane_fb(struct drm_plane *plane,unsigned frontbuffer_bits =0 ;int ret; -if (WARN_ON (fb == plane->fb || !obj)) +if (fb == plane->fb || !obj)return 0 ;switch (plane->type) {
@@ -11835,99 +11835,6 @@ intel_commit_primary_plane(struct drm_plane *plane, } } -int -intel_update_plane (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h) -{ -struct drm_device *dev = plane->dev; -struct drm_framebuffer *old_fb = plane->fb; -struct intel_plane_state state = {{0 }}; -struct intel_plane *intel_plane =to_intel_plane (plane); -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -unsigned start_vbl_count; -bool atomic_update = false; -int ret; - - state.base.crtc = crtc ? crtc : plane->crtc; - state.base.fb = fb; - -/* sample coordinates in 16.16 fixed point */ - state.src.x1 = src_x; - state.src.x2 = src_x + src_w; - state.src.y1 = src_y; - state.src.y2 = src_y + src_h; - -/* integer pixels */ - state.dst.x1 = crtc_x; - state.dst.x2 = crtc_x + crtc_w; - state.dst.y1 = crtc_y; - state.dst.y2 = crtc_y + crtc_h; - - state.clip.x1 =0 ; - state.clip.y1 =0 ; - state.clip.x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 ; - state.clip.y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 ; - - state.orig_src = state.src; - state.orig_dst = state.dst; - - ret = intel_plane->check_plane (plane, &state); -if (ret) -return ret; - -if (fb != old_fb && fb) { - ret =intel_prepare_plane_fb (plane, fb); -if (ret) -return ret; - } - -if (intel_plane->pre_commit) - intel_plane->pre_commit (plane, &state); - -/* Perform vblank evasion around commit operation */ -if (intel_crtc->active) - atomic_update =intel_pipe_update_start (intel_crtc, - &start_vbl_count); - intel_plane->commit_plane (plane, &state); -if (atomic_update) -intel_pipe_update_end (intel_crtc, start_vbl_count); - -if (intel_plane->post_commit) - intel_plane->post_commit (plane, &state); - -if (fb != old_fb) { -if (intel_crtc->active) -intel_wait_for_vblank (dev, intel_crtc->pipe); -if (old_fb) -intel_cleanup_plane_fb (plane, old_fb); - } - - plane->fb = fb; - -return 0 ; -} - -/** -* intel_disable_plane - disable a plane -* @plane: plane to disable -* -* General disable handler for all plane types. -*/ -int -intel_disable_plane (struct drm_plane *plane) -{ -if (!plane->fb) -return 0 ; - -BUG_ON (!plane->crtc); - -return plane->funcs->update_plane (plane, plane->crtc,NULL , -0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ); -} -/* Common destruction function for both primary and cursor planes */ void intel_plane_destroy (struct drm_plane *plane) {
@@ -11938,8 +11845,8 @@ void intel_plane_destroy(struct drm_plane *plane) }static const struct drm_plane_funcs intel_primary_plane_funcs = { - .update_plane = intel_update_plane, - .disable_plane = intel_disable_plane, + .update_plane = drm_plane_helper_update, + .disable_plane = drm_plane_helper_disable, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, .atomic_duplicate_state = intel_plane_duplicate_state,
@@ -12015,7 +11922,6 @@ intel_check_cursor_plane(struct drm_plane *plane,struct drm_rect *src = &state->src;const struct drm_rect *clip = &state->clip;struct drm_i915_gem_object *obj =intel_fb_obj (fb); -int crtc_w, crtc_h;unsigned stride;int ret;
@@ -12033,15 +11939,14 @@ intel_check_cursor_plane(struct drm_plane *plane,return 0 ;/* Check for which cursor types we support */ - crtc_w =drm_rect_width (&state->orig_dst); - crtc_h =drm_rect_height (&state->orig_dst); -if (!cursor_size_ok (dev, crtc_w, crtc_h)) { -DRM_DEBUG ("Cursor dimension not supported\n" ); +if (!cursor_size_ok (dev, state->base.crtc_w, state->base.crtc_h)) { +DRM_DEBUG ("Cursor dimension %dx%d not supported\n" , + state->base.crtc_w, state->base.crtc_h);return -EINVAL ; } - stride =roundup_pow_of_two (crtc_w) *4 ; -if (obj->base.size < stride * crtc_h) { + stride =roundup_pow_of_two (state->base.crtc_w) *4 ; +if (obj->base.size < stride * state->base.crtc_h) {DRM_DEBUG_KMS ("buffer is too small\n" );return -ENOMEM ; }
@@ -12111,8 +12016,8 @@ intel_commit_cursor_plane(struct drm_plane *plane,struct drm_i915_gem_object *obj =intel_fb_obj (state->base.fb);uint32_t addr; - crtc->cursor_x = state->orig_dst.x1; - crtc->cursor_y = state->orig_dst.y1; + crtc->cursor_x = state->base.crtc_x; + crtc->cursor_y = state->base.crtc_y; intel_plane->crtc_x = state->orig_dst.x1; intel_plane->crtc_y = state->orig_dst.y1;
@@ -12145,8 +12050,8 @@ update: }static const struct drm_plane_funcs intel_cursor_plane_funcs = { - .update_plane = intel_update_plane, - .disable_plane = intel_disable_plane, + .update_plane = drm_plane_helper_update, + .disable_plane = drm_plane_helper_disable, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, .atomic_duplicate_state = intel_plane_duplicate_state,
drivers/gpu/drm/i915/intel_sprite.c +2 -2
@@ -1418,8 +1418,8 @@ int intel_plane_restore(struct drm_plane *plane) }static const struct drm_plane_funcs intel_plane_funcs = { - .update_plane = intel_update_plane, - .disable_plane = intel_disable_plane, + .update_plane = drm_plane_helper_update, + .disable_plane = drm_plane_helper_disable, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, .atomic_duplicate_state = intel_plane_duplicate_state,
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/10 drm/i915: Drop unused position fields
In reply to Matt RoperThe userspace-requested plane coordinates are now stored in plane->state.base (and the i915-adjusted values are stored in plane->state), so we no longer use the coordinate fields in intel_plane or the orig_{src,dst} fields in intel_plane_state. Drop them.
--- drivers/gpu/drm/i915/intel_display.c | 40 ++++++++++-------------------------- drivers/gpu/drm/i915/intel_drv.h | 6 ------ drivers/gpu/drm/i915/intel_sprite.c | 27 ++++++++---------------- 3 files changed, 19 insertions(+), 54 deletions(-)
drivers/gpu/drm/i915/intel_display.c +11 -29
@@ -9548,7 +9548,6 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,struct drm_i915_gem_object *obj =intel_fb_obj (fb);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct drm_plane *primary = crtc->primary; -struct intel_plane *intel_plane =to_intel_plane (primary);enum pipe pipe = intel_crtc->pipe;struct intel_unpin_work *work;struct intel_engine_cs *ring;
@@ -9708,14 +9707,14 @@ free_work:if (ret == -EIO ) { out_hang: ret = primary->funcs->update_plane (primary, crtc, fb, - intel_plane->crtc_x, - intel_plane->crtc_y, - intel_plane->crtc_h, - intel_plane->crtc_w, - intel_plane->src_x, - intel_plane->src_y, - intel_plane->src_h, - intel_plane->src_w); + primary->state->crtc_x, + primary->state->crtc_y, + primary->state->crtc_h, + primary->state->crtc_w, + primary->state->src_x, + primary->state->src_y, + primary->state->src_h, + primary->state->src_w);if (ret ==0 && event) {spin_lock_irq (&dev->event_lock);drm_send_vblank_event (dev, pipe, event);
@@ -11739,14 +11738,6 @@ intel_commit_primary_plane(struct drm_plane *plane, crtc->x = src->x1 >>16 ; crtc->y = src->y1 >>16 ; - intel_plane->crtc_x = state->orig_dst.x1; - intel_plane->crtc_y = state->orig_dst.y1; - intel_plane->crtc_w =drm_rect_width (&state->orig_dst); - intel_plane->crtc_h =drm_rect_height (&state->orig_dst); - intel_plane->src_x = state->orig_src.x1; - intel_plane->src_y = state->orig_src.y1; - intel_plane->src_w =drm_rect_width (&state->orig_src); - intel_plane->src_h =drm_rect_height (&state->orig_src); intel_plane->obj = obj;if (intel_crtc->active) {
@@ -11920,8 +11911,7 @@ intel_pre_commit_cursor(struct drm_plane *plane, }if (intel_crtc->active) { -if (intel_crtc->cursor_width != -drm_rect_width (&state->orig_dst)) +if (intel_crtc->cursor_width != state->base.crtc_w)intel_update_watermarks (&intel_crtc->base); } }
@@ -11952,14 +11942,6 @@ intel_commit_cursor_plane(struct drm_plane *plane, crtc->cursor_x = state->base.crtc_x; crtc->cursor_y = state->base.crtc_y; - intel_plane->crtc_x = state->orig_dst.x1; - intel_plane->crtc_y = state->orig_dst.y1; - intel_plane->crtc_w =drm_rect_width (&state->orig_dst); - intel_plane->crtc_h =drm_rect_height (&state->orig_dst); - intel_plane->src_x = state->orig_src.x1; - intel_plane->src_y = state->orig_src.y1; - intel_plane->src_w =drm_rect_width (&state->orig_src); - intel_plane->src_h =drm_rect_height (&state->orig_src); intel_plane->obj = obj;if (intel_crtc->cursor_bo == obj)
@@ -11975,8 +11957,8 @@ intel_commit_cursor_plane(struct drm_plane *plane, intel_crtc->cursor_addr = addr; intel_crtc->cursor_bo = obj; update: - intel_crtc->cursor_width =drm_rect_width (&state->orig_dst); - intel_crtc->cursor_height =drm_rect_height (&state->orig_dst); + intel_crtc->cursor_width = state->base.crtc_w; + intel_crtc->cursor_height = state->base.crtc_h;if (intel_crtc->active)intel_crtc_update_cursor (crtc, state->visible);
drivers/gpu/drm/i915/intel_drv.h +0 -6
@@ -248,8 +248,6 @@ struct intel_plane_state {struct drm_rect src;struct drm_rect dst;struct drm_rect clip; -struct drm_rect orig_src; -struct drm_rect orig_dst;bool visible;/*
@@ -498,10 +496,6 @@ struct intel_plane {struct drm_i915_gem_object *obj;bool can_scale;int max_downscale; -int crtc_x, crtc_y; -unsigned int crtc_w, crtc_h; -uint32_t src_x, src_y; -uint32_t src_w, src_h;unsigned int rotation;/* Since we need to change the watermarks before/after
drivers/gpu/drm/i915/intel_sprite.c +8 -19
@@ -1064,7 +1064,6 @@ intel_check_sprite_plane(struct drm_plane *plane,uint32_t src_x, src_y, src_w, src_h;struct drm_rect *src = &state->src;struct drm_rect *dst = &state->dst; -struct drm_rect *orig_src = &state->orig_src;const struct drm_rect *clip = &state->clip;int hscale, vscale;int max_scale, min_scale;
@@ -1150,10 +1149,10 @@ intel_check_sprite_plane(struct drm_plane *plane, intel_plane->rotation);/* sanity check to make sure the src viewport wasn't enlarged */ -WARN_ON (src->x1 < (int ) orig_src->x1 || - src->y1 < (int ) orig_src->y1 || - src->x2 > (int ) orig_src->x2 || - src->y2 > (int ) orig_src->y2); +WARN_ON (src->x1 < (int ) state->base.src_x || + src->y1 < (int ) state->base.src_y || + src->x2 > (int ) state->base.src_x + state->base.src_w || + src->y2 > (int ) state->base.src_y + state->base.src_h);/* * Hardware doesn't handle subpixel coordinates.
@@ -1289,14 +1288,6 @@ intel_commit_sprite_plane(struct drm_plane *plane,unsigned int crtc_w, crtc_h;uint32_t src_x, src_y, src_w, src_h; - intel_plane->crtc_x = state->orig_dst.x1; - intel_plane->crtc_y = state->orig_dst.y1; - intel_plane->crtc_w =drm_rect_width (&state->orig_dst); - intel_plane->crtc_h =drm_rect_height (&state->orig_dst); - intel_plane->src_x = state->orig_src.x1; - intel_plane->src_y = state->orig_src.y1; - intel_plane->src_w =drm_rect_width (&state->orig_src); - intel_plane->src_h =drm_rect_height (&state->orig_src); intel_plane->obj = obj;if (intel_crtc->active) {
@@ -1405,16 +1396,14 @@ int intel_plane_set_property(struct drm_plane *plane,int intel_plane_restore (struct drm_plane *plane) { -struct intel_plane *intel_plane =to_intel_plane (plane); -if (!plane->crtc || !plane->fb)return 0 ;return plane->funcs->update_plane (plane, plane->crtc, plane->fb, - intel_plane->crtc_x, intel_plane->crtc_y, - intel_plane->crtc_w, intel_plane->crtc_h, - intel_plane->src_x, intel_plane->src_y, - intel_plane->src_w, intel_plane->src_h); + plane->state->crtc_x, plane->state->crtc_y, + plane->state->crtc_w, plane->state->crtc_h, + plane->state->src_x, plane->state->src_y, + plane->state->src_w, plane->state->src_h); }static const struct drm_plane_funcs intel_plane_funcs = {
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/10 drm/i915: Integrate kerneldoc for atomic plane helpers
In reply to Matt Roper--- Documentation/DocBook/drm.tmpl | 5 +++++ drivers/gpu/drm/i915/intel_atomic_plane.c | 10 ++++++++++ 2 files changed, 15 insertions(+)
Documentation/DocBook/drm.tmpl +5 -0
@@ -3906,6 +3906,11 @@ int num_ioctls;</synopsis> </para> </sect2> <sect2> + <title>Atomic Plane Helpers</title> +!Pdrivers/gpu/drm/i915/intel_atomic_plane.c atomic plane helpers +!Idrivers/gpu/drm/i915/intel_atomic_plane.c + </sect2> + <sect2> <title>Output Probing</title> <para> This section covers output probing and related infrastructure like the
drivers/gpu/drm/i915/intel_atomic_plane.c +10 -0
@@ -21,6 +21,16 @@* DEALINGS IN THE SOFTWARE. */ +/** +* DOC: atomic plane helper support +* +* The functions here are used by the atomic plane helper functions to +* implement legacy plane updates (i.e., drm_plane->update_plane() and +* drm_plane->disable_plane()). This allows plane updates to use the +* atomic state infrastructure and perform plane updates as separate +* prepare/check/commit/cleanup steps. +*/ +#include <drm/drmP.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_plane_helper.h>
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx