Skip to content

Commit 5f5bf6e

Browse files
committed
drm: apple: Use dest rct in offscreen test
The plane state's dst rectangle is what's used to set dcp parameters and the KMS documentation actively recommends that over crtc_x / crtc_y. Signed-off-by: Janne Grunau <[email protected]>
1 parent e875b9f commit 5f5bf6e

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

drivers/gpu/drm/apple/apple_drv.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ static int apple_plane_atomic_check(struct drm_plane *plane,
8181
{
8282
struct drm_plane_state *new_plane_state;
8383
struct drm_crtc_state *crtc_state;
84+
struct drm_rect *dst;
8485
int ret;
8586

8687
new_plane_state = drm_atomic_get_new_plane_state(state, plane);
@@ -122,20 +123,20 @@ static int apple_plane_atomic_check(struct drm_plane *plane,
122123
* This is most pertinent to cursors. Userspace should fall back to
123124
* software cursors if the plane check is rejected.
124125
*/
125-
if ((new_plane_state->crtc_x + 32) > crtc_state->mode.hdisplay ||
126-
(new_plane_state->crtc_y + 32) > crtc_state->mode.vdisplay) {
126+
dst = &new_plane_state->dst;
127+
if (drm_rect_width(dst) < 32 || drm_rect_height(dst) < 32) {
127128
dev_err_once(state->dev->dev,
128129
"Plane operation would have crashed DCP! Rejected!\n\
129130
DCP requires 32x32 of every plane to be within screen space.\n\
130-
Your compositor asked for a screen space area of [%d, %d].\n\
131+
Your compositor asked to overlay [%dx%d, %dx%d] on %dx%d.\n\
131132
This is not supported, and your compositor should have\n\
132133
switched to software compositing when this operation failed.\n\
133134
You should not have noticed this at all. If your screen\n\
134135
froze/hitched, or your compositor crashed, please report\n\
135136
this to the your compositor's developers. We will not\n\
136137
throw this error again until you next reboot.\n",
137-
crtc_state->mode.hdisplay - new_plane_state->crtc_x,
138-
crtc_state->mode.vdisplay - new_plane_state->crtc_y);
138+
dst->x1, dst->y1, dst->x2, dst->y2,
139+
crtc_state->mode.hdisplay, crtc_state->mode.vdisplay);
139140
return -EINVAL;
140141
}
141142

0 commit comments

Comments
 (0)