diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-28 20:49:53 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-28 20:49:53 -0400 |
| commit | 53b3b6bbfde6aae8d1ededc86ad4e0e1e00eb5f8 (patch) | |
| tree | b29473f21270aefd113b298c9402be8b4b3c91b4 /drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |
| parent | 746bb4ed6d626f3f9e431a7f9b20504538e62ded (diff) | |
| parent | f2bfc71aee75feff33ca659322b72ffeed5a243d (diff) | |
Merge tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm
Pull drm updates from Dave Airlie:
"This is going to rebuild more than drm as it adds a new helper to
list.h for doing bulk updates. Seemed like a reasonable addition to
me.
Otherwise the usual merge window stuff lots of i915 and amdgpu, not so
much nouveau, and piles of everything else.
Core:
- Adds a new list.h helper for doing bulk list updates for TTM.
- Don't leak fb address in smem_start to userspace (comes with EXPORT
workaround for people using mali out of tree hacks)
- udmabuf device to turn memfd regions into dma-buf
- Per-plane blend mode property
- ref/unref replacements with get/put
- fbdev conflicting framebuffers code cleaned up
- host-endian format variants
- panel orientation quirk for Acer One 10
bridge:
- TI SN65DSI86 chip support
vkms:
- GEM support.
- Cursor support
amdgpu:
- Merge amdkfd and amdgpu into one module
- CEC over DP AUX support
- Picasso APU support + VCN dynamic powergating
- Raven2 APU support
- Vega20 enablement + kfd support
- ACP powergating improvements
- ABGR/XBGR display support
- VCN jpeg support
- xGMI support
- DC i2c/aux cleanup
- Ycbcr 4:2:0 support
- GPUVM improvements
- Powerplay and powerplay endian fixes
- Display underflow fixes
vmwgfx:
- Move vmwgfx specific TTM code to vmwgfx
- Split out vmwgfx buffer/resource validation code
- Atomic operation rework
bochs:
- use more helpers
- format/byteorder improvements
qxl:
- use more helpers
i915:
- GGTT coherency getparam
- Turn off resource streamer API
- More Icelake enablement + DMC firmware
- Full PPGTT for Ivybridge, Haswell and Valleyview
- DDB distribution based on resolution
- Limited range DP display support
nouveau:
- CEC over DP AUX support
- Initial HDMI 2.0 support
virtio-gpu:
- vmap support for PRIME objects
tegra:
- Initial Tegra194 support
- DMA/IOMMU integration fixes
msm:
- a6xx perf improvements + clock prefix
- GPU preemption optimisations
- a6xx devfreq support
- cursor support
rockchip:
- PX30 support
- rgb output interface support
mediatek:
- HDMI output support on mt2701 and mt7623
rcar-du:
- Interlaced modes on Gen3
- LVDS on R8A77980
- D3 and E3 SoC support
hisilicon:
- misc fixes
mxsfb:
- runtime pm support
sun4i:
- R40 TCON support
- Allwinner A64 support
- R40 HDMI support
omapdrm:
- Driver rework changing display pipeline ordering to use common code
- DMM memory barrier and irq fixes
- Errata workarounds
exynos:
- out-bridge support for LVDS bridge driver
- Samsung 16x16 tiled format support
- Plane alpha and pixel blend mode support
tilcdc:
- suspend/resume update
mali-dp:
- misc updates"
* tag 'drm-next-2018-10-24' of git://anongit.freedesktop.org/drm/drm: (1382 commits)
firmware/dmc/icl: Add missing MODULE_FIRMWARE() for Icelake.
drm/i915/icl: Fix signal_levels
drm/i915/icl: Fix DDI/TC port clk_off bits
drm/i915/icl: create function to identify combophy port
drm/i915/gen9+: Fix initial readout for Y tiled framebuffers
drm/i915: Large page offsets for pread/pwrite
drm/i915/selftests: Disable shrinker across mmap-exhaustion
drm/i915/dp: Link train Fallback on eDP only if fallback link BW can fit panel's native mode
drm/i915: Fix intel_dp_mst_best_encoder()
drm/i915: Skip vcpi allocation for MSTB ports that are gone
drm/i915: Don't unset intel_connector->mst_port
drm/i915: Only reset seqno if actually idle
drm/i915: Use the correct crtc when sanitizing plane mapping
drm/i915: Restore vblank interrupts earlier
drm/i915: Check fb stride against plane max stride
drm/amdgpu/vcn:Fix uninitialized symbol error
drm: panel-orientation-quirks: Add quirk for Acer One 10 (S1003)
drm/amd/amdgpu: Fix debugfs error handling
drm/amdgpu: Update gc_9_0 golden settings.
drm/amd/powerplay: update PPtable with DC BTC and Tvr SocLimit fields
...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_object.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 96 |
1 files changed, 35 insertions, 61 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index b0e14a3d54ef..904014dc5915 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | |||
| @@ -51,18 +51,6 @@ | |||
| 51 | * | 51 | * |
| 52 | */ | 52 | */ |
| 53 | 53 | ||
| 54 | static bool amdgpu_bo_need_backup(struct amdgpu_device *adev) | ||
| 55 | { | ||
| 56 | if (adev->flags & AMD_IS_APU) | ||
| 57 | return false; | ||
| 58 | |||
| 59 | if (amdgpu_gpu_recovery == 0 || | ||
| 60 | (amdgpu_gpu_recovery == -1 && !amdgpu_sriov_vf(adev))) | ||
| 61 | return false; | ||
| 62 | |||
| 63 | return true; | ||
| 64 | } | ||
| 65 | |||
| 66 | /** | 54 | /** |
| 67 | * amdgpu_bo_subtract_pin_size - Remove BO from pin_size accounting | 55 | * amdgpu_bo_subtract_pin_size - Remove BO from pin_size accounting |
| 68 | * | 56 | * |
| @@ -163,10 +151,7 @@ void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain) | |||
| 163 | 151 | ||
| 164 | if (domain & AMDGPU_GEM_DOMAIN_GTT) { | 152 | if (domain & AMDGPU_GEM_DOMAIN_GTT) { |
| 165 | places[c].fpfn = 0; | 153 | places[c].fpfn = 0; |
| 166 | if (flags & AMDGPU_GEM_CREATE_SHADOW) | 154 | places[c].lpfn = 0; |
| 167 | places[c].lpfn = adev->gmc.gart_size >> PAGE_SHIFT; | ||
| 168 | else | ||
| 169 | places[c].lpfn = 0; | ||
| 170 | places[c].flags = TTM_PL_FLAG_TT; | 155 | places[c].flags = TTM_PL_FLAG_TT; |
| 171 | if (flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) | 156 | if (flags & AMDGPU_GEM_CREATE_CPU_GTT_USWC) |
| 172 | places[c].flags |= TTM_PL_FLAG_WC | | 157 | places[c].flags |= TTM_PL_FLAG_WC | |
| @@ -253,6 +238,11 @@ int amdgpu_bo_create_reserved(struct amdgpu_device *adev, | |||
| 253 | bool free = false; | 238 | bool free = false; |
| 254 | int r; | 239 | int r; |
| 255 | 240 | ||
| 241 | if (!size) { | ||
| 242 | amdgpu_bo_unref(bo_ptr); | ||
| 243 | return 0; | ||
| 244 | } | ||
| 245 | |||
| 256 | memset(&bp, 0, sizeof(bp)); | 246 | memset(&bp, 0, sizeof(bp)); |
| 257 | bp.size = size; | 247 | bp.size = size; |
| 258 | bp.byte_align = align; | 248 | bp.byte_align = align; |
| @@ -346,7 +336,8 @@ int amdgpu_bo_create_kernel(struct amdgpu_device *adev, | |||
| 346 | if (r) | 336 | if (r) |
| 347 | return r; | 337 | return r; |
| 348 | 338 | ||
| 349 | amdgpu_bo_unreserve(*bo_ptr); | 339 | if (*bo_ptr) |
| 340 | amdgpu_bo_unreserve(*bo_ptr); | ||
| 350 | 341 | ||
| 351 | return 0; | 342 | return 0; |
| 352 | } | 343 | } |
| @@ -436,7 +427,11 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, | |||
| 436 | int r; | 427 | int r; |
| 437 | 428 | ||
| 438 | page_align = roundup(bp->byte_align, PAGE_SIZE) >> PAGE_SHIFT; | 429 | page_align = roundup(bp->byte_align, PAGE_SIZE) >> PAGE_SHIFT; |
| 439 | size = ALIGN(size, PAGE_SIZE); | 430 | if (bp->domain & (AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GWS | |
| 431 | AMDGPU_GEM_DOMAIN_OA)) | ||
| 432 | size <<= PAGE_SHIFT; | ||
| 433 | else | ||
| 434 | size = ALIGN(size, PAGE_SIZE); | ||
| 440 | 435 | ||
| 441 | if (!amdgpu_bo_validate_size(adev, size, bp->domain)) | 436 | if (!amdgpu_bo_validate_size(adev, size, bp->domain)) |
| 442 | return -ENOMEM; | 437 | return -ENOMEM; |
| @@ -451,7 +446,7 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, | |||
| 451 | return -ENOMEM; | 446 | return -ENOMEM; |
| 452 | drm_gem_private_object_init(adev->ddev, &bo->gem_base, size); | 447 | drm_gem_private_object_init(adev->ddev, &bo->gem_base, size); |
| 453 | INIT_LIST_HEAD(&bo->shadow_list); | 448 | INIT_LIST_HEAD(&bo->shadow_list); |
| 454 | INIT_LIST_HEAD(&bo->va); | 449 | bo->vm_bo = NULL; |
| 455 | bo->preferred_domains = bp->preferred_domain ? bp->preferred_domain : | 450 | bo->preferred_domains = bp->preferred_domain ? bp->preferred_domain : |
| 456 | bp->domain; | 451 | bp->domain; |
| 457 | bo->allowed_domains = bo->preferred_domains; | 452 | bo->allowed_domains = bo->preferred_domains; |
| @@ -541,7 +536,7 @@ fail_unreserve: | |||
| 541 | } | 536 | } |
| 542 | 537 | ||
| 543 | static int amdgpu_bo_create_shadow(struct amdgpu_device *adev, | 538 | static int amdgpu_bo_create_shadow(struct amdgpu_device *adev, |
| 544 | unsigned long size, int byte_align, | 539 | unsigned long size, |
| 545 | struct amdgpu_bo *bo) | 540 | struct amdgpu_bo *bo) |
| 546 | { | 541 | { |
| 547 | struct amdgpu_bo_param bp; | 542 | struct amdgpu_bo_param bp; |
| @@ -552,7 +547,6 @@ static int amdgpu_bo_create_shadow(struct amdgpu_device *adev, | |||
| 552 | 547 | ||
| 553 | memset(&bp, 0, sizeof(bp)); | 548 | memset(&bp, 0, sizeof(bp)); |
| 554 | bp.size = size; | 549 | bp.size = size; |
| 555 | bp.byte_align = byte_align; | ||
| 556 | bp.domain = AMDGPU_GEM_DOMAIN_GTT; | 550 | bp.domain = AMDGPU_GEM_DOMAIN_GTT; |
| 557 | bp.flags = AMDGPU_GEM_CREATE_CPU_GTT_USWC | | 551 | bp.flags = AMDGPU_GEM_CREATE_CPU_GTT_USWC | |
| 558 | AMDGPU_GEM_CREATE_SHADOW; | 552 | AMDGPU_GEM_CREATE_SHADOW; |
| @@ -563,7 +557,7 @@ static int amdgpu_bo_create_shadow(struct amdgpu_device *adev, | |||
| 563 | if (!r) { | 557 | if (!r) { |
| 564 | bo->shadow->parent = amdgpu_bo_ref(bo); | 558 | bo->shadow->parent = amdgpu_bo_ref(bo); |
| 565 | mutex_lock(&adev->shadow_list_lock); | 559 | mutex_lock(&adev->shadow_list_lock); |
| 566 | list_add_tail(&bo->shadow_list, &adev->shadow_list); | 560 | list_add_tail(&bo->shadow->shadow_list, &adev->shadow_list); |
| 567 | mutex_unlock(&adev->shadow_list_lock); | 561 | mutex_unlock(&adev->shadow_list_lock); |
| 568 | } | 562 | } |
| 569 | 563 | ||
| @@ -596,12 +590,12 @@ int amdgpu_bo_create(struct amdgpu_device *adev, | |||
| 596 | if (r) | 590 | if (r) |
| 597 | return r; | 591 | return r; |
| 598 | 592 | ||
| 599 | if ((flags & AMDGPU_GEM_CREATE_SHADOW) && amdgpu_bo_need_backup(adev)) { | 593 | if ((flags & AMDGPU_GEM_CREATE_SHADOW) && !(adev->flags & AMD_IS_APU)) { |
| 600 | if (!bp->resv) | 594 | if (!bp->resv) |
| 601 | WARN_ON(reservation_object_lock((*bo_ptr)->tbo.resv, | 595 | WARN_ON(reservation_object_lock((*bo_ptr)->tbo.resv, |
| 602 | NULL)); | 596 | NULL)); |
| 603 | 597 | ||
| 604 | r = amdgpu_bo_create_shadow(adev, bp->size, bp->byte_align, (*bo_ptr)); | 598 | r = amdgpu_bo_create_shadow(adev, bp->size, *bo_ptr); |
| 605 | 599 | ||
| 606 | if (!bp->resv) | 600 | if (!bp->resv) |
| 607 | reservation_object_unlock((*bo_ptr)->tbo.resv); | 601 | reservation_object_unlock((*bo_ptr)->tbo.resv); |
| @@ -695,13 +689,10 @@ retry: | |||
| 695 | } | 689 | } |
| 696 | 690 | ||
| 697 | /** | 691 | /** |
| 698 | * amdgpu_bo_restore_from_shadow - restore an &amdgpu_bo buffer object | 692 | * amdgpu_bo_restore_shadow - restore an &amdgpu_bo shadow |
| 699 | * @adev: amdgpu device object | 693 | * |
| 700 | * @ring: amdgpu_ring for the engine handling the buffer operations | 694 | * @shadow: &amdgpu_bo shadow to be restored |
| 701 | * @bo: &amdgpu_bo buffer to be restored | ||
| 702 | * @resv: reservation object with embedded fence | ||
| 703 | * @fence: dma_fence associated with the operation | 695 | * @fence: dma_fence associated with the operation |
| 704 | * @direct: whether to submit the job directly | ||
| 705 | * | 696 | * |
| 706 | * Copies a buffer object's shadow content back to the object. | 697 | * Copies a buffer object's shadow content back to the object. |
| 707 | * This is used for recovering a buffer from its shadow in case of a gpu | 698 | * This is used for recovering a buffer from its shadow in case of a gpu |
| @@ -710,36 +701,19 @@ retry: | |||
| 710 | * Returns: | 701 | * Returns: |
| 711 | * 0 for success or a negative error code on failure. | 702 | * 0 for success or a negative error code on failure. |
| 712 | */ | 703 | */ |
| 713 | int amdgpu_bo_restore_from_shadow(struct amdgpu_device *adev, | 704 | int amdgpu_bo_restore_shadow(struct amdgpu_bo *shadow, struct dma_fence **fence) |
| 714 | struct amdgpu_ring *ring, | ||
| 715 | struct amdgpu_bo *bo, | ||
| 716 | struct reservation_object *resv, | ||
| 717 | struct dma_fence **fence, | ||
| 718 | |||
