Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e0828d54 authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

drm/qxl: use embedded gem object



Drop drm_gem_object from qxl_bo, use the
ttm_buffer_object.base instead.

Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Acked-by: default avatarChristian König <christian.koenig@amd.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20190805140119.7337-4-kraxel@redhat.com
parent 0e580c6d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -377,7 +377,7 @@ void qxl_io_destroy_primary(struct qxl_device *qdev)
{
	wait_for_io_cmd(qdev, 0, QXL_IO_DESTROY_PRIMARY_ASYNC);
	qdev->primary_bo->is_primary = false;
	drm_gem_object_put_unlocked(&qdev->primary_bo->gem_base);
	drm_gem_object_put_unlocked(&qdev->primary_bo->tbo.base);
	qdev->primary_bo = NULL;
}

@@ -404,7 +404,7 @@ void qxl_io_create_primary(struct qxl_device *qdev, struct qxl_bo *bo)
	wait_for_io_cmd(qdev, 0, QXL_IO_CREATE_PRIMARY_ASYNC);
	qdev->primary_bo = bo;
	qdev->primary_bo->is_primary = true;
	drm_gem_object_get(&qdev->primary_bo->gem_base);
	drm_gem_object_get(&qdev->primary_bo->tbo.base);
}

void qxl_io_memslot_add(struct qxl_device *qdev, uint8_t id)
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ qxl_debugfs_buffers_info(struct seq_file *m, void *data)
		rcu_read_unlock();

		seq_printf(m, "size %ld, pc %d, num releases %d\n",
			   (unsigned long)bo->gem_base.size,
			   (unsigned long)bo->tbo.base.size,
			   bo->pin_count, rel);
	}
	return 0;
+4 −4
Original line number Diff line number Diff line
@@ -797,7 +797,7 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane,
		    qdev->dumb_shadow_bo->surf.height != surf.height) {
			if (qdev->dumb_shadow_bo) {
				drm_gem_object_put_unlocked
					(&qdev->dumb_shadow_bo->gem_base);
					(&qdev->dumb_shadow_bo->tbo.base);
				qdev->dumb_shadow_bo = NULL;
			}
			qxl_bo_create(qdev, surf.height * surf.stride,
@@ -807,10 +807,10 @@ static int qxl_plane_prepare_fb(struct drm_plane *plane,
		if (user_bo->shadow != qdev->dumb_shadow_bo) {
			if (user_bo->shadow) {
				drm_gem_object_put_unlocked
					(&user_bo->shadow->gem_base);
					(&user_bo->shadow->tbo.base);
				user_bo->shadow = NULL;
			}
			drm_gem_object_get(&qdev->dumb_shadow_bo->gem_base);
			drm_gem_object_get(&qdev->dumb_shadow_bo->tbo.base);
			user_bo->shadow = qdev->dumb_shadow_bo;
		}
	}
@@ -841,7 +841,7 @@ static void qxl_plane_cleanup_fb(struct drm_plane *plane,
	qxl_bo_unpin(user_bo);

	if (old_state->fb != plane->state->fb && user_bo->shadow) {
		drm_gem_object_put_unlocked(&user_bo->shadow->gem_base);
		drm_gem_object_put_unlocked(&user_bo->shadow->tbo.base);
		user_bo->shadow = NULL;
	}
}
+3 −3
Original line number Diff line number Diff line
@@ -71,12 +71,13 @@ extern int qxl_max_ioctls;
	QXL_INTERRUPT_CLIENT_MONITORS_CONFIG)

struct qxl_bo {
	struct ttm_buffer_object	tbo;

	/* Protected by gem.mutex */
	struct list_head		list;
	/* Protected by tbo.reserved */
	struct ttm_place		placements[3];
	struct ttm_placement		placement;
	struct ttm_buffer_object	tbo;
	struct ttm_bo_kmap_obj		kmap;
	unsigned int pin_count;
	void				*kptr;
@@ -84,7 +85,6 @@ struct qxl_bo {
	int                             type;

	/* Constant after initialization */
	struct drm_gem_object		gem_base;
	unsigned int is_primary:1; /* is this now a primary surface */
	unsigned int is_dumb:1;
	struct qxl_bo *shadow;
@@ -93,7 +93,7 @@ struct qxl_bo {
	uint32_t surface_id;
	struct qxl_release *surf_create;
};
#define gem_to_qxl_bo(gobj) container_of((gobj), struct qxl_bo, gem_base)
#define gem_to_qxl_bo(gobj) container_of((gobj), struct qxl_bo, tbo.base)
#define to_qxl_bo(tobj) container_of((tobj), struct qxl_bo, tbo)

struct qxl_gem {
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ int qxl_gem_object_create(struct qxl_device *qdev, int size,
				  size, initial_domain, alignment, r);
		return r;
	}
	*obj = &qbo->gem_base;
	*obj = &qbo->tbo.base;

	mutex_lock(&qdev->gem.mutex);
	list_add_tail(&qbo->list, &qdev->gem.objects);
Loading