All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/qxl: workaround broken qxl hw primary setting.
@ 2017-10-19  1:53 Dave Airlie
  2017-10-19  7:29 ` Frediano Ziglio
  2017-10-19 11:28 ` [Spice-devel] " Frediano Ziglio
  0 siblings, 2 replies; 4+ messages in thread
From: Dave Airlie @ 2017-10-19  1:53 UTC (permalink / raw)
  To: dri-devel; +Cc: spice-devel, kraxel

From: Dave Airlie <airlied@redhat.com>

QXL hw can't change primary surfaces easily, the server sends a msg
and the client flickers a lo when it does. The old pre-atomic
page flip code endeavoured to workaround this with a copy operation.

This worked by another accident of how the qxl virtual gpu is designed,
it does lazy operation evaluation on the host, so this operation
wouldn't generally trash the memory, and result in correct display.

This tries to work out when the commit is likely just a pageflip
and avoid touching the primary surface, this might go wrong at
some point but I believe it's the same level as wrong as the old code
base.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/qxl/qxl_display.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index afbf50d..3b702d1 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -502,6 +502,7 @@ static void qxl_primary_atomic_update(struct drm_plane *plane,
 	struct qxl_framebuffer *qfb_old;
 	struct qxl_bo *bo = gem_to_qxl_bo(qfb->obj);
 	struct qxl_bo *bo_old;
+	bool update_primary = true;
 	struct drm_clip_rect norect = {
 	    .x1 = 0,
 	    .y1 = 0,
@@ -519,15 +520,31 @@ static void qxl_primary_atomic_update(struct drm_plane *plane,
 	if (bo == bo_old)
 		return;
 
+	if (bo && bo_old &&
+	    plane->state->crtc == old_state->crtc &&
+	    plane->state->crtc_w == old_state->crtc_w &&
+	    plane->state->crtc_h == old_state->crtc_h &&
+	    plane->state->src_x == old_state->src_x &&
+	    plane->state->src_y == old_state->src_y &&
+	    plane->state->src_w == old_state->src_w &&
+	    plane->state->src_h == old_state->src_h &&
+	    plane->state->rotation == old_state->rotation &&
+	    plane->state->zpos == old_state->zpos)
+		/* this is likely a pageflip */
+		update_primary = false;
+
 	if (bo_old && bo_old->is_primary) {
-		qxl_io_destroy_primary(qdev);
+		if (update_primary)
+			qxl_io_destroy_primary(qdev);
 		bo_old->is_primary = false;
 	}
 
 	if (!bo->is_primary) {
-		qxl_io_create_primary(qdev, 0, bo);
+		if (update_primary)
+			qxl_io_create_primary(qdev, 0, bo);
 		bo->is_primary = true;
 	}
+
 	qxl_draw_dirty_fb(qdev, qfb, bo, 0, 0, &norect, 1, 1);
 }
 
-- 
2.9.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-19 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-19  1:53 [PATCH] drm/qxl: workaround broken qxl hw primary setting Dave Airlie
2017-10-19  7:29 ` Frediano Ziglio
2017-10-19 11:28 ` [Spice-devel] " Frediano Ziglio
2017-10-19 13:36   ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.