diff options
Diffstat (limited to 'drivers/gpu/drm/qxl/qxl_drv.h')
-rw-r--r-- | drivers/gpu/drm/qxl/qxl_drv.h | 76 |
1 files changed, 41 insertions, 35 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h index aacb791464a3..7e96f4f11738 100644 --- a/drivers/gpu/drm/qxl/qxl_drv.h +++ b/drivers/gpu/drm/qxl/qxl_drv.h | |||
@@ -42,6 +42,9 @@ | |||
42 | #include <ttm/ttm_placement.h> | 42 | #include <ttm/ttm_placement.h> |
43 | #include <ttm/ttm_module.h> | 43 | #include <ttm/ttm_module.h> |
44 | 44 | ||
45 | /* just for ttm_validate_buffer */ | ||
46 | #include <ttm/ttm_execbuf_util.h> | ||
47 | |||
45 | #include <drm/qxl_drm.h> | 48 | #include <drm/qxl_drm.h> |
46 | #include "qxl_dev.h" | 49 | #include "qxl_dev.h" |
47 | 50 | ||
@@ -118,9 +121,9 @@ struct qxl_bo { | |||
118 | uint32_t surface_id; | 121 | uint32_t surface_id; |
119 | struct qxl_fence fence; /* per bo fence - list of releases */ | 122 | struct qxl_fence fence; /* per bo fence - list of releases */ |
120 | struct qxl_release *surf_create; | 123 | struct qxl_release *surf_create; |
121 | atomic_t reserve_count; | ||
122 | }; | 124 | }; |
123 | #define gem_to_qxl_bo(gobj) container_of((gobj), struct qxl_bo, gem_base) | 125 | #define gem_to_qxl_bo(gobj) container_of((gobj), struct qxl_bo, gem_base) |
126 | #define to_qxl_bo(tobj) container_of((tobj), struct qxl_bo, tbo) | ||
124 | 127 | ||
125 | struct qxl_gem { | 128 | struct qxl_gem { |
126 | struct mutex mutex; | 129 | struct mutex mutex; |
@@ -128,12 +131,7 @@ struct qxl_gem { | |||
128 | }; | 131 | }; |
129 | 132 | ||
130 | struct qxl_bo_list { | 133 | struct qxl_bo_list { |
131 | struct list_head lhead; | 134 | struct ttm_validate_buffer tv; |
132 | struct qxl_bo *bo; | ||
133 | }; | ||
134 | |||
135 | struct qxl_reloc_list { | ||
136 | struct list_head bos; | ||
137 | }; | 135 | }; |
138 | 136 | ||
139 | struct qxl_crtc { | 137 | struct qxl_crtc { |
@@ -195,10 +193,20 @@ enum { | |||
195 | struct qxl_release { | 193 | struct qxl_release { |
196 | int id; | 194 | int id; |
197 | int type; | 195 | int type; |
198 | int bo_count; | ||
199 | uint32_t release_offset; | 196 | uint32_t release_offset; |
200 | uint32_t surface_release_id; | 197 | uint32_t surface_release_id; |
201 | struct qxl_bo *bos[QXL_MAX_RES]; | 198 | struct ww_acquire_ctx ticket; |
199 | struct list_head bos; | ||
200 | }; | ||
201 | |||
202 | struct qxl_drm_chunk { | ||
203 | struct list_head head; | ||
204 | struct qxl_bo *bo; | ||
205 | }; | ||
206 | |||
207 | struct qxl_drm_image { | ||
208 | struct qxl_bo *bo; | ||
209 | struct list_head chunk_list; | ||
202 | }; | 210 | }; |
203 | 211 | ||
204 | struct qxl_fb_image { | 212 | struct qxl_fb_image { |
@@ -314,6 +322,7 @@ struct qxl_device { | |||
314 | struct workqueue_struct *gc_queue; | 322 | struct workqueue_struct *gc_queue; |
315 | struct work_struct gc_work; | 323 | struct work_struct gc_work; |
316 | 324 | ||
325 | struct work_struct fb_work; | ||
317 | }; | 326 | }; |
318 | 327 | ||
319 | /* forward declaration for QXL_INFO_IO */ | 328 | /* forward declaration for QXL_INFO_IO */ |
@@ -433,12 +442,19 @@ int qxl_mmap(struct file *filp, struct vm_area_struct *vma); | |||
433 | 442 | ||
434 | /* qxl image */ | 443 | /* qxl image */ |
435 | 444 | ||
436 | int qxl_image_create(struct qxl_device *qdev, | 445 | int qxl_image_init(struct qxl_device *qdev, |
437 | struct qxl_release *release, | 446 | struct qxl_release *release, |
438 | struct qxl_bo **image_bo, | 447 | struct qxl_drm_image *dimage, |
439 | const uint8_t *data, | 448 | const uint8_t *data, |
440 | int x, int y, int width, int height, | 449 | int x, int y, int width, int height, |
441 | int depth, int stride); | 450 | int depth, int stride); |
451 | int | ||
452 | qxl_image_alloc_objects(struct qxl_device *qdev, | ||
453 | struct qxl_release *release, | ||
454 | struct qxl_drm_image **image_ptr, | ||
455 | int height, int stride); | ||
456 | void qxl_image_free_objects(struct qxl_device *qdev, struct qxl_drm_image *dimage); | ||
457 | |||
442 | void qxl_update_screen(struct qxl_device *qxl); | 458 | void qxl_update_screen(struct qxl_device *qxl); |
443 | 459 | ||
444 | /* qxl io operations (qxl_cmd.c) */ | 460 | /* qxl io operations (qxl_cmd.c) */ |
@@ -459,20 +475,15 @@ int qxl_ring_push(struct qxl_ring *ring, const void *new_elt, bool interruptible | |||
459 | void qxl_io_flush_release(struct qxl_device *qdev); | 475 | void qxl_io_flush_release(struct qxl_device *qdev); |
460 | void qxl_io_flush_surfaces(struct qxl_device *qdev); | 476 | void qxl_io_flush_surfaces(struct qxl_device *qdev); |
461 | 477 | ||
462 | int qxl_release_reserve(struct qxl_device *qdev, | ||
463 | struct qxl_release *release, bool no_wait); | ||
464 | void qxl_release_unreserve(struct qxl_device *qdev, | ||
465 | struct qxl_release *release); | ||
466 | union qxl_release_info *qxl_release_map(struct qxl_device *qdev, | 478 | union qxl_release_info *qxl_release_map(struct qxl_device *qdev, |
467 | struct qxl_release *release); | 479 | struct qxl_release *release); |
468 | void qxl_release_unmap(struct qxl_device *qdev, | 480 | void qxl_release_unmap(struct qxl_device *qdev, |
469 | struct qxl_release *release, | 481 | struct qxl_release *release, |
470 | union qxl_release_info *info); | 482 | union qxl_release_info *info); |
471 | /* | 483 | int qxl_release_list_add(struct qxl_release *release, struct qxl_bo *bo); |
472 | * qxl_bo_add_resource. | 484 | int qxl_release_reserve_list(struct qxl_release *release, bool no_intr); |
473 | * | 485 | void qxl_release_backoff_reserve_list(struct qxl_release *release); |
474 | */ | 486 | void qxl_release_fence_buffer_objects(struct qxl_release *release); |
475 | void qxl_bo_add_resource(struct qxl_bo *main_bo, struct qxl_bo *resource); | ||
476 | 487 | ||
477 | int qxl_alloc_surface_release_reserved(struct qxl_device *qdev, | 488 | int qxl_alloc_surface_release_reserved(struct qxl_device *qdev, |
478 | enum qxl_surface_cmd_type surface_cmd_type, | 489 | enum qxl_surface_cmd_type surface_cmd_type, |
@@ -481,15 +492,16 @@ int qxl_alloc_surface_release_reserved(struct qxl_device *qdev, | |||
481 | int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, | 492 | int qxl_alloc_release_reserved(struct qxl_device *qdev, unsigned long size, |
482 | int type, struct qxl_release **release, | 493 | int type, struct qxl_release **release, |
483 | struct qxl_bo **rbo); | 494 | struct qxl_bo **rbo); |
484 | int qxl_fence_releaseable(struct qxl_device *qdev, | 495 | |
485 | struct qxl_release *release); | ||
486 | int | 496 | int |
487 | qxl_push_command_ring_release(struct qxl_device *qdev, struct qxl_release *release, | 497 | qxl_push_command_ring_release(struct qxl_device *qdev, struct qxl_release *release, |
488 | uint32_t type, bool interruptible); | 498 | uint32_t type, bool interruptible); |
489 | int | 499 | int |
490 | qxl_push_cursor_ring_release(struct qxl_device *qdev, struct qxl_release *release, | 500 | qxl_push_cursor_ring_release(struct qxl_device *qdev, struct qxl_release *release, |
491 | uint32_t type, bool interruptible); | 501 | uint32_t type, bool interruptible); |
492 | int qxl_alloc_bo_reserved(struct qxl_device *qdev, unsigned long size, | 502 | int qxl_alloc_bo_reserved(struct qxl_device *qdev, |
503 | struct qxl_release *release, | ||
504 | unsigned long size, | ||
493 | struct qxl_bo **_bo); | 505 | struct qxl_bo **_bo); |
494 | /* qxl drawing commands */ | 506 | /* qxl drawing commands */ |
495 | 507 | ||
@@ -510,15 +522,9 @@ void qxl_draw_copyarea(struct qxl_device *qdev, | |||
510 | u32 sx, u32 sy, | 522 | u32 sx, u32 sy, |
511 | u32 dx, u32 dy); | 523 | u32 dx, u32 dy); |
512 | 524 | ||
513 | uint64_t | ||
514 | qxl_release_alloc(struct qxl_device *qdev, int type, | ||
515 | struct qxl_release **ret); | ||
516 | |||
517 | void qxl_release_free(struct qxl_device *qdev, | 525 | void qxl_release_free(struct qxl_device *qdev, |
518 | struct qxl_release *release); | 526 | struct qxl_release *release); |
519 | void qxl_release_add_res(struct qxl_device *qdev, | 527 | |
520 | struct qxl_release *release, | ||
521 | struct qxl_bo *bo); | ||
522 | /* used by qxl_debugfs_release */ | 528 | /* used by qxl_debugfs_release */ |
523 | struct qxl_release *qxl_release_from_id_locked(struct qxl_device *qdev, | 529 | struct qxl_release *qxl_release_from_id_locked(struct qxl_device *qdev, |
524 | uint64_t id); | 530 | uint64_t id); |
@@ -561,7 +567,7 @@ void qxl_surface_evict(struct qxl_device *qdev, struct qxl_bo *surf, bool freein | |||
561 | int qxl_update_surface(struct qxl_device *qdev, struct qxl_bo *surf); | 567 | int qxl_update_surface(struct qxl_device *qdev, struct qxl_bo *surf); |
562 | 568 | ||
563 | /* qxl_fence.c */ | 569 | /* qxl_fence.c */ |
564 | int qxl_fence_add_release(struct qxl_fence *qfence, uint32_t rel_id); | 570 | void qxl_fence_add_release_locked(struct qxl_fence *qfence, uint32_t rel_id); |
565 | int qxl_fence_remove_release(struct qxl_fence *qfence, uint32_t rel_id); | 571 | int qxl_fence_remove_release(struct qxl_fence *qfence, uint32_t rel_id); |
566 | int qxl_fence_init(struct qxl_device *qdev, struct qxl_fence *qfence); | 572 | int qxl_fence_init(struct qxl_device *qdev, struct qxl_fence *qfence); |
567 | void qxl_fence_fini(struct qxl_fence *qfence); | 573 | void qxl_fence_fini(struct qxl_fence *qfence); |