drm/i915: Use drm_mode_get_hv_timing() to populate plane clip rectangle
Use drm_mode_get_hv_timing() to fill out the plane clip rectangle. No functional changes since pipe_src_w/h are already filled via drm_mode_get_hv_timing(). Once everyone agrees on this we can move the clip handling into drm_atomic_helper_check_plane_state(). Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171123190502.28449-3-ville.syrjala@linux.intel.com Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
parent
0574bd882e
commit
a2936e3d9a
4 changed files with 18 additions and 13 deletions
|
@ -129,14 +129,6 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
|
||||||
if (!intel_state->base.crtc && !old_plane_state->base.crtc)
|
if (!intel_state->base.crtc && !old_plane_state->base.crtc)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Clip all planes to CRTC size, or 0x0 if CRTC is disabled */
|
|
||||||
intel_state->clip.x1 = 0;
|
|
||||||
intel_state->clip.y1 = 0;
|
|
||||||
intel_state->clip.x2 =
|
|
||||||
crtc_state->base.enable ? crtc_state->pipe_src_w : 0;
|
|
||||||
intel_state->clip.y2 =
|
|
||||||
crtc_state->base.enable ? crtc_state->pipe_src_h : 0;
|
|
||||||
|
|
||||||
if (state->fb && drm_rotation_90_or_270(state->rotation)) {
|
if (state->fb && drm_rotation_90_or_270(state->rotation)) {
|
||||||
struct drm_format_name_buf format_name;
|
struct drm_format_name_buf format_name;
|
||||||
|
|
||||||
|
|
|
@ -9317,13 +9317,18 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
|
||||||
struct intel_plane_state *plane_state)
|
struct intel_plane_state *plane_state)
|
||||||
{
|
{
|
||||||
const struct drm_framebuffer *fb = plane_state->base.fb;
|
const struct drm_framebuffer *fb = plane_state->base.fb;
|
||||||
|
struct drm_rect clip = {};
|
||||||
int src_x, src_y;
|
int src_x, src_y;
|
||||||
u32 offset;
|
u32 offset;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (crtc_state->base.enable)
|
||||||
|
drm_mode_get_hv_timing(&crtc_state->base.mode,
|
||||||
|
&clip.x2, &clip.y2);
|
||||||
|
|
||||||
ret = drm_atomic_helper_check_plane_state(&plane_state->base,
|
ret = drm_atomic_helper_check_plane_state(&plane_state->base,
|
||||||
&crtc_state->base,
|
&crtc_state->base,
|
||||||
&plane_state->clip,
|
&clip,
|
||||||
DRM_PLANE_HELPER_NO_SCALING,
|
DRM_PLANE_HELPER_NO_SCALING,
|
||||||
DRM_PLANE_HELPER_NO_SCALING,
|
DRM_PLANE_HELPER_NO_SCALING,
|
||||||
true, true);
|
true, true);
|
||||||
|
@ -12752,6 +12757,7 @@ intel_check_primary_plane(struct intel_plane *plane,
|
||||||
int min_scale = DRM_PLANE_HELPER_NO_SCALING;
|
int min_scale = DRM_PLANE_HELPER_NO_SCALING;
|
||||||
int max_scale = DRM_PLANE_HELPER_NO_SCALING;
|
int max_scale = DRM_PLANE_HELPER_NO_SCALING;
|
||||||
bool can_position = false;
|
bool can_position = false;
|
||||||
|
struct drm_rect clip = {};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (INTEL_GEN(dev_priv) >= 9) {
|
if (INTEL_GEN(dev_priv) >= 9) {
|
||||||
|
@ -12763,9 +12769,13 @@ intel_check_primary_plane(struct intel_plane *plane,
|
||||||
can_position = true;
|
can_position = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (crtc_state->base.enable)
|
||||||
|
drm_mode_get_hv_timing(&crtc_state->base.mode,
|
||||||
|
&clip.x2, &clip.y2);
|
||||||
|
|
||||||
ret = drm_atomic_helper_check_plane_state(&state->base,
|
ret = drm_atomic_helper_check_plane_state(&state->base,
|
||||||
&crtc_state->base,
|
&crtc_state->base,
|
||||||
&state->clip,
|
&clip,
|
||||||
min_scale, max_scale,
|
min_scale, max_scale,
|
||||||
can_position, true);
|
can_position, true);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -406,7 +406,6 @@ struct intel_atomic_state {
|
||||||
|
|
||||||
struct intel_plane_state {
|
struct intel_plane_state {
|
||||||
struct drm_plane_state base;
|
struct drm_plane_state base;
|
||||||
struct drm_rect clip;
|
|
||||||
struct i915_vma *vma;
|
struct i915_vma *vma;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -864,7 +864,7 @@ intel_check_sprite_plane(struct intel_plane *plane,
|
||||||
uint32_t src_x, src_y, src_w, src_h;
|
uint32_t src_x, src_y, src_w, src_h;
|
||||||
struct drm_rect *src = &state->base.src;
|
struct drm_rect *src = &state->base.src;
|
||||||
struct drm_rect *dst = &state->base.dst;
|
struct drm_rect *dst = &state->base.dst;
|
||||||
const struct drm_rect *clip = &state->clip;
|
struct drm_rect clip = {};
|
||||||
int hscale, vscale;
|
int hscale, vscale;
|
||||||
int max_scale, min_scale;
|
int max_scale, min_scale;
|
||||||
bool can_scale;
|
bool can_scale;
|
||||||
|
@ -922,7 +922,11 @@ intel_check_sprite_plane(struct intel_plane *plane,
|
||||||
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);
|
BUG_ON(vscale < 0);
|
||||||
|
|
||||||
state->base.visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
|
if (crtc_state->base.enable)
|
||||||
|
drm_mode_get_hv_timing(&crtc_state->base.mode,
|
||||||
|
&clip.x2, &clip.y2);
|
||||||
|
|
||||||
|
state->base.visible = drm_rect_clip_scaled(src, dst, &clip, hscale, vscale);
|
||||||
|
|
||||||
crtc_x = dst->x1;
|
crtc_x = dst->x1;
|
||||||
crtc_y = dst->y1;
|
crtc_y = dst->y1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue