aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-06 11:16:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-06 11:16:33 -0400
commit135c5504a600ff9b06e321694fbcac78a9530cd4 (patch)
tree8d22ed739b0e85954010a964a9aeadf3c692c977 /drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
parentaf6c5d5e01ad9f2c9ca38cccaae6b5d67ddd241f (diff)
parent568cf2e6aa0c762f14d2d0d481a006f93c63ab7a (diff)
Merge tag 'drm-next-2018-06-06-1' of git://anongit.freedesktop.org/drm/drm
Pull drm updates from Dave Airlie: "This starts to support NVIDIA volta hardware with nouveau, and adds amdgpu support for the GPU in the Kabylake-G (the intel + radeon single package chip), along with some initial Intel icelake enabling. Summary: New Drivers: - v3d - driver for broadcom V3D V3.x+ hardware - xen-front - XEN PV display frontend core: - handle zpos normalization in the core - stop looking at legacy pointers in atomic paths - improved scheduler documentation - improved aspect ratio validation - aspect ratio support for 64:27 and 256:135 - drop unused control node code. i915: - Icelake (ICL) enabling - GuC/HuC refactoring - PSR/PSR2 enabling and fixes - DPLL management refactoring - DP MST fixes - NV12 enabling - HDCP improvements - GEM/Execlist/reset improvements - GVT improvements - stolen memory first 4k fix amdgpu: - Vega 20 support - VEGAM support (Kabylake-G) - preOS scanout buffer reservation - power management gfxoff support for raven - SR-IOV fixes - Vega10 power profiles and clock voltage control - scatter/gather display support on CZ/ST amdkfd: - GFX9 dGPU support - userptr memory mapping nouveau: - major refactoring for Volta GV100 support tda998x: - HDMI i2c CEC support etnaviv: - removed unused logging code - license text cleanups - MMU handling improvements - timeout fence fix for 50 days uptime tegra: - IOMMU support in gr2d/gr3d drivers - zpos support vc4: - syncobj support - CTM, plane alpha and async cursor support analogix_dp: - HPD and aux chan fixes sun4i: - MIPI DSI support tilcdc: - clock divider fixes for OMAP-l138 LCDK board rcar-du: - R8A77965 support - dma-buf fences fixes - hardware indexed crtc/du group handling - generic zplane property support atmel-hclcdc: - generic zplane property support mediatek: - use generic video mode function exynos: - S5PV210 FIMD variant support - IPP v2 framework - more HW overlays support" * tag 'drm-next-2018-06-06-1' of git://anongit.freedesktop.org/drm/drm: (1286 commits) drm/amdgpu: fix 32-bit build warning drm/exynos: fimc: signedness bug in fimc_setup_clocks() drm/exynos: scaler: fix static checker warning drm/amdgpu: Use dev_info() to report amdkfd is not supported for this ASIC drm/amd/display: Remove use of division operator for long longs drm/amdgpu: Update GFX info structure to match what vega20 used drm/amdgpu/pp: remove duplicate assignment drm/sched: add rcu_barrier after entity fini drm/amdgpu: move VM BOs on LRU again drm/amdgpu: consistenly use VM moved flag drm/amdgpu: kmap PDs/PTs in amdgpu_vm_update_directories drm/amdgpu: further optimize amdgpu_vm_handle_moved drm/amdgpu: cleanup amdgpu_vm_validate_pt_bos v2 drm/amdgpu: rework VM state machine lock handling v2 drm/amdgpu: Add runtime VCN PG support drm/amdgpu: Enable VCN static PG by default on RV drm/amdgpu: Add VCN static PG support on RV drm/amdgpu: Enable VCN CG by default on RV drm/amdgpu: Add static CG control for VCN on RV drm/exynos: Fix default value for zpos plane property ...
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c50
1 files changed, 37 insertions, 13 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 46b9ea4e6103..2c8e27370284 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -48,17 +48,25 @@ int amdgpu_gem_object_create(struct amdgpu_device *adev, unsigned long size,
48 struct drm_gem_object **obj) 48 struct drm_gem_object **obj)
49{ 49{
50 struct amdgpu_bo *bo; 50 struct amdgpu_bo *bo;
51 struct amdgpu_bo_param bp;
51 int r; 52 int r;
52 53
54 memset(&bp, 0, sizeof(bp));
53 *obj = NULL; 55 *obj = NULL;
54 /* At least align on page size */ 56 /* At least align on page size */
55 if (alignment < PAGE_SIZE) { 57 if (alignment < PAGE_SIZE) {
56 alignment = PAGE_SIZE; 58 alignment = PAGE_SIZE;
57 } 59 }
58 60
61 bp.size = size;
62 bp.byte_align = alignment;
63 bp.type = type;
64 bp.resv = resv;
65 bp.preferred_domain = initial_domain;
59retry: 66retry:
60 r = amdgpu_bo_create(adev, size, alignment, initial_domain, 67 bp.flags = flags;
61 flags, type, resv, &bo); 68 bp.domain = initial_domain;
69 r = amdgpu_bo_create(adev, &bp, &bo);
62 if (r) { 70 if (r) {
63 if (r != -ERESTARTSYS) { 71 if (r != -ERESTARTSYS) {
64 if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) { 72 if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
@@ -221,12 +229,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data,
221 return -EINVAL; 229 return -EINVAL;
222 230
223 /* reject invalid gem domains */ 231 /* reject invalid gem domains */
224 if (args->in.domains & ~(AMDGPU_GEM_DOMAIN_CPU | 232 if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK)
225 AMDGPU_GEM_DOMAIN_GTT |
226 AMDGPU_GEM_DOMAIN_VRAM |
227 AMDGPU_GEM_DOMAIN_GDS |
228 AMDGPU_GEM_DOMAIN_GWS |
229 AMDGPU_GEM_DOMAIN_OA))
230 return -EINVAL; 233 return -EINVAL;
231 234
232 /* create a gem object to contain this object in */ 235 /* create a gem object to contain this object in */
@@ -771,16 +774,23 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
771} 774}
772 775
773#if defined(CONFIG_DEBUG_FS) 776#if defined(CONFIG_DEBUG_FS)
777
778#define amdgpu_debugfs_gem_bo_print_flag(m, bo, flag) \
779 if (bo->flags & (AMDGPU_GEM_CREATE_ ## flag)) { \
780 seq_printf((m), " " #flag); \
781 }
782
774static int amdgpu_debugfs_gem_bo_info(int id, void *ptr, void *data) 783static int amdgpu_debugfs_gem_bo_info(int id, void *ptr, void *data)
775{ 784{
776 struct drm_gem_object *gobj = ptr; 785 struct drm_gem_object *gobj = ptr;
777 struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj); 786 struct amdgpu_bo *bo = gem_to_amdgpu_bo(gobj);
778 struct seq_file *m = data; 787 struct seq_file *m = data;
779 788
789 struct dma_buf_attachment *attachment;
790 struct dma_buf *dma_buf;
780 unsigned domain; 791 unsigned domain;
781 const char *placement; 792 const char *placement;
782 unsigned pin_count; 793 unsigned pin_count;
783 uint64_t offset;
784 794
785 domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type); 795 domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type);
786 switch (domain) { 796 switch (domain) {
@@ -798,13 +808,27 @@ static int amdgpu_debugfs_gem_bo_info(int id, void *ptr, void *data)
798 seq_printf(m, "\t0x%08x: %12ld byte %s", 808 seq_printf(m, "\t0x%08x: %12ld byte %s",
799 id, amdgpu_bo_size(bo), placement); 809 id, amdgpu_bo_size(bo), placement);
800 810
801 offset = READ_ONCE(bo->tbo.mem.start);
802 if (offset != AMDGPU_BO_INVALID_OFFSET)
803 seq_printf(m, " @ 0x%010Lx", offset);
804
805 pin_count = READ_ONCE(bo->pin_count); 811 pin_count = READ_ONCE(bo->pin_count);
806 if (pin_count) 812 if (pin_count)
807 seq_printf(m, " pin count %d", pin_count); 813 seq_printf(m, " pin count %d", pin_count);
814
815 dma_buf = READ_ONCE(bo->gem_base.dma_buf);
816 attachment = READ_ONCE(bo->gem_base.import_attach);
817
818 if (attachment)
819 seq_printf(m, " imported from %p", dma_buf);
820 else if (dma_buf)
821 seq_printf(m, " exported as %p", dma_buf);
822
823 amdgpu_debugfs_gem_bo_print_flag(m, bo, CPU_ACCESS_REQUIRED);
824 amdgpu_debugfs_gem_bo_print_flag(m, bo, NO_CPU_ACCESS);
825 amdgpu_debugfs_gem_bo_print_flag(m, bo, CPU_GTT_USWC);
826 amdgpu_debugfs_gem_bo_print_flag(m, bo, VRAM_CLEARED);
827 amdgpu_debugfs_gem_bo_print_flag(m, bo, SHADOW);
828 amdgpu_debugfs_gem_bo_print_flag(m, bo, VRAM_CONTIGUOUS);
829 amdgpu_debugfs_gem_bo_print_flag(m, bo, VM_ALWAYS_VALID);
830 amdgpu_debugfs_gem_bo_print_flag(m, bo, EXPLICIT_SYNC);
831
808 seq_printf(m, "\n"); 832 seq_printf(m, "\n");
809 833
810 return 0; 834 return 0;