Commit 7a31805b authored by Gerd Hoffmann's avatar Gerd Hoffmann Committed by Sean Paul

qxl: keep separate release_bo pointer

qxl expects that list_first_entry(release->bos) returns the first
element qxl added to the list.  ttm_eu_reserve_buffers() may reorder
the list though.

Add a release_bo field to struct qxl_release and use that instead.
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20180418054257.15388-3-kraxel@redhat.comSigned-off-by: default avatarSean Paul <seanpaul@chromium.org>
parent 66c0255c
...@@ -179,10 +179,9 @@ qxl_push_command_ring_release(struct qxl_device *qdev, struct qxl_release *relea ...@@ -179,10 +179,9 @@ qxl_push_command_ring_release(struct qxl_device *qdev, struct qxl_release *relea
uint32_t type, bool interruptible) uint32_t type, bool interruptible)
{ {
struct qxl_command cmd; struct qxl_command cmd;
struct qxl_bo_list *entry = list_first_entry(&release->bos, struct qxl_bo_list, tv.head);
cmd.type = type; cmd.type = type;
cmd.data = qxl_bo_physical_address(qdev, to_qxl_bo(entry->tv.bo), release->release_offset); cmd.data = qxl_bo_physical_address(qdev, release->release_bo, release->release_offset);
return qxl_ring_push(qdev->command_ring, &cmd, interruptible); return qxl_ring_push(qdev->command_ring, &cmd, interruptible);
} }
...@@ -192,10 +191,9 @@ qxl_push_cursor_ring_release(struct qxl_device *qdev, struct qxl_release *releas ...@@ -192,10 +191,9 @@ qxl_push_cursor_ring_release(struct qxl_device *qdev, struct qxl_release *releas
uint32_t type, bool interruptible) uint32_t type, bool interruptible)
{ {
struct qxl_command cmd; struct qxl_command cmd;
struct qxl_bo_list *entry = list_first_entry(&release->bos, struct qxl_bo_list, tv.head);
cmd.type = type; cmd.type = type;
cmd.data = qxl_bo_physical_address(qdev, to_qxl_bo(entry->tv.bo), release->release_offset); cmd.data = qxl_bo_physical_address(qdev, release->release_bo, release->release_offset);
return qxl_ring_push(qdev->cursor_ring, &cmd, interruptible); return qxl_ring_push(qdev->cursor_ring, &cmd, interruptible);
} }
......
...@@ -167,6 +167,7 @@ struct qxl_release { ...@@ -167,6 +167,7 @@ struct qxl_release {
int id; int id;
int type; int type;
struct qxl_bo *release_bo;
uint32_t release_offset; uint32_t release_offset;
uint32_t surface_release_id; uint32_t surface_release_id;
struct ww_acquire_ctx ticket; struct ww_acquire_ctx ticket;
......
...@@ -173,6 +173,7 @@ qxl_release_free_list(struct qxl_release *release) ...@@ -173,6 +173,7 @@ qxl_release_free_list(struct qxl_release *release)
list_del(&entry->tv.head); list_del(&entry->tv.head);
kfree(entry); kfree(entry);
} }
release->release_bo = NULL;
} }
void void
...@@ -296,7 +297,6 @@ int qxl_alloc_surface_release_reserved(struct qxl_device *qdev, ...@@ -296,7 +297,6 @@ int qxl_alloc_surface_release_reserved(struct qxl_device *qdev,
{ {
if (surface_cmd_type == QXL_SURFACE_CMD_DESTROY && create_rel) { if (surface_cmd_type == QXL_SURFACE_CMD_DESTROY && create_rel) {
int idr_ret; int idr_ret;
struct qxl_bo_list *entry = list_first_entry(&create_rel->bos, struct qxl_bo_list, tv.head);
struct qxl_bo *bo; struct qxl_bo *bo;
union qxl_release_info *info; union qxl_release_info *info;
...@@ -304,8 +304,9 @@ int qxl_alloc_surface_release_reserved(struct qxl_device *qdev, ...@@ -304,8 +304,9 @@ int qxl_alloc_surface_release_reserved(struct qxl_device *qdev,
idr_ret = qxl_release_alloc(qdev, QXL_RELEASE_SURFACE_CMD, release); idr_ret = qxl_release_alloc(qdev, QXL_RELEASE_SURFACE_CMD, release);
if (idr_ret < 0) if (idr_ret < 0)
return idr_ret; return idr_ret;
bo = to_qxl_bo(entry->tv.bo); bo = create_rel->release_bo;
(*release)->release_bo = bo;
(*release)->release_offset = create_rel->release_offset + 64; (*release)->release_offset = create_rel->release_offset + 64;
qxl_release_list_add(*release, bo); qxl_release_list_add(*release, bo);
...@@ -365,6 +366,7 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, ...@@ -365,6 +366,7 @@ int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size,
bo = qxl_bo_ref(qdev->current_release_bo[cur_idx]); bo = qxl_bo_ref(qdev->current_release_bo[cur_idx]);
(*release)->release_bo = bo;
(*release)->release_offset = qdev->current_release_bo_offset[cur_idx] * release_size_per_bo[cur_idx]; (*release)->release_offset = qdev->current_release_bo_offset[cur_idx] * release_size_per_bo[cur_idx];
qdev->current_release_bo_offset[cur_idx]++; qdev->current_release_bo_offset[cur_idx]++;
...@@ -408,8 +410,7 @@ union qxl_release_info *qxl_release_map(struct qxl_device *qdev, ...@@ -408,8 +410,7 @@ union qxl_release_info *qxl_release_map(struct qxl_device *qdev,
{ {
void *ptr; void *ptr;
union qxl_release_info *info; union qxl_release_info *info;
struct qxl_bo_list *entry = list_first_entry(&release->bos, struct qxl_bo_list, tv.head); struct qxl_bo *bo = release->release_bo;
struct qxl_bo *bo = to_qxl_bo(entry->tv.bo);
ptr = qxl_bo_kmap_atomic_page(qdev, bo, release->release_offset & PAGE_MASK); ptr = qxl_bo_kmap_atomic_page(qdev, bo, release->release_offset & PAGE_MASK);
if (!ptr) if (!ptr)
...@@ -422,8 +423,7 @@ void qxl_release_unmap(struct qxl_device *qdev, ...@@ -422,8 +423,7 @@ void qxl_release_unmap(struct qxl_device *qdev,
struct qxl_release *release, struct qxl_release *release,
union qxl_release_info *info) union qxl_release_info *info)
{ {
struct qxl_bo_list *entry = list_first_entry(&release->bos, struct qxl_bo_list, tv.head); struct qxl_bo *bo = release->release_bo;
struct qxl_bo *bo = to_qxl_bo(entry->tv.bo);
void *ptr; void *ptr;
ptr = ((void *)info) - (release->release_offset & ~PAGE_MASK); ptr = ((void *)info) - (release->release_offset & ~PAGE_MASK);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment