split plane's updates functions into check() and commit()
Subsystems (2)
cover split plane's updates functions into check() and commit()
From: Gustavo Padovan <[email protected]>
This is the beginning of the work to prepare i915 for the upcoming atomic modesetting API. Here we split the plane update fucntions in the check and commit states.
v2: use struct intel_plane_state to keep states between check and commit stages.
v3: take Ville's comments:
- rename pstate to state
- get rid of non-drm_rect coordinates in intel_plane_state
- keep 'clip' const
v4: take more Ville's comments:
- populates orig_dst and orig_src too
- use orig_dst coordinates to program the cursor plane
Gustavo Padovan (4):
drm/i915: create struct intel_plane_state
drm/i915: split intel_update_plane into check() and commit() drm/i915: split intel_cursor_plane_update() into check() and commit() drm/i915: split intel_primary_plane_setplane() into check() and
commit()
drivers/gpu/drm/i915/intel_display.c | 240 +++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_drv.h | 12 ++ drivers/gpu/drm/i915/intel_sprite.c | 233 ++++++++++++++++++++-------------- 3 files changed, 298 insertions(+), 187 deletions(-)
Signature · 1 line
1.9.3
PATCH 1/4 drm/i915: create struct intel_plane_state
From: Gustavo Padovan <[email protected]>
This new struct will be the storage of src and dst coordinates between the check and commit stages of a plane update.
--- drivers/gpu/drm/i915/intel_drv.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/i915/intel_drv.h +12 -0
@@ -34,6 +34,7 @@#include <drm/drm_crtc_helper.h> #include <drm/drm_fb_helper.h> #include <drm/drm_dp_mst_helper.h> +#include <drm/drm_rect.h> /** * _wait_for - magic (register) wait macro
@@ -237,6 +238,17 @@ typedef struct dpll {int p; } intel_clock_t; +struct intel_plane_state { +struct drm_crtc *crtc; +struct drm_framebuffer *fb; +struct drm_rect src; +struct drm_rect dst; +struct drm_rect clip; +struct drm_rect orig_src; +struct drm_rect orig_dst; +bool visible; +}; +struct intel_plane_config {bool tiled;int size;
Signature · 1 line
1.9.3
PATCH 2/4 drm/i915: split intel_update_plane into check() and commit()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Due to the upcoming atomic modesetting feature we need to separate some update functions into a check step that can fail and a commit step that should, ideally, never fail.
This commit splits intel_update_plane() and its commit part can still fail due to the fb pinning procedure.
--- drivers/gpu/drm/i915/intel_sprite.c | 233 ++++++++++++++++++++++-------------- 1 file changed, 141 insertions(+), 92 deletions(-)
drivers/gpu/drm/i915/intel_sprite.c +141 -92
@@ -845,57 +845,24 @@ static bool colorkey_enabled(struct intel_plane *intel_plane) }static int -intel_update_plane (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h) +intel_check_sprite_plane (struct drm_plane *plane, +struct intel_plane_state *state) { -struct drm_device *dev = plane->dev; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_crtc *intel_crtc =to_intel_crtc (state->crtc);struct intel_plane *intel_plane =to_intel_plane (plane); -enum pipe pipe = intel_crtc->pipe; +struct drm_framebuffer *fb = state->fb;struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb);struct drm_i915_gem_object *obj = intel_fb->obj; -struct drm_i915_gem_object *old_obj = intel_plane->obj; -int ret; -bool primary_enabled; -bool visible; +int crtc_x, crtc_y; +unsigned int crtc_w, crtc_h; +uint32_t src_x, src_y, src_w, src_h; +struct drm_rect *src = &state->src; +struct drm_rect *dst = &state->dst; +struct drm_rect *orig_src = &state->orig_src; +const struct drm_rect *clip = &state->clip;int hscale, vscale;int max_scale, min_scale;int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); -struct drm_rect src = { -/* sample coordinates in 16.16 fixed point */ - .x1 = src_x, - .x2 = src_x + src_w, - .y1 = src_y, - .y2 = src_y + src_h, - }; -struct drm_rect dst = { -/* integer pixels */ - .x1 = crtc_x, - .x2 = crtc_x + crtc_w, - .y1 = crtc_y, - .y2 = crtc_y + crtc_h, - }; -const struct drm_rect clip = { - .x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 , - .y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 , - }; -const struct { -int crtc_x, crtc_y; -unsigned int crtc_w, crtc_h; -uint32_t src_x, src_y, src_w, src_h; - } orig = { - .crtc_x = crtc_x, - .crtc_y = crtc_y, - .crtc_w = crtc_w, - .crtc_h = crtc_h, - .src_x = src_x, - .src_y = src_y, - .src_w = src_w, - .src_h = src_h, - };/* Don't modify another pipe's plane */ if (intel_plane->pipe != intel_crtc->pipe) {
@@ -927,55 +894,55 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, max_scale = intel_plane->max_downscale <<16 ; min_scale = intel_plane->can_scale ?1 : (1 <<16 ); -drm_rect_rotate (&src, fb->width <<16 , fb->height <<16 , +drm_rect_rotate (src, fb->width <<16 , fb->height <<16 , intel_plane->rotation); - hscale =drm_rect_calc_hscale_relaxed (&src, &dst, min_scale, max_scale); + hscale =drm_rect_calc_hscale_relaxed (src, dst, min_scale, max_scale);BUG_ON (hscale <0 ); - vscale =drm_rect_calc_vscale_relaxed (&src, &dst, min_scale, max_scale); + vscale =drm_rect_calc_vscale_relaxed (src, dst, min_scale, max_scale);BUG_ON (vscale <0 ); - visible =drm_rect_clip_scaled (&src, &dst, &clip, hscale, vscale); + state->visible =drm_rect_clip_scaled (src, dst, clip, hscale, vscale); - crtc_x = dst.x1; - crtc_y = dst.y1; - crtc_w =drm_rect_width (&dst); - crtc_h =drm_rect_height (&dst); + crtc_x = dst->x1; + crtc_y = dst->y1; + crtc_w =drm_rect_width (dst); + crtc_h =drm_rect_height (dst); -if (visible) { +if (state->visible) {/* check again in case clipping clamped the results */ - hscale =drm_rect_calc_hscale (&src, &dst, min_scale, max_scale); + hscale =drm_rect_calc_hscale (src, dst, min_scale, max_scale);if (hscale <0 ) {DRM_DEBUG_KMS ("Horizontal scaling factor out of limits\n" ); -drm_rect_debug_print (&src, true); -drm_rect_debug_print (&dst, false); +drm_rect_debug_print (src, true); +drm_rect_debug_print (dst, false);return hscale; } - vscale =drm_rect_calc_vscale (&src, &dst, min_scale, max_scale); + vscale =drm_rect_calc_vscale (src, dst, min_scale, max_scale);if (vscale <0 ) {DRM_DEBUG_KMS ("Vertical scaling factor out of limits\n" ); -drm_rect_debug_print (&src, true); -drm_rect_debug_print (&dst, false); +drm_rect_debug_print (src, true); +drm_rect_debug_print (dst, false);return vscale; }/* Make the source viewport size an exact multiple of the scaling factors. */ -drm_rect_adjust_size (&src, -drm_rect_width (&dst) * hscale -drm_rect_width (&src), -drm_rect_height (&dst) * vscale -drm_rect_height (&src)); +drm_rect_adjust_size (src, +drm_rect_width (dst) * hscale -drm_rect_width (src), +drm_rect_height (dst) * vscale -drm_rect_height (src)); -drm_rect_rotate_inv (&src, fb->width <<16 , fb->height <<16 , +drm_rect_rotate_inv (src, fb->width <<16 , fb->height <<16 , intel_plane->rotation);/* sanity check to make sure the src viewport wasn't enlarged */ -WARN_ON (src.x1 < (int ) src_x || - src.y1 < (int ) src_y || - src.x2 > (int ) (src_x + src_w) || - src.y2 > (int ) (src_y + src_h)); +WARN_ON (src->x1 < (int ) orig_src->x1 || + src->y1 < (int ) orig_src->y1 || + src->x2 > (int ) orig_src->x2 || + src->y2 > (int ) orig_src->y2);/* * Hardware doesn't handle subpixel coordinates.
@@ -983,10 +950,10 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,* increase the source viewport size, because that could * push the downscaling factor out of bounds. */ - src_x = src.x1 >>16 ; - src_w =drm_rect_width (&src) >>16 ; - src_y = src.y1 >>16 ; - src_h =drm_rect_height (&src) >>16 ; + src_x = src->x1 >>16 ; + src_w =drm_rect_width (src) >>16 ; + src_y = src->y1 >>16 ; + src_h =drm_rect_height (src) >>16 ;if (format_is_yuv (fb->pixel_format)) { src_x &= ~1 ;
@@ -1000,12 +967,12 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, crtc_w &= ~1 ;if (crtc_w ==0 ) - visible = false; + state->visible = false; } }/* Check size restrictions when scaling */ -if (visible && (src_w != crtc_w || src_h != crtc_h)) { +if (state->visible && (src_w != crtc_w || src_h != crtc_h)) {unsigned int width_bytes;WARN_ON (!intel_plane->can_scale);
@@ -1013,12 +980,13 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,/* FIXME interlacing min height is 6 */ if (crtc_w <3 || crtc_h <3 ) - visible = false; + state->visible = false;if (src_w <3 || src_h <3 ) - visible = false; + state->visible = false; - width_bytes = ((src_x * pixel_size) &63 ) + src_w * pixel_size; + width_bytes = ((src_x * pixel_size) &63 ) + + src_w * pixel_size;if (src_w >2048 || src_h >2048 || width_bytes >4096 || fb->pitches[0 ] >4096 ) {
@@ -1027,17 +995,48 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, } } - dst.x1 = crtc_x; - dst.x2 = crtc_x + crtc_w; - dst.y1 = crtc_y; - dst.y2 = crtc_y + crtc_h; +if (state->visible) { + src->x1 = src_x; + src->x2 = src_x + src_w; + src->y1 = src_y; + src->y2 = src_y + src_h; + } + + dst->x1 = crtc_x; + dst->x2 = crtc_x + crtc_w; + dst->y1 = crtc_y; + dst->y2 = crtc_y + crtc_h; + +return 0 ; +} + +static int +intel_commit_sprite_plane (struct drm_plane *plane, +struct intel_plane_state *state) +{ +struct drm_device *dev = plane->dev; +struct drm_crtc *crtc = state->crtc; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane *intel_plane =to_intel_plane (plane); +enum pipe pipe = intel_crtc->pipe; +struct drm_framebuffer *fb = state->fb; +struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb); +struct drm_i915_gem_object *obj = intel_fb->obj; +struct drm_i915_gem_object *old_obj = intel_plane->obj; +int crtc_x, crtc_y; +unsigned int crtc_w, crtc_h; +uint32_t src_x, src_y, src_w, src_h; +struct drm_rect *dst = &state->dst; +const struct drm_rect *clip = &state->clip; +bool primary_enabled; +int ret;/* * If the sprite is completely covering the primary plane, * we can disable the primary and save power. */ - primary_enabled = !drm_rect_equals (&dst, &clip) ||colorkey_enabled (intel_plane); -WARN_ON (!primary_enabled && !visible && intel_crtc->active); + primary_enabled = !drm_rect_equals (dst, clip) ||colorkey_enabled (intel_plane); +WARN_ON (!primary_enabled && !state->visible && intel_crtc->active);mutex_lock (&dev->struct_mutex);
@@ -1055,14 +1054,14 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,if (ret)return ret; - intel_plane->crtc_x = orig.crtc_x; - intel_plane->crtc_y = orig.crtc_y; - intel_plane->crtc_w = orig.crtc_w; - intel_plane->crtc_h = orig.crtc_h; - intel_plane->src_x = orig.src_x; - intel_plane->src_y = orig.src_y; - intel_plane->src_w = orig.src_w; - intel_plane->src_h = orig.src_h; + intel_plane->crtc_x = state->orig_dst.x1; + intel_plane->crtc_y = state->orig_dst.y1; + intel_plane->crtc_w =drm_rect_width (&state->orig_dst); + intel_plane->crtc_h =drm_rect_height (&state->orig_dst); + intel_plane->src_x = state->orig_src.x1; + intel_plane->src_y = state->orig_src.y1; + intel_plane->src_w =drm_rect_width (&state->orig_src); + intel_plane->src_h =drm_rect_height (&state->orig_src); intel_plane->obj = obj;if (intel_crtc->active) {
@@ -1076,12 +1075,22 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,if (primary_was_enabled && !primary_enabled)intel_pre_disable_primary (crtc); -if (visible) +if (state->visible) { + crtc_x = state->dst.x1; + crtc_y = state->dst.x2; + crtc_w =drm_rect_width (&state->dst); + crtc_h =drm_rect_height (&state->dst); + src_x = state->src.x1; + src_y = state->src.y1; + src_w =drm_rect_width (&state->src); + src_h =drm_rect_height (&state->src); intel_plane->update_plane (plane, crtc, fb, obj, crtc_x, crtc_y, crtc_w, crtc_h, src_x, src_y, src_w, src_h); -else + }else { intel_plane->disable_plane (plane, crtc); + } +intel_frontbuffer_flip (dev,INTEL_FRONTBUFFER_SPRITE (pipe));
@@ -1109,6 +1118,46 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, }static int +intel_update_plane (struct drm_plane *plane,struct drm_crtc *crtc, +struct drm_framebuffer *fb,int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t src_x,uint32_t src_y, +uint32_t src_w,uint32_t src_h) +{ +struct intel_plane_state state; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int ret; + + state.crtc = crtc; + state.fb = fb; + +/* sample coordinates in 16.16 fixed point */ + state.src.x1 = src_x; + state.src.x2 = src_x + src_w; + state.src.y1 = src_y; + state.src.y2 = src_y + src_h; + +/* integer pixels */ + state.dst.x1 = crtc_x; + state.dst.x2 = crtc_x + crtc_w; + state.dst.y1 = crtc_y; + state.dst.y2 = crtc_y + crtc_h; + + state.clip.x1 =0 ; + state.clip.y1 =0 ; + state.clip.x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 ; + state.clip.y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 ; + state.orig_src = state.src; + state.orig_dst = state.dst; + + ret =intel_check_sprite_plane (plane, &state); +if (ret) +return ret; + +return intel_commit_sprite_plane (plane, &state); +} + +static int intel_disable_plane (struct drm_plane *plane) {struct drm_device *dev = plane->dev;
Signature · 1 line
1.9.3
Jani Nikula
maintainerRe: [Intel-gfx] [PATCH -v4 2/4] drm/i915: split intel_update_plane into check() and commit()
Quoted 8 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
Due to the upcoming atomic modesetting feature we need to separate some update functions into a check step that can fail and a commit step that should, ideally, never fail.
This commit splits
intel_update_plane()and its commit part can still fail due to the fb pinning procedure.
This patch regresses our tests:
https://bugs.freedesktop.org/show_bug.cgi?id=83747
BR,
Jani.
Quoted 362 lines
Signed-off-by Gustavo Padovan <[email protected]>--- drivers/gpu/drm/i915/intel_sprite.c | 233 ++++++++++++++++++++++-------------- 1 file changed, 141 insertions(+), 92 deletions(-)drivers/gpu/drm/i915/intel_sprite.c +141
-92@@ -845,57 +845,24 @@ static bool colorkey_enabled(struct intel_plane *intel_plane) }static int -intel_update_plane (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h) +intel_check_sprite_plane (struct drm_plane *plane, +struct intel_plane_state *state) { -struct drm_device *dev = plane->dev; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_crtc *intel_crtc =to_intel_crtc (state->crtc);struct intel_plane *intel_plane =to_intel_plane (plane); -enum pipe pipe = intel_crtc->pipe; +struct drm_framebuffer *fb = state->fb;struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb);struct drm_i915_gem_object *obj = intel_fb->obj; -struct drm_i915_gem_object *old_obj = intel_plane->obj; -int ret; -bool primary_enabled; -bool visible; +int crtc_x, crtc_y; +unsigned int crtc_w, crtc_h; +uint32_t src_x, src_y, src_w, src_h; +struct drm_rect *src = &state->src; +struct drm_rect *dst = &state->dst; +struct drm_rect *orig_src = &state->orig_src; +const struct drm_rect *clip = &state->clip;int hscale, vscale;int max_scale, min_scale;int pixel_size =drm_format_plane_cpp (fb->pixel_format,0 ); -struct drm_rect src = { -/* sample coordinates in 16.16 fixed point */ - .x1 = src_x, - .x2 = src_x + src_w, - .y1 = src_y, - .y2 = src_y + src_h, - }; -struct drm_rect dst = { -/* integer pixels */ - .x1 = crtc_x, - .x2 = crtc_x + crtc_w, - .y1 = crtc_y, - .y2 = crtc_y + crtc_h, - }; -const struct drm_rect clip = { - .x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 , - .y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 , - }; -const struct { -int crtc_x, crtc_y; -unsigned int crtc_w, crtc_h; -uint32_t src_x, src_y, src_w, src_h; - } orig = { - .crtc_x = crtc_x, - .crtc_y = crtc_y, - .crtc_w = crtc_w, - .crtc_h = crtc_h, - .src_x = src_x, - .src_y = src_y, - .src_w = src_w, - .src_h = src_h, - };/* Don't modify another pipe's plane */ if (intel_plane->pipe != intel_crtc->pipe) {@@ -927,55 +894,55 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, max_scale = intel_plane->max_downscale <<16 ; min_scale = intel_plane->can_scale ?1 : (1 <<16 ); -drm_rect_rotate (&src, fb->width <<16 , fb->height <<16 , +drm_rect_rotate (src, fb->width <<16 , fb->height <<16 , intel_plane->rotation); - hscale =drm_rect_calc_hscale_relaxed (&src, &dst, min_scale, max_scale); + hscale =drm_rect_calc_hscale_relaxed (src, dst, min_scale, max_scale);BUG_ON (hscale <0 ); - vscale =drm_rect_calc_vscale_relaxed (&src, &dst, min_scale, max_scale); + vscale =drm_rect_calc_vscale_relaxed (src, dst, min_scale, max_scale);BUG_ON (vscale <0 ); - visible =drm_rect_clip_scaled (&src, &dst, &clip, hscale, vscale); + state->visible =drm_rect_clip_scaled (src, dst, clip, hscale, vscale); - crtc_x = dst.x1; - crtc_y = dst.y1; - crtc_w =drm_rect_width (&dst); - crtc_h =drm_rect_height (&dst); + crtc_x = dst->x1; + crtc_y = dst->y1; + crtc_w =drm_rect_width (dst); + crtc_h =drm_rect_height (dst); -if (visible) { +if (state->visible) {/* check again in case clipping clamped the results */ - hscale =drm_rect_calc_hscale (&src, &dst, min_scale, max_scale); + hscale =drm_rect_calc_hscale (src, dst, min_scale, max_scale);if (hscale <0 ) {DRM_DEBUG_KMS ("Horizontal scaling factor out of limits\n" ); -drm_rect_debug_print (&src, true); -drm_rect_debug_print (&dst, false); +drm_rect_debug_print (src, true); +drm_rect_debug_print (dst, false);return hscale; } - vscale =drm_rect_calc_vscale (&src, &dst, min_scale, max_scale); + vscale =drm_rect_calc_vscale (src, dst, min_scale, max_scale);if (vscale <0 ) {DRM_DEBUG_KMS ("Vertical scaling factor out of limits\n" ); -drm_rect_debug_print (&src, true); -drm_rect_debug_print (&dst, false); +drm_rect_debug_print (src, true); +drm_rect_debug_print (dst, false);return vscale; }/* Make the source viewport size an exact multiple of the scaling factors. */ -drm_rect_adjust_size (&src, -drm_rect_width (&dst) * hscale -drm_rect_width (&src), -drm_rect_height (&dst) * vscale -drm_rect_height (&src)); +drm_rect_adjust_size (src, +drm_rect_width (dst) * hscale -drm_rect_width (src), +drm_rect_height (dst) * vscale -drm_rect_height (src)); -drm_rect_rotate_inv (&src, fb->width <<16 , fb->height <<16 , +drm_rect_rotate_inv (src, fb->width <<16 , fb->height <<16 , intel_plane->rotation);/* sanity check to make sure the src viewport wasn't enlarged */ -WARN_ON (src.x1 < (int ) src_x || - src.y1 < (int ) src_y || - src.x2 > (int ) (src_x + src_w) || - src.y2 > (int ) (src_y + src_h)); +WARN_ON (src->x1 < (int ) orig_src->x1 || + src->y1 < (int ) orig_src->y1 || + src->x2 > (int ) orig_src->x2 || + src->y2 > (int ) orig_src->y2);/* * Hardware doesn't handle subpixel coordinates. @@ -983,10 +950,10 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,* increase the source viewport size, because that could * push the downscaling factor out of bounds. */ - src_x = src.x1 >>16 ; - src_w =drm_rect_width (&src) >>16 ; - src_y = src.y1 >>16 ; - src_h =drm_rect_height (&src) >>16 ; + src_x = src->x1 >>16 ; + src_w =drm_rect_width (src) >>16 ; + src_y = src->y1 >>16 ; + src_h =drm_rect_height (src) >>16 ;if (format_is_yuv (fb->pixel_format)) { src_x &= ~1 ;@@ -1000,12 +967,12 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, crtc_w &= ~1 ;if (crtc_w ==0 ) - visible = false; + state->visible = false; } }/* Check size restrictions when scaling */ -if (visible && (src_w != crtc_w || src_h != crtc_h)) { +if (state->visible && (src_w != crtc_w || src_h != crtc_h)) {unsigned int width_bytes;WARN_ON (!intel_plane->can_scale);@@ -1013,12 +980,13 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,/* FIXME interlacing min height is 6 */ if (crtc_w <3 || crtc_h <3 ) - visible = false; + state->visible = false;if (src_w <3 || src_h <3 ) - visible = false; + state->visible = false; - width_bytes = ((src_x * pixel_size) &63 ) + src_w * pixel_size; + width_bytes = ((src_x * pixel_size) &63 ) + + src_w * pixel_size;if (src_w >2048 || src_h >2048 || width_bytes >4096 || fb->pitches[0 ] >4096 ) {@@ -1027,17 +995,48 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, } } - dst.x1 = crtc_x; - dst.x2 = crtc_x + crtc_w; - dst.y1 = crtc_y; - dst.y2 = crtc_y + crtc_h; +if (state->visible) { + src->x1 = src_x; + src->x2 = src_x + src_w; + src->y1 = src_y; + src->y2 = src_y + src_h; + } + + dst->x1 = crtc_x; + dst->x2 = crtc_x + crtc_w; + dst->y1 = crtc_y; + dst->y2 = crtc_y + crtc_h; + +return 0 ; +} + +static int +intel_commit_sprite_plane (struct drm_plane *plane, +struct intel_plane_state *state) +{ +struct drm_device *dev = plane->dev; +struct drm_crtc *crtc = state->crtc; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane *intel_plane =to_intel_plane (plane); +enum pipe pipe = intel_crtc->pipe; +struct drm_framebuffer *fb = state->fb; +struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb); +struct drm_i915_gem_object *obj = intel_fb->obj; +struct drm_i915_gem_object *old_obj = intel_plane->obj; +int crtc_x, crtc_y; +unsigned int crtc_w, crtc_h; +uint32_t src_x, src_y, src_w, src_h; +struct drm_rect *dst = &state->dst; +const struct drm_rect *clip = &state->clip; +bool primary_enabled; +int ret;/* * If the sprite is completely covering the primary plane, * we can disable the primary and save power. */ - primary_enabled = !drm_rect_equals (&dst, &clip) ||colorkey_enabled (intel_plane); -WARN_ON (!primary_enabled && !visible && intel_crtc->active); + primary_enabled = !drm_rect_equals (dst, clip) ||colorkey_enabled (intel_plane); +WARN_ON (!primary_enabled && !state->visible && intel_crtc->active);mutex_lock (&dev->struct_mutex);@@ -1055,14 +1054,14 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,if (ret)return ret; - intel_plane->crtc_x = orig.crtc_x; - intel_plane->crtc_y = orig.crtc_y; - intel_plane->crtc_w = orig.crtc_w; - intel_plane->crtc_h = orig.crtc_h; - intel_plane->src_x = orig.src_x; - intel_plane->src_y = orig.src_y; - intel_plane->src_w = orig.src_w; - intel_plane->src_h = orig.src_h; + intel_plane->crtc_x = state->orig_dst.x1; + intel_plane->crtc_y = state->orig_dst.y1; + intel_plane->crtc_w =drm_rect_width (&state->orig_dst); + intel_plane->crtc_h =drm_rect_height (&state->orig_dst); + intel_plane->src_x = state->orig_src.x1; + intel_plane->src_y = state->orig_src.y1; + intel_plane->src_w =drm_rect_width (&state->orig_src); + intel_plane->src_h =drm_rect_height (&state->orig_src); intel_plane->obj = obj;if (intel_crtc->active) {@@ -1076,12 +1075,22 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,if (primary_was_enabled && !primary_enabled)intel_pre_disable_primary (crtc); -if (visible) +if (state->visible) { + crtc_x = state->dst.x1; + crtc_y = state->dst.x2; + crtc_w =drm_rect_width (&state->dst); + crtc_h =drm_rect_height (&state->dst); + src_x = state->src.x1; + src_y = state->src.y1; + src_w =drm_rect_width (&state->src); + src_h =drm_rect_height (&state->src); intel_plane->update_plane (plane, crtc, fb, obj, crtc_x, crtc_y, crtc_w, crtc_h, src_x, src_y, src_w, src_h); -else + }else { intel_plane->disable_plane (plane, crtc); + } +intel_frontbuffer_flip (dev,INTEL_FRONTBUFFER_SPRITE (pipe));@@ -1109,6 +1118,46 @@ intel_update_plane(struct drm_plane *plane, struct drm_crtc *crtc, }static int +intel_update_plane (struct drm_plane *plane,struct drm_crtc *crtc, +struct drm_framebuffer *fb,int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t src_x,uint32_t src_y, +uint32_t src_w,uint32_t src_h) +{ +struct intel_plane_state state; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int ret; + + state.crtc = crtc; + state.fb = fb; + +/* sample coordinates in 16.16 fixed point */ + state.src.x1 = src_x; + state.src.x2 = src_x + src_w; + state.src.y1 = src_y; + state.src.y2 = src_y + src_h; + +/* integer pixels */ + state.dst.x1 = crtc_x; + state.dst.x2 = crtc_x + crtc_w; + state.dst.y1 = crtc_y; + state.dst.y2 = crtc_y + crtc_h; + + state.clip.x1 =0 ; + state.clip.y1 =0 ; + state.clip.x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 ; + state.clip.y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 ; + state.orig_src = state.src; + state.orig_dst = state.dst; + + ret =intel_check_sprite_plane (plane, &state); +if (ret) +return ret; + +return intel_commit_sprite_plane (plane, &state); +} + +static int intel_disable_plane (struct drm_plane *plane) {struct drm_device *dev = plane->dev;Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
PATCH 1/1 drm/i915: Fix regression in the sprite plane update split
From: Gustavo Padovan <[email protected]>
7e4bf45dbd99a965c7b5d5944c6dc4246f171eb5 introduced the regression. We fix it by doing the right assignment of crtc_y
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83747
--- drivers/gpu/drm/i915/intel_sprite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_sprite.c +1 -1
@@ -1080,7 +1080,7 @@ intel_commit_sprite_plane(struct drm_plane *plane,if (state->visible) { crtc_x = state->dst.x1; - crtc_y = state->dst.x2; + crtc_y = state->dst.y1; crtc_w =drm_rect_width (&state->dst); crtc_h =drm_rect_height (&state->dst); src_x = state->src.x1;
Signature · 1 line
1.9.3
Re: [PATCH] drm/i915: Fix regression in the sprite plane update split
Quoted 7 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
7e4bf45dbd99a965c7b5d5944c6dc4246f171eb5introduced the regression. We fix it by doing the right assignment ofcrtc_yBugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83747
Signed-off-by Gustavo Padovan <[email protected]>
Thanks for the quick fix.
Quoted 20 lines
--- drivers/gpu/drm/i915/intel_sprite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/i915/intel_sprite.c +1
-1@@ -1080,7 +1080,7 @@ intel_commit_sprite_plane(struct drm_plane *plane,if (state->visible) { crtc_x = state->dst.x1; - crtc_y = state->dst.x2; + crtc_y = state->dst.y1; crtc_w =drm_rect_width (&state->dst); crtc_h =drm_rect_height (&state->dst); src_x = state->src.x1;Signature · 1 line
1.9.3
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Re: [PATCH] drm/i915: Fix regression in the sprite plane update split
Quoted 6 lines · Jani Nikula
Quoted 5 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
7e4bf45dbd99a965c7b5d5944c6dc4246f171eb5introduced the regression. We fix it by doing the right assignment ofcrtc_y
Quoted 6 lines
Quoted 2 lines
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83747
Signed-off-by Gustavo Padovan <[email protected]>Thanks for the quick fix.
Reviewed-by Jani Nikula <[email protected]>
Yeah, thanks a lot for the quick fix. Queued for -next, thanks for the patch. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 3/4 drm/i915: split intel_cursor_plane_update() into check() and commit()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
Due to the upcoming atomic modesetting feature we need to separate some update functions into a check step that can fail and a commit step that should, ideally, never fail.
The commit part can still fail, but that should be solved in another upcoming patch.
--- drivers/gpu/drm/i915/intel_display.c | 107 +++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 37 deletions(-)
drivers/gpu/drm/i915/intel_display.c +70 -37
@@ -11896,51 +11896,42 @@ intel_cursor_plane_disable(struct drm_plane *plane) }static int -intel_cursor_plane_update (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h) +intel_check_cursor_plane (struct drm_plane *plane, +struct intel_plane_state *state) { -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb); -struct drm_i915_gem_object *obj = intel_fb->obj; -struct drm_rect dest = { -/* integer pixels */ - .x1 = crtc_x, - .y1 = crtc_y, - .x2 = crtc_x + crtc_w, - .y2 = crtc_y + crtc_h, - }; -struct drm_rect src = { -/* 16.16 fixed point */ - .x1 = src_x, - .y1 = src_y, - .x2 = src_x + src_w, - .y2 = src_y + src_h, - }; -const struct drm_rect clip = { -/* integer pixels */ - .x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 , - .y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 , - }; -bool visible; -int ret; +struct drm_crtc *crtc = state->crtc; +struct drm_framebuffer *fb = state->fb; +struct drm_rect *dest = &state->dst; +struct drm_rect *src = &state->src; +const struct drm_rect *clip = &state->clip; - ret =drm_plane_helper_check_update (plane, crtc, fb, - &src, &dest, &clip, +return drm_plane_helper_check_update (plane, crtc, fb, + src, dest, clip,DRM_PLANE_HELPER_NO_SCALING ,DRM_PLANE_HELPER_NO_SCALING , - true, true, &visible); -if (ret) -return ret; + true, true, &state->visible); +} - crtc->cursor_x = crtc_x; - crtc->cursor_y = crtc_y; +static int +intel_commit_cursor_plane (struct drm_plane *plane, +struct intel_plane_state *state) +{ +struct drm_crtc *crtc = state->crtc; +struct drm_framebuffer *fb = state->fb; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb); +struct drm_i915_gem_object *obj = intel_fb->obj; +struct drm_rect *dest = &state->dst; +int crtc_w, crtc_h; + + crtc->cursor_x = state->orig_dst.x1; + crtc->cursor_y = state->orig_dst.y1;if (fb != crtc->cursor->fb) { + crtc_w =drm_rect_width (&state->orig_dst); + crtc_h =drm_rect_height (&state->orig_dst);return intel_crtc_cursor_set_obj (crtc, obj, crtc_w, crtc_h); }else { -intel_crtc_update_cursor (crtc, visible); +intel_crtc_update_cursor (crtc, state->visible);intel_frontbuffer_flip (crtc->dev,INTEL_FRONTBUFFER_CURSOR (intel_crtc->pipe));
@@ -11948,6 +11939,48 @@ intel_cursor_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,return 0 ; } } + +static int +intel_cursor_plane_update (struct drm_plane *plane,struct drm_crtc *crtc, +struct drm_framebuffer *fb,int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t src_x,uint32_t src_y, +uint32_t src_w,uint32_t src_h) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane_state state; +int ret; + + state.crtc = crtc; + state.fb = fb; + +/* sample coordinates in 16.16 fixed point */ + state.src.x1 = src_x; + state.src.x2 = src_x + src_w; + state.src.y1 = src_y; + state.src.y2 = src_y + src_h; + +/* integer pixels */ + state.dst.x1 = crtc_x; + state.dst.x2 = crtc_x + crtc_w; + state.dst.y1 = crtc_y; + state.dst.y2 = crtc_y + crtc_h; + + state.clip.x1 =0 ; + state.clip.y1 =0 ; + state.clip.x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 ; + state.clip.y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 ; + + state.orig_src = state.src; + state.orig_dst = state.dst; + + ret =intel_check_cursor_plane (plane, &state); +if (ret) +return ret; + +return intel_commit_cursor_plane (plane, &state); +} +static const struct drm_plane_funcs intel_cursor_plane_funcs = { .update_plane = intel_cursor_plane_update, .disable_plane = intel_cursor_plane_disable,
Signature · 1 line
1.9.3
PATCH 3/4 drm/i915: split intel_cursor_plane_update() into check() and commit()
From: Gustavo Padovan <[email protected]>
Due to the upcoming atomic modesetting feature we need to separate some update functions into a check step that can fail and a commit step that should, ideally, never fail.
The commit part can still fail, but that should be solved in another upcoming patch.
---
v5: fix compile warning of not used var
drivers/gpu/drm/i915/intel_display.c | 106 +++++++++++++++++++++++------------ 1 file changed, 69 insertions(+), 37 deletions(-)
drivers/gpu/drm/i915/intel_display.c +69 -37
@@ -11896,51 +11896,41 @@ intel_cursor_plane_disable(struct drm_plane *plane) }static int -intel_cursor_plane_update (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h) +intel_check_cursor_plane (struct drm_plane *plane, +struct intel_plane_state *state) { -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb); -struct drm_i915_gem_object *obj = intel_fb->obj; -struct drm_rect dest = { -/* integer pixels */ - .x1 = crtc_x, - .y1 = crtc_y, - .x2 = crtc_x + crtc_w, - .y2 = crtc_y + crtc_h, - }; -struct drm_rect src = { -/* 16.16 fixed point */ - .x1 = src_x, - .y1 = src_y, - .x2 = src_x + src_w, - .y2 = src_y + src_h, - }; -const struct drm_rect clip = { -/* integer pixels */ - .x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 , - .y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 , - }; -bool visible; -int ret; +struct drm_crtc *crtc = state->crtc; +struct drm_framebuffer *fb = state->fb; +struct drm_rect *dest = &state->dst; +struct drm_rect *src = &state->src; +const struct drm_rect *clip = &state->clip; - ret =drm_plane_helper_check_update (plane, crtc, fb, - &src, &dest, &clip, +return drm_plane_helper_check_update (plane, crtc, fb, + src, dest, clip,DRM_PLANE_HELPER_NO_SCALING ,DRM_PLANE_HELPER_NO_SCALING , - true, true, &visible); -if (ret) -return ret; + true, true, &state->visible); +} - crtc->cursor_x = crtc_x; - crtc->cursor_y = crtc_y; +static int +intel_commit_cursor_plane (struct drm_plane *plane, +struct intel_plane_state *state) +{ +struct drm_crtc *crtc = state->crtc; +struct drm_framebuffer *fb = state->fb; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_framebuffer *intel_fb =to_intel_framebuffer (fb); +struct drm_i915_gem_object *obj = intel_fb->obj; +int crtc_w, crtc_h; + + crtc->cursor_x = state->orig_dst.x1; + crtc->cursor_y = state->orig_dst.y1;if (fb != crtc->cursor->fb) { + crtc_w =drm_rect_width (&state->orig_dst); + crtc_h =drm_rect_height (&state->orig_dst);return intel_crtc_cursor_set_obj (crtc, obj, crtc_w, crtc_h); }else { -intel_crtc_update_cursor (crtc, visible); +intel_crtc_update_cursor (crtc, state->visible);intel_frontbuffer_flip (crtc->dev,INTEL_FRONTBUFFER_CURSOR (intel_crtc->pipe));
@@ -11948,6 +11938,48 @@ intel_cursor_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,return 0 ; } } + +static int +intel_cursor_plane_update (struct drm_plane *plane,struct drm_crtc *crtc, +struct drm_framebuffer *fb,int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t src_x,uint32_t src_y, +uint32_t src_w,uint32_t src_h) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct intel_plane_state state; +int ret; + + state.crtc = crtc; + state.fb = fb; + +/* sample coordinates in 16.16 fixed point */ + state.src.x1 = src_x; + state.src.x2 = src_x + src_w; + state.src.y1 = src_y; + state.src.y2 = src_y + src_h; + +/* integer pixels */ + state.dst.x1 = crtc_x; + state.dst.x2 = crtc_x + crtc_w; + state.dst.y1 = crtc_y; + state.dst.y2 = crtc_y + crtc_h; + + state.clip.x1 =0 ; + state.clip.y1 =0 ; + state.clip.x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 ; + state.clip.y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 ; + + state.orig_src = state.src; + state.orig_dst = state.dst; + + ret =intel_check_cursor_plane (plane, &state); +if (ret) +return ret; + +return intel_commit_cursor_plane (plane, &state); +} +static const struct drm_plane_funcs intel_cursor_plane_funcs = { .update_plane = intel_cursor_plane_update, .disable_plane = intel_cursor_plane_disable,
Signature · 1 line
1.9.3
PATCH 4/4 drm/i915: split intel_primary_plane_setplane() into check() and commit()
In reply to Gustavo PadovanFrom: Gustavo Padovan <[email protected]>
As a preparation for atomic updates we need to split the code to check everything we are going to commit first. This patch starts the work to split intel_primary_plane_setplane() into check() and commit() parts.
More work is expected on this to get a better split of the two steps. Ideally the commit() step should never fail.
--- drivers/gpu/drm/i915/intel_display.c | 133 ++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 58 deletions(-)
drivers/gpu/drm/i915/intel_display.c +75 -58
@@ -11663,63 +11663,37 @@ disable_unpin: }static int -intel_primary_plane_setplane (struct drm_plane *plane,struct drm_crtc *crtc, -struct drm_framebuffer *fb,int crtc_x,int crtc_y, -unsigned int crtc_w,unsigned int crtc_h, -uint32_t src_x,uint32_t src_y, -uint32_t src_w,uint32_t src_h) +intel_check_primary_plane (struct drm_plane *plane, +struct intel_plane_state *state) { +struct drm_crtc *crtc = state->crtc; +struct drm_framebuffer *fb = state->fb; +struct drm_rect *dest = &state->dst; +struct drm_rect *src = &state->src; +const struct drm_rect *clip = &state->clip; + +return drm_plane_helper_check_update (plane, crtc, fb, + src, dest, clip, +DRM_PLANE_HELPER_NO_SCALING , +DRM_PLANE_HELPER_NO_SCALING , + false, true, &state->visible); +} + +static int +intel_commit_primary_plane (struct drm_plane *plane, +struct intel_plane_state *state) +{ +struct drm_crtc *crtc = state->crtc; +struct drm_framebuffer *fb = state->fb;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 drm_i915_gem_object *obj =intel_fb_obj (fb);struct drm_i915_gem_object *old_obj =intel_fb_obj (plane->fb); -struct drm_rect dest = { -/* integer pixels */ - .x1 = crtc_x, - .y1 = crtc_y, - .x2 = crtc_x + crtc_w, - .y2 = crtc_y + crtc_h, - }; -struct drm_rect src = { -/* 16.16 fixed point */ - .x1 = src_x, - .y1 = src_y, - .x2 = src_x + src_w, - .y2 = src_y + src_h, - }; -const struct drm_rect clip = { -/* integer pixels */ - .x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 , - .y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 , - }; -const struct { -int crtc_x, crtc_y; -unsigned int crtc_w, crtc_h; -uint32_t src_x, src_y, src_w, src_h; - } orig = { - .crtc_x = crtc_x, - .crtc_y = crtc_y, - .crtc_w = crtc_w, - .crtc_h = crtc_h, - .src_x = src_x, - .src_y = src_y, - .src_w = src_w, - .src_h = src_h, - };struct intel_plane *intel_plane =to_intel_plane (plane); -bool visible; +struct drm_rect *src = &state->src;int ret; - ret =drm_plane_helper_check_update (plane, crtc, fb, - &src, &dest, &clip, -DRM_PLANE_HELPER_NO_SCALING , -DRM_PLANE_HELPER_NO_SCALING , - false, true, &visible); - -if (ret) -return ret; -/* * If the CRTC isn't enabled, we're just pinning the framebuffer, * updating the fb pointer, and returning without touching the
@@ -11754,7 +11728,7 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,* happens if userspace explicitly disables the plane by passing fb=0 * because plane->fb still gets set and pinned. */ -if (!visible) { +if (!state->visible) {mutex_lock (&dev->struct_mutex);/*
@@ -11801,7 +11775,7 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,intel_disable_fbc (dev); } } - ret =intel_pipe_set_base (crtc, src.x1, src.y1, fb); + ret =intel_pipe_set_base (crtc, src->x1, src->y1, fb);if (ret)return ret;
@@ -11809,19 +11783,62 @@ intel_primary_plane_setplane(struct drm_plane *plane, struct drm_crtc *crtc,intel_enable_primary_hw_plane (plane, crtc); } - intel_plane->crtc_x = orig.crtc_x; - intel_plane->crtc_y = orig.crtc_y; - intel_plane->crtc_w = orig.crtc_w; - intel_plane->crtc_h = orig.crtc_h; - intel_plane->src_x = orig.src_x; - intel_plane->src_y = orig.src_y; - intel_plane->src_w = orig.src_w; - intel_plane->src_h = orig.src_h; + intel_plane->crtc_x = state->orig_dst.x1; + intel_plane->crtc_y = state->orig_dst.y1; + intel_plane->crtc_w =drm_rect_width (&state->orig_dst); + intel_plane->crtc_h =drm_rect_height (&state->orig_dst); + intel_plane->src_x = state->orig_src.x1; + intel_plane->src_y = state->orig_src.y1; + intel_plane->src_w =drm_rect_width (&state->orig_src); + intel_plane->src_h =drm_rect_height (&state->orig_src); intel_plane->obj = obj;return 0 ; } +static int +intel_primary_plane_setplane (struct drm_plane *plane,struct drm_crtc *crtc, +struct drm_framebuffer *fb,int crtc_x,int crtc_y, +unsigned int crtc_w,unsigned int crtc_h, +uint32_t src_x,uint32_t src_y, +uint32_t src_w,uint32_t src_h) +{ +struct intel_plane_state state; +struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +int ret; + + state.crtc = crtc; + state.fb = fb; + +/* sample coordinates in 16.16 fixed point */ + state.src.x1 = src_x; + state.src.x2 = src_x + src_w; + state.src.y1 = src_y; + state.src.y2 = src_y + src_h; + +/* integer pixels */ + state.dst.x1 = crtc_x; + state.dst.x2 = crtc_x + crtc_w; + state.dst.y1 = crtc_y; + state.dst.y2 = crtc_y + crtc_h; + + state.clip.x1 =0 ; + state.clip.y1 =0 ; + state.clip.x2 = intel_crtc->active ? intel_crtc->config.pipe_src_w :0 ; + state.clip.y2 = intel_crtc->active ? intel_crtc->config.pipe_src_h :0 ; + + state.orig_src = state.src; + state.orig_dst = state.dst; + + ret =intel_check_primary_plane (plane, &state); +if (ret) +return ret; + +intel_commit_primary_plane (plane, &state); + +return 0 ; +} +/* Common destruction function for both primary and cursor planes */ static void intel_plane_destroy (struct drm_plane *plane) {
Signature · 1 line
1.9.3
Quoted 9 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
This is the beginning of the work to prepare i915 for the upcoming atomic modesetting API. Here we split the plane update fucntions in the check and commit states.
v2: use struct
intel_plane_stateto keep states between check and commit stages.
Quoted 8 lines
v3: take Ville's comments:
- rename pstate to state
- get rid of non-drm_rect coordinates inintel_plane_state
- keep 'clip' constv4: take more Ville's comments:
- populatesorig_dstandorig_srctoo
- useorig_dstcoordinates to program the cursor plane
In the future please include such changelogs in the patches themselves. Makes for easier review and also it gets recorded in the commit message so we can see a bit of the history even years later. Also makes it possible to figure out which version of a patch got pushed and which were discarded.
Quoted 20 lines
Gustavo Padovan (4):
drm/i915: create structintel_plane_state
drm/i915: splitintel_update_planeintocheck()andcommit()drm/i915: splitintel_cursor_plane_update()intocheck()andcommit()drm/i915: splitintel_primary_plane_setplane()intocheck()and
commit()drivers/gpu/drm/i915/intel_display.c | 240 +++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_drv.h | 12 ++ drivers/gpu/drm/i915/intel_sprite.c | 233 ++++++++++++++++++++-------------- 3 files changed, 298 insertions(+), 187 deletions(-)Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Quoted 18 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
This is the beginning of the work to prepare i915 for the upcoming atomic modesetting API. Here we split the plane update fucntions in the check and commit states.
v2: use struct
intel_plane_stateto keep states between check and commit stages.v3: take Ville's comments:
- rename pstate to state
- get rid of non-drm_rect coordinates inintel_plane_state
- keep 'clip' constv4: take more Ville's comments:
- populatesorig_dstandorig_srctoo
- useorig_dstcoordinates to program the cursor plane
Quoted 6 lines
Gustavo Padovan (4):
drm/i915: create structintel_plane_state
drm/i915: splitintel_update_planeintocheck()andcommit()drm/i915: splitintel_cursor_plane_update()intocheck()andcommit()drm/i915: splitintel_primary_plane_setplane()intocheck()and
commit()
It's looking pretty nice. I didn't spot any more problems, so for the series:
Quoted 13 lines
drivers/gpu/drm/i915/intel_display.c | 240 +++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_drv.h | 12 ++ drivers/gpu/drm/i915/intel_sprite.c | 233 ++++++++++++++++++++-------------- 3 files changed, 298 insertions(+), 187 deletions(-)Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Ville Syrjälä Intel OTC
Daniel Vetter
AppliedQuoted 26 lines · Ville Syrjälä
Quoted 18 lines · Gustavo Padovan
From: Gustavo Padovan <[email protected]>
This is the beginning of the work to prepare i915 for the upcoming atomic modesetting API. Here we split the plane update fucntions in the check and commit states.
v2: use struct
intel_plane_stateto keep states between check and commit stages.v3: take Ville's comments:
- rename pstate to state
- get rid of non-drm_rect coordinates inintel_plane_state
- keep 'clip' constv4: take more Ville's comments:
- populatesorig_dstandorig_srctoo
- useorig_dstcoordinates to program the cursor planeQuoted 6 lines
Gustavo Padovan (4):
drm/i915: create structintel_plane_state
drm/i915: splitintel_update_planeintocheck()andcommit()drm/i915: splitintel_cursor_plane_update()intocheck()andcommit()drm/i915: splitintel_primary_plane_setplane()intocheck()and
commit()
Quoted 3 lines
It's looking pretty nice. I didn't spot any more problems, so for the series:
Reviewed-by Ville Syrjälä <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Quoted 22 lines
Quoted 14 lines
drivers/gpu/drm/i915/intel_display.c | 240 +++++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_drv.h | 12 ++ drivers/gpu/drm/i915/intel_sprite.c | 233 ++++++++++++++++++++-------------- 3 files changed, 298 insertions(+), 187 deletions(-)Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch