|
@@ -512,23 +512,25 @@ static void qxl_primary_atomic_update(struct drm_plane *plane,
|
|
|
.y2 = qfb->base.height
|
|
|
};
|
|
|
|
|
|
- if (!old_state->fb) {
|
|
|
- qxl_io_log(qdev,
|
|
|
- "create primary fb: %dx%d,%d,%d\n",
|
|
|
- bo->surf.width, bo->surf.height,
|
|
|
- bo->surf.stride, bo->surf.format);
|
|
|
+ if (old_state->fb) {
|
|
|
+ qfb_old = to_qxl_framebuffer(old_state->fb);
|
|
|
+ bo_old = gem_to_qxl_bo(qfb_old->obj);
|
|
|
+ } else {
|
|
|
+ bo_old = NULL;
|
|
|
+ }
|
|
|
|
|
|
- qxl_io_create_primary(qdev, 0, bo);
|
|
|
- bo->is_primary = true;
|
|
|
+ if (bo == bo_old)
|
|
|
return;
|
|
|
|
|
|
- } else {
|
|
|
- qfb_old = to_qxl_framebuffer(old_state->fb);
|
|
|
- bo_old = gem_to_qxl_bo(qfb_old->obj);
|
|
|
+ if (bo_old && bo_old->is_primary) {
|
|
|
+ qxl_io_destroy_primary(qdev);
|
|
|
bo_old->is_primary = false;
|
|
|
}
|
|
|
|
|
|
- bo->is_primary = true;
|
|
|
+ if (!bo->is_primary) {
|
|
|
+ qxl_io_create_primary(qdev, 0, bo);
|
|
|
+ bo->is_primary = true;
|
|
|
+ }
|
|
|
qxl_draw_dirty_fb(qdev, qfb, bo, 0, 0, &norect, 1, 1);
|
|
|
}
|
|
|
|
|
@@ -537,13 +539,15 @@ static void qxl_primary_atomic_disable(struct drm_plane *plane,
|
|
|
{
|
|
|
struct qxl_device *qdev = plane->dev->dev_private;
|
|
|
|
|
|
- if (old_state->fb)
|
|
|
- { struct qxl_framebuffer *qfb =
|
|
|
+ if (old_state->fb) {
|
|
|
+ struct qxl_framebuffer *qfb =
|
|
|
to_qxl_framebuffer(old_state->fb);
|
|
|
struct qxl_bo *bo = gem_to_qxl_bo(qfb->obj);
|
|
|
|
|
|
- qxl_io_destroy_primary(qdev);
|
|
|
- bo->is_primary = false;
|
|
|
+ if (bo->is_primary) {
|
|
|
+ qxl_io_destroy_primary(qdev);
|
|
|
+ bo->is_primary = false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|