This reverts commit 355a70183848f21198e9f6296bd646df3478a26d. This had some bad side effects under normal operation, and should have been dropped earlier.
Unified · Split
| @@ -1586,7 +1586,7 @@ static struct drm_driver driver = { · 1585 unmodified lines | ||
| 1586 | 1586 | .gem_prime_import = i915_gem_prime_import, |
| 1587 | 1587 | |
| 1588 | 1588 | .dumb_create = i915_gem_dumb_create, |
| 1589 | − .dumb_map_offset = i915_gem_dumb_map_offset, | |
| 1589 | + .dumb_map_offset = i915_gem_mmap_gtt, | |
| 1590 | 1590 | .dumb_destroy = drm_gem_dumb_destroy, |
| 1591 | 1591 | .ioctls = i915_ioctls, |
| 1592 | 1592 | .fops = &i915_driver_fops, |
| @@ -2501,9 +2501,8 @@ void i915_vma_move_to_active(struct i915_vma *vma, · 2500 unmodified lines | ||
| 2501 | 2501 | int i915_gem_dumb_create(struct drm_file *file_priv, |
| 2502 | 2502 | struct drm_device *dev, |
| 2503 | 2503 | struct drm_mode_create_dumb *args); |
| 2504 | −int i915_gem_dumb_map_offset(struct drm_file *file_priv, | |
| 2505 | − struct drm_device *dev, uint32_t handle, | |
| 2506 | − uint64_t *offset); | |
| 2504 | +int i915_gem_mmap_gtt(struct drm_file *file_priv, struct drm_device *dev, | |
| 2505 | + uint32_t handle, uint64_t *offset); | |
| 2507 | 2506 | /** |
| 2508 | 2507 | * Returns true if seq1 is later than seq2. |
| 2509 | 2508 | */ |
| @@ -401,7 +401,6 @@ static int · 400 unmodified lines | ||
| 401 | 401 | i915_gem_create(struct drm_file *file, |
| 402 | 402 | struct drm_device *dev, |
| 403 | 403 | uint64_t size, |
| 404 | − bool dumb, | |
| 405 | 404 | uint32_t *handle_p) |
| 406 | 405 | { |
| 407 | 406 | struct drm_i915_gem_object *obj; |
| @@ -417,7 +416,6 @@ i915_gem_create(struct drm_file *file, · 9 unmodified lines | ||
| 417 | 416 | if (obj == NULL) |
| 418 | 417 | return -ENOMEM; |
| 419 | 418 | |
| 420 | − obj->base.dumb = dumb; | |
| 421 | 419 | ret = drm_gem_handle_create(file, &obj->base, &handle); |
| 422 | 420 | /* drop reference from allocate - handle holds it now */ |
| 423 | 421 | drm_gem_object_unreference_unlocked(&obj->base); |
| @@ -437,7 +435,7 @@ i915_gem_dumb_create(struct drm_file *file, · 13 unmodified lines | ||
| 437 | 435 | args->pitch = ALIGN(args->width * DIV_ROUND_UP(args->bpp, 8), 64); |
| 438 | 436 | args->size = args->pitch * args->height; |
| 439 | 437 | return i915_gem_create(file, dev, |
| 440 | − args->size, true, &args->handle); | |
| 438 | + args->size, &args->handle); | |
| 441 | 439 | } |
| 442 | 440 | |
| 443 | 441 | /** |
| @@ -450,7 +448,7 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data, · 6 unmodified lines | ||
| 450 | 448 | struct drm_i915_gem_create *args = data; |
| 451 | 449 | |
| 452 | 450 | return i915_gem_create(file, dev, |
| 453 | − args->size, false, &args->handle); | |
| 451 | + args->size, &args->handle); | |
| 454 | 452 | } |
| 455 | 453 | |
| 456 | 454 | static inline int |
| @@ -1840,10 +1838,10 @@ static void i915_gem_object_free_mmap_offset(struct drm_i915_gem_object *obj) · 1383 unmodified lines | ||
| 1840 | 1838 | drm_gem_free_mmap_offset(&obj->base); |
| 1841 | 1839 | } |
| 1842 | 1840 | |
| 1843 | −static int | |
| 1841 | +int | |
| 1844 | 1842 | i915_gem_mmap_gtt(struct drm_file *file, |
| 1845 | 1843 | struct drm_device *dev, |
| 1846 | − uint32_t handle, bool dumb, | |
| 1844 | + uint32_t handle, | |
| 1847 | 1845 | uint64_t *offset) |
| 1848 | 1846 | { |
| 1849 | 1847 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -1860,13 +1858,6 @@ i915_gem_mmap_gtt(struct drm_file *file, · 10 unmodified lines | ||
| 1860 | 1858 | goto unlock; |
| 1861 | 1859 | } |
| 1862 | 1860 | |
| 1863 | − /* | |
| 1864 | − * We don't allow dumb mmaps on objects created using another | |
| 1865 | − * interface. | |
| 1866 | − */ | |
| 1867 | − WARN_ONCE(dumb && !(obj->base.dumb || obj->base.import_attach), | |
| 1868 | − "Illegal dumb map of accelerated buffer.\n"); | |
| 1869 | − | |
| 1870 | 1861 | if (obj->base.size > dev_priv->gtt.mappable_end) { |
| 1871 | 1862 | ret = -E2BIG; |
| 1872 | 1863 | goto out; |
| @@ -1891,15 +1882,6 @@ unlock: · 18 unmodified lines | ||
| 1891 | 1882 | return ret; |
| 1892 | 1883 | } |
| 1893 | 1884 | |
| 1894 | −int | |
| 1895 | −i915_gem_dumb_map_offset(struct drm_file *file, | |
| 1896 | − struct drm_device *dev, | |
| 1897 | − uint32_t handle, | |
| 1898 | − uint64_t *offset) | |
| 1899 | −{ | |
| 1900 | − return i915_gem_mmap_gtt(file, dev, handle, true, offset); | |
| 1901 | −} | |
| 1902 | − | |
| 1903 | 1885 | /** |
| 1904 | 1886 | * i915_gem_mmap_gtt_ioctl - prepare an object for GTT mmap'ing |
| 1905 | 1887 | * @dev: DRM device |
| @@ -1921,7 +1903,7 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data, · 15 unmodified lines | ||
| 1921 | 1903 | { |
| 1922 | 1904 | struct drm_i915_gem_mmap_gtt *args = data; |
| 1923 | 1905 | |
| 1924 | − return i915_gem_mmap_gtt(file, dev, args->handle, false, &args->offset); | |
| 1906 | + return i915_gem_mmap_gtt(file, dev, args->handle, &args->offset); | |
| 1925 | 1907 | } |
| 1926 | 1908 | |
| 1927 | 1909 | static inline int |
| @@ -121,9 +121,6 @@ eb_lookup_vmas(struct eb_vmas *eb, · 120 unmodified lines | ||
| 121 | 121 | goto err; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | − WARN_ONCE(obj->base.dumb, | |
| 125 | − "GPU use of dumb buffer is illegal.\n"); | |
| 126 | − | |
| 127 | 124 | drm_gem_object_reference(&obj->base); |
| 128 | 125 | list_add_tail(&obj->obj_exec_link, &objects); |
| 129 | 126 | } |
| @@ -876,7 +876,6 @@ nouveau_display_dumb_create(struct drm_file *file_priv, struct drm_device *dev, · 875 unmodified lines | ||
| 876 | 876 | if (ret) |
| 877 | 877 | return ret; |
| 878 | 878 | |
| 879 | − bo->gem.dumb = true; | |
| 880 | 879 | ret = drm_gem_handle_create(file_priv, &bo->gem, &args->handle); |
| 881 | 880 | drm_gem_object_unreference_unlocked(&bo->gem); |
| 882 | 881 | return ret; |
| @@ -892,14 +891,6 @@ nouveau_display_dumb_map_offset(struct drm_file *file_priv, · 9 unmodified lines | ||
| 892 | 891 | gem = drm_gem_object_lookup(dev, file_priv, handle); |
| 893 | 892 | if (gem) { |
| 894 | 893 | struct nouveau_bo *bo = nouveau_gem_object(gem); |
| 895 | − | |
| 896 | − /* | |
| 897 | − * We don't allow dumb mmaps on objects created using another | |
| 898 | − * interface. | |
| 899 | − */ | |
| 900 | − WARN_ONCE(!(gem->dumb || gem->import_attach), | |
| 901 | − "Illegal dumb map of accelerated buffer.\n"); | |
| 902 | − | |
| 903 | 894 | *poffset = drm_vma_node_offset_addr(&bo->bo.vma_node); |
| 904 | 895 | drm_gem_object_unreference_unlocked(gem); |
| 905 | 896 | return 0; |
| @@ -444,9 +444,6 @@ validate_list(struct nouveau_channel *chan, struct nouveau_cli *cli, · 443 unmodified lines | ||
| 444 | 444 | list_for_each_entry(nvbo, list, entry) { |
| 445 | 445 | struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index]; |
| 446 | 446 | |
| 447 | − WARN_ONCE(nvbo->gem.dumb, | |
| 448 | − "GPU use of dumb buffer is illegal.\n"); | |
| 449 | − | |
| 450 | 447 | ret = nouveau_gem_set_domain(&nvbo->gem, b->read_domains, |
| 451 | 448 | b->write_domains, |
| 452 | 449 | b->valid_domains); |
| @@ -394,10 +394,9 @@ int radeon_gem_set_domain_ioctl(struct drm_device *dev, void *data, · 393 unmodified lines | ||
| 394 | 394 | return r; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | −static int radeon_mode_mmap(struct drm_file *filp, | |
| 398 | − struct drm_device *dev, | |
| 399 | − uint32_t handle, bool dumb, | |
| 400 | − uint64_t *offset_p) | |
| 397 | +int radeon_mode_dumb_mmap(struct drm_file *filp, | |
| 398 | + struct drm_device *dev, | |
| 399 | + uint32_t handle, uint64_t *offset_p) | |
| 401 | 400 | { |
| 402 | 401 | struct drm_gem_object *gobj; |
| 403 | 402 | struct radeon_bo *robj; |
| @@ -406,14 +405,6 @@ static int radeon_mode_mmap(struct drm_file *filp, · 2 unmodified lines | ||
| 406 | 405 | if (gobj == NULL) { |
| 407 | 406 | return -ENOENT; |
| 408 | 407 | } |
| 409 | − | |
| 410 | − /* | |
| 411 | − * We don't allow dumb mmaps on objects created using another | |
| 412 | − * interface. | |
| 413 | − */ | |
| 414 | − WARN_ONCE(dumb && !(gobj->dumb || gobj->import_attach), | |
| 415 | − "Illegal dumb map of GPU buffer.\n"); | |
| 416 | − | |
| 417 | 408 | robj = gem_to_radeon_bo(gobj); |
| 418 | 409 | if (radeon_ttm_tt_has_userptr(robj->tbo.ttm)) { |
| 419 | 410 | drm_gem_object_unreference_unlocked(gobj); |
| @@ -424,20 +415,12 @@ static int radeon_mode_mmap(struct drm_file *filp, · 4 unmodified lines | ||
| 424 | 415 | return 0; |
| 425 | 416 | } |
| 426 | 417 | |
| 427 | −int radeon_mode_dumb_mmap(struct drm_file *filp, | |
| 428 | − struct drm_device *dev, | |
| 429 | − uint32_t handle, uint64_t *offset_p) | |
| 430 | −{ | |
| 431 | − return radeon_mode_mmap(filp, dev, handle, true, offset_p); | |
| 432 | −} | |
| 433 | − | |
| 434 | 418 | int radeon_gem_mmap_ioctl(struct drm_device *dev, void *data, |
| 435 | 419 | struct drm_file *filp) |
| 436 | 420 | { |
| 437 | 421 | struct drm_radeon_gem_mmap *args = data; |
| 438 | 422 | |
| 439 | − return radeon_mode_mmap(filp, dev, args->handle, false, | |
| 440 | − &args->addr_ptr); | |
| 423 | + return radeon_mode_dumb_mmap(filp, dev, args->handle, &args->addr_ptr); | |
| 441 | 424 | } |
| 442 | 425 | |
| 443 | 426 | int radeon_gem_busy_ioctl(struct drm_device *dev, void *data, |
| @@ -763,7 +746,6 @@ int radeon_mode_dumb_create(struct drm_file *file_priv, · 319 unmodified lines | ||
| 763 | 746 | return -ENOMEM; |
| 764 | 747 | |
| 765 | 748 | r = drm_gem_handle_create(file_priv, gobj, &handle); |
| 766 | − gobj->dumb = true; | |
| 767 | 749 | /* drop reference from allocate - handle holds it now */ |
| 768 | 750 | drm_gem_object_unreference_unlocked(gobj); |
| 769 | 751 | if (r) { |
| @@ -529,9 +529,6 @@ int radeon_bo_list_validate(struct radeon_device *rdev, · 528 unmodified lines | ||
| 529 | 529 | u32 current_domain = |
| 530 | 530 | radeon_mem_type_to_domain(bo->tbo.mem.mem_type); |
| 531 | 531 | |
| 532 | − WARN_ONCE(bo->gem_base.dumb, | |
| 533 | − "GPU use of dumb buffer is illegal.\n"); | |
| 534 | − | |
| 535 | 532 | /* Check if this buffer will be moved and don't move it |
| 536 | 533 | * if we have moved too many buffers for this IB already. |
| 537 | 534 | * |
| @@ -119,13 +119,6 @@ struct drm_gem_object { · 118 unmodified lines | ||
| 119 | 119 | * simply leave it as NULL. |
| 120 | 120 | */ |
| 121 | 121 | struct dma_buf_attachment *import_attach; |
| 122 | − | |
| 123 | − /** | |
| 124 | − * dumb - created as dumb buffer | |
| 125 | − * Whether the gem object was created using the dumb buffer interface | |
| 126 | − * as such it may not be used for GPU rendering. | |
| 127 | − */ | |
| 128 | − bool dumb; | |
| 129 | 122 | }; |
| 130 | 123 | |
| 131 | 124 | void drm_gem_object_release(struct drm_gem_object *obj); |