aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:39:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-14 03:39:08 -0400
commit2d65a9f48fcdf7866aab6457bc707ca233e0c791 (patch)
treef93e5838d6ac2e59434367f4ff905f7d9c45fc2b /drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
parentda92da3638a04894afdca8b99e973ddd20268471 (diff)
parentdfda0df3426483cf5fc7441f23f318edbabecb03 (diff)
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
Pull drm updates from Dave Airlie: "This is the main git pull for the drm, I pretty much froze major pulls at -rc5/6 time, and haven't had much fallout, so will probably continue doing that. Lots of changes all over, big internal header cleanup to make it clear drm features are legacy things and what are things that modern KMS drivers should be using. Also big move to use the new generic fences in all the TTM drivers. core: atomic prep work, vblank rework changes, allows immediate vblank disables major header reworking and cleanups to better delinate legacy interfaces from what KMS drivers should be using. cursor planes locking fixes ttm: move to generic fences (affects all TTM drivers) ppc64 caching fixes radeon: userptr support, uvd for old asics, reset rework for fence changes better buffer placement changes, dpm feature enablement hdmi audio support fixes intel: Cherryview work, 180 degree rotation, skylake prep work, execlist command submission full ppgtt prep work cursor improvements edid caching, vdd handling improvements nouveau: fence reworking kepler memory clock work gt21x clock work fan control improvements hdmi infoframe fixes DP audio ast: ppc64 fixes caching fix rcar: rcar-du DT support ipuv3: prep work for capture support msm: LVDS support for mdp4, new panel, gpu refactoring exynos: exynos3250 SoC support, drop bad mmap interface, mipi dsi changes, and component match support" * 'drm-next' of git://people.freedesktop.org/~airlied/linux: (640 commits) drm/mst: rework payload table allocation to conform better. drm/ast: Fix HW cursor image drm/radeon/kv: add uvd/vce info to dpm debugfs output drm/radeon/ci: add uvd/vce info to dpm debugfs output drm/radeon: export reservation_object from dmabuf to ttm drm/radeon: cope with foreign fences inside the reservation object drm/radeon: cope with foreign fences inside display drm/core: use helper to check driver features drm/radeon/cik: write gfx ucode version to ucode addr reg drm/radeon/si: print full CS when we hit a packet 0 drm/radeon: remove unecessary includes drm/radeon/combios: declare legacy_connector_convert as static drm/radeon/atombios: declare connector convert tables as static drm/radeon: drop btc_get_max_clock_from_voltage_dependency_table drm/radeon/dpm: drop clk/voltage dependency filters for BTC drm/radeon/dpm: drop clk/voltage dependency filters for CI drm/radeon/dpm: drop clk/voltage dependency filters for SI drm/radeon/dpm: drop clk/voltage dependency filters for NI drm/radeon: disable audio when we disable hdmi (v2) drm/radeon: split audio enable between eg and r600 (v2) ...
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c183
1 files changed, 85 insertions, 98 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
index 6327cfc36805..cff2bf9db9d2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
@@ -30,66 +30,101 @@
30#include <drm/ttm/ttm_placement.h> 30#include <drm/ttm/ttm_placement.h>
31#include <drm/ttm/ttm_page_alloc.h> 31#include <drm/ttm/ttm_page_alloc.h>
32 32
33static uint32_t vram_placement_flags = TTM_PL_FLAG_VRAM | 33static struct ttm_place vram_placement_flags = {
34 TTM_PL_FLAG_CACHED; 34 .fpfn = 0,
35 35 .lpfn = 0,
36static uint32_t vram_ne_placement_flags = TTM_PL_FLAG_VRAM | 36 .flags = TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED
37 TTM_PL_FLAG_CACHED | 37};
38 TTM_PL_FLAG_NO_EVICT;
39 38
40static uint32_t sys_placement_flags = TTM_PL_FLAG_SYSTEM | 39static struct ttm_place vram_ne_placement_flags = {
41 TTM_PL_FLAG_CACHED; 40 .fpfn = 0,
41 .lpfn = 0,
42 .flags = TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT
43};
42 44
43static uint32_t sys_ne_placement_flags = TTM_PL_FLAG_SYSTEM | 45static struct ttm_place sys_placement_flags = {
44 TTM_PL_FLAG_CACHED | 46 .fpfn = 0,
45 TTM_PL_FLAG_NO_EVICT; 47 .lpfn = 0,
48 .flags = TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED
49};
46 50
47static uint32_t gmr_placement_flags = VMW_PL_FLAG_GMR | 51static struct ttm_place sys_ne_placement_flags = {
48 TTM_PL_FLAG_CACHED; 52 .fpfn = 0,
53 .lpfn = 0,
54 .flags = TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT
55};
49 56
50static uint32_t gmr_ne_placement_flags = VMW_PL_FLAG_GMR | 57static struct ttm_place gmr_placement_flags = {
51 TTM_PL_FLAG_CACHED | 58 .fpfn = 0,
52 TTM_PL_FLAG_NO_EVICT; 59 .lpfn = 0,
60 .flags = VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED
61};
53 62
54static uint32_t mob_placement_flags = VMW_PL_FLAG_MOB | 63static struct ttm_place gmr_ne_placement_flags = {
55 TTM_PL_FLAG_CACHED; 64 .fpfn = 0,
65 .lpfn = 0,
66 .flags = VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT
67};
56 68
57struct ttm_placement vmw_vram_placement = { 69static struct ttm_place mob_placement_flags = {
58 .fpfn = 0, 70 .fpfn = 0,
59 .lpfn = 0, 71 .lpfn = 0,
72 .flags = VMW_PL_FLAG_MOB | TTM_PL_FLAG_CACHED
73};
74
75struct ttm_placement vmw_vram_placement = {
60 .num_placement = 1, 76 .num_placement = 1,
61 .placement = &vram_placement_flags, 77 .placement = &vram_placement_flags,
62 .num_busy_placement = 1, 78 .num_busy_placement = 1,
63 .busy_placement = &vram_placement_flags 79 .busy_placement = &vram_placement_flags
64}; 80};
65 81
66static uint32_t vram_gmr_placement_flags[] = { 82static struct ttm_place vram_gmr_placement_flags[] = {
67 TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED, 83 {
68 VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED 84 .fpfn = 0,
85 .lpfn = 0,
86 .flags = TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED
87 }, {
88 .fpfn = 0,
89 .lpfn = 0,
90 .flags = VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED
91 }
69}; 92};
70 93
71static uint32_t gmr_vram_placement_flags[] = { 94static struct ttm_place gmr_vram_placement_flags[] = {
72 VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED, 95 {
73 TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED 96 .fpfn = 0,
97 .lpfn = 0,
98 .flags = VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED
99 }, {
100 .fpfn = 0,
101 .lpfn = 0,
102 .flags = TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED
103 }
74}; 104};
75 105
76struct ttm_placement vmw_vram_gmr_placement = { 106struct ttm_placement vmw_vram_gmr_placement = {
77 .fpfn = 0,
78 .lpfn = 0,
79 .num_placement = 2, 107 .num_placement = 2,
80 .placement = vram_gmr_placement_flags, 108 .placement = vram_gmr_placement_flags,
81 .num_busy_placement = 1, 109 .num_busy_placement = 1,
82 .busy_placement = &gmr_placement_flags 110 .busy_placement = &gmr_placement_flags
83}; 111};
84 112
85static uint32_t vram_gmr_ne_placement_flags[] = { 113static struct ttm_place vram_gmr_ne_placement_flags[] = {
86 TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT, 114 {
87 VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED | TTM_PL_FLAG_NO_EVICT 115 .fpfn = 0,
116 .lpfn = 0,
117 .flags = TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED |
118 TTM_PL_FLAG_NO_EVICT
119 }, {
120 .fpfn = 0,
121 .lpfn = 0,
122 .flags = VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED |
123 TTM_PL_FLAG_NO_EVICT
124 }
88}; 125};
89 126
90struct ttm_placement vmw_vram_gmr_ne_placement = { 127struct ttm_placement vmw_vram_gmr_ne_placement = {
91 .fpfn = 0,
92 .lpfn = 0,
93 .num_placement = 2, 128 .num_placement = 2,
94 .placement = vram_gmr_ne_placement_flags, 129 .placement = vram_gmr_ne_placement_flags,
95 .num_busy_placement = 1, 130 .num_busy_placement = 1,
@@ -97,8 +132,6 @@ struct ttm_placement vmw_vram_gmr_ne_placement = {
97}; 132};
98 133
99struct ttm_placement vmw_vram_sys_placement = { 134struct ttm_placement vmw_vram_sys_placement = {
100 .fpfn = 0,
101 .lpfn = 0,
102 .num_placement = 1, 135 .num_placement = 1,
103 .placement = &vram_placement_flags, 136 .placement = &vram_placement_flags,
104 .num_busy_placement = 1, 137 .num_busy_placement = 1,
@@ -106,8 +139,6 @@ struct ttm_placement vmw_vram_sys_placement = {
106}; 139};
107 140
108struct ttm_placement vmw_vram_ne_placement = { 141struct ttm_placement vmw_vram_ne_placement = {
109 .fpfn = 0,
110 .lpfn = 0,
111 .num_placement = 1, 142 .num_placement = 1,
112 .placement = &vram_ne_placement_flags, 143 .placement = &vram_ne_placement_flags,
113 .num_busy_placement = 1, 144 .num_busy_placement = 1,
@@ -115,8 +146,6 @@ struct ttm_placement vmw_vram_ne_placement = {
115}; 146};
116 147
117struct ttm_placement vmw_sys_placement = { 148struct ttm_placement vmw_sys_placement = {
118 .fpfn = 0,
119 .lpfn = 0,
120 .num_placement = 1, 149 .num_placement = 1,
121 .placement = &sys_placement_flags, 150 .placement = &sys_placement_flags,
122 .num_busy_placement = 1, 151 .num_busy_placement = 1,
@@ -124,24 +153,33 @@ struct ttm_placement vmw_sys_placement = {
124}; 153};
125 154
126struct ttm_placement vmw_sys_ne_placement = { 155struct ttm_placement vmw_sys_ne_placement = {
127 .fpfn = 0,
128 .lpfn = 0,
129 .num_placement = 1, 156 .num_placement = 1,
130 .placement = &sys_ne_placement_flags, 157 .placement = &sys_ne_placement_flags,
131 .num_busy_placement = 1, 158 .num_busy_placement = 1,
132 .busy_placement = &sys_ne_placement_flags 159 .busy_placement = &sys_ne_placement_flags
133}; 160};
134 161
135static uint32_t evictable_placement_flags[] = { 162static struct ttm_place evictable_placement_flags[] = {
136 TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED, 163 {
137 TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED, 164 .fpfn = 0,
138 VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED, 165 .lpfn = 0,
139 VMW_PL_FLAG_MOB | TTM_PL_FLAG_CACHED 166 .flags = TTM_PL_FLAG_SYSTEM | TTM_PL_FLAG_CACHED
167 }, {
168 .fpfn = 0,
169 .lpfn = 0,
170 .flags = TTM_PL_FLAG_VRAM | TTM_PL_FLAG_CACHED
171 }, {
172 .fpfn = 0,
173 .lpfn = 0,
174 .flags = VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED
175 }, {
176 .fpfn = 0,
177 .lpfn = 0,
178 .flags = VMW_PL_FLAG_MOB | TTM_PL_FLAG_CACHED
179 }
140}; 180};
141 181
142struct ttm_placement vmw_evictable_placement = { 182struct ttm_placement vmw_evictable_placement = {
143 .fpfn = 0,
144 .lpfn = 0,
145 .num_placement = 4, 183 .num_placement = 4,
146 .placement = evictable_placement_flags, 184 .placement = evictable_placement_flags,
147 .num_busy_placement = 1, 185 .num_busy_placement = 1,
@@ -149,8 +187,6 @@ struct ttm_placement vmw_evictable_placement = {
149}; 187};
150 188
151struct ttm_placement vmw_srf_placement = { 189struct ttm_placement vmw_srf_placement = {
152 .fpfn = 0,
153 .lpfn = 0,
154 .num_placement = 1, 190 .num_placement = 1,
155 .num_busy_placement = 2, 191 .num_busy_placement = 2,
156 .placement = &gmr_placement_flags, 192 .placement = &gmr_placement_flags,
@@ -158,8 +194,6 @@ struct ttm_placement vmw_srf_placement = {
158}; 194};
159 195
160struct ttm_placement vmw_mob_placement = { 196struct ttm_placement vmw_mob_placement = {
161 .fpfn = 0,
162 .lpfn = 0,
163 .num_placement = 1, 197 .num_placement = 1,
164 .num_busy_placement = 1, 198 .num_busy_placement = 1,
165 .placement = &mob_placement_flags, 199 .placement = &mob_placement_flags,
@@ -768,44 +802,6 @@ static int vmw_ttm_fault_reserve_notify(struct ttm_buffer_object *bo)
768} 802}
769 803
770/** 804/**
771 * FIXME: We're using the old vmware polling method to sync.
772 * Do this with fences instead.
773 */
774
775static void *vmw_sync_obj_ref(void *sync_obj)
776{
777
778 return (void *)
779 vmw_fence_obj_reference((struct vmw_fence_obj *) sync_obj);
780}
781
782static void vmw_sync_obj_unref(void **sync_obj)
783{
784 vmw_fence_obj_unreference((struct vmw_fence_obj **) sync_obj);
785}
786
787static int vmw_sync_obj_flush(void *sync_obj)
788{
789 vmw_fence_obj_flush((struct vmw_fence_obj *) sync_obj);
790 return 0;
791}
792
793static bool vmw_sync_obj_signaled(void *sync_obj)
794{
795 return vmw_fence_obj_signaled((struct vmw_fence_obj *) sync_obj,
796 DRM_VMW_FENCE_FLAG_EXEC);
797
798}
799
800static int vmw_sync_obj_wait(void *sync_obj, bool lazy, bool interruptible)
801{
802 return vmw_fence_obj_wait((struct vmw_fence_obj *) sync_obj,
803 DRM_VMW_FENCE_FLAG_EXEC,
804 lazy, interruptible,
805 VMW_FENCE_WAIT_TIMEOUT);
806}
807
808/**
809 * vmw_move_notify - TTM move_notify_callback 805 * vmw_move_notify - TTM move_notify_callback
810 * 806 *
811 * @bo: The TTM buffer object about to move. 807 * @bo: The TTM buffer object about to move.
@@ -829,11 +825,7 @@ static void vmw_move_notify(struct ttm_buffer_object *bo,
829 */ 825 */
830static void vmw_swap_notify(struct ttm_buffer_object *bo) 826static void vmw_swap_notify(struct ttm_buffer_object *bo)
831{ 827{
832 struct ttm_bo_device *bdev = bo->bdev;
833
834 spin_lock(&bdev->fence_lock);
835 ttm_bo_wait(bo, false, false, false); 828 ttm_bo_wait(bo, false, false, false);
836 spin_unlock(&bdev->fence_lock);
837} 829}
838 830
839 831
@@ -846,11 +838,6 @@ struct ttm_bo_driver vmw_bo_driver = {
846 .evict_flags = vmw_evict_flags, 838 .evict_flags = vmw_evict_flags,
847 .move = NULL, 839 .move = NULL,
848 .verify_access = vmw_verify_access, 840 .verify_access = vmw_verify_access,
849 .sync_obj_signaled = vmw_sync_obj_signaled,
850 .sync_obj_wait = vmw_sync_obj_wait,
851 .sync_obj_flush = vmw_sync_obj_flush,
852 .sync_obj_unref = vmw_sync_obj_unref,
853 .sync_obj_ref = vmw_sync_obj_ref,
854 .move_notify = vmw_move_notify, 841 .move_notify = vmw_move_notify,
855 .swap_notify = vmw_swap_notify, 842 .swap_notify = vmw_swap_notify,
856 .fault_reserve_notify = &vmw_ttm_fault_reserve_notify, 843 .fault_reserve_notify = &vmw_ttm_fault_reserve_notify,