i915 nuclear pageflip
Subsystems (3)
cover i915 nuclear pageflip
This patchset adds experimental "nuclear pageflip" support to the i915 driver. Nuclear pageflip is the subset of atomic modeset functionality that is most important to display compositors --- i.e., plane updates for a single CRTC. Nuclear pageflip allows a compositor to ensure that the frame-specific updates of all planes, and all properties associated with those planes, land within the same vblank, thus allowing each frame to be displayed perfectly without the artifacts/synchronization issues often caused by sprite/overlay use.
To enable this support, an "i915.nuclear=1" option must be added to the kernel command line (in addition to the "drm.atomic=1" option already required by the DRM core). This option will internally flip on the DRIVER_ATOMIC flag for i915, enabling use of the atomic ioctl and causing all of the atomic object properties to be exposed.
Note that this patchset does not enable "full" atomic modeset (i.e., the ability to perform changes on multiple CRTC's in a single operation, or the ability to update non-plane properties), so the i915.nuclear command line guard will not be removed until the rest of the atomic modeset functionality arrives. If you try to pass propertysets to the kernel containing updates outside the scope of "nuclear pageflip" functionality, things may blow up. There is ongoing work by several people to complete the remaining changes necessary for full atomic modeset support. Asynchronous commit for nuclear updates is also still on the todo list and not supported by this patchset.
This patchset depends on Ander's patches from the mailing list (not yet merged):
http://lists.freedesktop.org/archives/intel-gfx/2015-January/058457.html
(the first patch in this series is actually a change intended to be squashed into one of Ander's patches).
Patches #2-7 were previously sent to intel-gfx here:
http://lists.freedesktop.org/archives/intel-gfx/2015-January/058488.html
Rob Clark has an updated libdrm repo capable of working with this functionality here:
https://github.com/robclark/libdrm.git atomic
i-g-t updates to support nuclear pageflip in the igt_kms library, and a very simple testcase for nuclear pageflip will be posted shortly.
Matt Roper (13):
squash! drm/i915: Improve how the memory for crtc state is allocated drm/i915: Move rotation from intel_plane to intel_plane_state drm/i915: Consolidate plane handler vtables drm/plane-helper: Add transitional helper for .set_plane(). drm/plane-helper: Fix transitional helper kerneldocs drm/i915: Add .atomic_{get,set}_property() entrypoints to planes drm/i915: Replace intel_set_property() with transitional helper drm/i915: Add main atomic entrypoints
drm/i915: Setup dummy atomic state for connectors drm/i915: Set connector state destruction handler drm/i915: Add atomic_get_property entrypoint for connectors drm/i915: Add crtc state duplication/destruction functions drm/i915: Add i915.nuclear kernel command line param to force atomic
drivers/gpu/drm/drm_plane_helper.c | 109 +++++++++++++- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/i915_drv.c | 12 ++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_params.c | 5 + drivers/gpu/drm/i915/intel_atomic.c | 234 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_atomic_plane.c | 84 ++++++++++- drivers/gpu/drm/i915/intel_crt.c | 3 + drivers/gpu/drm/i915/intel_display.c | 97 +++++++++---- drivers/gpu/drm/i915/intel_dp.c | 3 + drivers/gpu/drm/i915/intel_dp_mst.c | 3 + drivers/gpu/drm/i915/intel_drv.h | 36 ++++- drivers/gpu/drm/i915/intel_dsi.c | 2 + drivers/gpu/drm/i915/intel_dvo.c | 2 + drivers/gpu/drm/i915/intel_fbc.c | 4 +- drivers/gpu/drm/i915/intel_hdmi.c | 3 + drivers/gpu/drm/i915/intel_lvds.c | 3 + drivers/gpu/drm/i915/intel_sdvo.c | 3 + drivers/gpu/drm/i915/intel_sprite.c | 65 +++------ drivers/gpu/drm/i915/intel_tv.c | 3 + include/drm/drm_plane_helper.h | 3 + 21 files changed, 593 insertions(+), 83 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_atomic.c
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/13 squash! drm/i915: Improve how the memory for crtc state is allocated
--- drivers/gpu/drm/i915/intel_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -8950,9 +8950,9 @@ static void intel_crtc_destroy(struct drm_crtc *crtc)kfree (work); } +intel_crtc_set_state (intel_crtc,NULL );drm_crtc_cleanup (crtc); -intel_crtc_set_state (intel_crtc,NULL );kfree (intel_crtc); }
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/13 drm/i915: Move rotation from intel_plane to intel_plane_state
In reply to Matt RoperRuntime state that can be manipulated via properties should now go in intel_plane_state instead so that it can be tracked as part of an atomic transaction.
--- drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++- drivers/gpu/drm/i915/intel_fbc.c | 4 +++- drivers/gpu/drm/i915/intel_sprite.c | 33 ++++++++++++++++++++------------- 4 files changed, 56 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/intel_display.c +24 -12
@@ -2435,6 +2435,8 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc, {struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_plane_state *state = +to_intel_plane_state (crtc->primary->state);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct drm_i915_gem_object *obj;int plane = intel_crtc->plane;
@@ -2532,7 +2534,7 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc, intel_crtc->dspaddr_offset = linear_offset; } -if (to_intel_plane (crtc->primary)->rotation ==BIT (DRM_ROTATE_180 )) { +if (state->rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ; x += (intel_crtc->config->pipe_src_w -1 );
@@ -2568,6 +2570,8 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane_state *state = +to_intel_plane_state (crtc->primary->state);struct drm_i915_gem_object *obj;int plane = intel_crtc->plane;unsigned long linear_offset;
@@ -2634,7 +2638,7 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc, pixel_size, fb->pitches[0]); linear_offset -= intel_crtc->dspaddr_offset; -if (to_intel_plane (crtc->primary)->rotation ==BIT (DRM_ROTATE_180 )) { +if (state->rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) {
@@ -2673,6 +2677,8 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane_state *state = +to_intel_plane_state (crtc->primary->state);struct intel_framebuffer *intel_fb;struct drm_i915_gem_object *obj;int pipe = intel_crtc->pipe;
@@ -2731,7 +2737,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc, } plane_ctl |=PLANE_CTL_PLANE_GAMMA_DISABLE ; -if (to_intel_plane (crtc->primary)->rotation ==BIT (DRM_ROTATE_180 )) +if (state->rotation ==BIT (DRM_ROTATE_180 )) plane_ctl |=PLANE_CTL_ROTATE_180 ;I915_WRITE (PLANE_CTL (pipe,0 ), plane_ctl);
@@ -8216,6 +8222,8 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane_state *state = +to_intel_plane_state (crtc->cursor->state);int pipe = intel_crtc->pipe;uint32_t cntl;
@@ -8242,7 +8250,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base) cntl |=CURSOR_PIPE_CSC_ENABLE ; } -if (to_intel_plane (crtc->cursor)->rotation ==BIT (DRM_ROTATE_180 )) +if (state->rotation ==BIT (DRM_ROTATE_180 )) cntl |=CURSOR_ROTATE_180 ;if (intel_crtc->cursor_cntl != cntl) {
@@ -8265,6 +8273,8 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane_state *state = +to_intel_plane_state (crtc->cursor->state);int pipe = intel_crtc->pipe;int x = crtc->cursor_x;int y = crtc->cursor_y;
@@ -8303,8 +8313,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,I915_WRITE (CURPOS (pipe), pos);/* ILK+ do this automagically */ -if (HAS_GMCH_DISPLAY (dev) && -to_intel_plane (crtc->cursor)->rotation ==BIT (DRM_ROTATE_180 )) { +if (HAS_GMCH_DISPLAY (dev) && state->rotation ==BIT (DRM_ROTATE_180 )) { base += (intel_crtc->cursor_height * intel_crtc->cursor_width -1 ) *4 ; }
@@ -11756,7 +11765,6 @@ intel_check_primary_plane(struct drm_plane *plane,struct drm_i915_private *dev_priv = dev->dev_private;struct drm_crtc *crtc = state->base.crtc;struct intel_crtc *intel_crtc; -struct intel_plane *intel_plane =to_intel_plane (plane);struct drm_framebuffer *fb = state->base.fb;struct drm_rect *dest = &state->dst;struct drm_rect *src = &state->src;
@@ -11790,7 +11798,7 @@ intel_check_primary_plane(struct drm_plane *plane,if (intel_crtc->primary_enabled &&INTEL_INFO (dev)->gen <=4 && !IS_G4X (dev) && dev_priv->fbc.plane == intel_crtc->plane && - intel_plane->rotation !=BIT (DRM_ROTATE_0 )) { + state->rotation !=BIT (DRM_ROTATE_0 )) { intel_crtc->atomic.disable_fbc = true; }
@@ -11974,6 +11982,7 @@ 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;
@@ -11986,12 +11995,13 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,kfree (primary);return NULL ; } + state =to_intel_plane_state (primary->base.state); primary->can_scale = false; primary->max_downscale =1 ; primary->pipe = pipe; primary->plane = pipe; - primary->rotation =BIT (DRM_ROTATE_0 ); + state->rotation =BIT (DRM_ROTATE_0 ); primary->check_plane = intel_check_primary_plane; primary->commit_plane = intel_commit_primary_plane;if (HAS_FBC (dev) &&INTEL_INFO (dev)->gen <4 )
@@ -12019,7 +12029,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,if (dev->mode_config.rotation_property)drm_object_attach_property (&primary->base.base, dev->mode_config.rotation_property, - primary->rotation); + state->rotation); }drm_plane_helper_add (&primary->base, &intel_plane_helper_funcs);
@@ -12147,6 +12157,7 @@ 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 )
@@ -12157,12 +12168,13 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,kfree (cursor);return NULL ; } + state =to_intel_plane_state (cursor->base.state); cursor->can_scale = false; cursor->max_downscale =1 ; cursor->pipe = pipe; cursor->plane = pipe; - cursor->rotation =BIT (DRM_ROTATE_0 ); + state->rotation =BIT (DRM_ROTATE_0 ); cursor->check_plane = intel_check_cursor_plane; cursor->commit_plane = intel_commit_cursor_plane;
@@ -12181,7 +12193,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,if (dev->mode_config.rotation_property)drm_object_attach_property (&cursor->base.base, dev->mode_config.rotation_property, - cursor->rotation); + state->rotation); }drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs);
drivers/gpu/drm/i915/intel_drv.h +9 -1
@@ -250,6 +250,9 @@ struct intel_plane_state {struct drm_rect clip;bool visible; +/* Intel-specific plane properties */ +unsigned int rotation; +/* * used only for sprite planes to determine when to implicitly * enable/disable the primary plane
@@ -509,7 +512,6 @@ struct intel_plane {struct drm_i915_gem_object *obj;bool can_scale;int max_downscale; -unsigned int rotation;/* Since we need to change the watermarks before/after * enabling/disabling the planes, we need to store the parameters here
@@ -518,6 +520,12 @@ struct intel_plane {*/ struct intel_plane_wm_parameters wm; +/* +* NOTE: Do not place new plane state fields here (e.g., when adding +* new plane properties). New runtime state should now be placed in +* the intel_plane_state structure and accessed via drm_plane->state. +*/ + void (*update_plane)(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb,
drivers/gpu/drm/i915/intel_fbc.c +3 -1
@@ -496,6 +496,7 @@ void intel_fbc_update(struct drm_device *dev)struct drm_i915_private *dev_priv = dev->dev_private;struct drm_crtc *crtc =NULL , *tmp_crtc;struct intel_crtc *intel_crtc; +struct intel_plane_state *primary_state;struct drm_framebuffer *fb;struct drm_i915_gem_object *obj;const struct drm_display_mode *adjusted_mode;
@@ -540,6 +541,7 @@ void intel_fbc_update(struct drm_device *dev) } intel_crtc =to_intel_crtc (crtc); + primary_state =to_intel_plane_state (crtc->primary->state); fb = crtc->primary->fb; obj =intel_fb_obj (fb); adjusted_mode = &intel_crtc->config->base.adjusted_mode;
@@ -595,7 +597,7 @@ void intel_fbc_update(struct drm_device *dev) goto out_disable; }if (INTEL_INFO (dev)->gen <=4 && !IS_G4X (dev) && -to_intel_plane (crtc->primary)->rotation !=BIT (DRM_ROTATE_0 )) { + primary_state->rotation !=BIT (DRM_ROTATE_0 )) {if (set_no_fbc_reason (dev_priv,FBC_UNSUPPORTED_MODE ))DRM_DEBUG_KMS ("Rotation unsupported, disabling\n" ); goto out_disable;
drivers/gpu/drm/i915/intel_sprite.c +20 -13
@@ -187,6 +187,8 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,struct drm_device *dev = drm_plane->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_plane *intel_plane =to_intel_plane (drm_plane); +struct intel_plane_state *state = +to_intel_plane_state (drm_plane->state);const int pipe = intel_plane->pipe;const int plane = intel_plane->plane +1 ;u32 plane_ctl, stride;
@@ -256,7 +258,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,default :BUG (); } -if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) +if (state->rotation ==BIT (DRM_ROTATE_180 )) plane_ctl |=PLANE_CTL_ROTATE_180 ; plane_ctl |=PLANE_CTL_ENABLE ;
@@ -407,6 +409,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,struct drm_device *dev = dplane->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_plane *intel_plane =to_intel_plane (dplane); +struct intel_plane_state *state =to_intel_plane_state (dplane->state);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_plane->pipe;int plane = intel_plane->plane;
@@ -493,7 +496,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, fb->pitches[0]); linear_offset -= sprsurf_offset; -if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { +if (state->rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SP_ROTATE_180 ; x += src_w;
@@ -608,6 +611,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,struct drm_device *dev = plane->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_plane *intel_plane =to_intel_plane (plane); +struct intel_plane_state *state =to_intel_plane_state (plane->state);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_plane->pipe;u32 sprctl, sprscale =0 ;
@@ -684,7 +688,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, pixel_size, fb->pitches[0]); linear_offset -= sprsurf_offset; -if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { +if (state->rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SPRITE_ROTATE_180 ;/* HSW and BDW does this automagically in hardware */
@@ -813,6 +817,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,struct drm_device *dev = plane->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_plane *intel_plane =to_intel_plane (plane); +struct intel_plane_state *state =to_intel_plane_state (plane->state);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_plane->pipe;unsigned long dvssurf_offset, linear_offset;
@@ -884,7 +889,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, pixel_size, fb->pitches[0]); linear_offset -= dvssurf_offset; -if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { +if (state->rotation ==BIT (DRM_ROTATE_180 )) { dvscntr |=DVS_ROTATE_180 ; x += src_w;
@@ -1125,7 +1130,7 @@ intel_check_sprite_plane(struct drm_plane *plane, min_scale = intel_plane->can_scale ?1 : (1 <<16 );drm_rect_rotate (src, fb->width <<16 , fb->height <<16 , - intel_plane->rotation); + state->rotation); hscale =drm_rect_calc_hscale_relaxed (src, dst, min_scale, max_scale);BUG_ON (hscale <0 );
@@ -1166,7 +1171,7 @@ intel_check_sprite_plane(struct drm_plane *plane, drm_rect_height(dst) * vscale - drm_rect_height(src));drm_rect_rotate_inv (src, fb->width <<16 , fb->height <<16 , - intel_plane->rotation); + state->rotation);/* sanity check to make sure the src viewport wasn't enlarged */ WARN_ON(src->x1 < (int) state->base.src_x ||
@@ -1367,7 +1372,7 @@ int intel_plane_set_property(struct drm_plane *plane, uint64_t val) {struct drm_device *dev = plane->dev; -struct intel_plane *intel_plane =to_intel_plane (plane); +struct intel_plane_state *state =to_intel_plane_state (plane->state);uint64_t old_val;int ret = -ENOENT ;
@@ -1376,14 +1381,14 @@ int intel_plane_set_property(struct drm_plane *plane,if (hweight32 (val &0xf ) !=1 )return -EINVAL ; -if (intel_plane->rotation == val) +if (state->rotation == val)return 0 ; - old_val = intel_plane->rotation; - intel_plane->rotation = val; + old_val = state->rotation; + state->rotation = val; ret =intel_plane_restore (plane);if (ret) - intel_plane->rotation = old_val; + state->rotation = old_val; }return ret;
@@ -1457,6 +1462,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;
@@ -1475,6 +1481,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)kfree (intel_plane);return -ENOMEM ; } + state =to_intel_plane_state (intel_plane->base.state);switch (INTEL_INFO (dev)->gen) {case 5 :
@@ -1545,7 +1552,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) intel_plane->pipe = pipe; intel_plane->plane = plane; - intel_plane->rotation =BIT (DRM_ROTATE_0 ); + state->rotation =BIT (DRM_ROTATE_0 ); intel_plane->check_plane = intel_check_sprite_plane; intel_plane->commit_plane = intel_commit_sprite_plane; possible_crtcs = (1 << pipe);
@@ -1567,7 +1574,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)if (dev->mode_config.rotation_property)drm_object_attach_property (&intel_plane->base.base, dev->mode_config.rotation_property, - intel_plane->rotation); + state->rotation);drm_plane_helper_add (&intel_plane->base, &intel_plane_helper_funcs);
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 02/13] drm/i915: Move rotation from intel_plane to intel_plane_state
Quoted 134 lines · Matt Roper
Runtime state that can be manipulated via properties should now go in
intel_plane_stateinstead so that it can be tracked as part of an atomic transaction.Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 36 ++++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_drv.h | 10 +++++++++- drivers/gpu/drm/i915/intel_fbc.c | 4 +++- drivers/gpu/drm/i915/intel_sprite.c | 33 ++++++++++++++++++++------------- 4 files changed, 56 insertions(+), 27 deletions(-)drivers/gpu/drm/i915/intel_display.c +17
-8@@ -2435,6 +2435,8 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc, {struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_plane_state *state = +to_intel_plane_state (crtc->primary->state);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct drm_i915_gem_object *obj;int plane = intel_crtc->plane;@@ -2532,7 +2534,7 @@ static void i9xx_update_primary_plane(struct drm_crtc *crtc, intel_crtc->dspaddr_offset = linear_offset; } -if (to_intel_plane (crtc->primary)->rotation ==BIT (DRM_ROTATE_180 )) { +if (state->rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ; x += (intel_crtc->config->pipe_src_w -1 );@@ -2568,6 +2570,8 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane_state *state = +to_intel_plane_state (crtc->primary->state);struct drm_i915_gem_object *obj;int plane = intel_crtc->plane;unsigned long linear_offset;@@ -2634,7 +2638,7 @@ static void ironlake_update_primary_plane(struct drm_crtc *crtc, pixel_size, fb->pitches[0]); linear_offset -= intel_crtc->dspaddr_offset; -if (to_intel_plane (crtc->primary)->rotation ==BIT (DRM_ROTATE_180 )) { +if (state->rotation ==BIT (DRM_ROTATE_180 )) { dspcntr |=DISPPLANE_ROTATE_180 ;if (!IS_HASWELL (dev) && !IS_BROADWELL (dev)) {@@ -2673,6 +2677,8 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane_state *state = +to_intel_plane_state (crtc->primary->state);struct intel_framebuffer *intel_fb;struct drm_i915_gem_object *obj;int pipe = intel_crtc->pipe;@@ -2731,7 +2737,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc, } plane_ctl |=PLANE_CTL_PLANE_GAMMA_DISABLE ; -if (to_intel_plane (crtc->primary)->rotation ==BIT (DRM_ROTATE_180 )) +if (state->rotation ==BIT (DRM_ROTATE_180 )) plane_ctl |=PLANE_CTL_ROTATE_180 ;I915_WRITE (PLANE_CTL (pipe,0 ), plane_ctl);@@ -8216,6 +8222,8 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane_state *state = +to_intel_plane_state (crtc->cursor->state);int pipe = intel_crtc->pipe;uint32_t cntl;@@ -8242,7 +8250,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base) cntl |=CURSOR_PIPE_CSC_ENABLE ; } -if (to_intel_plane (crtc->cursor)->rotation ==BIT (DRM_ROTATE_180 )) +if (state->rotation ==BIT (DRM_ROTATE_180 )) cntl |=CURSOR_ROTATE_180 ;if (intel_crtc->cursor_cntl != cntl) {@@ -8265,6 +8273,8 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane_state *state = +to_intel_plane_state (crtc->cursor->state);int pipe = intel_crtc->pipe;int x = crtc->cursor_x;int y = crtc->cursor_y;@@ -8303,8 +8313,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,I915_WRITE (CURPOS (pipe), pos);/* ILK+ do this automagically */ -if (HAS_GMCH_DISPLAY (dev) && -to_intel_plane (crtc->cursor)->rotation ==BIT (DRM_ROTATE_180 )) { +if (HAS_GMCH_DISPLAY (dev) && state->rotation ==BIT (DRM_ROTATE_180 )) { base += (intel_crtc->cursor_height * intel_crtc->cursor_width -1 ) *4 ; }@@ -11756,7 +11765,6 @@ intel_check_primary_plane(struct drm_plane *plane,struct drm_i915_private *dev_priv = dev->dev_private;struct drm_crtc *crtc = state->base.crtc;struct intel_crtc *intel_crtc; -struct intel_plane *intel_plane =to_intel_plane (plane);struct drm_framebuffer *fb = state->base.fb;struct drm_rect *dest = &state->dst;struct drm_rect *src = &state->src;@@ -11790,7 +11798,7 @@ intel_check_primary_plane(struct drm_plane *plane,if (intel_crtc->primary_enabled &&INTEL_INFO (dev)->gen <=4 && !IS_G4X (dev) && dev_priv->fbc.plane == intel_crtc->plane && - intel_plane->rotation !=BIT (DRM_ROTATE_0 )) { + state->rotation !=BIT (DRM_ROTATE_0 )) { intel_crtc->atomic.disable_fbc = true; }@@ -11974,6 +11982,7 @@ 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;@@ -11986,12 +11995,13 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,kfree (primary);
drivers/gpu/drm/i915/intel_display.c static struct drm_plane *intel_primary_plane_create(struct drm_device *dev, · line 12004
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +2
-1return NULL ; } + state =to_intel_plane_state (primary->base.state); primary->can_scale = false; primary->max_downscale =1 ; primary->pipe = pipe; primary->plane = pipe; - primary->rotation =BIT (DRM_ROTATE_0 ); + state->rotation =BIT (DRM_ROTATE_0 );
I'm thinking it would be better to split the part of intel_plane_duplicate_state() that allocates the state into a separate function and do this there. That way there is a clear place to initialize state default values like this.
Ander
Quoted 254 lines
drivers/gpu/drm/i915/intel_display.c +5
-3primary->check_plane = intel_check_primary_plane; primary->commit_plane = intel_commit_primary_plane;if (HAS_FBC (dev) &&INTEL_INFO (dev)->gen <4 )@@ -12019,7 +12029,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,if (dev->mode_config.rotation_property)drm_object_attach_property (&primary->base.base, dev->mode_config.rotation_property, - primary->rotation); + state->rotation); }drm_plane_helper_add (&primary->base, &intel_plane_helper_funcs);@@ -12147,6 +12157,7 @@ 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 )@@ -12157,12 +12168,13 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,kfree (cursor);return NULL ; } + state =to_intel_plane_state (cursor->base.state); cursor->can_scale = false; cursor->max_downscale =1 ; cursor->pipe = pipe; cursor->plane = pipe; - cursor->rotation =BIT (DRM_ROTATE_0 ); + state->rotation =BIT (DRM_ROTATE_0 ); cursor->check_plane = intel_check_cursor_plane; cursor->commit_plane = intel_commit_cursor_plane;@@ -12181,7 +12193,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,if (dev->mode_config.rotation_property)drm_object_attach_property (&cursor->base.base, dev->mode_config.rotation_property, - cursor->rotation); + state->rotation); }drm_plane_helper_add (&cursor->base, &intel_plane_helper_funcs);drivers/gpu/drm/i915/intel_drv.h +9
-1@@ -250,6 +250,9 @@ struct intel_plane_state {struct drm_rect clip;bool visible; +/* Intel-specific plane properties */ +unsigned int rotation; +/* * used only for sprite planes to determine when to implicitly * enable/disable the primary plane @@ -509,7 +512,6 @@ struct intel_plane {struct drm_i915_gem_object *obj;bool can_scale;int max_downscale; -unsigned int rotation;/* Since we need to change the watermarks before/after * enabling/disabling the planes, we need to store the parameters here @@ -518,6 +520,12 @@ struct intel_plane {*/ struct intel_plane_wm_parameters wm; +/* +* NOTE: Do not place new plane state fields here (e.g., when adding +* new plane properties). New runtime state should now be placed in +* the intel_plane_state structure and accessed via drm_plane->state. +*/ + void (*update_plane)(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb,drivers/gpu/drm/i915/intel_fbc.c +3
-1@@ -496,6 +496,7 @@ void intel_fbc_update(struct drm_device *dev)struct drm_i915_private *dev_priv = dev->dev_private;struct drm_crtc *crtc =NULL , *tmp_crtc;struct intel_crtc *intel_crtc; +struct intel_plane_state *primary_state;struct drm_framebuffer *fb;struct drm_i915_gem_object *obj;const struct drm_display_mode *adjusted_mode;@@ -540,6 +541,7 @@ void intel_fbc_update(struct drm_device *dev) } intel_crtc =to_intel_crtc (crtc); + primary_state =to_intel_plane_state (crtc->primary->state); fb = crtc->primary->fb; obj =intel_fb_obj (fb); adjusted_mode = &intel_crtc->config->base.adjusted_mode;@@ -595,7 +597,7 @@ void intel_fbc_update(struct drm_device *dev) goto out_disable; }if (INTEL_INFO (dev)->gen <=4 && !IS_G4X (dev) && -to_intel_plane (crtc->primary)->rotation !=BIT (DRM_ROTATE_0 )) { + primary_state->rotation !=BIT (DRM_ROTATE_0 )) {if (set_no_fbc_reason (dev_priv,FBC_UNSUPPORTED_MODE ))DRM_DEBUG_KMS ("Rotation unsupported, disabling\n" ); goto out_disable;drivers/gpu/drm/i915/intel_sprite.c +19
-12@@ -187,6 +187,8 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,struct drm_device *dev = drm_plane->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_plane *intel_plane =to_intel_plane (drm_plane); +struct intel_plane_state *state = +to_intel_plane_state (drm_plane->state);const int pipe = intel_plane->pipe;const int plane = intel_plane->plane +1 ;u32 plane_ctl, stride;@@ -256,7 +258,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,default :BUG (); } -if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) +if (state->rotation ==BIT (DRM_ROTATE_180 )) plane_ctl |=PLANE_CTL_ROTATE_180 ; plane_ctl |=PLANE_CTL_ENABLE ;@@ -407,6 +409,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,struct drm_device *dev = dplane->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_plane *intel_plane =to_intel_plane (dplane); +struct intel_plane_state *state =to_intel_plane_state (dplane->state);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_plane->pipe;int plane = intel_plane->plane;@@ -493,7 +496,7 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc, fb->pitches[0]); linear_offset -= sprsurf_offset; -if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { +if (state->rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SP_ROTATE_180 ; x += src_w;@@ -608,6 +611,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,struct drm_device *dev = plane->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_plane *intel_plane =to_intel_plane (plane); +struct intel_plane_state *state =to_intel_plane_state (plane->state);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_plane->pipe;u32 sprctl, sprscale =0 ;@@ -684,7 +688,7 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, pixel_size, fb->pitches[0]); linear_offset -= sprsurf_offset; -if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { +if (state->rotation ==BIT (DRM_ROTATE_180 )) { sprctl |=SPRITE_ROTATE_180 ;/* HSW and BDW does this automagically in hardware */ @@ -813,6 +817,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,struct drm_device *dev = plane->dev;struct drm_i915_private *dev_priv = dev->dev_private;struct intel_plane *intel_plane =to_intel_plane (plane); +struct intel_plane_state *state =to_intel_plane_state (plane->state);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_plane->pipe;unsigned long dvssurf_offset, linear_offset;@@ -884,7 +889,7 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, pixel_size, fb->pitches[0]); linear_offset -= dvssurf_offset; -if (intel_plane->rotation ==BIT (DRM_ROTATE_180 )) { +if (state->rotation ==BIT (DRM_ROTATE_180 )) { dvscntr |=DVS_ROTATE_180 ; x += src_w;@@ -1125,7 +1130,7 @@ intel_check_sprite_plane(struct drm_plane *plane, min_scale = intel_plane->can_scale ?1 : (1 <<16 );drm_rect_rotate (src, fb->width <<16 , fb->height <<16 , - intel_plane->rotation); + state->rotation); hscale =drm_rect_calc_hscale_relaxed (src, dst, min_scale, max_scale);BUG_ON (hscale <0 );@@ -1166,7 +1171,7 @@ intel_check_sprite_plane(struct drm_plane *plane, drm_rect_height(dst) * vscale - drm_rect_height(src));drm_rect_rotate_inv (src, fb->width <<16 , fb->height <<16 , - intel_plane->rotation); + state->rotation);/* sanity check to make sure the src viewport wasn't enlarged */ WARN_ON(src->x1 < (int) state->base.src_x ||@@ -1367,7 +1372,7 @@ int intel_plane_set_property(struct drm_plane *plane, uint64_t val) {struct drm_device *dev = plane->dev; -struct intel_plane *intel_plane =to_intel_plane (plane); +struct intel_plane_state *state =to_intel_plane_state (plane->state);uint64_t old_val;int ret = -ENOENT ;@@ -1376,14 +1381,14 @@ int intel_plane_set_property(struct drm_plane *plane,if (hweight32 (val &0xf ) !=1 )return -EINVAL ; -if (intel_plane->rotation == val) +if (state->rotation == val)return 0 ; - old_val = intel_plane->rotation; - intel_plane->rotation = val; + old_val = state->rotation; + state->rotation = val; ret =intel_plane_restore (plane);if (ret) - intel_plane->rotation = old_val; + state->rotation = old_val; }return ret;@@ -1457,6 +1462,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;@@ -1475,6 +1481,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)kfree (intel_plane);return -ENOMEM ; } + state =to_intel_plane_state (intel_plane->base.state);switch (INTEL_INFO (dev)->gen) {case 5 :@@ -1545,7 +1552,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) intel_plane->pipe = pipe; intel_plane->plane = plane; - intel_plane->rotation =BIT (DRM_ROTATE_0 ); + state->rotation =BIT (DRM_ROTATE_0 ); intel_plane->check_plane = intel_check_sprite_plane; intel_plane->commit_plane = intel_commit_sprite_plane; possible_crtcs = (1 << pipe);
drivers/gpu/drm/i915/intel_sprite.c intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) · line 1580
Quoted 8 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-1@@ -1567,7 +1574,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)if (dev->mode_config.rotation_property)drm_object_attach_property (&intel_plane->base.base, dev->mode_config.rotation_property, - intel_plane->rotation); + state->rotation);drm_plane_helper_add (&intel_plane->base, &intel_plane_helper_funcs);
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/13 drm/i915: Consolidate plane handler vtables
In reply to Matt RoperAll of the previous refactoring/consolidation of plane code has resulted in intel_primary_plane_funcs, intel_cursor_plane_funcs, and intel_sprite_plane_funcs being identical. Replace all of these with a single 'intel_plane_funcs' vtable for simplicity.
--- drivers/gpu/drm/i915/intel_display.c | 15 +++------------ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 11 +---------- 3 files changed, 5 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -12
@@ -11968,7 +11968,7 @@ void intel_plane_destroy(struct drm_plane *plane)kfree (intel_plane); } -static const struct drm_plane_funcs intel_primary_plane_funcs = { +const struct drm_plane_funcs intel_plane_funcs = { .update_plane = drm_plane_helper_update, .disable_plane = drm_plane_helper_disable, .destroy = intel_plane_destroy,
@@ -12016,7 +12016,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev, }drm_universal_plane_init (dev, &primary->base,0 , - &intel_primary_plane_funcs, + &intel_plane_funcs, intel_primary_formats, num_formats,DRM_PLANE_TYPE_PRIMARY );
@@ -12144,15 +12144,6 @@ update:intel_crtc_update_cursor (crtc, state->visible); } -static const struct drm_plane_funcs intel_cursor_plane_funcs = { - .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, - .atomic_destroy_state = intel_plane_destroy_state, -}; -static struct drm_plane *intel_cursor_plane_create (struct drm_device *dev,int pipe) {
@@ -12179,7 +12170,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev, cursor->commit_plane = intel_commit_cursor_plane;drm_universal_plane_init (dev, &cursor->base,0 , - &intel_cursor_plane_funcs, + &intel_plane_funcs, intel_cursor_formats,ARRAY_SIZE (intel_cursor_formats),DRM_PLANE_TYPE_CURSOR );
drivers/gpu/drm/i915/intel_drv.h +1 -0
@@ -908,6 +908,7 @@ void i915_audio_component_init(struct drm_i915_private *dev_priv);void i915_audio_component_cleanup (struct drm_i915_private *dev_priv);/* intel_display.c */ +extern const struct drm_plane_funcs intel_plane_funcs;bool intel_has_pending_fb_unpin (struct drm_device *dev);int intel_pch_rawclk (struct drm_device *dev);void intel_mark_busy (struct drm_device *dev);
drivers/gpu/drm/i915/intel_sprite.c +1 -10
@@ -1406,15 +1406,6 @@ int intel_plane_restore(struct drm_plane *plane) plane->state->src_w, plane->state->src_h); } -static const struct drm_plane_funcs intel_sprite_plane_funcs = { - .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, - .atomic_destroy_state = intel_plane_destroy_state, -}; -static uint32_t ilk_plane_formats[] = {DRM_FORMAT_XRGB8888 ,DRM_FORMAT_YUYV ,
@@ -1557,7 +1548,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) intel_plane->commit_plane = intel_commit_sprite_plane; possible_crtcs = (1 << pipe); ret =drm_universal_plane_init (dev, &intel_plane->base, possible_crtcs, - &intel_sprite_plane_funcs, + &intel_plane_funcs, plane_formats, num_plane_formats,DRM_PLANE_TYPE_OVERLAY );if (ret) {
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 03/13] drm/i915: Consolidate plane handler vtables
Quoted 93 lines · Matt Roper
All of the previous refactoring/consolidation of plane code has resulted in
intel_primary_plane_funcs,intel_cursor_plane_funcs, andintel_sprite_plane_funcsbeing identical. Replace all of these with a single 'intel_plane_funcs' vtable for simplicity.Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 15 +++------------ drivers/gpu/drm/i915/intel_drv.h | 1 + drivers/gpu/drm/i915/intel_sprite.c | 11 +---------- 3 files changed, 5 insertions(+), 22 deletions(-)drivers/gpu/drm/i915/intel_display.c +3
-12@@ -11968,7 +11968,7 @@ void intel_plane_destroy(struct drm_plane *plane)kfree (intel_plane); } -static const struct drm_plane_funcs intel_primary_plane_funcs = { +const struct drm_plane_funcs intel_plane_funcs = { .update_plane = drm_plane_helper_update, .disable_plane = drm_plane_helper_disable, .destroy = intel_plane_destroy,@@ -12016,7 +12016,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev, }drm_universal_plane_init (dev, &primary->base,0 , - &intel_primary_plane_funcs, + &intel_plane_funcs, intel_primary_formats, num_formats,DRM_PLANE_TYPE_PRIMARY );@@ -12144,15 +12144,6 @@ update:intel_crtc_update_cursor (crtc, state->visible); } -static const struct drm_plane_funcs intel_cursor_plane_funcs = { - .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, - .atomic_destroy_state = intel_plane_destroy_state, -}; -static struct drm_plane *intel_cursor_plane_create (struct drm_device *dev,int pipe) {@@ -12179,7 +12170,7 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev, cursor->commit_plane = intel_commit_cursor_plane;drm_universal_plane_init (dev, &cursor->base,0 , - &intel_cursor_plane_funcs, + &intel_plane_funcs, intel_cursor_formats,ARRAY_SIZE (intel_cursor_formats),DRM_PLANE_TYPE_CURSOR );drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -908,6 +908,7 @@ void i915_audio_component_init(struct drm_i915_private *dev_priv);void i915_audio_component_cleanup (struct drm_i915_private *dev_priv);/* intel_display.c */ +extern const struct drm_plane_funcs intel_plane_funcs;bool intel_has_pending_fb_unpin (struct drm_device *dev);int intel_pch_rawclk (struct drm_device *dev);void intel_mark_busy (struct drm_device *dev);drivers/gpu/drm/i915/intel_sprite.c +0
-9@@ -1406,15 +1406,6 @@ int intel_plane_restore(struct drm_plane *plane) plane->state->src_w, plane->state->src_h); } -static const struct drm_plane_funcs intel_sprite_plane_funcs = { - .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, - .atomic_destroy_state = intel_plane_destroy_state, -}; -static uint32_t ilk_plane_formats[] = {DRM_FORMAT_XRGB8888 ,DRM_FORMAT_YUYV ,
drivers/gpu/drm/i915/intel_sprite.c intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) · line 1554
Quoted 8 lines
drivers/gpu/drm/i915/intel_sprite.c +1
-1@@ -1557,7 +1548,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) intel_plane->commit_plane = intel_commit_sprite_plane; possible_crtcs = (1 << pipe); ret =drm_universal_plane_init (dev, &intel_plane->base, possible_crtcs, - &intel_sprite_plane_funcs, + &intel_plane_funcs, plane_formats, num_plane_formats,DRM_PLANE_TYPE_OVERLAY );if (ret) {
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/13 drm/plane-helper: Add transitional helper for .set_plane().
In reply to Matt RoperAdd a transitional helper for planes' .set_property() entrypoint, similar to what we already have for .update_plane() and .disable_plane(). This allows drivers that are still in the process of transitioning to implement and exercise the .atomic_set_property() driver entrypoint that will eventually be used by atomic.
--- drivers/gpu/drm/drm_plane_helper.c | 105 +++++++++++++++++++++++++++++++++++++ include/drm/drm_plane_helper.h | 3 ++ 2 files changed, 108 insertions(+)
drivers/gpu/drm/drm_plane_helper.c +105 -0
@@ -586,3 +586,108 @@ int drm_plane_helper_disable(struct drm_plane *plane)return drm_plane_helper_commit (plane, plane_state, plane->fb); }EXPORT_SYMBOL (drm_plane_helper_disable); + +/** +* drm_plane_helper_set_property() - Transitional helper for property updates +* @plane: plane object to update +* @prop: property to update +* @val: value to set property to +* +* Provides a default plane property handler using the atomic plane update +* functions. Drivers in the process of transitioning to atomic should +* replace their plane.set_property() entrypoint with this function and +* then implement the plane.atomic_set_property() entrypoint. +* +* This is useful for piecewise transitioning of a driver to the atomic helpers. +* +* Note that this helper assumes that no hardware programming should be +* performed if the plane is disabled. When the plane is not attached to a +* crtc, we just swap in the validated plane state and return; there's no +* call to atomic_begin()/atomic_update()/atomic_flush(). +* +* RETURNS: +* Zero on success, error code on failure +*/ +int drm_plane_helper_set_property (struct drm_plane *plane, +struct drm_property *prop, +uint64_t val) +{ +struct drm_plane_state *plane_state; +struct drm_plane_helper_funcs *plane_funcs = plane->helper_private; +struct drm_crtc_helper_funcs *crtc_funcs; +int ret; + +/* +* Drivers may not have an .atomic_set_property() handler if they have +* no driver-specific properties, but they generally wouldn't setup a +* .set_property() handler (pointing to this function) for the plane in +* that case either; throw a warning since this is probably a mistake. +*/ +if (WARN_ON (!plane->funcs->atomic_set_property)) +return -EINVAL ; + +if (plane->funcs->atomic_duplicate_state) + plane_state = plane->funcs->atomic_duplicate_state (plane); +else if (plane->state) + plane_state =drm_atomic_helper_plane_duplicate_state (plane); +else + plane_state =kzalloc (sizeof (*plane_state),GFP_KERNEL ); +if (!plane_state) +return -ENOMEM ; + plane_state->plane = plane; + +/* +* Update the state object with the new property value we want to +* set. If the property is not recognized as a driver-specific property, +* -EINVAL will be returned here. +*/ + ret = plane->funcs->atomic_set_property (plane, plane_state, prop, val); +if (ret) + goto out; + +/* +* Check that the updated plane state is actually programmable (e.g., +* doesn't violate hardware constraints). +*/ +if (plane_funcs->atomic_check) { + ret = plane_funcs->atomic_check (plane, plane_state); +if (ret) + goto out; + } + +/* Point of no return, commit sw state. */ +swap (plane->state, plane_state); + +/* +* If the plane is disabled, we're done. No hardware programming is +* attempted when the plane is disabled. +*/ +if (!plane->crtc) + goto out; + +/* Start hardware transaction to commit new state to hardware */ + crtc_funcs = plane->crtc->helper_private; +if (crtc_funcs && crtc_funcs->atomic_begin) + crtc_funcs->atomic_begin (plane->crtc); + plane_funcs->atomic_update (plane, plane_state); +if (crtc_funcs && crtc_funcs->atomic_flush) + crtc_funcs->atomic_flush (plane->crtc); + +/* +* Since we're not using full atomic yet, we still need to update the shadow +* property value that's managed by the DRM core since that's where the +* property values will be read back from. +*/ +drm_object_property_set_value (&plane->base, prop, val); + +out: +if (plane_state) { +if (plane->funcs->atomic_destroy_state) + plane->funcs->atomic_destroy_state (plane, plane_state); +else +drm_atomic_helper_plane_destroy_state (plane, plane_state); + } + +return ret; +} +EXPORT_SYMBOL (drm_plane_helper_set_property);
include/drm/drm_plane_helper.h +3 -0
@@ -107,6 +107,9 @@ int drm_plane_helper_update(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 drm_plane_helper_disable (struct drm_plane *plane); +int drm_plane_helper_set_property (struct drm_plane *plane, +struct drm_property *prop, +uint64_t val);/* For use by drm_crtc_helper.c */ int drm_plane_helper_commit(struct drm_plane *plane,
Signature · 6 lines
1.8.5.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/13 drm/plane-helper: Fix transitional helper kerneldocs
In reply to Matt Roperdrm_plane_helper_{update,disable} are not specific to primary planes; fix some copy/paste summaries to avoid confusion.
--- drivers/gpu/drm/drm_plane_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_plane_helper.c +2 -2
@@ -492,7 +492,7 @@ out: }/** -* drm_plane_helper_update() - Helper for primary plane update +* drm_plane_helper_update() - Transitional helper for plane update * @plane: plane object to update * @crtc: owning CRTC of owning plane * @fb: framebuffer to flip onto plane
@@ -549,7 +549,7 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,EXPORT_SYMBOL (drm_plane_helper_update);/** -* drm_plane_helper_disable() - Helper for primary plane disable +* drm_plane_helper_disable() - Transitional helper for plane disable * @plane: plane to disable * * Provides a default plane disable handler using the atomic plane update
Signature · 6 lines
1.8.5.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/13 drm/i915: Add .atomic_{get, set}_property() entrypoints to planes
In reply to Matt RoperWhen we flip on the DRIVER_ATOMIC bit, the DRM core will start calling this entrypoint to set and lookup driver-specific plane property values, rather than maintaining a shadow copy in object->properties.
Note that although we add these functions to the plane vtable, they will not yet be called. Future patches that switch our .set_property() handler and/or enable full atomic functionality are required before these code paths will be executed.
--- drivers/gpu/drm/i915/intel_atomic_plane.c | 60 +++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 8 +++++ 3 files changed, 70 insertions(+)
drivers/gpu/drm/i915/intel_atomic_plane.c +60 -0
@@ -150,3 +150,63 @@ const struct drm_plane_helper_funcs intel_plane_helper_funcs = { .atomic_update = intel_plane_atomic_update, }; +/** +* intel_plane_atomic_get_property - fetch plane property value +* @plane: plane to fetch property for +* @state: state containing the property value +* @property: property to look up +* @val: pointer to write property value into +* +* The DRM core does not store shadow copies of properties for +* atomic-capable drivers. This entrypoint is used to fetch +* the current value of a driver-specific plane property. +*/ +int +intel_plane_atomic_get_property (struct drm_plane *plane, +const struct drm_plane_state *state, +struct drm_property *property, +uint64_t *val) +{ +struct drm_mode_config *config = &plane->dev->mode_config; +struct intel_plane_state *intel_state =to_intel_plane_state (state); + +if (property == config->rotation_property) { + *val = intel_state->rotation; + }else { +DRM_DEBUG_KMS ("Unknown plane property '%s'\n" , property->name); +return -EINVAL ; + } + +return 0 ; +} + +/** +* intel_plane_atomic_set_property - set plane property value +* @plane: plane to set property for +* @state: state to update property value in +* @property: property to set +* @val: value to set property to +* +* Writes the specified property value for a plane into the provided atomic +* state object. +* +* Returns 0 on success, -EINVAL on unrecognized properties +*/ +int +intel_plane_atomic_set_property (struct drm_plane *plane, +struct drm_plane_state *state, +struct drm_property *property, +uint64_t val) +{ +struct drm_mode_config *config = &plane->dev->mode_config; +struct intel_plane_state *intel_state =to_intel_plane_state (state); + +if (property == config->rotation_property) { + intel_state->rotation = val; + }else { +DRM_DEBUG_KMS ("Unknown plane property '%s'\n" , property->name); +return -EINVAL ; + } + +return 0 ; +}
drivers/gpu/drm/i915/intel_display.c +2 -0
@@ -11973,6 +11973,8 @@ const struct drm_plane_funcs intel_plane_funcs = { .disable_plane = drm_plane_helper_disable, .destroy = intel_plane_destroy, .set_property = intel_plane_set_property, + .atomic_get_property = intel_plane_atomic_get_property, + .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state, .atomic_destroy_state = intel_plane_destroy_state,
drivers/gpu/drm/i915/intel_drv.h +8 -0
@@ -963,6 +963,14 @@ 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); +int intel_plane_atomic_get_property (struct drm_plane *plane, +const struct drm_plane_state *state, +struct drm_property *property, +uint64_t *val); +int intel_plane_atomic_set_property (struct drm_plane *plane, +struct drm_plane_state *state, +struct drm_property *property, +uint64_t val);/* 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/13 drm/i915: Replace intel_set_property() with transitional helper
In reply to Matt RoperThis switch allows us to exercise the .atomic_set_property() that will be used by atomic. The only real changes we need to make here are:
* extract the property validation from our old set_property handler and stick it in intel_plane_atomic_check().
* make intel_check_*_plane() functions capable of handling a NULL crtc (which will happen if userspace tries to set a property value on a disabled plane).
--- drivers/gpu/drm/i915/intel_atomic_plane.c | 24 +++++++++++++++++++----- drivers/gpu/drm/i915/intel_display.c | 10 +++++++++- drivers/gpu/drm/i915/intel_drv.h | 3 --- drivers/gpu/drm/i915/intel_sprite.c | 31 ++++--------------------------- 4 files changed, 32 insertions(+), 36 deletions(-)
drivers/gpu/drm/i915/intel_atomic_plane.c +19 -5
@@ -104,13 +104,20 @@ static int intel_plane_atomic_check(struct drm_plane *plane, intel_state->dst.x2 = state->crtc_x + state->crtc_w; intel_state->dst.y2 = state->crtc_y + state->crtc_h; -/* Clip all planes to CRTC size, or 0x0 if CRTC is disabled */ +/* +* Clip all planes to CRTC size, or 0x0 if CRTC unset or disabled. +* Note that CRTC may be unset if we're setting a property of a +* disabled plane. +*/ intel_state->clip.x1 =0 ; intel_state->clip.y1 =0 ; - intel_state->clip.x2 = - intel_crtc->active ? intel_crtc->config->pipe_src_w :0 ; - intel_state->clip.y2 = - intel_crtc->active ? intel_crtc->config->pipe_src_h :0 ; +if (crtc && intel_crtc->active) { + intel_state->clip.x2 = intel_crtc->config->pipe_src_w; + intel_state->clip.y2 = intel_crtc->config->pipe_src_h; + }else { + intel_state->clip.x2 =0 ; + intel_state->clip.y2 =0 ; + }/* * Disabling a plane is always okay; we just need to update
@@ -118,6 +125,9 @@ static int intel_plane_atomic_check(struct drm_plane *plane,* get called by the plane helpers. */ if (state->fb ==NULL && plane->state->fb !=NULL ) { +if (WARN_ON (!crtc)) +return -EINVAL ; +/* * 'prepare' is never called when plane is being disabled, so * we need to handle frontbuffer tracking as a special case
@@ -126,6 +136,10 @@ static int intel_plane_atomic_check(struct drm_plane *plane, (1 <<drm_plane_index (plane)); } +/* Rotation property should contain only a single rotation bit */ +if (hweight32 (intel_state->rotation &0xf ) !=1 ) +return -EINVAL ; +return intel_plane->check_plane (plane, intel_state); }
drivers/gpu/drm/i915/intel_display.c +9 -1
@@ -11774,6 +11774,10 @@ intel_check_primary_plane(struct drm_plane *plane, crtc = crtc ? crtc : plane->crtc; intel_crtc =to_intel_crtc (crtc); +/* CRTC may be unset if we're updating a property of a disabled plane */ +if (!crtc) +return 0 ; + ret = drm_plane_helper_check_update(plane, crtc, fb, src, dest, clip, DRM_PLANE_HELPER_NO_SCALING,
@@ -11972,7 +11976,7 @@ const struct drm_plane_funcs intel_plane_funcs = { .update_plane = drm_plane_helper_update, .disable_plane = drm_plane_helper_disable, .destroy = intel_plane_destroy, - .set_property = intel_plane_set_property, + .set_property = drm_plane_helper_set_property, .atomic_get_property = intel_plane_atomic_get_property, .atomic_set_property = intel_plane_atomic_set_property, .atomic_duplicate_state = intel_plane_duplicate_state,
@@ -12057,6 +12061,10 @@ intel_check_cursor_plane(struct drm_plane *plane, crtc = crtc ? crtc : plane->crtc; intel_crtc =to_intel_crtc (crtc); +/* CRTC may be unset if we're updating a property of a disabled plane */ +if (!crtc) +return 0 ; + ret = drm_plane_helper_check_update(plane, crtc, fb, src, dest, clip, DRM_PLANE_HELPER_NO_SCALING,
drivers/gpu/drm/i915/intel_drv.h +0 -3
@@ -1246,9 +1246,6 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob);int intel_plane_init (struct drm_device *dev,enum pipe pipe,int plane);void intel_flush_primary_plane (struct drm_i915_private *dev_priv,enum plane plane); -int intel_plane_set_property (struct drm_plane *plane, -struct drm_property *prop, -uint64_t val);int intel_plane_restore (struct drm_plane *plane);int intel_sprite_set_colorkey (struct drm_device *dev,void *data,struct drm_file *file_priv);
drivers/gpu/drm/i915/intel_sprite.c +4 -27
@@ -1094,6 +1094,10 @@ intel_check_sprite_plane(struct drm_plane *plane, intel_crtc = intel_crtc ? intel_crtc :to_intel_crtc (plane->crtc); +/* CRTC may be unset if we're updating a property of a disabled plane */ +if (!intel_crtc) +return 0 ; +if (!fb) { state->visible = false; goto finish;
@@ -1367,33 +1371,6 @@ out_unlock:return ret; } -int intel_plane_set_property (struct drm_plane *plane, -struct drm_property *prop, -uint64_t val) -{ -struct drm_device *dev = plane->dev; -struct intel_plane_state *state =to_intel_plane_state (plane->state); -uint64_t old_val; -int ret = -ENOENT ; - -if (prop == dev->mode_config.rotation_property) { -/* exactly one rotation angle please */ -if (hweight32 (val &0xf ) !=1 ) -return -EINVAL ; - -if (state->rotation == val) -return 0 ; - - old_val = state->rotation; - state->rotation = val; - ret =intel_plane_restore (plane); -if (ret) - state->rotation = old_val; - } - -return ret; -} -int intel_plane_restore (struct drm_plane *plane) {if (!plane->crtc || !plane->fb)
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/13 drm/i915: Add main atomic entrypoints
In reply to Matt RoperAdd the top-level atomic entrypoints for check/commit. These won't get called yet; we still need to either enable the atomic ioctl or switch to using the non-transitional atomic helpers for legacy operations.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_atomic.c | 161 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 2 + drivers/gpu/drm/i915/intel_drv.h | 7 ++ 4 files changed, 171 insertions(+) create mode 100644 drivers/gpu/drm/i915/intel_atomic.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -66,6 +66,7 @@ i915-y += dvo_ch7017.o \ dvo_ns2501.o \ dvo_sil164.o \ dvo_tfp410.o \ + intel_atomic.o \ intel_atomic_plane.o \ intel_crt.o \ intel_ddi.o \
drivers/gpu/drm/i915/intel_atomic.c new file +161 -0
161 lines not on this page · raw message
drivers/gpu/drm/i915/intel_display.c +2 -0
@@ -12681,6 +12681,8 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)static const struct drm_mode_config_funcs intel_mode_funcs = { .fb_create = intel_user_framebuffer_create, .output_poll_changed = intel_fbdev_output_poll_changed, + .atomic_check = intel_atomic_check, + .atomic_commit = intel_atomic_commit, };/* Set up chip specific display functions */
drivers/gpu/drm/i915/intel_drv.h +7 -0
@@ -1261,6 +1261,13 @@ void intel_pre_disable_primary(struct drm_crtc *crtc);void intel_tv_init (struct drm_device *dev);/* intel_atomic.c */ +int intel_atomic_check (struct drm_device *dev, +struct drm_atomic_state *state); +int intel_atomic_commit (struct drm_device *dev, +struct drm_atomic_state *state, +bool async); + +/* intel_atomic_plane.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);
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/13] drm/i915: Add main atomic entrypoints
Quoted 81 lines · Matt Roper
Add the top-level atomic entrypoints for check/commit. These won't get called yet; we still need to either enable the atomic ioctl or switch to using the non-transitional atomic helpers for legacy operations.
Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_atomic.c | 161 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 2 + drivers/gpu/drm/i915/intel_drv.h | 7 ++ 4 files changed, 171 insertions(+)create mode 100644
drivers/gpu/drm/i915/intel_atomic.cdrivers/gpu/drm/i915/Makefile +1
-0@@ -66,6 +66,7 @@ i915-y += dvo_ch7017.o \ dvo_ns2501.o \ dvo_sil164.o \ dvo_tfp410.o \ + intel_atomic.o \ intel_atomic_plane.o \ intel_crt.o \ intel_ddi.o \drivers/gpu/drm/i915/intel_atomic.c new file +50
-0@@ -0,0 +1,161 @@ +/* +* Copyright © 2015 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +* DEALINGS IN THE SOFTWARE. +*/ + +/** +* DOC: atomic modeset support +* +* The functions here implement the state management and hardware programming +* dispatch required by the atomic modeset infrastructure. +* See intel_atomic_plane.c for the plane-specific atomic functionality. +*/ + +#include <drm/drmP.h> +#include <drm/drm_atomic.h> +#include <drm/drm_atomic_helper.h> +#include <drm/drm_plane_helper.h> +#include "intel_drv.h" + + +/** +* intel_atomic_check - validate state object +* @dev: drm device +* @state: state to validate +*/ +int intel_atomic_check (struct drm_device *dev, +struct drm_atomic_state *state) +{ +int nplanes = dev->mode_config.num_total_plane; +int ncrtcs = dev->mode_config.num_crtc; +int nconnectors = dev->mode_config.num_connector; +int crtc_mask =0 ;
drivers/gpu/drm/i915/intel_atomic.c line 60
Quoted 10 lines
drivers/gpu/drm/i915/intel_atomic.c new file +10
-0+int ret; +int i; +bool not_nuclear = false; + +/* Figure out what crtcs are involved */ +for (i =0 ; i < nplanes; i++) { +struct drm_plane *plane = state->planes[i]; +if (!plane) +continue ; + crtc_mask |= plane->possible_crtcs;
This would compute the wrong mask for older gens, where the planes are not mapped to one specific pipe. But we don't support planes at all in that case, so I guess this is fine.
Quoted 11 lines
drivers/gpu/drm/i915/intel_atomic.c new file +11
-0+ } + +/* +* FIXME: At the moment, we only support "nuclear pageflip" on a +* single CRTC. Cross-crtc updates will be added later. +*/ +if (hweight32 (crtc_mask) >1 ) { +DRM_DEBUG_KMS ("i915 only support atomic plane operations on a single CRTC at the moment\n" ); +return -EINVAL ; + } +
drivers/gpu/drm/i915/intel_atomic.c line 81
Quoted 10 lines
drivers/gpu/drm/i915/intel_atomic.c new file +10
-0+/* +* FIXME: We only handle planes for now; make sure there are no CRTC's +* or connectors involved. +*/ + state->allow_modeset = false; +for (i =0 ; i < ncrtcs; i++) + not_nuclear |= (state->crtcs[i] && +drm_crtc_mask (state->crtcs[i]) != crtc_mask); +for (i =0 ; i < nconnectors; i++) + not_nuclear |= (state->connectors[i] !=NULL );
I think "if (condition) not_nuclear = true;" would be more clear here.
Ander
Quoted 102 lines
drivers/gpu/drm/i915/intel_atomic.c new file +80
-0+ +if (not_nuclear) { +DRM_DEBUG_KMS ("i915 only supports atomic plane operations at the moment\n" ); +return -EINVAL ; + } + + ret =drm_atomic_helper_check_planes (dev, state); +if (ret) +return ret; + +return ret; +} + + +/** +* intel_atomic_commit - commit validated state object +* @dev: DRM device +* @state: the top-level driver state object +* @async: asynchronous commit +* +* This function commits a top-level state object that has been validated +* with drm_atomic_helper_check(). +* +* FIXME: Atomic modeset support for i915 is not yet complete. At the moment +* we can only handle plane-related operations and do not yet support +* asynchronous commit. +* +* RETURNS +* Zero for success or -errno. +*/ +int intel_atomic_commit (struct drm_device *dev, +struct drm_atomic_state *state, +bool async) +{ +int ret; +int i; + +if (async) { +DRM_DEBUG_KMS ("i915 does not yet support async commit\n" ); +return -EINVAL ; + } + + ret =drm_atomic_helper_prepare_planes (dev, state); +if (ret) +return ret; + +/* Point of no return */ + +/* +* FIXME: The proper sequence here will eventually be: +* +* drm_atomic_helper_swap_state(dev, state) +* drm_atomic_helper_commit_pre_planes(dev, state); +* drm_atomic_helper_commit_planes(dev, state); +* drm_atomic_helper_commit_post_planes(dev, state); +* drm_atomic_helper_wait_for_vblanks(dev, state); +* drm_atomic_helper_cleanup_planes(dev, state); +* drm_atomic_state_free(state); +* +* once we have full atomic modeset. For now, just manually update +* plane states to avoid clobbering good states with dummy states +* while nuclear pageflipping. +*/ +for (i =0 ; i < dev->mode_config.num_total_plane; i++) { +struct drm_plane *plane = state->planes[i]; + +if (!plane) +continue ; + + plane->state->state = state; +swap (state->plane_states[i], plane->state); + plane->state->state =NULL ; + } +drm_atomic_helper_commit_planes (dev, state); +drm_atomic_helper_wait_for_vblanks (dev, state); +drm_atomic_helper_cleanup_planes (dev, state); +drm_atomic_state_free (state); + +return 0 ; +}drivers/gpu/drm/i915/intel_display.c +2
-0@@ -12681,6 +12681,8 @@ static inline void intel_fbdev_output_poll_changed(struct drm_device *dev)static const struct drm_mode_config_funcs intel_mode_funcs = { .fb_create = intel_user_framebuffer_create, .output_poll_changed = intel_fbdev_output_poll_changed, + .atomic_check = intel_atomic_check, + .atomic_commit = intel_atomic_commit, };/* Set up chip specific display functions */ drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -1261,6 +1261,13 @@ void intel_pre_disable_primary(struct drm_crtc *crtc);void intel_tv_init (struct drm_device *dev);/* intel_atomic.c */
drivers/gpu/drm/i915/intel_drv.h void intel_pre_disable_primary(struct drm_crtc *crtc); · line 1273
Quoted 10 lines
drivers/gpu/drm/i915/intel_drv.h +7
-0+int intel_atomic_check (struct drm_device *dev, +struct drm_atomic_state *state); +int intel_atomic_commit (struct drm_device *dev, +struct drm_atomic_state *state, +bool async); + +/* intel_atomic_plane.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);
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/13 drm/i915: Setup dummy atomic state for connectors
In reply to Matt RoperWe want to enable/test plane updates via the atomic interface, but as soon as we flip DRIVER_ATOMIC on, the DRM core will take some atomic codepaths to lookup properties during drmModeGetConnector() and some of those codepaths unconditionally dereference connector->state (specifically when looking up the CRTC ID property in drm_atomic_connector_get_property()). Create a dummy connector state for each connector at init time to ensure the DRM core doesn't try to dereference a NULL connector->state. The actual connector properties will never be updated or contain useful information, but since we're doing this specifically for testing/debug of the plane operations (and only when a specific kernel module option is given), that shouldn't really matter.
--- drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/gpu/drm/i915/intel_display.c +28 -0
@@ -12368,6 +12368,7 @@ static void intel_setup_outputs(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_encoder *encoder; +struct drm_connector *connector;bool dpd_is_edp = false;intel_lvds_init (dev);
@@ -12498,6 +12499,33 @@ static void intel_setup_outputs(struct drm_device *dev)if (SUPPORTS_TV (dev))intel_tv_init (dev); +/* +* FIXME: We don't have full atomic support yet, but we want to be +* able to enable/test plane updates via the atomic interface in the +* meantime. However as soon as we flip DRIVER_ATOMIC on, the DRM core +* will take some atomic codepaths to lookup properties during +* drmModeGetConnector() that unconditionally dereference +* connector->state. +* +* We create a dummy connector state here for each connector to ensure +* the DRM core doesn't try to dereference a NULL connector->state. +* The actual connector properties will never be updated or contain +* useful information, but since we're doing this specifically for +* testing/debug of the plane operations (and only when a specific +* kernel module option is given), that shouldn't really matter. +* +* Once atomic support for crtc's + connectors lands, this loop should +* be removed since we'll be setting up real connector state, which +* will contain Intel-specific properties. +*/ +list_for_each_entry (connector, + &dev->mode_config.connector_list, + head) { +if (!WARN_ON (connector->state)) + connector->state =kzalloc (sizeof (*connector->state), +GFP_KERNEL ); + } +intel_psr_init (dev);for_each_intel_encoder (dev, encoder) {
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 09/13] drm/i915: Setup dummy atomic state for connectors
Quoted 51 lines · Matt Roper
We want to enable/test plane updates via the atomic interface, but as soon as we flip
DRIVER_ATOMICon, the DRM core will take some atomic codepaths to lookup properties duringdrmModeGetConnector()and some of those codepaths unconditionally dereferenceconnector->state(specifically when looking up the CRTC ID property indrm_atomic_connector_get_property()). Create a dummy connector state for each connector at init time to ensure the DRM core doesn't try to dereference a NULLconnector->state. The actual connector properties will never be updated or contain useful information, but since we're doing this specifically for testing/debug of the plane operations (and only when a specific kernel module option is given), that shouldn't really matter.Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)drivers/gpu/drm/i915/intel_display.c +18
-0@@ -12368,6 +12368,7 @@ static void intel_setup_outputs(struct drm_device *dev) {struct drm_i915_private *dev_priv = dev->dev_private;struct intel_encoder *encoder; +struct drm_connector *connector;bool dpd_is_edp = false;intel_lvds_init (dev);@@ -12498,6 +12499,33 @@ static void intel_setup_outputs(struct drm_device *dev)if (SUPPORTS_TV (dev))intel_tv_init (dev); +/* +* FIXME: We don't have full atomic support yet, but we want to be +* able to enable/test plane updates via the atomic interface in the +* meantime. However as soon as we flip DRIVER_ATOMIC on, the DRM core +* will take some atomic codepaths to lookup properties during +* drmModeGetConnector() that unconditionally dereference +* connector->state. +* +* We create a dummy connector state here for each connector to ensure +* the DRM core doesn't try to dereference a NULL connector->state. +* The actual connector properties will never be updated or contain +* useful information, but since we're doing this specifically for +* testing/debug of the plane operations (and only when a specific +* kernel module option is given), that shouldn't really matter. +* +* Once atomic support for crtc's + connectors lands, this loop should +* be removed since we'll be setting up real connector state, which
drivers/gpu/drm/i915/intel_display.c static void intel_setup_outputs(struct drm_device *dev) · line 12528
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+* will contain Intel-specific properties. +*/ +list_for_each_entry (connector, + &dev->mode_config.connector_list, + head) { +if (!WARN_ON (connector->state)) + connector->state =kzalloc (sizeof (*connector->state), +GFP_KERNEL ); + } +
I think this will trigger a WARN in drm_connector_cleanup() on driver unload, and we also leak the dummy state.
Also, I'm not sure if this changes the behaviour of drm_mode_getconnector(), since now the call to drm_connector_get_encoder() will always return NULL.
Ander
drivers/gpu/drm/i915/intel_display.c static void intel_setup_outputs(struct drm_device *dev) · line 12531
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +0
-0intel_psr_init (dev);for_each_intel_encoder (dev, encoder) {
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/13 drm/i915: Set connector state destruction handler
In reply to Matt RoperOnce we start creating connector states, the DRM core will want to be able to clean them up for us. Hook up the destruction entrypoint to the core's helper.
--- drivers/gpu/drm/i915/intel_crt.c | 2 ++ drivers/gpu/drm/i915/intel_dp.c | 2 ++ drivers/gpu/drm/i915/intel_dp_mst.c | 2 ++ drivers/gpu/drm/i915/intel_dsi.c | 2 ++ drivers/gpu/drm/i915/intel_dvo.c | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 2 ++ drivers/gpu/drm/i915/intel_lvds.c | 2 ++ drivers/gpu/drm/i915/intel_sdvo.c | 2 ++ drivers/gpu/drm/i915/intel_tv.c | 2 ++ 9 files changed, 18 insertions(+)
drivers/gpu/drm/i915/intel_crt.c +2 -0
@@ -28,6 +28,7 @@#include <linux/i2c.h> #include <linux/slab.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_edid.h>
@@ -792,6 +793,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .destroy = intel_crt_destroy, .set_property = intel_crt_set_property, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {
drivers/gpu/drm/i915/intel_dp.c +2 -0
@@ -31,6 +31,7 @@#include <linux/notifier.h> #include <linux/reboot.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_edid.h>
@@ -4402,6 +4403,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_dp_set_property, .destroy = intel_dp_connector_destroy, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = {
drivers/gpu/drm/i915/intel_dp_mst.c +2 -0
@@ -26,6 +26,7 @@#include <drm/drmP.h> #include "i915_drv.h" #include "intel_drv.h" +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_edid.h>
@@ -314,6 +315,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_dp_mst_set_property, .destroy = intel_dp_mst_connector_destroy, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int intel_dp_mst_get_modes (struct drm_connector *connector)
drivers/gpu/drm/i915/intel_dsi.c +2 -0
@@ -24,6 +24,7 @@*/ #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include <drm/i915_drm.h>
@@ -791,6 +792,7 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = { .detect = intel_dsi_detect, .destroy = intel_dsi_destroy, .fill_modes = drm_helper_probe_single_connector_modes, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };void intel_dsi_init (struct drm_device *dev)
drivers/gpu/drm/i915/intel_dvo.c +2 -0
@@ -27,6 +27,7 @@#include <linux/i2c.h> #include <linux/slab.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include "intel_drv.h" #include <drm/i915_drm.h>
@@ -390,6 +391,7 @@ static const struct drm_connector_funcs intel_dvo_connector_funcs = { .detect = intel_dvo_detect, .destroy = intel_dvo_destroy, .fill_modes = drm_helper_probe_single_connector_modes, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_dvo_connector_helper_funcs = {
drivers/gpu/drm/i915/intel_hdmi.c +2 -0
@@ -31,6 +31,7 @@#include <linux/delay.h> #include <linux/hdmi.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include "intel_drv.h"
@@ -1615,6 +1616,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_hdmi_set_property, .destroy = intel_hdmi_destroy, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = {
drivers/gpu/drm/i915/intel_lvds.c +2 -0
@@ -32,6 +32,7 @@#include <linux/i2c.h> #include <linux/slab.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include "intel_drv.h"
@@ -532,6 +533,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_lvds_set_property, .destroy = intel_lvds_destroy, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_encoder_funcs intel_lvds_enc_funcs = {
drivers/gpu/drm/i915/intel_sdvo.c +2 -0
@@ -30,6 +30,7 @@#include <linux/delay.h> #include <linux/export.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include "intel_drv.h"
@@ -2191,6 +2192,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_sdvo_set_property, .destroy = intel_sdvo_destroy, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_sdvo_connector_helper_funcs = {
drivers/gpu/drm/i915/intel_tv.c +2 -0
@@ -31,6 +31,7 @@*/ #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include "intel_drv.h"
@@ -1513,6 +1514,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = { .destroy = intel_tv_destroy, .set_property = intel_tv_set_property, .fill_modes = drm_helper_probe_single_connector_modes, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = {
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/13] drm/i915: Set connector state destruction handler
Spoke too soon, this fix the warning I mentioned on the previous patch. Perhaps it makes sense to squash this?
Ander
Quoted 191 lines · Matt Roper
Once we start creating connector states, the DRM core will want to be able to clean them up for us. Hook up the destruction entrypoint to the core's helper.
Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/i915/intel_crt.c | 2 ++ drivers/gpu/drm/i915/intel_dp.c | 2 ++ drivers/gpu/drm/i915/intel_dp_mst.c | 2 ++ drivers/gpu/drm/i915/intel_dsi.c | 2 ++ drivers/gpu/drm/i915/intel_dvo.c | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 2 ++ drivers/gpu/drm/i915/intel_lvds.c | 2 ++ drivers/gpu/drm/i915/intel_sdvo.c | 2 ++ drivers/gpu/drm/i915/intel_tv.c | 2 ++ 9 files changed, 18 insertions(+)drivers/gpu/drm/i915/intel_crt.c +2
-0@@ -28,6 +28,7 @@#include <linux/i2c.h> #include <linux/slab.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_edid.h> @@ -792,6 +793,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .destroy = intel_crt_destroy, .set_property = intel_crt_set_property, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {drivers/gpu/drm/i915/intel_dp.c +2
-0@@ -31,6 +31,7 @@#include <linux/notifier.h> #include <linux/reboot.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_edid.h> @@ -4402,6 +4403,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_dp_set_property, .destroy = intel_dp_connector_destroy, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs = {drivers/gpu/drm/i915/intel_dp_mst.c +2
-0@@ -26,6 +26,7 @@#include <drm/drmP.h> #include "i915_drv.h" #include "intel_drv.h" +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_edid.h> @@ -314,6 +315,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_dp_mst_set_property, .destroy = intel_dp_mst_connector_destroy, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int intel_dp_mst_get_modes (struct drm_connector *connector)drivers/gpu/drm/i915/intel_dsi.c +2
-0@@ -24,6 +24,7 @@*/ #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include <drm/i915_drm.h> @@ -791,6 +792,7 @@ static const struct drm_connector_funcs intel_dsi_connector_funcs = { .detect = intel_dsi_detect, .destroy = intel_dsi_destroy, .fill_modes = drm_helper_probe_single_connector_modes, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };void intel_dsi_init (struct drm_device *dev)drivers/gpu/drm/i915/intel_dvo.c +2
-0@@ -27,6 +27,7 @@#include <linux/i2c.h> #include <linux/slab.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include "intel_drv.h" #include <drm/i915_drm.h> @@ -390,6 +391,7 @@ static const struct drm_connector_funcs intel_dvo_connector_funcs = { .detect = intel_dvo_detect, .destroy = intel_dvo_destroy, .fill_modes = drm_helper_probe_single_connector_modes, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_dvo_connector_helper_funcs = {drivers/gpu/drm/i915/intel_hdmi.c +2
-0@@ -31,6 +31,7 @@#include <linux/delay.h> #include <linux/hdmi.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include "intel_drv.h" @@ -1615,6 +1616,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_hdmi_set_property, .destroy = intel_hdmi_destroy, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_hdmi_connector_helper_funcs = {drivers/gpu/drm/i915/intel_lvds.c +2
-0@@ -32,6 +32,7 @@#include <linux/i2c.h> #include <linux/slab.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include "intel_drv.h" @@ -532,6 +533,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_lvds_set_property, .destroy = intel_lvds_destroy, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_encoder_funcs intel_lvds_enc_funcs = {drivers/gpu/drm/i915/intel_sdvo.c +2
-0@@ -30,6 +30,7 @@#include <linux/delay.h> #include <linux/export.h> #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include "intel_drv.h" @@ -2191,6 +2192,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_sdvo_set_property, .destroy = intel_sdvo_destroy, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_sdvo_connector_helper_funcs = {drivers/gpu/drm/i915/intel_tv.c +1
-0@@ -31,6 +31,7 @@*/ #include <drm/drmP.h> +#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> #include "intel_drv.h"
drivers/gpu/drm/i915/intel_tv.c static const struct drm_connector_funcs intel_tv_connector_funcs = { · line 1520
Quoted 7 lines
drivers/gpu/drm/i915/intel_tv.c +1
-0@@ -1513,6 +1514,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = { .destroy = intel_tv_destroy, .set_property = intel_tv_set_property, .fill_modes = drm_helper_probe_single_connector_modes, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = {
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/13 drm/i915: Add atomic_get_property entrypoint for connectors
In reply to Matt RoperEven though we only support atomic plane updates at the moment, we still need to add an .atomic_get_property() entrypoint for connectors before we allow the driver to flip on the DRIVER_ATOMIC bit. As soon as that bit gets set, the DRM core will start adding atomic connector properties (in addition to the plane properties we care about at the moment), so we need to be able to handle the new way the DRM core will interact with us.
For simplicity, we just lookup driver-specific connector properties in the usual shadow array maintained by the core. Once we get real atomic modeset support for crtc's and planes, this code should be re-written to pull the data out of crtc/connector state structures.
--- drivers/gpu/drm/i915/intel_atomic.c | 38 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_crt.c | 1 + drivers/gpu/drm/i915/intel_dp.c | 1 + drivers/gpu/drm/i915/intel_dp_mst.c | 1 + drivers/gpu/drm/i915/intel_drv.h | 4 ++++ drivers/gpu/drm/i915/intel_hdmi.c | 1 + drivers/gpu/drm/i915/intel_lvds.c | 1 + drivers/gpu/drm/i915/intel_sdvo.c | 1 + drivers/gpu/drm/i915/intel_tv.c | 1 + 9 files changed, 49 insertions(+)
drivers/gpu/drm/i915/intel_atomic.c +38 -0
@@ -159,3 +159,41 @@ int intel_atomic_commit(struct drm_device *dev,return 0 ; } + +/** +* intel_connector_atomic_get_property - fetch connector property value +* @connector: connector to fetch property for +* @state: state containing the property value +* @property: property to look up +* @val: pointer to write property value into +* +* The DRM core does not store shadow copies of properties for +* atomic-capable drivers. This entrypoint is used to fetch +* the current value of a driver-specific connector property. +*/ +int +intel_connector_atomic_get_property (struct drm_connector *connector, +const struct drm_connector_state *state, +struct drm_property *property, +uint64_t *val) +{ +int i; + +/* +* TODO: We only have atomic modeset for planes at the moment, so the +* crtc/connector code isn't quite ready yet. Until it's ready, +* continue to look up all property values in the DRM's shadow copy +* in obj->properties->values[]. +* +* When the crtc/connector state work matures, this function should +* be updated to read the values out of the state structure instead. +*/ +for (i =0 ; i < connector->base.properties->count; i++) { +if (connector->base.properties->properties[i] == property) { + *val = connector->base.properties->values[i]; +return 0 ; + } + } + +return -EINVAL ; +}
drivers/gpu/drm/i915/intel_crt.c +1 -0
@@ -794,6 +794,7 @@ static const struct drm_connector_funcs intel_crt_connector_funcs = { .destroy = intel_crt_destroy, .set_property = intel_crt_set_property, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, + .atomic_get_property = intel_connector_atomic_get_property, };static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs = {
drivers/gpu/drm/i915/intel_dp.c +1 -0
@@ -4402,6 +4402,7 @@ static const struct drm_connector_funcs intel_dp_connector_funcs = { .force = intel_dp_force, .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_dp_set_property, + .atomic_get_property = intel_connector_atomic_get_property, .destroy = intel_dp_connector_destroy, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };
drivers/gpu/drm/i915/intel_dp_mst.c +1 -0
@@ -314,6 +314,7 @@ static const struct drm_connector_funcs intel_dp_mst_connector_funcs = { .detect = intel_dp_mst_detect, .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_dp_mst_set_property, + .atomic_get_property = intel_connector_atomic_get_property, .destroy = intel_dp_mst_connector_destroy, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };
drivers/gpu/drm/i915/intel_drv.h +4 -0
@@ -1266,6 +1266,10 @@ int intel_atomic_check(struct drm_device *dev,int intel_atomic_commit (struct drm_device *dev,struct drm_atomic_state *state,bool async); +int intel_connector_atomic_get_property (struct drm_connector *connector, +const struct drm_connector_state *state, +struct drm_property *property, +uint64_t *val);/* intel_atomic_plane.c */ struct drm_plane_state *intel_plane_duplicate_state (struct drm_plane *plane);
drivers/gpu/drm/i915/intel_hdmi.c +1 -0
@@ -1615,6 +1615,7 @@ static const struct drm_connector_funcs intel_hdmi_connector_funcs = { .force = intel_hdmi_force, .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_hdmi_set_property, + .atomic_get_property = intel_connector_atomic_get_property, .destroy = intel_hdmi_destroy, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };
drivers/gpu/drm/i915/intel_lvds.c +1 -0
@@ -532,6 +532,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = { .detect = intel_lvds_detect, .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_lvds_set_property, + .atomic_get_property = intel_connector_atomic_get_property, .destroy = intel_lvds_destroy, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };
drivers/gpu/drm/i915/intel_sdvo.c +1 -0
@@ -2191,6 +2191,7 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = { .detect = intel_sdvo_detect, .fill_modes = drm_helper_probe_single_connector_modes, .set_property = intel_sdvo_set_property, + .atomic_get_property = intel_connector_atomic_get_property, .destroy = intel_sdvo_destroy, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };
drivers/gpu/drm/i915/intel_tv.c +1 -0
@@ -1513,6 +1513,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = { .detect = intel_tv_detect, .destroy = intel_tv_destroy, .set_property = intel_tv_set_property, + .atomic_get_property = intel_connector_atomic_get_property, .fill_modes = drm_helper_probe_single_connector_modes, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/13 drm/i915: Add crtc state duplication/destruction functions
In reply to Matt RoperThe atomic helpers need these to prepare a new state object when starting a new atomic operation.
--- drivers/gpu/drm/i915/intel_atomic.c | 35 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 3 +++ 3 files changed, 40 insertions(+)
drivers/gpu/drm/i915/intel_atomic.c +35 -0
@@ -197,3 +197,38 @@ intel_connector_atomic_get_property(struct drm_connector *connector,return -EINVAL ; } + +/* +* intel_crtc_duplicate_state - duplicate crtc state +* @crtc: drm crtc +* +* Allocates and returns a copy of the crtc state (both common and +* Intel-specific) for the specified crtc. +* +* Returns: The newly allocated crtc state, or NULL on failure. +*/ +struct drm_crtc_state * +intel_crtc_duplicate_state (struct drm_crtc *crtc) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); + +if (WARN_ON (!intel_crtc->config)) +return kzalloc (sizeof (*intel_crtc->config),GFP_KERNEL ); + +return kmemdup (intel_crtc->config,sizeof (*intel_crtc->config), +GFP_KERNEL ); +} + +/** +* intel_crtc_destroy_state - destroy crtc state +* @crtc: drm crtc +* +* Destroys the crtc state (both common and Intel-specific) for the +* specified crtc. +*/ +void +intel_crtc_destroy_state (struct drm_crtc *crtc, +struct drm_crtc_state *state) +{ +drm_atomic_helper_crtc_destroy_state (crtc, state); +}
drivers/gpu/drm/i915/intel_display.c +2 -0
@@ -11571,6 +11571,8 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { .set_config = intel_crtc_set_config, .destroy = intel_crtc_destroy, .page_flip = intel_crtc_page_flip, + .atomic_duplicate_state = intel_crtc_duplicate_state, + .atomic_destroy_state = intel_crtc_destroy_state, }; static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/intel_drv.h +3 -0
@@ -1270,6 +1270,9 @@ int intel_connector_atomic_get_property(struct drm_connector *connector,const struct drm_connector_state *state, struct drm_property *property, uint64_t *val); +struct drm_crtc_state *intel_crtc_duplicate_state (struct drm_crtc *crtc); +void intel_crtc_destroy_state (struct drm_crtc *crtc, +struct drm_crtc_state *state);/* intel_atomic_plane.c */ struct drm_plane_state *intel_plane_duplicate_state (struct drm_plane *plane);
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 13/13 drm/i915: Add i915.nuclear kernel command line param to force atomic
In reply to Matt RoperWe don't have full atomic modeset support yet, but the "nuclear pageflip" subset of functionality (i.e., plane operations only) should be ready. Allow the user to force atomic on for debug purposes, or for fixed-purpose embedded devices that will only use atomic for plane updates.
The term 'nuclear' is used here instead of 'atomic' to make it clear that this doesn't allow full atomic modeset support, just a (very useful) subset of the atomic functionality.
We'll drop the kernel parameter and unconditionally enable atomic in a future patch once all of the necessary pieces are in.
--- drivers/gpu/drm/i915/i915_drv.c | 12 ++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_params.c | 5 +++++ 3 files changed, 18 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +12 -0
@@ -1642,6 +1642,18 @@ static int __init i915_init(void)#endif } +/* +* FIXME: We don't yet support full atomic modeset, just the plane +* operations subset (i.e., the "nuclear pageflip" functionality). +* Allow us to advertise atomic functionality when specifically +* requested on the kernel command line. +* +* We'll remove this module parameter and just advertise DRIVER_ATOMIC +* unconditionally once the rest of the atomic infrastructure is ready. +*/ +if (i915.nuclear) + driver.driver_features |=DRIVER_ATOMIC ; +return drm_pci_init (&driver, &i915_pci_driver); }
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -2445,6 +2445,7 @@ struct i915_params {int use_mmio_flip;bool mmio_debug;bool verbose_state_checks; +bool nuclear; };extern struct i915_params i915__read_mostly ;
drivers/gpu/drm/i915/i915_params.c +5 -0
@@ -52,6 +52,7 @@ struct i915_params i915 __read_mostly = { .use_mmio_flip = 0, .mmio_debug = 0, .verbose_state_checks = 1, + .nuclear = 0, };module_param_named (modeset, i915.modeset, int,0400 );
@@ -178,3 +179,7 @@ MODULE_PARM_DESC(mmio_debug,module_param_named (verbose_state_checks, i915.verbose_state_checks, bool,0600 );MODULE_PARM_DESC (verbose_state_checks,"Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions." ); + +module_param_named (nuclear, i915.nuclear, bool,0600 ); +MODULE_PARM_DESC (nuclear, +"Force atomic modeset functionality; only planes work for now (default: false)." );
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 13/13] drm/i915: Add i915.nuclear kernel command line param to force atomic
Quoted 27 lines · Matt Roper
We don't have full atomic modeset support yet, but the "nuclear pageflip" subset of functionality (i.e., plane operations only) should be ready. Allow the user to force atomic on for debug purposes, or for fixed-purpose embedded devices that will only use atomic for plane updates.
The term 'nuclear' is used here instead of 'atomic' to make it clear that this doesn't allow full atomic modeset support, just a (very useful) subset of the atomic functionality.
We'll drop the kernel parameter and unconditionally enable atomic in a future patch once all of the necessary pieces are in.
Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 12 ++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_params.c | 5 +++++ 3 files changed, 18 insertions(+)drivers/gpu/drm/i915/i915_drv.c +0
-0@@ -1642,6 +1642,18 @@ static int __init i915_init(void)#endif }
drivers/gpu/drm/i915/i915_drv.c static int __init i915_init(void) · line 1653
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c +9
-0+/* +* FIXME: We don't yet support full atomic modeset, just the plane +* operations subset (i.e., the "nuclear pageflip" functionality). +* Allow us to advertise atomic functionality when specifically +* requested on the kernel command line. +* +* We'll remove this module parameter and just advertise DRIVER_ATOMIC +* unconditionally once the rest of the atomic infrastructure is ready. +*/
Imo self-explanatory comment (if you do the suggestion below).
Quoted 31 lines
drivers/gpu/drm/i915/i915_drv.c +3
-0+if (i915.nuclear) + driver.driver_features |=DRIVER_ATOMIC ; +return drm_pci_init (&driver, &i915_pci_driver); }drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -2445,6 +2445,7 @@ struct i915_params {int use_mmio_flip;bool mmio_debug;bool verbose_state_checks; +bool nuclear; };extern struct i915_params i915__read_mostly ;drivers/gpu/drm/i915/i915_params.c +1
-0@@ -52,6 +52,7 @@ struct i915_params i915 __read_mostly = { .use_mmio_flip = 0, .mmio_debug = 0, .verbose_state_checks = 1, + .nuclear = 0, };module_param_named (modeset, i915.modeset, int,0400 );
drivers/gpu/drm/i915/i915_params.c MODULE_PARM_DESC(mmio_debug, · line 183
Quoted 5 lines
drivers/gpu/drm/i915/i915_params.c +2
-0@@ -178,3 +179,7 @@ MODULE_PARM_DESC(mmio_debug,module_param_named (verbose_state_checks, i915.verbose_state_checks, bool,0600 );MODULE_PARM_DESC (verbose_state_checks,"Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions." ); + +module_param_named (nuclear, i915.nuclear, bool,0600 );
module_param_named_debug please.
-Daniel
Quoted 9 lines
drivers/gpu/drm/i915/i915_params.c +2
-0+MODULE_PARM_DESC (nuclear, +"Force atomic modeset functionality; only planes work for now (default: false)." );Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerRe: [PATCH 13/13] drm/i915: Add i915.nuclear kernel command line param to force atomic
Quoted 4 lines · Daniel Vetter
Quoted 1 line · Matt Roper
+module_param_named(nuclear, i915.nuclear, bool, 0600);
module_param_named_debugplease.
ITYM module_param_named_unsafe.
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 13/13] drm/i915: Add i915.nuclear kernel command line param to force atomic
In reply to Matt RoperQuoted 9 lines · Matt Roper
We don't have full atomic modeset support yet, but the "nuclear pageflip" subset of functionality (i.e., plane operations only) should be ready. Allow the user to force atomic on for debug purposes, or for fixed-purpose embedded devices that will only use atomic for plane updates.
The term 'nuclear' is used here instead of 'atomic' to make it clear that this doesn't allow full atomic modeset support, just a (very useful) subset of the atomic functionality.
Can we make that i915.nuclear_pageflip instead? I think it should make it more clear.
Cheers,
Ander
Quoted 59 lines
We'll drop the kernel parameter and unconditionally enable atomic in a future patch once all of the necessary pieces are in.
Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 12 ++++++++++++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_params.c | 5 +++++ 3 files changed, 18 insertions(+)drivers/gpu/drm/i915/i915_drv.c +12
-0@@ -1642,6 +1642,18 @@ static int __init i915_init(void)#endif } +/* +* FIXME: We don't yet support full atomic modeset, just the plane +* operations subset (i.e., the "nuclear pageflip" functionality). +* Allow us to advertise atomic functionality when specifically +* requested on the kernel command line. +* +* We'll remove this module parameter and just advertise DRIVER_ATOMIC +* unconditionally once the rest of the atomic infrastructure is ready. +*/ +if (i915.nuclear) + driver.driver_features |=DRIVER_ATOMIC ; +return drm_pci_init (&driver, &i915_pci_driver); }drivers/gpu/drm/i915/i915_drv.h +1
-0@@ -2445,6 +2445,7 @@ struct i915_params {int use_mmio_flip;bool mmio_debug;bool verbose_state_checks; +bool nuclear; };extern struct i915_params i915__read_mostly ;drivers/gpu/drm/i915/i915_params.c +1
-0@@ -52,6 +52,7 @@ struct i915_params i915 __read_mostly = { .use_mmio_flip = 0, .mmio_debug = 0, .verbose_state_checks = 1, + .nuclear = 0, };module_param_named (modeset, i915.modeset, int,0400 );
drivers/gpu/drm/i915/i915_params.c MODULE_PARM_DESC(mmio_debug, · line 185
Quoted 7 lines
drivers/gpu/drm/i915/i915_params.c +4
-0@@ -178,3 +179,7 @@ MODULE_PARM_DESC(mmio_debug,module_param_named (verbose_state_checks, i915.verbose_state_checks, bool,0600 );MODULE_PARM_DESC (verbose_state_checks,"Enable verbose logs (ie. WARN_ON()) in case of unexpected hw state conditions." ); + +module_param_named (nuclear, i915.nuclear, bool,0600 ); +MODULE_PARM_DESC (nuclear, +"Force atomic modeset functionality; only planes work for now (default: false)." );
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx