summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/qxl/qxl_display.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-01-18 13:20:10 +0100
committerGerd Hoffmann <kraxel@redhat.com>2019-01-28 14:24:53 +0100
commit4979904c62b9c0af492e679fb04f675ad5f238f2 (patch)
tree58e49aa78717bb468bec5a95e5ef49c35fe493b2 /drivers/gpu/drm/qxl/qxl_display.c
parentdrm/qxl: track primary bo (diff)
downloadlinux-4979904c62b9c0af492e679fb04f675ad5f238f2.tar.xz
linux-4979904c62b9c0af492e679fb04f675ad5f238f2.zip
drm/qxl: use shadow bo directly
Pass the shadow bo to qxl_io_create_primary() instead of expecting qxl_io_create_primary to check bo->shadow. Set is_primary flag on the shadow bo. Move the is_primary tracking into qxl_io_create_primary() and qxl_io_destroy_primary() functions. That simplifies primary surface tracking and the workflow in qxl_primary_atomic_update(). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Noralf Trønnes <noralf@tronnes.org> Link: http://patchwork.freedesktop.org/patch/msgid/20190118122020.27596-14-kraxel@redhat.com qxl_io_create/destroy_primary: primary_bo tracking [fixup]
Diffstat (limited to 'drivers/gpu/drm/qxl/qxl_display.c')
-rw-r--r--drivers/gpu/drm/qxl/qxl_display.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index a0db90788824..455b1b595a09 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -401,13 +401,15 @@ static int qxl_framebuffer_surface_dirty(struct drm_framebuffer *fb,
struct qxl_device *qdev = fb->dev->dev_private;
struct drm_clip_rect norect;
struct qxl_bo *qobj;
+ bool is_primary;
int inc = 1;
drm_modeset_lock_all(fb->dev);
qobj = gem_to_qxl_bo(fb->obj[0]);
/* if we aren't primary surface ignore this */
- if (!qobj->is_primary) {
+ is_primary = qobj->shadow ? qobj->shadow->is_primary : qobj->is_primary;
+ if (!is_primary) {
drm_modeset_unlock_all(fb->dev);
return 0;
}
@@ -526,14 +528,13 @@ static void qxl_primary_atomic_update(struct drm_plane *plane,
{
struct qxl_device *qdev = plane->dev->dev_private;
struct qxl_bo *bo = gem_to_qxl_bo(plane->state->fb->obj[0]);
- struct qxl_bo *bo_old;
+ struct qxl_bo *bo_old, *primary;
struct drm_clip_rect norect = {
.x1 = 0,
.y1 = 0,
.x2 = plane->state->fb->width,
.y2 = plane->state->fb->height
};
- bool same_shadow = false;
if (old_state->fb) {
bo_old = gem_to_qxl_bo(old_state->fb->obj[0]);
@@ -541,26 +542,13 @@ static void qxl_primary_atomic_update(struct drm_plane *plane,
bo_old = NULL;
}
- if (bo == bo_old)
- return;
-
- if (bo_old && bo_old->shadow && bo->shadow &&
- bo_old->shadow == bo->shadow) {
- same_shadow = true;
- }
+ primary = bo->shadow ? bo->shadow : bo;
- if (bo_old && bo_old->is_primary) {
- if (!same_shadow)
+ if (!primary->is_primary) {
+ if (qdev->primary_bo)
qxl_io_destroy_primary(qdev);
- bo_old->is_primary = false;
- }
-
- if (!bo->is_primary) {
- if (!same_shadow) {
- qxl_io_create_primary(qdev, bo);
- qxl_primary_apply_cursor(plane);
- }
- bo->is_primary = true;
+ qxl_io_create_primary(qdev, primary);
+ qxl_primary_apply_cursor(plane);
}
qxl_draw_dirty_fb(qdev, plane->state->fb, bo, 0, 0, &norect, 1, 1);
@@ -756,6 +744,7 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane,
qxl_bo_create(qdev, user_bo->gem_base.size,
true, true, QXL_GEM_DOMAIN_SURFACE, NULL,
&user_bo->shadow);
+ user_bo->shadow->surf = user_bo->surf;
}
}
@@ -784,7 +773,7 @@ static void qxl_plane_cleanup_fb(struct drm_plane *plane,
user_bo = gem_to_qxl_bo(obj);
qxl_bo_unpin(user_bo);
- if (user_bo->shadow && !user_bo->is_primary) {
+ if (user_bo->shadow && !user_bo->shadow->is_primary) {
drm_gem_object_put_unlocked(&user_bo->shadow->gem_base);
user_bo->shadow = NULL;
}