On Fri, May 25, 2018 at 11:00:23AM -0700, Fritz Koenig wrote: > YUV planes need to be multiples of 2 to scan out. This was > handled correctly for planes other than the primary in the > intel_check_sprite_plane, where the code fixes up the plane > and makes it compliant. Move this code into a location that > allows the primary check to access it as well. > > Signed-off-by: Fritz Koenig <frkoe...@google.com> > --- > > Hi, > > I think this is a better implementation where instead of rejecting > yuv planes that are not correctly aligned, they are fixed up. This > is done by reusing the sprite check code that was already doing that. > > drivers/gpu/drm/i915/intel_display.c | 170 +++++++++++++++++++++++++++ > drivers/gpu/drm/i915/intel_drv.h | 2 + > drivers/gpu/drm/i915/intel_sprite.c | 154 +----------------------- > 3 files changed, 175 insertions(+), 151 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_display.c > b/drivers/gpu/drm/i915/intel_display.c > index 56004ffbd8bb..1328fb90367f 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -12854,6 +12854,170 @@ skl_max_scale(struct intel_crtc *intel_crtc, struct > intel_crtc_state *crtc_state > return max_scale; > } > > +int > +intel_clip_src_rect(struct intel_plane *plane, > + struct intel_crtc_state *crtc_state, > + struct intel_plane_state *state) > +{ > + struct drm_i915_private *dev_priv = to_i915(plane->base.dev); > + struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc); > + struct drm_framebuffer *fb = state->base.fb; > + 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->base.src; > + struct drm_rect *dst = &state->base.dst; > + struct drm_rect clip = {}; > + int hscale, vscale; > + int max_scale, min_scale; > + bool can_scale; > + > + *src = drm_plane_state_src(&state->base); > + *dst = drm_plane_state_dest(&state->base); > + > + /* setup can_scale, min_scale, max_scale */ > + if (INTEL_GEN(dev_priv) >= 9) { > + /* use scaler when colorkey is not required */ > + if (!state->ckey.flags) { > + can_scale = 1; > + min_scale = 1; > + max_scale = skl_max_scale(crtc, crtc_state); > + } else { > + can_scale = 0; > + min_scale = DRM_PLANE_HELPER_NO_SCALING; > + max_scale = DRM_PLANE_HELPER_NO_SCALING; > + } > + } else { > + can_scale = plane->can_scale; > + max_scale = plane->max_downscale << 16; > + min_scale = plane->can_scale ? 1 : (1 << 16); > + } > + > + /* > + * FIXME the following code does a bunch of fuzzy adjustments to the > + * coordinates and sizes. We probably need some way to decide whether > + * more strict checking should be done instead. > + */ > + drm_rect_rotate(src, fb->width << 16, fb->height << 16, > + state->base.rotation); > + > + 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); > + BUG_ON(vscale < 0);
Your baseline is already outdated. -- Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx