Skip to content

Commit a2936e3

Browse files
committed
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 <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Daniel Vetter <[email protected]> Reviewed-by: Thierry Reding <[email protected]>
1 parent 0574bd8 commit a2936e3

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

drivers/gpu/drm/i915/intel_atomic_plane.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,6 @@ int intel_plane_atomic_check_with_state(const struct intel_crtc_state *old_crtc_
129129
if (!intel_state->base.crtc && !old_plane_state->base.crtc)
130130
return 0;
131131

132-
/* Clip all planes to CRTC size, or 0x0 if CRTC is disabled */
133-
intel_state->clip.x1 = 0;
134-
intel_state->clip.y1 = 0;
135-
intel_state->clip.x2 =
136-
crtc_state->base.enable ? crtc_state->pipe_src_w : 0;
137-
intel_state->clip.y2 =
138-
crtc_state->base.enable ? crtc_state->pipe_src_h : 0;
139-
140132
if (state->fb && drm_rotation_90_or_270(state->rotation)) {
141133
struct drm_format_name_buf format_name;
142134

drivers/gpu/drm/i915/intel_display.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9317,13 +9317,18 @@ static int intel_check_cursor(struct intel_crtc_state *crtc_state,
93179317
struct intel_plane_state *plane_state)
93189318
{
93199319
const struct drm_framebuffer *fb = plane_state->base.fb;
9320+
struct drm_rect clip = {};
93209321
int src_x, src_y;
93219322
u32 offset;
93229323
int ret;
93239324

9325+
if (crtc_state->base.enable)
9326+
drm_mode_get_hv_timing(&crtc_state->base.mode,
9327+
&clip.x2, &clip.y2);
9328+
93249329
ret = drm_atomic_helper_check_plane_state(&plane_state->base,
93259330
&crtc_state->base,
9326-
&plane_state->clip,
9331+
&clip,
93279332
DRM_PLANE_HELPER_NO_SCALING,
93289333
DRM_PLANE_HELPER_NO_SCALING,
93299334
true, true);
@@ -12752,6 +12757,7 @@ intel_check_primary_plane(struct intel_plane *plane,
1275212757
int min_scale = DRM_PLANE_HELPER_NO_SCALING;
1275312758
int max_scale = DRM_PLANE_HELPER_NO_SCALING;
1275412759
bool can_position = false;
12760+
struct drm_rect clip = {};
1275512761
int ret;
1275612762

1275712763
if (INTEL_GEN(dev_priv) >= 9) {
@@ -12763,9 +12769,13 @@ intel_check_primary_plane(struct intel_plane *plane,
1276312769
can_position = true;
1276412770
}
1276512771

12772+
if (crtc_state->base.enable)
12773+
drm_mode_get_hv_timing(&crtc_state->base.mode,
12774+
&clip.x2, &clip.y2);
12775+
1276612776
ret = drm_atomic_helper_check_plane_state(&state->base,
1276712777
&crtc_state->base,
12768-
&state->clip,
12778+
&clip,
1276912779
min_scale, max_scale,
1277012780
can_position, true);
1277112781
if (ret)

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,6 @@ struct intel_atomic_state {
406406

407407
struct intel_plane_state {
408408
struct drm_plane_state base;
409-
struct drm_rect clip;
410409
struct i915_vma *vma;
411410

412411
struct {

drivers/gpu/drm/i915/intel_sprite.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ intel_check_sprite_plane(struct intel_plane *plane,
864864
uint32_t src_x, src_y, src_w, src_h;
865865
struct drm_rect *src = &state->base.src;
866866
struct drm_rect *dst = &state->base.dst;
867-
const struct drm_rect *clip = &state->clip;
867+
struct drm_rect clip = {};
868868
int hscale, vscale;
869869
int max_scale, min_scale;
870870
bool can_scale;
@@ -922,7 +922,11 @@ intel_check_sprite_plane(struct intel_plane *plane,
922922
vscale = drm_rect_calc_vscale_relaxed(src, dst, min_scale, max_scale);
923923
BUG_ON(vscale < 0);
924924

925-
state->base.visible = drm_rect_clip_scaled(src, dst, clip, hscale, vscale);
925+
if (crtc_state->base.enable)
926+
drm_mode_get_hv_timing(&crtc_state->base.mode,
927+
&clip.x2, &clip.y2);
928+
929+
state->base.visible = drm_rect_clip_scaled(src, dst, &clip, hscale, vscale);
926930

927931
crtc_x = dst->x1;
928932
crtc_y = dst->y1;

0 commit comments

Comments
 (0)