Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'vmwgfx-next' of git://people.freedesktop.org/~thomash/linux into drm-next

A couple of independent patches extracted from the 5.3 pull request, fixed for
merge conflicts and a single unused variable warning.

And the drmP.h removal from Sam.

Signed-off-by: Dave Airlie <airlied@redhat.com>

+265 -396
-100
drivers/gpu/drm/vmwgfx/ttm_lock.c
··· 29 29 * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com> 30 30 */ 31 31 32 - #include <drm/ttm/ttm_module.h> 33 32 #include <linux/atomic.h> 34 33 #include <linux/errno.h> 35 34 #include <linux/wait.h> ··· 48 49 init_waitqueue_head(&lock->queue); 49 50 lock->rw = 0; 50 51 lock->flags = 0; 51 - lock->kill_takers = false; 52 - lock->signal = SIGKILL; 53 52 } 54 53 55 54 void ttm_read_unlock(struct ttm_lock *lock) ··· 63 66 bool locked = false; 64 67 65 68 spin_lock(&lock->lock); 66 - if (unlikely(lock->kill_takers)) { 67 - send_sig(lock->signal, current, 0); 68 - spin_unlock(&lock->lock); 69 - return false; 70 - } 71 69 if (lock->rw >= 0 && lock->flags == 0) { 72 70 ++lock->rw; 73 71 locked = true; ··· 90 98 *locked = false; 91 99 92 100 spin_lock(&lock->lock); 93 - if (unlikely(lock->kill_takers)) { 94 - send_sig(lock->signal, current, 0); 95 - spin_unlock(&lock->lock); 96 - return false; 97 - } 98 101 if (lock->rw >= 0 && lock->flags == 0) { 99 102 ++lock->rw; 100 103 block = false; ··· 134 147 bool locked = false; 135 148 136 149 spin_lock(&lock->lock); 137 - if (unlikely(lock->kill_takers)) { 138 - send_sig(lock->signal, current, 0); 139 - spin_unlock(&lock->lock); 140 - return false; 141 - } 142 150 if (lock->rw == 0 && ((lock->flags & ~TTM_WRITE_LOCK_PENDING) == 0)) { 143 151 lock->rw = -1; 144 152 lock->flags &= ~TTM_WRITE_LOCK_PENDING; ··· 162 180 wait_event(lock->queue, __ttm_write_lock(lock)); 163 181 164 182 return ret; 165 - } 166 - 167 - static int __ttm_vt_unlock(struct ttm_lock *lock) 168 - { 169 - int ret = 0; 170 - 171 - spin_lock(&lock->lock); 172 - if (unlikely(!(lock->flags & TTM_VT_LOCK))) 173 - ret = -EINVAL; 174 - lock->flags &= ~TTM_VT_LOCK; 175 - wake_up_all(&lock->queue); 176 - spin_unlock(&lock->lock); 177 - 178 - return ret; 179 - } 180 - 181 - static void ttm_vt_lock_remove(struct ttm_base_object **p_base) 182 - { 183 - struct ttm_base_object *base = *p_base; 184 - struct ttm_lock *lock = container_of(base, struct ttm_lock, base); 185 - int ret; 186 - 187 - *p_base = NULL; 188 - ret = __ttm_vt_unlock(lock); 189 - BUG_ON(ret != 0); 190 - } 191 - 192 - static bool __ttm_vt_lock(struct ttm_lock *lock) 193 - { 194 - bool locked = false; 195 - 196 - spin_lock(&lock->lock); 197 - if (lock->rw == 0) { 198 - lock->flags &= ~TTM_VT_LOCK_PENDING; 199 - lock->flags |= TTM_VT_LOCK; 200 - locked = true; 201 - } else { 202 - lock->flags |= TTM_VT_LOCK_PENDING; 203 - } 204 - spin_unlock(&lock->lock); 205 - return locked; 206 - } 207 - 208 - int ttm_vt_lock(struct ttm_lock *lock, 209 - bool interruptible, 210 - struct ttm_object_file *tfile) 211 - { 212 - int ret = 0; 213 - 214 - if (interruptible) { 215 - ret = wait_event_interruptible(lock->queue, 216 - __ttm_vt_lock(lock)); 217 - if (unlikely(ret != 0)) { 218 - spin_lock(&lock->lock); 219 - lock->flags &= ~TTM_VT_LOCK_PENDING; 220 - wake_up_all(&lock->queue); 221 - spin_unlock(&lock->lock); 222 - return ret; 223 - } 224 - } else 225 - wait_event(lock->queue, __ttm_vt_lock(lock)); 226 - 227 - /* 228 - * Add a base-object, the destructor of which will 229 - * make sure the lock is released if the client dies 230 - * while holding it. 231 - */ 232 - 233 - ret = ttm_base_object_init(tfile, &lock->base, false, 234 - ttm_lock_type, &ttm_vt_lock_remove, NULL); 235 - if (ret) 236 - (void)__ttm_vt_unlock(lock); 237 - else 238 - lock->vt_holder = tfile; 239 - 240 - return ret; 241 - } 242 - 243 - int ttm_vt_unlock(struct ttm_lock *lock) 244 - { 245 - return ttm_ref_object_base_unref(lock->vt_holder, 246 - lock->base.handle, TTM_REF_USAGE); 247 183 } 248 184 249 185 void ttm_suspend_unlock(struct ttm_lock *lock)
+1 -31
drivers/gpu/drm/vmwgfx/ttm_lock.h
··· 49 49 #ifndef _TTM_LOCK_H_ 50 50 #define _TTM_LOCK_H_ 51 51 52 - #include <linux/wait.h> 53 52 #include <linux/atomic.h> 53 + #include <linux/wait.h> 54 54 55 55 #include "ttm_object.h" 56 56 ··· 63 63 * @lock: Spinlock protecting some lock members. 64 64 * @rw: Read-write lock counter. Protected by @lock. 65 65 * @flags: Lock state. Protected by @lock. 66 - * @kill_takers: Boolean whether to kill takers of the lock. 67 - * @signal: Signal to send when kill_takers is true. 68 66 */ 69 67 70 68 struct ttm_lock { ··· 71 73 spinlock_t lock; 72 74 int32_t rw; 73 75 uint32_t flags; 74 - bool kill_takers; 75 - int signal; 76 - struct ttm_object_file *vt_holder; 77 76 }; 78 77 79 78 ··· 214 219 * -ERESTARTSYS If interrupted by a signal and interruptible is true. 215 220 */ 216 221 extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible); 217 - 218 - /** 219 - * ttm_lock_set_kill 220 - * 221 - * @lock: Pointer to a struct ttm_lock 222 - * @val: Boolean whether to kill processes taking the lock. 223 - * @signal: Signal to send to the process taking the lock. 224 - * 225 - * The kill-when-taking-lock functionality is used to kill processes that keep 226 - * on using the TTM functionality when its resources has been taken down, for 227 - * example when the X server exits. A typical sequence would look like this: 228 - * - X server takes lock in write mode. 229 - * - ttm_lock_set_kill() is called with @val set to true. 230 - * - As part of X server exit, TTM resources are taken down. 231 - * - X server releases the lock on file release. 232 - * - Another dri client wants to render, takes the lock and is killed. 233 - * 234 - */ 235 - static inline void ttm_lock_set_kill(struct ttm_lock *lock, bool val, 236 - int signal) 237 - { 238 - lock->kill_takers = val; 239 - if (val) 240 - lock->signal = signal; 241 - } 242 222 243 223 #endif
+5 -4
drivers/gpu/drm/vmwgfx/ttm_object.h
··· 37 37 #ifndef _TTM_OBJECT_H_ 38 38 #define _TTM_OBJECT_H_ 39 39 40 - #include <linux/list.h> 41 - #include <drm/drm_hashtab.h> 42 - #include <linux/kref.h> 43 - #include <linux/rcupdate.h> 44 40 #include <linux/dma-buf.h> 41 + #include <linux/kref.h> 42 + #include <linux/list.h> 43 + #include <linux/rcupdate.h> 44 + 45 + #include <drm/drm_hashtab.h> 45 46 #include <drm/ttm/ttm_memory.h> 46 47 47 48 /**
+2 -1
drivers/gpu/drm/vmwgfx/vmwgfx_binding.h
··· 27 27 #ifndef _VMWGFX_BINDING_H_ 28 28 #define _VMWGFX_BINDING_H_ 29 29 30 - #include "device_include/svga3d_reg.h" 31 30 #include <linux/list.h> 31 + 32 + #include "device_include/svga3d_reg.h" 32 33 33 34 #define VMW_MAX_VIEW_BINDINGS 128 34 35
+2 -1
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
··· 28 28 29 29 #include <drm/ttm/ttm_placement.h> 30 30 31 - #include <drm/drmP.h> 32 31 #include "vmwgfx_drv.h" 33 32 #include "ttm_object.h" 34 33 ··· 509 510 510 511 acc_size = vmw_bo_acc_size(dev_priv, size, user); 511 512 memset(vmw_bo, 0, sizeof(*vmw_bo)); 513 + BUILD_BUG_ON(TTM_MAX_BO_PRIORITY <= 3); 514 + vmw_bo->base.priority = 3; 512 515 513 516 INIT_LIST_HEAD(&vmw_bo->res_list); 514 517
+3
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 + #include <linux/dmapool.h> 29 + #include <linux/pci.h> 30 + 28 31 #include <drm/ttm/ttm_bo_api.h> 29 32 30 33 #include "vmwgfx_drv.h"
+4
drivers/gpu/drm/vmwgfx/vmwgfx_context.c
··· 88 88 .res_type = vmw_res_context, 89 89 .needs_backup = true, 90 90 .may_evict = true, 91 + .prio = 3, 92 + .dirty_prio = 3, 91 93 .type_name = "guest backed contexts", 92 94 .backup_placement = &vmw_mob_placement, 93 95 .create = vmw_gb_context_create, ··· 102 100 .res_type = vmw_res_dx_context, 103 101 .needs_backup = true, 104 102 .may_evict = true, 103 + .prio = 3, 104 + .dirty_prio = 3, 105 105 .type_name = "dx contexts", 106 106 .backup_placement = &vmw_mob_placement, 107 107 .create = vmw_dx_context_create,
+8 -5
drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c
··· 116 116 .res_type = vmw_res_cotable, 117 117 .needs_backup = true, 118 118 .may_evict = true, 119 + .prio = 3, 120 + .dirty_prio = 3, 119 121 .type_name = "context guest backed object tables", 120 122 .backup_placement = &vmw_mob_placement, 121 123 .create = vmw_cotable_create, ··· 309 307 struct ttm_buffer_object *bo = val_buf->bo; 310 308 struct vmw_fence_obj *fence; 311 309 312 - if (list_empty(&res->mob_head)) 310 + if (!vmw_resource_mob_attached(res)) 313 311 return 0; 314 312 315 313 WARN_ON_ONCE(bo->mem.mem_type != VMW_PL_MOB); ··· 455 453 goto out_wait; 456 454 } 457 455 456 + vmw_resource_mob_detach(res); 458 457 res->backup = buf; 459 458 res->backup_size = new_size; 460 459 vcotbl->size_read_back = cur_size_read_back; ··· 470 467 res->backup = old_buf; 471 468 res->backup_size = old_size; 472 469 vcotbl->size_read_back = old_size_read_back; 470 + vmw_resource_mob_attach(res); 473 471 goto out_wait; 474 472 } 475 473 474 + vmw_resource_mob_attach(res); 476 475 /* Let go of the old mob. */ 477 - list_del(&res->mob_head); 478 - list_add_tail(&res->mob_head, &buf->res_list); 479 476 vmw_bo_unreference(&old_buf); 480 477 res->id = vcotbl->type; 481 478 ··· 499 496 * is called before bind() in the validation sequence is instead used for two 500 497 * things. 501 498 * 1) Unscrub the cotable if it is scrubbed and still attached to a backup 502 - * buffer, that is, if @res->mob_head is non-empty. 499 + * buffer. 503 500 * 2) Resize the cotable if needed. 504 501 */ 505 502 static int vmw_cotable_create(struct vmw_resource *res) ··· 515 512 new_size *= 2; 516 513 517 514 if (likely(new_size <= res->backup_size)) { 518 - if (vcotbl->scrubbed && !list_empty(&res->mob_head)) { 515 + if (vcotbl->scrubbed && vmw_resource_mob_attached(res)) { 519 516 ret = vmw_cotable_unscrub(res); 520 517 if (ret) 521 518 return ret;
+13 -167
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
··· 24 24 * USE OR OTHER DEALINGS IN THE SOFTWARE. 25 25 * 26 26 **************************************************************************/ 27 - #include <linux/module.h> 27 + 28 28 #include <linux/console.h> 29 29 #include <linux/dma-mapping.h> 30 + #include <linux/module.h> 30 31 31 - #include <drm/drmP.h> 32 - #include "vmwgfx_drv.h" 33 - #include "vmwgfx_binding.h" 34 - #include "ttm_object.h" 35 - #include <drm/ttm/ttm_placement.h> 32 + #include <drm/drm_drv.h> 33 + #include <drm/drm_ioctl.h> 34 + #include <drm/drm_pci.h> 35 + #include <drm/drm_sysfs.h> 36 36 #include <drm/ttm/ttm_bo_driver.h> 37 37 #include <drm/ttm/ttm_module.h> 38 + #include <drm/ttm/ttm_placement.h> 39 + 40 + #include "ttm_object.h" 41 + #include "vmwgfx_binding.h" 42 + #include "vmwgfx_drv.h" 38 43 39 44 #define VMWGFX_DRIVER_DESC "Linux drm driver for VMware graphics devices" 40 45 #define VMWGFX_CHIP_SVGAII 0 ··· 259 254 static int vmw_assume_16bpp; 260 255 261 256 static int vmw_probe(struct pci_dev *, const struct pci_device_id *); 262 - static void vmw_master_init(struct vmw_master *); 263 257 static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val, 264 258 void *ptr); 265 259 ··· 768 764 DRM_INFO("MMIO at 0x%08x size is %u kiB\n", 769 765 dev_priv->mmio_start, dev_priv->mmio_size / 1024); 770 766 771 - vmw_master_init(&dev_priv->fbdev_master); 772 - ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM); 773 - dev_priv->active_master = &dev_priv->fbdev_master; 774 - 775 767 dev_priv->mmio_virt = memremap(dev_priv->mmio_start, 776 768 dev_priv->mmio_size, MEMREMAP_WB); 777 769 ··· 1009 1009 static void vmw_postclose(struct drm_device *dev, 1010 1010 struct drm_file *file_priv) 1011 1011 { 1012 - struct vmw_fpriv *vmw_fp; 1013 - 1014 - vmw_fp = vmw_fpriv(file_priv); 1015 - 1016 - if (vmw_fp->locked_master) { 1017 - struct vmw_master *vmaster = 1018 - vmw_master(vmw_fp->locked_master); 1019 - 1020 - ttm_lock_set_kill(&vmaster->lock, true, SIGTERM); 1021 - ttm_vt_unlock(&vmaster->lock); 1022 - drm_master_put(&vmw_fp->locked_master); 1023 - } 1012 + struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv); 1024 1013 1025 1014 ttm_object_file_release(&vmw_fp->tfile); 1026 1015 kfree(vmw_fp); ··· 1038 1049 return ret; 1039 1050 } 1040 1051 1041 - static struct vmw_master *vmw_master_check(struct drm_device *dev, 1042 - struct drm_file *file_priv, 1043 - unsigned int flags) 1044 - { 1045 - int ret; 1046 - struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv); 1047 - struct vmw_master *vmaster; 1048 - 1049 - if (!drm_is_primary_client(file_priv) || !(flags & DRM_AUTH)) 1050 - return NULL; 1051 - 1052 - ret = mutex_lock_interruptible(&dev->master_mutex); 1053 - if (unlikely(ret != 0)) 1054 - return ERR_PTR(-ERESTARTSYS); 1055 - 1056 - if (drm_is_current_master(file_priv)) { 1057 - mutex_unlock(&dev->master_mutex); 1058 - return NULL; 1059 - } 1060 - 1061 - /* 1062 - * Check if we were previously master, but now dropped. In that 1063 - * case, allow at least render node functionality. 1064 - */ 1065 - if (vmw_fp->locked_master) { 1066 - mutex_unlock(&dev->master_mutex); 1067 - 1068 - if (flags & DRM_RENDER_ALLOW) 1069 - return NULL; 1070 - 1071 - DRM_ERROR("Dropped master trying to access ioctl that " 1072 - "requires authentication.\n"); 1073 - return ERR_PTR(-EACCES); 1074 - } 1075 - mutex_unlock(&dev->master_mutex); 1076 - 1077 - /* 1078 - * Take the TTM lock. Possibly sleep waiting for the authenticating 1079 - * master to become master again, or for a SIGTERM if the 1080 - * authenticating master exits. 1081 - */ 1082 - vmaster = vmw_master(file_priv->master); 1083 - ret = ttm_read_lock(&vmaster->lock, true); 1084 - if (unlikely(ret != 0)) 1085 - vmaster = ERR_PTR(ret); 1086 - 1087 - return vmaster; 1088 - } 1089 - 1090 1052 static long vmw_generic_ioctl(struct file *filp, unsigned int cmd, 1091 1053 unsigned long arg, 1092 1054 long (*ioctl_func)(struct file *, unsigned int, ··· 1046 1106 struct drm_file *file_priv = filp->private_data; 1047 1107 struct drm_device *dev = file_priv->minor->dev; 1048 1108 unsigned int nr = DRM_IOCTL_NR(cmd); 1049 - struct vmw_master *vmaster; 1050 1109 unsigned int flags; 1051 - long ret; 1052 1110 1053 1111 /* 1054 1112 * Do extra checking on driver private ioctls. ··· 1072 1134 } else if (!drm_ioctl_flags(nr, &flags)) 1073 1135 return -EINVAL; 1074 1136 1075 - vmaster = vmw_master_check(dev, file_priv, flags); 1076 - if (IS_ERR(vmaster)) { 1077 - ret = PTR_ERR(vmaster); 1078 - 1079 - if (ret != -ERESTARTSYS) 1080 - DRM_INFO("IOCTL ERROR Command %d, Error %ld.\n", 1081 - nr, ret); 1082 - return ret; 1083 - } 1084 - 1085 - ret = ioctl_func(filp, cmd, arg); 1086 - if (vmaster) 1087 - ttm_read_unlock(&vmaster->lock); 1088 - 1089 - return ret; 1137 + return ioctl_func(filp, cmd, arg); 1090 1138 1091 1139 out_io_encoding: 1092 1140 DRM_ERROR("Invalid command format, ioctl %d\n", ··· 1095 1171 } 1096 1172 #endif 1097 1173 1098 - static void vmw_master_init(struct vmw_master *vmaster) 1099 - { 1100 - ttm_lock_init(&vmaster->lock); 1101 - } 1102 - 1103 - static int vmw_master_create(struct drm_device *dev, 1104 - struct drm_master *master) 1105 - { 1106 - struct vmw_master *vmaster; 1107 - 1108 - vmaster = kzalloc(sizeof(*vmaster), GFP_KERNEL); 1109 - if (unlikely(!vmaster)) 1110 - return -ENOMEM; 1111 - 1112 - vmw_master_init(vmaster); 1113 - ttm_lock_set_kill(&vmaster->lock, true, SIGTERM); 1114 - master->driver_priv = vmaster; 1115 - 1116 - return 0; 1117 - } 1118 - 1119 - static void vmw_master_destroy(struct drm_device *dev, 1120 - struct drm_master *master) 1121 - { 1122 - struct vmw_master *vmaster = vmw_master(master); 1123 - 1124 - master->driver_priv = NULL; 1125 - kfree(vmaster); 1126 - } 1127 - 1128 1174 static int vmw_master_set(struct drm_device *dev, 1129 1175 struct drm_file *file_priv, 1130 1176 bool from_open) 1131 1177 { 1132 - struct vmw_private *dev_priv = vmw_priv(dev); 1133 - struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv); 1134 - struct vmw_master *active = dev_priv->active_master; 1135 - struct vmw_master *vmaster = vmw_master(file_priv->master); 1136 - int ret = 0; 1137 - 1138 - if (active) { 1139 - BUG_ON(active != &dev_priv->fbdev_master); 1140 - ret = ttm_vt_lock(&active->lock, false, vmw_fp->tfile); 1141 - if (unlikely(ret != 0)) 1142 - return ret; 1143 - 1144 - ttm_lock_set_kill(&active->lock, true, SIGTERM); 1145 - dev_priv->active_master = NULL; 1146 - } 1147 - 1148 - ttm_lock_set_kill(&vmaster->lock, false, SIGTERM); 1149 - if (!from_open) { 1150 - ttm_vt_unlock(&vmaster->lock); 1151 - BUG_ON(vmw_fp->locked_master != file_priv->master); 1152 - drm_master_put(&vmw_fp->locked_master); 1153 - } 1154 - 1155 - dev_priv->active_master = vmaster; 1156 - 1157 1178 /* 1158 1179 * Inform a new master that the layout may have changed while 1159 1180 * it was gone. ··· 1113 1244 struct drm_file *file_priv) 1114 1245 { 1115 1246 struct vmw_private *dev_priv = vmw_priv(dev); 1116 - struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv); 1117 - struct vmw_master *vmaster = vmw_master(file_priv->master); 1118 - int ret; 1119 1247 1120 - /** 1121 - * Make sure the master doesn't disappear while we have 1122 - * it locked. 1123 - */ 1124 - 1125 - vmw_fp->locked_master = drm_master_get(file_priv->master); 1126 - ret = ttm_vt_lock(&vmaster->lock, false, vmw_fp->tfile); 1127 1248 vmw_kms_legacy_hotspot_clear(dev_priv); 1128 - if (unlikely((ret != 0))) { 1129 - DRM_ERROR("Unable to lock TTM at VT switch.\n"); 1130 - drm_master_put(&vmw_fp->locked_master); 1131 - } 1132 - 1133 - ttm_lock_set_kill(&vmaster->lock, false, SIGTERM); 1134 - 1135 1249 if (!dev_priv->enable_fb) 1136 1250 vmw_svga_disable(dev_priv); 1137 - 1138 - dev_priv->active_master = &dev_priv->fbdev_master; 1139 - ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM); 1140 - ttm_vt_unlock(&dev_priv->fbdev_master.lock); 1141 1251 } 1142 1252 1143 1253 /** ··· 1394 1546 .disable_vblank = vmw_disable_vblank, 1395 1547 .ioctls = vmw_ioctls, 1396 1548 .num_ioctls = ARRAY_SIZE(vmw_ioctls), 1397 - .master_create = vmw_master_create, 1398 - .master_destroy = vmw_master_destroy, 1399 1549 .master_set = vmw_master_set, 1400 1550 .master_drop = vmw_master_drop, 1401 1551 .open = vmw_driver_open,
+102 -24
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
··· 28 28 #ifndef _VMWGFX_DRV_H_ 29 29 #define _VMWGFX_DRV_H_ 30 30 31 - #include "vmwgfx_validation.h" 32 - #include "vmwgfx_reg.h" 33 - #include <drm/drmP.h> 34 - #include <drm/vmwgfx_drm.h> 35 - #include <drm/drm_hashtab.h> 36 - #include <drm/drm_auth.h> 37 31 #include <linux/suspend.h> 32 + #include <linux/sync_file.h> 33 + 34 + #include <drm/drm_auth.h> 35 + #include <drm/drm_device.h> 36 + #include <drm/drm_file.h> 37 + #include <drm/drm_hashtab.h> 38 + #include <drm/drm_rect.h> 39 + 38 40 #include <drm/ttm/ttm_bo_driver.h> 39 41 #include <drm/ttm/ttm_execbuf_util.h> 40 42 #include <drm/ttm/ttm_module.h> 41 - #include "vmwgfx_fence.h" 42 - #include "ttm_object.h" 43 + 43 44 #include "ttm_lock.h" 44 - #include <linux/sync_file.h> 45 + #include "ttm_object.h" 46 + 47 + #include "vmwgfx_fence.h" 48 + #include "vmwgfx_reg.h" 49 + #include "vmwgfx_validation.h" 50 + 51 + /* 52 + * FIXME: vmwgfx_drm.h needs to be last due to dependencies. 53 + * uapi headers should not depend on header files outside uapi/. 54 + */ 55 + #include <drm/vmwgfx_drm.h> 56 + 45 57 46 58 #define VMWGFX_DRIVER_NAME "vmwgfx" 47 59 #define VMWGFX_DRIVER_DATE "20180704" ··· 93 81 #define VMW_RES_SHADER ttm_driver_type4 94 82 95 83 struct vmw_fpriv { 96 - struct drm_master *locked_master; 97 84 struct ttm_object_file *tfile; 98 85 bool gb_aware; /* user-space is guest-backed aware */ 99 86 }; 100 87 88 + /** 89 + * struct vmw_buffer_object - TTM buffer object with vmwgfx additions 90 + * @base: The TTM buffer object 91 + * @res_list: List of resources using this buffer object as a backing MOB 92 + * @pin_count: pin depth 93 + * @dx_query_ctx: DX context if this buffer object is used as a DX query MOB 94 + * @map: Kmap object for semi-persistent mappings 95 + * @res_prios: Eviction priority counts for attached resources 96 + */ 101 97 struct vmw_buffer_object { 102 98 struct ttm_buffer_object base; 103 99 struct list_head res_list; ··· 114 94 struct vmw_resource *dx_query_ctx; 115 95 /* Protected by reservation */ 116 96 struct ttm_bo_kmap_obj map; 97 + u32 res_prios[TTM_MAX_BO_PRIORITY]; 117 98 }; 118 99 119 100 /** ··· 166 145 struct kref kref; 167 146 struct vmw_private *dev_priv; 168 147 int id; 148 + u32 used_prio; 169 149 unsigned long backup_size; 170 150 bool res_dirty; 171 151 bool backup_dirty; ··· 398 376 struct vmw_legacy_display; 399 377 struct vmw_overlay; 400 378 401 - struct vmw_master { 402 - struct ttm_lock lock; 403 - }; 404 - 405 379 struct vmw_vga_topology_state { 406 380 uint32_t width; 407 381 uint32_t height; ··· 555 537 spinlock_t svga_lock; 556 538 557 539 /** 558 - * Master management. 540 + * PM management. 559 541 */ 560 - 561 - struct vmw_master *active_master; 562 - struct vmw_master fbdev_master; 563 542 struct notifier_block pm_nb; 564 543 bool refuse_hibernation; 565 544 bool suspend_locked; ··· 620 605 static inline struct vmw_fpriv *vmw_fpriv(struct drm_file *file_priv) 621 606 { 622 607 return (struct vmw_fpriv *)file_priv->driver_priv; 623 - } 624 - 625 - static inline struct vmw_master *vmw_master(struct drm_master *master) 626 - { 627 - return (struct vmw_master *) master->driver_priv; 628 608 } 629 609 630 610 /* ··· 714 704 extern int vmw_query_readback_all(struct vmw_buffer_object *dx_query_mob); 715 705 extern void vmw_resource_evict_all(struct vmw_private *dev_priv); 716 706 extern void vmw_resource_unbind_list(struct vmw_buffer_object *vbo); 707 + void vmw_resource_mob_attach(struct vmw_resource *res); 708 + void vmw_resource_mob_detach(struct vmw_resource *res); 709 + 710 + /** 711 + * vmw_resource_mob_attached - Whether a resource currently has a mob attached 712 + * @res: The resource 713 + * 714 + * Return: true if the resource has a mob attached, false otherwise. 715 + */ 716 + static inline bool vmw_resource_mob_attached(const struct vmw_resource *res) 717 + { 718 + return !list_empty(&res->mob_head); 719 + } 717 720 718 721 /** 719 722 * vmw_user_resource_noref_release - release a user resource pointer looked up ··· 805 782 ttm_base_object_noref_release(); 806 783 } 807 784 785 + /** 786 + * vmw_bo_adjust_prio - Adjust the buffer object eviction priority 787 + * according to attached resources 788 + * @vbo: The struct vmw_buffer_object 789 + */ 790 + static inline void vmw_bo_prio_adjust(struct vmw_buffer_object *vbo) 791 + { 792 + int i = ARRAY_SIZE(vbo->res_prios); 793 + 794 + while (i--) { 795 + if (vbo->res_prios[i]) { 796 + vbo->base.priority = i; 797 + return; 798 + } 799 + } 800 + 801 + vbo->base.priority = 3; 802 + } 803 + 804 + /** 805 + * vmw_bo_prio_add - Notify a buffer object of a newly attached resource 806 + * eviction priority 807 + * @vbo: The struct vmw_buffer_object 808 + * @prio: The resource priority 809 + * 810 + * After being notified, the code assigns the highest resource eviction priority 811 + * to the backing buffer object (mob). 812 + */ 813 + static inline void vmw_bo_prio_add(struct vmw_buffer_object *vbo, int prio) 814 + { 815 + if (vbo->res_prios[prio]++ == 0) 816 + vmw_bo_prio_adjust(vbo); 817 + } 818 + 819 + /** 820 + * vmw_bo_prio_del - Notify a buffer object of a resource with a certain 821 + * priority being removed 822 + * @vbo: The struct vmw_buffer_object 823 + * @prio: The resource priority 824 + * 825 + * After being notified, the code assigns the highest resource eviction priority 826 + * to the backing buffer object (mob). 827 + */ 828 + static inline void vmw_bo_prio_del(struct vmw_buffer_object *vbo, int prio) 829 + { 830 + if (--vbo->res_prios[prio] == 0) 831 + vmw_bo_prio_adjust(vbo); 832 + } 808 833 809 834 /** 810 835 * Misc Ioctl functionality - vmwgfx_ioctl.c ··· 1082 1011 int vmw_kms_write_svga(struct vmw_private *vmw_priv, 1083 1012 unsigned width, unsigned height, unsigned pitch, 1084 1013 unsigned bpp, unsigned depth); 1085 - void vmw_kms_idle_workqueues(struct vmw_master *vmaster); 1086 1014 bool vmw_kms_validate_mode_vram(struct vmw_private *dev_priv, 1087 1015 uint32_t pitch, 1088 1016 uint32_t height); ··· 1401 1331 * etc. 1402 1332 */ 1403 1333 #define VMW_DEBUG_USER(fmt, ...) \ 1334 + DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) 1335 + 1336 + /** 1337 + * VMW_DEBUG_KMS - Debug output for kernel mode-setting 1338 + * 1339 + * This macro is for debugging vmwgfx mode-setting code. 1340 + */ 1341 + #define VMW_DEBUG_KMS(fmt, ...) \ 1404 1342 DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) 1405 1343 1406 1344 /**
+4 -4
drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
··· 26 26 * 27 27 **************************************************************************/ 28 28 29 - #include <linux/export.h> 29 + #include <linux/pci.h> 30 30 31 - #include <drm/drmP.h> 31 + #include <drm/drm_fourcc.h> 32 + #include <drm/ttm/ttm_placement.h> 33 + 32 34 #include "vmwgfx_drv.h" 33 35 #include "vmwgfx_kms.h" 34 - 35 - #include <drm/ttm/ttm_placement.h> 36 36 37 37 #define VMW_DIRTY_DELAY (HZ / 30) 38 38
+2 -1
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 - #include <drm/drmP.h> 28 + #include <linux/sched/signal.h> 29 + 29 30 #include "vmwgfx_drv.h" 30 31 31 32 #define VMW_FENCE_WRAP (1 << 31)
+4 -1
drivers/gpu/drm/vmwgfx/vmwgfx_fence.h
··· 32 32 33 33 #define VMW_FENCE_WAIT_TIMEOUT (5*HZ) 34 34 35 - struct vmw_private; 35 + struct drm_device; 36 + struct drm_file; 37 + struct drm_pending_event; 36 38 39 + struct vmw_private; 37 40 struct vmw_fence_manager; 38 41 39 42 /**
+4 -2
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 - #include "vmwgfx_drv.h" 29 - #include <drm/drmP.h> 28 + #include <linux/sched/signal.h> 29 + 30 30 #include <drm/ttm/ttm_placement.h> 31 + 32 + #include "vmwgfx_drv.h" 31 33 32 34 struct vmw_temp_set_context { 33 35 SVGA3dCmdHeader header;
+2 -2
drivers/gpu/drm/vmwgfx/vmwgfx_gmr.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 - #include "vmwgfx_drv.h" 29 - #include <drm/drmP.h> 30 28 #include <drm/ttm/ttm_bo_driver.h> 29 + 30 + #include "vmwgfx_drv.h" 31 31 32 32 #define VMW_PPN_SIZE (sizeof(unsigned long)) 33 33 /* A future safe maximum remap size. */
+2 -1
drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 - #include <drm/drmP.h> 28 + #include <linux/sched/signal.h> 29 + 29 30 #include "vmwgfx_drv.h" 30 31 31 32 #define VMW_FENCE_WRAP (1 << 24)
+25 -8
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 - #include "vmwgfx_kms.h" 29 - #include <drm/drm_plane_helper.h> 30 28 #include <drm/drm_atomic.h> 31 29 #include <drm/drm_atomic_helper.h> 32 - #include <drm/drm_rect.h> 33 30 #include <drm/drm_damage_helper.h> 31 + #include <drm/drm_fourcc.h> 32 + #include <drm/drm_plane_helper.h> 33 + #include <drm/drm_rect.h> 34 + #include <drm/drm_sysfs.h> 35 + #include <drm/drm_vblank.h> 36 + 37 + #include "vmwgfx_kms.h" 34 38 35 39 /* Might need a hrtimer here? */ 36 40 #define VMWGFX_PRESENT_RATE ((HZ / 60 > 0) ? HZ / 60 : 1) ··· 1466 1462 if (dev_priv->active_display_unit == vmw_du_screen_target && 1467 1463 (drm_rect_width(&rects[i]) > dev_priv->stdu_max_width || 1468 1464 drm_rect_height(&rects[i]) > dev_priv->stdu_max_height)) { 1469 - DRM_ERROR("Screen size not supported.\n"); 1465 + VMW_DEBUG_KMS("Screen size not supported.\n"); 1470 1466 return -EINVAL; 1471 1467 } 1472 1468 ··· 1490 1486 * limit on primary bounding box 1491 1487 */ 1492 1488 if (pixel_mem > dev_priv->prim_bb_mem) { 1493 - DRM_ERROR("Combined output size too large.\n"); 1489 + VMW_DEBUG_KMS("Combined output size too large.\n"); 1494 1490 return -EINVAL; 1495 1491 } 1496 1492 ··· 1500 1496 bb_mem = (u64) bounding_box.x2 * bounding_box.y2 * 4; 1501 1497 1502 1498 if (bb_mem > dev_priv->prim_bb_mem) { 1503 - DRM_ERROR("Topology is beyond supported limits.\n"); 1499 + VMW_DEBUG_KMS("Topology is beyond supported limits.\n"); 1504 1500 return -EINVAL; 1505 1501 } 1506 1502 } ··· 1649 1645 struct vmw_connector_state *vmw_conn_state; 1650 1646 1651 1647 if (!du->pref_active && new_crtc_state->enable) { 1648 + VMW_DEBUG_KMS("Enabling a disabled display unit\n"); 1652 1649 ret = -EINVAL; 1653 1650 goto clean; 1654 1651 } ··· 1706 1701 return ret; 1707 1702 1708 1703 ret = vmw_kms_check_implicit(dev, state); 1709 - if (ret) 1704 + if (ret) { 1705 + VMW_DEBUG_KMS("Invalid implicit state\n"); 1710 1706 return ret; 1707 + } 1711 1708 1712 1709 for_each_new_crtc_in_state(state, crtc, crtc_state, i) { 1713 1710 if (drm_atomic_crtc_needs_modeset(crtc_state)) ··· 2346 2339 2347 2340 if (!arg->num_outputs) { 2348 2341 struct drm_rect def_rect = {0, 0, 800, 600}; 2342 + VMW_DEBUG_KMS("Default layout x1 = %d y1 = %d x2 = %d y2 = %d\n", 2343 + def_rect.x1, def_rect.y1, 2344 + def_rect.x2, def_rect.y2); 2349 2345 vmw_du_update_layout(dev_priv, 1, &def_rect); 2350 2346 return 0; 2351 2347 } ··· 2369 2359 2370 2360 drm_rects = (struct drm_rect *)rects; 2371 2361 2362 + VMW_DEBUG_KMS("Layout count = %u\n", arg->num_outputs); 2372 2363 for (i = 0; i < arg->num_outputs; i++) { 2373 2364 struct drm_vmw_rect curr_rect; 2374 2365 ··· 2386 2375 drm_rects[i].x2 = curr_rect.x + curr_rect.w; 2387 2376 drm_rects[i].y2 = curr_rect.y + curr_rect.h; 2388 2377 2378 + VMW_DEBUG_KMS(" x1 = %d y1 = %d x2 = %d y2 = %d\n", 2379 + drm_rects[i].x1, drm_rects[i].y1, 2380 + drm_rects[i].x2, drm_rects[i].y2); 2381 + 2389 2382 /* 2390 2383 * Currently this check is limiting the topology within 2391 2384 * mode_config->max (which actually is max texture size ··· 2400 2385 if (drm_rects[i].x1 < 0 || drm_rects[i].y1 < 0 || 2401 2386 drm_rects[i].x2 > mode_config->max_width || 2402 2387 drm_rects[i].y2 > mode_config->max_height) { 2403 - DRM_ERROR("Invalid GUI layout.\n"); 2388 + VMW_DEBUG_KMS("Invalid layout %d %d %d %d\n", 2389 + drm_rects[i].x1, drm_rects[i].y1, 2390 + drm_rects[i].x2, drm_rects[i].y2); 2404 2391 ret = -EINVAL; 2405 2392 goto out_free; 2406 2393 }
+1 -1
drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
··· 28 28 #ifndef VMWGFX_KMS_H_ 29 29 #define VMWGFX_KMS_H_ 30 30 31 - #include <drm/drmP.h> 32 31 #include <drm/drm_encoder.h> 33 32 #include <drm/drm_probe_helper.h> 33 + 34 34 #include "vmwgfx_drv.h" 35 35 36 36 /**
+4 -2
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 - #include "vmwgfx_kms.h" 29 - #include <drm/drm_plane_helper.h> 30 28 #include <drm/drm_atomic.h> 31 29 #include <drm/drm_atomic_helper.h> 30 + #include <drm/drm_fourcc.h> 31 + #include <drm/drm_plane_helper.h> 32 + #include <drm/drm_vblank.h> 32 33 34 + #include "vmwgfx_kms.h" 33 35 34 36 #define vmw_crtc_to_ldu(x) \ 35 37 container_of(x, struct vmw_legacy_display_unit, base.crtc)
+2
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 + #include <linux/highmem.h> 29 + 28 30 #include "vmwgfx_drv.h" 29 31 30 32 /*
+5 -6
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
··· 24 24 * 25 25 */ 26 26 27 - 28 - #include <linux/slab.h> 29 - #include <linux/module.h> 30 - #include <linux/kernel.h> 31 27 #include <linux/frame.h> 28 + #include <linux/kernel.h> 29 + #include <linux/module.h> 30 + #include <linux/slab.h> 31 + 32 32 #include <asm/hypervisor.h> 33 - #include <drm/drmP.h> 33 + 34 34 #include "vmwgfx_drv.h" 35 35 #include "vmwgfx_msg.h" 36 - 37 36 38 37 #define MESSAGE_STATUS_SUCCESS 0x0001 39 38 #define MESSAGE_STATUS_DORECV 0x0002
+2 -4
drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 - 29 - #include <drm/drmP.h> 30 - #include "vmwgfx_drv.h" 31 - 32 28 #include <drm/ttm/ttm_placement.h> 33 29 34 30 #include "device_include/svga_overlay.h" 35 31 #include "device_include/svga_escape.h" 32 + 33 + #include "vmwgfx_drv.h" 36 34 37 35 #define VMW_MAX_NUM_STREAMS 1 38 36 #define VMW_OVERLAY_CAP_MASK (SVGA_FIFO_CAP_VIDEO | SVGA_FIFO_CAP_ESCAPE)
+44 -16
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 - #include "vmwgfx_drv.h" 29 - #include <drm/vmwgfx_drm.h> 30 28 #include <drm/ttm/ttm_placement.h> 31 - #include <drm/drmP.h> 29 + 32 30 #include "vmwgfx_resource_priv.h" 33 31 #include "vmwgfx_binding.h" 32 + #include "vmwgfx_drv.h" 34 33 35 34 #define VMW_RES_EVICT_ERR_COUNT 10 35 + 36 + /** 37 + * vmw_resource_mob_attach - Mark a resource as attached to its backing mob 38 + * @res: The resource 39 + */ 40 + void vmw_resource_mob_attach(struct vmw_resource *res) 41 + { 42 + struct vmw_buffer_object *backup = res->backup; 43 + 44 + reservation_object_assert_held(backup->base.base.resv); 45 + res->used_prio = (res->res_dirty) ? res->func->dirty_prio : 46 + res->func->prio; 47 + list_add_tail(&res->mob_head, &backup->res_list); 48 + vmw_bo_prio_add(backup, res->used_prio); 49 + } 50 + 51 + /** 52 + * vmw_resource_mob_detach - Mark a resource as detached from its backing mob 53 + * @res: The resource 54 + */ 55 + void vmw_resource_mob_detach(struct vmw_resource *res) 56 + { 57 + struct vmw_buffer_object *backup = res->backup; 58 + 59 + reservation_object_assert_held(backup->base.base.resv); 60 + if (vmw_resource_mob_attached(res)) { 61 + list_del_init(&res->mob_head); 62 + vmw_bo_prio_del(backup, res->used_prio); 63 + } 64 + } 36 65 37 66 struct vmw_resource *vmw_resource_reference(struct vmw_resource *res) 38 67 { ··· 109 80 struct ttm_buffer_object *bo = &res->backup->base; 110 81 111 82 ttm_bo_reserve(bo, false, false, NULL); 112 - if (!list_empty(&res->mob_head) && 83 + if (vmw_resource_mob_attached(res) && 113 84 res->func->unbind != NULL) { 114 85 struct ttm_validate_buffer val_buf; 115 86 ··· 118 89 res->func->unbind(res, false, &val_buf); 119 90 } 120 91 res->backup_dirty = false; 121 - list_del_init(&res->mob_head); 92 + vmw_resource_mob_detach(res); 122 93 ttm_bo_unreserve(bo); 123 94 vmw_bo_unreference(&res->backup); 124 95 } ··· 208 179 res->backup_offset = 0; 209 180 res->backup_dirty = false; 210 181 res->res_dirty = false; 182 + res->used_prio = 3; 211 183 if (delay_id) 212 184 return 0; 213 185 else ··· 385 355 } 386 356 387 357 if (func->bind && 388 - ((func->needs_backup && list_empty(&res->mob_head) && 358 + ((func->needs_backup && !vmw_resource_mob_attached(res) && 389 359 val_buf->bo != NULL) || 390 360 (!func->needs_backup && val_buf->bo != NULL))) { 391 361 ret = func->bind(res, val_buf); 392 362 if (unlikely(ret != 0)) 393 363 goto out_bind_failed; 394 364 if (func->needs_backup) 395 - list_add_tail(&res->mob_head, &res->backup->res_list); 365 + vmw_resource_mob_attach(res); 396 366 } 397 367 398 368 return 0; ··· 432 402 433 403 if (switch_backup && new_backup != res->backup) { 434 404 if (res->backup) { 435 - reservation_object_assert_held(res->backup->base.base.resv); 436 - list_del_init(&res->mob_head); 405 + vmw_resource_mob_detach(res); 437 406 vmw_bo_unreference(&res->backup); 438 407 } 439 408 440 409 if (new_backup) { 441 410 res->backup = vmw_bo_reference(new_backup); 442 - reservation_object_assert_held(new_backup->base.base.resv); 443 - list_add_tail(&res->mob_head, &new_backup->res_list); 411 + vmw_resource_mob_attach(res); 444 412 } else { 445 413 res->backup = NULL; 446 414 } ··· 497 469 if (unlikely(ret != 0)) 498 470 goto out_no_reserve; 499 471 500 - if (res->func->needs_backup && list_empty(&res->mob_head)) 472 + if (res->func->needs_backup && !vmw_resource_mob_attached(res)) 501 473 return 0; 502 474 503 475 backup_dirty = res->backup_dirty; ··· 602 574 return ret; 603 575 604 576 if (unlikely(func->unbind != NULL && 605 - (!func->needs_backup || !list_empty(&res->mob_head)))) { 577 + (!func->needs_backup || vmw_resource_mob_attached(res)))) { 606 578 ret = func->unbind(res, res->res_dirty, &val_buf); 607 579 if (unlikely(ret != 0)) 608 580 goto out_no_unbind; 609 - list_del_init(&res->mob_head); 581 + vmw_resource_mob_detach(res); 610 582 } 611 583 ret = func->destroy(res); 612 584 res->backup_dirty = true; ··· 688 660 if (unlikely(ret != 0)) 689 661 goto out_no_validate; 690 662 else if (!res->func->needs_backup && res->backup) { 691 - list_del_init(&res->mob_head); 663 + WARN_ON_ONCE(vmw_resource_mob_attached(res)); 692 664 vmw_bo_unreference(&res->backup); 693 665 } 694 666 ··· 727 699 (void) res->func->unbind(res, res->res_dirty, &val_buf); 728 700 res->backup_dirty = true; 729 701 res->res_dirty = false; 730 - list_del_init(&res->mob_head); 702 + vmw_resource_mob_detach(res); 731 703 } 732 704 733 705 (void) ttm_bo_wait(&vbo->base, false, false);
+2
drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h
··· 78 78 const char *type_name; 79 79 struct ttm_placement *backup_placement; 80 80 bool may_evict; 81 + u32 prio; 82 + u32 dirty_prio; 81 83 82 84 int (*create) (struct vmw_resource *res); 83 85 int (*destroy) (struct vmw_resource *res);
+4 -2
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 - #include "vmwgfx_kms.h" 29 - #include <drm/drm_plane_helper.h> 30 28 #include <drm/drm_atomic.h> 31 29 #include <drm/drm_atomic_helper.h> 32 30 #include <drm/drm_damage_helper.h> 31 + #include <drm/drm_fourcc.h> 32 + #include <drm/drm_plane_helper.h> 33 + #include <drm/drm_vblank.h> 33 34 35 + #include "vmwgfx_kms.h" 34 36 35 37 #define vmw_crtc_to_sou(x) \ 36 38 container_of(x, struct vmw_screen_object_unit, base.crtc)
+6 -2
drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
··· 95 95 .res_type = vmw_res_shader, 96 96 .needs_backup = true, 97 97 .may_evict = true, 98 + .prio = 3, 99 + .dirty_prio = 3, 98 100 .type_name = "guest backed shaders", 99 101 .backup_placement = &vmw_mob_placement, 100 102 .create = vmw_gb_shader_create, ··· 108 106 static const struct vmw_res_func vmw_dx_shader_func = { 109 107 .res_type = vmw_res_shader, 110 108 .needs_backup = true, 111 - .may_evict = false, 109 + .may_evict = true, 110 + .prio = 3, 111 + .dirty_prio = 3, 112 112 .type_name = "dx shaders", 113 113 .backup_placement = &vmw_mob_placement, 114 114 .create = vmw_dx_shader_create, ··· 427 423 428 424 WARN_ON_ONCE(!shader->committed); 429 425 430 - if (!list_empty(&res->mob_head)) { 426 + if (vmw_resource_mob_attached(res)) { 431 427 mutex_lock(&dev_priv->binding_mutex); 432 428 ret = vmw_dx_shader_unscrub(res); 433 429 mutex_unlock(&dev_priv->binding_mutex);
+6 -3
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
··· 25 25 * 26 26 ******************************************************************************/ 27 27 28 - #include "vmwgfx_kms.h" 29 - #include "device_include/svga3d_surfacedefs.h" 30 - #include <drm/drm_plane_helper.h> 31 28 #include <drm/drm_atomic.h> 32 29 #include <drm/drm_atomic_helper.h> 33 30 #include <drm/drm_damage_helper.h> 31 + #include <drm/drm_fourcc.h> 32 + #include <drm/drm_plane_helper.h> 33 + #include <drm/drm_vblank.h> 34 + 35 + #include "vmwgfx_kms.h" 36 + #include "device_include/svga3d_surfacedefs.h" 34 37 35 38 #define vmw_crtc_to_stdu(x) \ 36 39 container_of(x, struct vmw_screen_target_display_unit, base.crtc)
+4 -6
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
··· 112 112 .res_type = vmw_res_surface, 113 113 .needs_backup = false, 114 114 .may_evict = true, 115 + .prio = 1, 116 + .dirty_prio = 1, 115 117 .type_name = "legacy surfaces", 116 118 .backup_placement = &vmw_srf_placement, 117 119 .create = &vmw_legacy_srf_create, ··· 126 124 .res_type = vmw_res_surface, 127 125 .needs_backup = true, 128 126 .may_evict = true, 127 + .prio = 1, 128 + .dirty_prio = 2, 129 129 .type_name = "guest backed surfaces", 130 130 .backup_placement = &vmw_mob_placement, 131 131 .create = vmw_gb_surface_create, ··· 918 914 } else { 919 915 if (unlikely(drm_is_render_client(file_priv))) 920 916 require_exist = true; 921 - 922 - if (READ_ONCE(vmw_fpriv(file_priv)->locked_master)) { 923 - DRM_ERROR("Locked master refused legacy " 924 - "surface reference.\n"); 925 - return -EACCES; 926 - } 927 917 928 918 handle = u_handle; 929 919 }
-1
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
··· 25 25 * 26 26 **************************************************************************/ 27 27 28 - #include <drm/drmP.h> 29 28 #include "vmwgfx_drv.h" 30 29 31 30 int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
+2 -1
drivers/gpu/drm/vmwgfx/vmwgfx_validation.h
··· 28 28 #ifndef _VMWGFX_VALIDATION_H_ 29 29 #define _VMWGFX_VALIDATION_H_ 30 30 31 - #include <drm/drm_hashtab.h> 32 31 #include <linux/list.h> 33 32 #include <linux/ww_mutex.h> 33 + 34 + #include <drm/drm_hashtab.h> 34 35 #include <drm/ttm/ttm_execbuf_util.h> 35 36 36 37 #define VMW_RES_DIRTY_NONE 0