Skip to content

Commit 51baf79

Browse files
committed
drm/qxl: Use the hotspot properties from cursor planes
jira VULN-136708 cve-bf CVE-2025-38449 commit-author Zack Rusin <zackr@vmware.com> commit 305b391 Atomic modesetting got support for mouse hotspots via the hotspot properties. Port the legacy kms hotspot handling to the new properties on cursor planes. Signed-off-by: Zack Rusin <zackr@vmware.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: virtualization@lists.linux-foundation.org Cc: spice-devel@lists.freedesktop.org Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20231023074613.41327-5-aesteve@redhat.com (cherry picked from commit 305b391) Signed-off-by: Roxana Nicolescu <rnicolescu@ciq.com>
1 parent 9613890 commit 51baf79

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/gpu/drm/qxl/qxl_display.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ static int qxl_primary_atomic_check(struct drm_plane *plane,
485485
static int qxl_primary_apply_cursor(struct qxl_device *qdev,
486486
struct drm_plane_state *plane_state)
487487
{
488-
struct drm_framebuffer *fb = plane_state->fb;
489488
struct qxl_crtc *qcrtc = to_qxl_crtc(plane_state->crtc);
490489
struct qxl_cursor_cmd *cmd;
491490
struct qxl_release *release;
@@ -510,8 +509,8 @@ static int qxl_primary_apply_cursor(struct qxl_device *qdev,
510509

511510
cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
512511
cmd->type = QXL_CURSOR_SET;
513-
cmd->u.set.position.x = plane_state->crtc_x + fb->hot_x;
514-
cmd->u.set.position.y = plane_state->crtc_y + fb->hot_y;
512+
cmd->u.set.position.x = plane_state->crtc_x + plane_state->hotspot_x;
513+
cmd->u.set.position.y = plane_state->crtc_y + plane_state->hotspot_y;
515514

516515
cmd->u.set.shape = qxl_bo_physical_address(qdev, qcrtc->cursor_bo, 0);
517516

@@ -531,7 +530,6 @@ static int qxl_primary_apply_cursor(struct qxl_device *qdev,
531530
static int qxl_primary_move_cursor(struct qxl_device *qdev,
532531
struct drm_plane_state *plane_state)
533532
{
534-
struct drm_framebuffer *fb = plane_state->fb;
535533
struct qxl_crtc *qcrtc = to_qxl_crtc(plane_state->crtc);
536534
struct qxl_cursor_cmd *cmd;
537535
struct qxl_release *release;
@@ -554,8 +552,8 @@ static int qxl_primary_move_cursor(struct qxl_device *qdev,
554552

555553
cmd = (struct qxl_cursor_cmd *)qxl_release_map(qdev, release);
556554
cmd->type = QXL_CURSOR_MOVE;
557-
cmd->u.position.x = plane_state->crtc_x + fb->hot_x;
558-
cmd->u.position.y = plane_state->crtc_y + fb->hot_y;
555+
cmd->u.position.x = plane_state->crtc_x + plane_state->hotspot_x;
556+
cmd->u.position.y = plane_state->crtc_y + plane_state->hotspot_y;
559557
qxl_release_unmap(qdev, release, &cmd->release_info);
560558

561559
qxl_release_fence_buffer_objects(release);
@@ -851,8 +849,8 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane,
851849
struct qxl_bo *old_cursor_bo = qcrtc->cursor_bo;
852850

853851
qcrtc->cursor_bo = qxl_create_cursor(qdev, user_bo,
854-
new_state->fb->hot_x,
855-
new_state->fb->hot_y);
852+
new_state->hotspot_x,
853+
new_state->hotspot_y);
856854
qxl_free_cursor(old_cursor_bo);
857855
}
858856

0 commit comments

Comments
 (0)