Skip to content

Commit 4640bfa

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 <j@jannau.net>
1 parent 869bc1e commit 4640bfa

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
@@ -82,6 +82,7 @@ static int apple_plane_atomic_check(struct drm_plane *plane,
8282
{
8383
struct drm_plane_state *new_plane_state;
8484
struct drm_crtc_state *crtc_state;
85+
struct drm_rect *dst;
8586
int ret;
8687

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

0 commit comments

Comments
 (0)