48-bit virtual address support in i915
v3 cover 48-bit virtual address support in i915
48-bit virtual address range will be enabled in i915 soon, but some objects must be referenced by 32-bit offsets. These patches use a new kernel flag to specify if this restriction applies or not.
I'm sending these patches to comply with the i915 merge process. Once the kernel patch is merged, I'll make a new libdrm release and address the mesa build dependency.
Michel Thierry (2):
intel: Add EXEC_OBJECT_SUPPORTS_48B_ADDRESS flag
intel: add new function name to symbol-check test
include/drm/i915_drm.h | 3 ++- intel/intel-symbol-check | 1 + intel/intel_bufmgr.c | 16 ++++++++++++++ intel/intel_bufmgr.h | 6 +++++- intel/intel_bufmgr_gem.c | 54 +++++++++++++++++++++++++++++++++++++++++++---- intel/intel_bufmgr_priv.h | 11 ++++++++++ 6 files changed, 85 insertions(+), 6 deletions(-)
Signature · 6 lines
2.5.0 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 1/2 intel: Add EXEC_OBJECT_SUPPORTS_48B_ADDRESS flag
Gen8+ supports 48-bit virtual addresses, but some objects must always be allocated inside the 32-bit address range.
In specific, any resource used with flat/heapless (0x00000000-0xfffff000) General State Heap (GSH) or Instruction State Heap (ISH) must be in a 32-bit range, because the General State Offset and Instruction State Offset are limited to 32-bits.
The i915 driver has been modified to provide a flag to set when the 4GB limit is not necessary in a given bo (EXEC_OBJECT_SUPPORTS_48B_ADDRESS). 48-bit range will only be used when explicitly requested.
Calls to the new drm_intel_bo_emit_reloc_48bit function will have this flag set automatically, while calls to drm_intel_bo_emit_reloc will clear it.
v2: Make set/clear functions nops on pre-gen8 platforms, and use them
internally in emit_reloc functions (Ben) s/48BADDRESS/48B_ADDRESS/ (Dave)
v3: Keep set/clear functions internal, no-one needs to use them directly.
References: http://lists.freedesktop.org/archives/intel-gfx/2015-July/072612.html
--- include/drm/i915_drm.h | 3 ++- intel/intel_bufmgr.c | 16 ++++++++++++++ intel/intel_bufmgr.h | 6 +++++- intel/intel_bufmgr_gem.c | 54 +++++++++++++++++++++++++++++++++++++++++++---- intel/intel_bufmgr_priv.h | 11 ++++++++++ 5 files changed, 84 insertions(+), 6 deletions(-)
include/drm/i915_drm.h +2 -1
@@ -680,7 +680,8 @@ struct drm_i915_gem_exec_object2 {#define EXEC_OBJECT_NEEDS_FENCE (1<<0)#define EXEC_OBJECT_NEEDS_GTT (1<<1)#define EXEC_OBJECT_WRITE (1<<2) -#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_WRITE<<1) +#define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3) +#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_SUPPORTS_48B_ADDRESS<<1)__u64 flags;__u64 rsvd1;
intel/intel_bufmgr.c +16 -0
@@ -202,6 +202,22 @@ drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, drm_intel_bo *target_bo, uint32_t target_offset, uint32_t read_domains, uint32_t write_domain) { + if (bo->bufmgr->bo_clear_supports_48b_address) + bo->bufmgr->bo_clear_supports_48b_address(target_bo); + +return bo->bufmgr->bo_emit_reloc (bo, offset, + target_bo, target_offset, + read_domains, write_domain); +} + +int +drm_intel_bo_emit_reloc_48bit (drm_intel_bo *bo,uint32_t offset, +drm_intel_bo *target_bo,uint32_t target_offset, +uint32_t read_domains,uint32_t write_domain) +{ +if (bo->bufmgr->bo_set_supports_48b_address) + bo->bufmgr->bo_set_supports_48b_address (target_bo); +return bo->bufmgr->bo_emit_reloc (bo, offset, target_bo, target_offset, read_domains, write_domain);
intel/intel_bufmgr.h +5 -1
@@ -87,7 +87,8 @@ struct _drm_intel_bo {/** * Last seen card virtual address (offset from the beginning of the * aperture) for the object. This should be used to fill relocation -* entries when calling drm_intel_bo_emit_reloc() +* entries when calling drm_intel_bo_emit_reloc() or +* drm_intel_bo_emit_reloc_48bit() */ uint64_t offset64; };
@@ -147,6 +148,9 @@ int drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count);int drm_intel_bo_emit_reloc (drm_intel_bo *bo,uint32_t offset,drm_intel_bo *target_bo,uint32_t target_offset,uint32_t read_domains,uint32_t write_domain); +int drm_intel_bo_emit_reloc_48bit (drm_intel_bo *bo,uint32_t offset, +drm_intel_bo *target_bo,uint32_t target_offset, +uint32_t read_domains,uint32_t write_domain); int drm_intel_bo_emit_reloc_fence(drm_intel_bo *bo, uint32_t offset, drm_intel_bo *target_bo, uint32_t target_offset,
intel/intel_bufmgr_gem.c +50 -4
120 lines not on this page · raw message
intel/intel_bufmgr_priv.h +11 -0
@@ -152,6 +152,17 @@ struct _drm_intel_bufmgr {void (*destroy) (drm_intel_bufmgr *bufmgr);/** +* Set/Clear 48-bit address support flag in a given bo. +* +* Any resource used with flat/heapless (0x00000000-0xfffff000) +* General State Heap (GSH) or Intructions State Heap (ISH) must +* be in a 32-bit range. 48-bit range will only be used when explicitly +* requested. +*/ +void (*bo_set_supports_48b_address) (drm_intel_bo *bo); +void (*bo_clear_supports_48b_address) (drm_intel_bo *bo); + +/** * Add relocation entry in reloc_buf, which will be updated with the * target buffer's real offset on on command submission. *
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH libdrm v3 1/2] intel: Add EXEC_OBJECT_SUPPORTS_48B_ADDRESS flag
Quoted 51 lines · Michel Thierry
Gen8+ supports 48-bit virtual addresses, but some objects must always be allocated inside the 32-bit address range.
In specific, any resource used with flat/heapless (0x00000000-0xfffff000) General State Heap (GSH) or Instruction State Heap (ISH) must be in a 32-bit range, because the General State Offset and Instruction State Offset are limited to 32-bits.
The i915 driver has been modified to provide a flag to set when the 4GB limit is not necessary in a given bo (
EXEC_OBJECT_SUPPORTS_48B_ADDRESS). 48-bit range will only be used when explicitly requested.Calls to the new
drm_intel_bo_emit_reloc_48bitfunction will have this flag set automatically, while calls todrm_intel_bo_emit_relocwill clear it.v2: Make set/clear functions nops on pre-gen8 platforms, and use them
internally inemit_relocfunctions (Ben) s/48BADDRESS/48B_ADDRESS/ (Dave)
v3: Keep set/clear functions internal, no-one needs to use them directly.References: http://lists.freedesktop.org/archives/intel-gfx/2015-July/072612.html
Cc Ben Widawsky <[email protected]>Cc Dave Gordon <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- include/drm/i915_drm.h | 3 ++- intel/intel_bufmgr.c | 16 ++++++++++++++ intel/intel_bufmgr.h | 6 +++++- intel/intel_bufmgr_gem.c | 54 +++++++++++++++++++++++++++++++++++++++++++---- intel/intel_bufmgr_priv.h | 11 ++++++++++ 5 files changed, 84 insertions(+), 6 deletions(-)include/drm/i915_drm.h +2
-1@@ -680,7 +680,8 @@ struct drm_i915_gem_exec_object2 {#define EXEC_OBJECT_NEEDS_FENCE (1<<0)#define EXEC_OBJECT_NEEDS_GTT (1<<1)#define EXEC_OBJECT_WRITE (1<<2) -#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_WRITE<<1) +#define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3) +#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_SUPPORTS_48B_ADDRESS<<1)__u64 flags;__u64 rsvd1;intel/intel_bufmgr.c +0
-0
intel/intel_bufmgr.c drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, · line 206
Quoted 5 lines
intel/intel_bufmgr.c +2
-0@@ -202,6 +202,22 @@ drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, drm_intel_bo *target_bo, uint32_t target_offset, uint32_t read_domains, uint32_t write_domain) { + if (bo->bufmgr->bo_clear_supports_48b_address) + bo->bufmgr->bo_clear_supports_48b_address(target_bo);
This is always true - you assign func to this func pointer unconditionally. Also - why not return some meaningful value if the user does not have enable_ppgtt=3 set? You can get that from I915_PARAM_HAS_ALIASING_PPGTT right now. Check for gen >= 8 seems rather inadequate, and even then you're not returning anything useful to the caller.
intel/intel_bufmgr.c drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, · line 212
Quoted 6 lines
intel/intel_bufmgr.c +6
-0+ +return bo->bufmgr->bo_emit_reloc (bo, offset, + target_bo, target_offset, + read_domains, write_domain); +} +
Using emit_reloc to set a BO flag seems confusing and can be error prone, emit_reloc can be called many times and caller needs to be careful and call the right function for each reloc.
intel/intel_bufmgr.c drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, · line 219
Quoted 7 lines
intel/intel_bufmgr.c +7
-0+int +drm_intel_bo_emit_reloc_48bit (drm_intel_bo *bo,uint32_t offset, +drm_intel_bo *target_bo,uint32_t target_offset, +uint32_t read_domains,uint32_t write_domain) +{ +if (bo->bufmgr->bo_set_supports_48b_address) + bo->bufmgr->bo_set_supports_48b_address (target_bo);
Same situation as with clear_supports_48b_address.
Quoted 33 lines
intel/intel_bufmgr.c +1
-0+return bo->bufmgr->bo_emit_reloc (bo, offset, target_bo, target_offset, read_domains, write_domain);intel/intel_bufmgr.h +5
-1@@ -87,7 +87,8 @@ struct _drm_intel_bo {/** * Last seen card virtual address (offset from the beginning of the * aperture) for the object. This should be used to fill relocation -* entries when calling drm_intel_bo_emit_reloc() +* entries when calling drm_intel_bo_emit_reloc() or +* drm_intel_bo_emit_reloc_48bit() */ uint64_t offset64; };@@ -147,6 +148,9 @@ int drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count);int drm_intel_bo_emit_reloc (drm_intel_bo *bo,uint32_t offset,drm_intel_bo *target_bo,uint32_t target_offset,uint32_t read_domains,uint32_t write_domain); +int drm_intel_bo_emit_reloc_48bit (drm_intel_bo *bo,uint32_t offset, +drm_intel_bo *target_bo,uint32_t target_offset, +uint32_t read_domains,uint32_t write_domain); int drm_intel_bo_emit_reloc_fence(drm_intel_bo *bo, uint32_t offset, drm_intel_bo *target_bo, uint32_t target_offset,intel/intel_bufmgr_gem.c +0
-0
intel/intel_bufmgr_gem.c typedef struct _drm_intel_bufmgr_gem { · line 143
Quoted 4 lines
intel/intel_bufmgr_gem.c +1
-0@@ -140,6 +140,7 @@ typedef struct _drm_intel_bufmgr_gem { } drm_intel_bufmgr_gem;#define DRM_INTEL_RELOC_FENCE (1<<0) +#define DRM_INTEL_RELOC_SUPPORTS_48B_ADDRESS (2<<0)
Why are you duplicating information about support for 48B in both emit reloc function argument and struct bo_gem?
Quoted 147 lines
intel/intel_bufmgr_gem.c +49
-4typedef struct _drm_intel_reloc_target_info { drm_intel_bo *bo;@@ -237,6 +238,14 @@ struct _drm_intel_bo_gem {bool is_userptr;/** +* Boolean of whether this buffer can be in the whole 48-bit address. +* +* By default, buffers will be keep in a 32-bit range, unless this +* flag is explicitly set. +*/ +bool supports_48b_address; + +/** * Size in bytes of this buffer and its relocation descendents. * * Used to avoid costly tree walking in @@ -463,13 +472,18 @@ drm_intel_add_validate_buffer(drm_intel_bo *bo) }static void -drm_intel_add_validate_buffer2 (drm_intel_bo *bo,int need_fence) +drm_intel_add_validate_buffer2 (drm_intel_bo *bo,int need_fence, +int supports_48b_address) {drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo;int index;if (bo_gem->validate_index !=-1 ) { +if (supports_48b_address) { + bufmgr_gem->exec2_objects[bo_gem->validate_index].flags |= +EXEC_OBJECT_SUPPORTS_48B_ADDRESS ; + }if (need_fence) bufmgr_gem->exec2_objects[bo_gem->validate_index].flags |=EXEC_OBJECT_NEEDS_FENCE ;@@ -508,6 +522,10 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence) bufmgr_gem->exec2_objects[index].flags |=EXEC_OBJECT_NEEDS_FENCE ; } +if (supports_48b_address) { + bufmgr_gem->exec2_objects[index].flags |= +EXEC_OBJECT_SUPPORTS_48B_ADDRESS ; + } bufmgr_gem->exec_count++; }@@ -1925,11 +1943,33 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,else bo_gem->reloc_target_info[bo_gem->reloc_count].flags =0 ; +if (target_bo_gem->supports_48b_address) + bo_gem->reloc_target_info[bo_gem->reloc_count].flags |= +DRM_INTEL_RELOC_SUPPORTS_48B_ADDRESS ; + bo_gem->reloc_count++;return 0 ; } +static void drm_intel_gem_bo_set_supports_48b_address (drm_intel_bo *bo) +{ +drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; +drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; + +if (bufmgr_gem->gen >=8 ) + bo_gem->supports_48b_address =1 ; +} + +static void drm_intel_gem_bo_clear_supports_48b_address (drm_intel_bo *bo) +{ +drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; +drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; + +if (bufmgr_gem->gen >=8 ) + bo_gem->supports_48b_address =0 ; +} + static int drm_intel_gem_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, drm_intel_bo *target_bo, uint32_t target_offset,@@ -2043,7 +2083,7 @@ drm_intel_gem_bo_process_reloc2(drm_intel_bo *bo)for (i =0 ; i < bo_gem->reloc_count; i++) {drm_intel_bo *target_bo = bo_gem->reloc_target_info[i].bo; -int need_fence; +int need_fence, supports_48b_addr;if (target_bo == bo)continue ;@@ -2056,8 +2096,12 @@ drm_intel_gem_bo_process_reloc2(drm_intel_bo *bo) need_fence = (bo_gem->reloc_target_info[i].flags &DRM_INTEL_RELOC_FENCE ); + supports_48b_addr = (bo_gem->reloc_target_info[i].flags & +DRM_INTEL_RELOC_SUPPORTS_48B_ADDRESS ); +/* Add the target to the validate list */ -drm_intel_add_validate_buffer2 (target_bo, need_fence); +drm_intel_add_validate_buffer2 (target_bo, need_fence, + supports_48b_addr); } }@@ -2217,7 +2261,7 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,/* Add the batch buffer to the validation list. There are no relocations * pointing to it. */ -drm_intel_add_validate_buffer2 (bo,0 ); +drm_intel_add_validate_buffer2 (bo,0 ,0 );memclear (execbuf); execbuf.buffers_ptr = (uintptr_t )bufmgr_gem->exec2_objects;@@ -3299,6 +3343,8 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) bufmgr_gem->bufmgr.bo_wait_rendering = drm_intel_gem_bo_wait_rendering; bufmgr_gem->bufmgr.bo_emit_reloc = drm_intel_gem_bo_emit_reloc; bufmgr_gem->bufmgr.bo_emit_reloc_fence = drm_intel_gem_bo_emit_reloc_fence; + bufmgr_gem->bufmgr.bo_set_supports_48b_address = drm_intel_gem_bo_set_supports_48b_address; + bufmgr_gem->bufmgr.bo_clear_supports_48b_address = drm_intel_gem_bo_clear_supports_48b_address; bufmgr_gem->bufmgr.bo_pin = drm_intel_gem_bo_pin; bufmgr_gem->bufmgr.bo_unpin = drm_intel_gem_bo_unpin; bufmgr_gem->bufmgr.bo_get_tiling = drm_intel_gem_bo_get_tiling;intel/intel_bufmgr_priv.h +11
-0@@ -152,6 +152,17 @@ struct _drm_intel_bufmgr {void (*destroy) (drm_intel_bufmgr *bufmgr);/** +* Set/Clear 48-bit address support flag in a given bo. +* +* Any resource used with flat/heapless (0x00000000-0xfffff000) +* General State Heap (GSH) or Intructions State Heap (ISH) must +* be in a 32-bit range. 48-bit range will only be used when explicitly +* requested. +*/ +void (*bo_set_supports_48b_address) (drm_intel_bo *bo); +void (*bo_clear_supports_48b_address) (drm_intel_bo *bo); + +/** * Add relocation entry in reloc_buf, which will be updated with the * target buffer's real offset on on command submission. * Signature · 1 line
2.5.0
You also haven't updated the dump_validation_list with proper format specifier (addresses are truncated otherwise).
I really don't like hiding set_supports_48b_address/clear_supports_48b_address in emit reloc - making this explicit would be a better approach. Of course this is just my opinion, but let me post a bit different version of this API - just as an RFC so you can see how it would look with explicit set on bo and without adding another emit_reloc variant.
Signature · 6 lines
Michał Winiarski Intel VPG _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC 1/1 intel: 48b ppgtt support
--- include/drm/i915_drm.h | 3 ++- intel/intel_bufmgr.c | 11 +++++++++++ intel/intel_bufmgr.h | 1 + intel/intel_bufmgr_gem.c | 43 +++++++++++++++++++++++++++++++++---------- intel/intel_bufmgr_priv.h | 8 ++++++++ 5 files changed, 55 insertions(+), 11 deletions(-)
include/drm/i915_drm.h +2 -1
@@ -680,7 +680,8 @@ struct drm_i915_gem_exec_object2 {#define EXEC_OBJECT_NEEDS_FENCE (1<<0)#define EXEC_OBJECT_NEEDS_GTT (1<<1)#define EXEC_OBJECT_WRITE (1<<2) -#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_WRITE<<1) +#define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3) +#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_SUPPORTS_48B_ADDRESS<<1)__u64 flags;__u64 rsvd1;
intel/intel_bufmgr.c +11 -0
@@ -261,6 +261,17 @@ drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t * tiling_mode, }int +drm_intel_bo_use_full_range (drm_intel_bo *bo,uint32_t enable) +{ +if (bo->bufmgr->bo_use_full_range) { + bo->bufmgr->bo_use_full_range (bo, enable); +return 0 ; + } + +return -ENODEV ; +} + +int drm_intel_bo_disable_reuse (drm_intel_bo *bo) {if (bo->bufmgr->bo_disable_reuse)
intel/intel_bufmgr.h +1 -0
@@ -160,6 +160,7 @@ int drm_intel_bo_get_tiling(drm_intel_bo *bo, uint32_t * tiling_mode,int drm_intel_bo_flink (drm_intel_bo *bo,uint32_t * name);int drm_intel_bo_busy (drm_intel_bo *bo);int drm_intel_bo_madvise (drm_intel_bo *bo,int madv); +int drm_intel_bo_use_full_range (drm_intel_bo *bo,uint32_t enable);int drm_intel_bo_disable_reuse (drm_intel_bo *bo);int drm_intel_bo_is_reusable (drm_intel_bo *bo);
intel/intel_bufmgr_gem.c +33 -10
107 lines not on this page · raw message
intel/intel_bufmgr_priv.h +8 -0
@@ -227,6 +227,14 @@ struct _drm_intel_bufmgr { uint32_t * swizzle_mode);/** +* Indicate that the buffer can be placed in full ppgtt range (2^48) +* without restrictions. +* \param bo Buffer to set the full_range flag for +* \param enable Flag value +*/ +void (*bo_use_full_range) (drm_intel_bo *bo,uint32_t enable); + +/** * Create a visible name for a buffer which can be used by other apps * * \param buf Buffer to create a name for
Signature · 6 lines
2.4.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH libdrm v3 1/2] intel: Add EXEC_OBJECT_SUPPORTS_48B_ADDRESS flag
In reply to Michał WiniarskiQuoted 277 lines · Michał Winiarski
Quoted 51 lines · Michel Thierry
Gen8+ supports 48-bit virtual addresses, but some objects must always be allocated inside the 32-bit address range.
In specific, any resource used with flat/heapless (0x00000000-0xfffff000) General State Heap (GSH) or Instruction State Heap (ISH) must be in a 32-bit range, because the General State Offset and Instruction State Offset are limited to 32-bits.
The i915 driver has been modified to provide a flag to set when the 4GB limit is not necessary in a given bo (
EXEC_OBJECT_SUPPORTS_48B_ADDRESS). 48-bit range will only be used when explicitly requested.Calls to the new
drm_intel_bo_emit_reloc_48bitfunction will have this flag set automatically, while calls todrm_intel_bo_emit_relocwill clear it.v2: Make set/clear functions nops on pre-gen8 platforms, and use them
internally inemit_relocfunctions (Ben) s/48BADDRESS/48B_ADDRESS/ (Dave)
v3: Keep set/clear functions internal, no-one needs to use them directly.References: http://lists.freedesktop.org/archives/intel-gfx/2015-July/072612.html
Cc Ben Widawsky <[email protected]>Cc Dave Gordon <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- include/drm/i915_drm.h | 3 ++- intel/intel_bufmgr.c | 16 ++++++++++++++ intel/intel_bufmgr.h | 6 +++++- intel/intel_bufmgr_gem.c | 54 +++++++++++++++++++++++++++++++++++++++++++---- intel/intel_bufmgr_priv.h | 11 ++++++++++ 5 files changed, 84 insertions(+), 6 deletions(-)include/drm/i915_drm.h +2
-1@@ -680,7 +680,8 @@ struct drm_i915_gem_exec_object2 {#define EXEC_OBJECT_NEEDS_FENCE (1<<0)#define EXEC_OBJECT_NEEDS_GTT (1<<1)#define EXEC_OBJECT_WRITE (1<<2) -#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_WRITE<<1) +#define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3) +#define __EXEC_OBJECT_UNKNOWN_FLAGS -(EXEC_OBJECT_SUPPORTS_48B_ADDRESS<<1)__u64 flags;__u64 rsvd1;intel/intel_bufmgr.c +0
-0intel/intel_bufmgr.c drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, · line 206
Quoted 5 lines
intel/intel_bufmgr.c +2
-0@@ -202,6 +202,22 @@ drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, drm_intel_bo *target_bo, uint32_t target_offset, uint32_t read_domains, uint32_t write_domain) { + if (bo->bufmgr->bo_clear_supports_48b_address) + bo->bufmgr->bo_clear_supports_48b_address(target_bo);This is always true - you assign func to this func pointer unconditionally. Also - why not return some meaningful value if the user does not have enable_ppgtt=3 set? You can get that from
I915_PARAM_HAS_ALIASING_PPGTTright now. Check for gen >= 8 seems rather inadequate, and even then you're not returning anything useful to the caller.intel/intel_bufmgr.c drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, · line 212
Quoted 6 lines
intel/intel_bufmgr.c +6
-0+ +return bo->bufmgr->bo_emit_reloc (bo, offset, + target_bo, target_offset, + read_domains, write_domain); +} +Using
emit_relocto set a BO flag seems confusing and can be error prone,emit_reloccan be called many times and caller needs to be careful and call the right function for each reloc.intel/intel_bufmgr.c drm_intel_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, · line 219
Quoted 7 lines
intel/intel_bufmgr.c +7
-0+int +drm_intel_bo_emit_reloc_48bit (drm_intel_bo *bo,uint32_t offset, +drm_intel_bo *target_bo,uint32_t target_offset, +uint32_t read_domains,uint32_t write_domain) +{ +if (bo->bufmgr->bo_set_supports_48b_address) + bo->bufmgr->bo_set_supports_48b_address (target_bo);Same situation as with
clear_supports_48b_address.Quoted 33 lines
intel/intel_bufmgr.c +1
-0+return bo->bufmgr->bo_emit_reloc (bo, offset, target_bo, target_offset, read_domains, write_domain);intel/intel_bufmgr.h +5
-1@@ -87,7 +87,8 @@ struct _drm_intel_bo {/** * Last seen card virtual address (offset from the beginning of the * aperture) for the object. This should be used to fill relocation -* entries when calling drm_intel_bo_emit_reloc() +* entries when calling drm_intel_bo_emit_reloc() or +* drm_intel_bo_emit_reloc_48bit() */ uint64_t offset64; };@@ -147,6 +148,9 @@ int drm_intel_bufmgr_check_aperture_space(drm_intel_bo ** bo_array, int count);int drm_intel_bo_emit_reloc (drm_intel_bo *bo,uint32_t offset,drm_intel_bo *target_bo,uint32_t target_offset,uint32_t read_domains,uint32_t write_domain); +int drm_intel_bo_emit_reloc_48bit (drm_intel_bo *bo,uint32_t offset, +drm_intel_bo *target_bo,uint32_t target_offset, +uint32_t read_domains,uint32_t write_domain); int drm_intel_bo_emit_reloc_fence(drm_intel_bo *bo, uint32_t offset, drm_intel_bo *target_bo, uint32_t target_offset,intel/intel_bufmgr_gem.c +0
-0intel/intel_bufmgr_gem.c typedef struct _drm_intel_bufmgr_gem { · line 143
Quoted 4 lines
intel/intel_bufmgr_gem.c +1
-0@@ -140,6 +140,7 @@ typedef struct _drm_intel_bufmgr_gem { } drm_intel_bufmgr_gem;#define DRM_INTEL_RELOC_FENCE (1<<0) +#define DRM_INTEL_RELOC_SUPPORTS_48B_ADDRESS (2<<0)Why are you duplicating information about support for 48B in both emit reloc function argument and struct
bo_gem?Quoted 146 lines
intel/intel_bufmgr_gem.c +49
-4typedef struct _drm_intel_reloc_target_info { drm_intel_bo *bo;@@ -237,6 +238,14 @@ struct _drm_intel_bo_gem {bool is_userptr;/** +* Boolean of whether this buffer can be in the whole 48-bit address. +* +* By default, buffers will be keep in a 32-bit range, unless this +* flag is explicitly set. +*/ +bool supports_48b_address; + +/** * Size in bytes of this buffer and its relocation descendents. * * Used to avoid costly tree walking in @@ -463,13 +472,18 @@ drm_intel_add_validate_buffer(drm_intel_bo *bo) }static void -drm_intel_add_validate_buffer2 (drm_intel_bo *bo,int need_fence) +drm_intel_add_validate_buffer2 (drm_intel_bo *bo,int need_fence, +int supports_48b_address) {drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *)bo->bufmgr;drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *)bo;int index;if (bo_gem->validate_index !=-1 ) { +if (supports_48b_address) { + bufmgr_gem->exec2_objects[bo_gem->validate_index].flags |= +EXEC_OBJECT_SUPPORTS_48B_ADDRESS ; + }if (need_fence) bufmgr_gem->exec2_objects[bo_gem->validate_index].flags |=EXEC_OBJECT_NEEDS_FENCE ;@@ -508,6 +522,10 @@ drm_intel_add_validate_buffer2(drm_intel_bo *bo, int need_fence) bufmgr_gem->exec2_objects[index].flags |=EXEC_OBJECT_NEEDS_FENCE ; } +if (supports_48b_address) { + bufmgr_gem->exec2_objects[index].flags |= +EXEC_OBJECT_SUPPORTS_48B_ADDRESS ; + } bufmgr_gem->exec_count++; }@@ -1925,11 +1943,33 @@ do_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset,else bo_gem->reloc_target_info[bo_gem->reloc_count].flags =0 ; +if (target_bo_gem->supports_48b_address) + bo_gem->reloc_target_info[bo_gem->reloc_count].flags |= +DRM_INTEL_RELOC_SUPPORTS_48B_ADDRESS ; + bo_gem->reloc_count++;return 0 ; } +static void drm_intel_gem_bo_set_supports_48b_address (drm_intel_bo *bo) +{ +drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; +drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; + +if (bufmgr_gem->gen >=8 ) + bo_gem->supports_48b_address =1 ; +} + +static void drm_intel_gem_bo_clear_supports_48b_address (drm_intel_bo *bo) +{ +drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bo->bufmgr; +drm_intel_bo_gem *bo_gem = (drm_intel_bo_gem *) bo; + +if (bufmgr_gem->gen >=8 ) + bo_gem->supports_48b_address =0 ; +} + static int drm_intel_gem_bo_emit_reloc(drm_intel_bo *bo, uint32_t offset, drm_intel_bo *target_bo, uint32_t target_offset,@@ -2043,7 +2083,7 @@ drm_intel_gem_bo_process_reloc2(drm_intel_bo *bo)for (i =0 ; i < bo_gem->reloc_count; i++) {drm_intel_bo *target_bo = bo_gem->reloc_target_info[i].bo; -int need_fence; +int need_fence, supports_48b_addr;if (target_bo == bo)continue ;@@ -2056,8 +2096,12 @@ drm_intel_gem_bo_process_reloc2(drm_intel_bo *bo) need_fence = (bo_gem->reloc_target_info[i].flags &DRM_INTEL_RELOC_FENCE ); + supports_48b_addr = (bo_gem->reloc_target_info[i].flags & +DRM_INTEL_RELOC_SUPPORTS_48B_ADDRESS ); +/* Add the target to the validate list */ -drm_intel_add_validate_buffer2 (target_bo, need_fence); +drm_intel_add_validate_buffer2 (target_bo, need_fence, + supports_48b_addr); } }@@ -2217,7 +2261,7 @@ do_exec2(drm_intel_bo *bo, int used, drm_intel_context *ctx,/* Add the batch buffer to the validation list. There are no relocations * pointing to it. */ -drm_intel_add_validate_buffer2 (bo,0 ); +drm_intel_add_validate_buffer2 (bo,0 ,0 );memclear (execbuf); execbuf.buffers_ptr = (uintptr_t )bufmgr_gem->exec2_objects;@@ -3299,6 +3343,8 @@ drm_intel_bufmgr_gem_init(int fd, int batch_size) bufmgr_gem->bufmgr.bo_wait_rendering = drm_intel_gem_bo_wait_rendering; bufmgr_gem->bufmgr.bo_emit_reloc = drm_intel_gem_bo_emit_reloc; bufmgr_gem->bufmgr.bo_emit_reloc_fence = drm_intel_gem_bo_emit_reloc_fence; + bufmgr_gem->bufmgr.bo_set_supports_48b_address = drm_intel_gem_bo_set_supports_48b_address; + bufmgr_gem->bufmgr.bo_clear_supports_48b_address = drm_intel_gem_bo_clear_supports_48b_address; bufmgr_gem->bufmgr.bo_pin = drm_intel_gem_bo_pin; bufmgr_gem->bufmgr.bo_unpin = drm_intel_gem_bo_unpin; bufmgr_gem->bufmgr.bo_get_tiling = drm_intel_gem_bo_get_tiling;intel/intel_bufmgr_priv.h +11
-1@@ -152,6 +152,17 @@ struct _drm_intel_bufmgr {void (*destroy) (drm_intel_bufmgr *bufmgr);/** +* Set/Clear 48-bit address support flag in a given bo. +* +* Any resource used with flat/heapless (0x00000000-0xfffff000) +* General State Heap (GSH) or Intructions State Heap (ISH) must +* be in a 32-bit range. 48-bit range will only be used when explicitly +* requested. +*/ +void (*bo_set_supports_48b_address) (drm_intel_bo *bo); +void (*bo_clear_supports_48b_address) (drm_intel_bo *bo); + +/** * Add relocation entry in reloc_buf, which will be updated with the * target buffer's real offset on on command submission. * -- Quoted 1 line
2.5.0
You also haven't updated the
dump_validation_listwith proper format specifier (addresses are truncated otherwise).
Quoted 6 lines
I really don't like hiding set_supports_48b_address/clear_supports_48b_address in emit reloc - making this explicit would be a better approach. Of course this is just my opinion, but let me post a bit different version of this API - just as an RFC so you can see how it would look with explicit set on bo and without adding another
emit_relocvariant.
Hi Michał,
Ben suggested having the set/clear in emit reloc as this is the only place mesa cares about these wa.
But I see your point, this will be used not only by mesa, so we should have something that is good for all the other projects.
-Michel
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH libdrm v3 1/2] intel: Add EXEC_OBJECT_SUPPORTS_48B_ADDRESS flag
Quoted 10 lines · Michel Thierry
Hi Michał,
Ben suggested having the set/clear in emit reloc as this is the only place mesa cares about these wa.
But I see your point, this will be used not only by mesa, so we should
have something that is good for all the other projects.-Michel
If there are no comments from anyone else then I'm fine with public API from last version.
But comments about the error handling and implementation details could still be addressed.
-Michał
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v3 2/2 intel: add new function name to symbol-check test
In reply to Michel Thierry--- intel/intel-symbol-check | 1 + 1 file changed, 1 insertion(+)
intel/intel-symbol-check +1 -0
@@ -18,6 +18,7 @@ drm_intel_bo_busy drm_intel_bo_disable_reuse drm_intel_bo_emit_reloc drm_intel_bo_emit_reloc_fence +drm_intel_bo_emit_reloc_48bit drm_intel_bo_exec drm_intel_bo_fake_alloc_static drm_intel_bo_fake_disable_backing_store
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 1/1 i965/gen8+: bo in state base address must be in 32-bit address range
In reply to Michel ThierryGen8+ supports 48-bit virtual addresses, but some objects must always be allocated inside the 32-bit address range.
In specific, any resource used with flat/heapless (0x00000000-0xfffff000) General State Heap or Intruction State Heap must be in a 32-bit range (GSH / ISH), because the General State Offset and Instruction State Offset are limited to 32-bits.
Use drm_intel_bo_emit_reloc_48bit when the 4GB limit is not necessary, and the bo can be in the full address space.
This commit introduces a dependency of libdrm 2.4.63, which introduces the drm_intel_bo_emit_reloc_48bit function.
v2: s/48baddress/48b_address/,
Only use in OUT_RELOC64 cases, OUT_RELOC implies a 32-bit address offset is needed (Ben)
v3: Added OUT_RELOC64_INSIDE_4G, so it stands out when a 64-bit relocation
needs the 32-bit workaround (Chris)
References: http://lists.freedesktop.org/archives/intel-gfx/2015-July/072612.html
--- configure.ac | 2 +- src/mesa/drivers/dri/i965/gen8_misc_state.c | 19 +++++++++++-------- src/mesa/drivers/dri/i965/intel_batchbuffer.c | 20 ++++++++++++++++---- src/mesa/drivers/dri/i965/intel_batchbuffer.h | 10 ++++++++-- 4 files changed, 36 insertions(+), 15 deletions(-)
configure.ac +1 -1
@@ -68,7 +68,7 @@ AC_SUBST([OSMESA_VERSION]) dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.38 LIBDRM_RADEON_REQUIRED=2.4.56 -LIBDRM_INTEL_REQUIRED=2.4.60 +LIBDRM_INTEL_REQUIRED=2.4.63 LIBDRM_NVVIEUX_REQUIRED=2.4.33 LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41" LIBDRM_FREEDRENO_REQUIRED=2.4.57
src/mesa/drivers/dri/i965/gen8_misc_state.c +11 -8
@@ -28,6 +28,10 @@/** * Define the base addresses which some state is referenced from. +* +* Use OUT_RELOC64_INSIDE_4G instead of OUT_RELOC64, the General State +* Offset and Instruction State Offset are limited to 32-bits by hardware, +* and must be located in the first 4GBs (32-bit offset). */ void gen8_upload_state_base_address (struct brw_context *brw) {
@@ -41,19 +45,18 @@ void gen8_upload_state_base_address(struct brw_context *brw)OUT_BATCH (0 );OUT_BATCH (mocs_wb <<16 );/* Surface state base address: */ -OUT_RELOC64 (brw->batch.bo,I915_GEM_DOMAIN_SAMPLER ,0 , - mocs_wb <<4 |1 ); +OUT_RELOC64_INSIDE_4G (brw->batch.bo,I915_GEM_DOMAIN_SAMPLER ,0 , + mocs_wb <<4 |1 );/* Dynamic state base address: */ -OUT_RELOC64 (brw->batch.bo, -I915_GEM_DOMAIN_RENDER |I915_GEM_DOMAIN_INSTRUCTION ,0 , - mocs_wb <<4 |1 ); +OUT_RELOC64_INSIDE_4G (brw->batch.bo, +I915_GEM_DOMAIN_RENDER |I915_GEM_DOMAIN_INSTRUCTION ,0 , + mocs_wb <<4 |1 );/* Indirect object base address: MEDIA_OBJECT data */ OUT_BATCH (mocs_wb <<4 |1 );OUT_BATCH (0 );/* Instruction base address: shader kernels (incl. SIP) */ -OUT_RELOC64 (brw->cache.bo,I915_GEM_DOMAIN_INSTRUCTION ,0 , - mocs_wb <<4 |1 ); - +OUT_RELOC64_INSIDE_4G (brw->cache.bo,I915_GEM_DOMAIN_INSTRUCTION ,0 , + mocs_wb <<4 |1 );/* General state buffer size */ OUT_BATCH (0xfffff001 );/* Dynamic state buffer size */
src/mesa/drivers/dri/i965/intel_batchbuffer.c +16 -4
@@ -409,11 +409,23 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw, drm_intel_bo *buffer, uint32_t read_domains, uint32_t write_domain, - uint32_t delta) + uint32_t delta, + bool support_48bit_offset) { - int ret = drm_intel_bo_emit_reloc(brw->batch.bo, 4*brw->batch.used, - buffer, delta, - read_domains, write_domain); + int ret; + +/* Not all buffers can be allocated outside the first 4GB, and +* offset must be limited to 32-bits. +*/ +if (support_48bit_offset) +drm_intel_bo_emit_reloc_48bit (brw->batch.bo,4 *brw->batch.used, + buffer, delta, + read_domains, write_domain); +else +drm_intel_bo_emit_reloc (brw->batch.bo,4 *brw->batch.used, + buffer, delta, + read_domains, write_domain); +assert (ret ==0 ); (void ) ret;
src/mesa/drivers/dri/i965/intel_batchbuffer.h +8 -2
@@ -62,7 +62,8 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw,drm_intel_bo *buffer, uint32_t read_domains, uint32_t write_domain, - uint32_t offset); + uint32_t offset, + bool support_48bit_offset);static inline uint32_t float_as_int (float f) {union {
@@ -167,7 +168,12 @@ intel_batchbuffer_advance(struct brw_context *brw)/* Handle 48-bit address relocations for Gen8+ */ #define OUT_RELOC64 (buf, read_domains, write_domain, delta) do { \ - intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta); \ + intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta, 1); \ +} while (0) + +/* Handle 48-bit address relocations for Gen8+, requesting 32-bit offset */ +#define OUT_RELOC64_INSIDE_4G (buf, read_domains, write_domain, delta) do { \ + intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta, 0); \ } while (0)#define ADVANCE_BATCH () intel_batchbuffer_advance(brw);
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH mesa v3] i965/gen8+: bo in state base address must be in 32-bit address range
src/mesa/drivers/dri/i965/intel_batchbuffer.c bool · line 409
Quoted 6 lines · Michel Thierry
src/mesa/drivers/dri/i965/intel_batchbuffer.c +0
-0@@ -409,11 +409,23 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw,
This patch needs to be rebased on commit 09348c12f (committed more than 3 weeks ago).
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH mesa v3] i965/gen8+: bo in state base address must be in 32-bit address range
In reply to Michel ThierryQuoted 36 lines · Michel Thierry
Gen8+ supports 48-bit virtual addresses, but some objects must always be allocated inside the 32-bit address range.
In specific, any resource used with flat/heapless (0x00000000-0xfffff000) General State Heap or Intruction State Heap must be in a 32-bit range (GSH / ISH), because the General State Offset and Instruction State Offset are limited to 32-bits.
Use
drm_intel_bo_emit_reloc_48bitwhen the 4GB limit is not necessary, and the bo can be in the full address space.This commit introduces a dependency of libdrm 2.4.63, which introduces the
drm_intel_bo_emit_reloc_48bitfunction.v2: s/48baddress/48b_address/,
Only use inOUT_RELOC64cases,OUT_RELOCimplies a 32-bit address offset is needed (Ben)
v3: AddedOUT_RELOC64_INSIDE_4G, so it stands out when a 64-bit relocation
needs the 32-bit workaround (Chris)References: http://lists.freedesktop.org/archives/intel-gfx/2015-July/072612.html
Cc Ben Widawsky <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- configure.ac | 2 +- src/mesa/drivers/dri/i965/gen8_misc_state.c | 19 +++++++++++-------- src/mesa/drivers/dri/i965/intel_batchbuffer.c | 20 ++++++++++++++++---- src/mesa/drivers/dri/i965/intel_batchbuffer.h | 10 ++++++++-- 4 files changed, 36 insertions(+), 15 deletions(-)configure.ac +0
-0
configure.ac AC_SUBST([OSMESA_VERSION]) · line 71
Quoted 5 lines
configure.ac +1
-1@@ -68,7 +68,7 @@ AC_SUBST([OSMESA_VERSION]) dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.38 LIBDRM_RADEON_REQUIRED=2.4.56 -LIBDRM_INTEL_REQUIRED=2.4.60 +LIBDRM_INTEL_REQUIRED=2.4.63
There is no such version. I think you need a release before you can commit this. Otherwise you'll cause pain for a whole lot of people.
Quoted 108 lines
configure.ac +0
-0LIBDRM_NVVIEUX_REQUIRED=2.4.33 LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41" LIBDRM_FREEDRENO_REQUIRED=2.4.57src/mesa/drivers/dri/i965/gen8_misc_state.c +11
-8@@ -28,6 +28,10 @@/** * Define the base addresses which some state is referenced from. +* +* Use OUT_RELOC64_INSIDE_4G instead of OUT_RELOC64, the General State +* Offset and Instruction State Offset are limited to 32-bits by hardware, +* and must be located in the first 4GBs (32-bit offset). */ void gen8_upload_state_base_address (struct brw_context *brw) {@@ -41,19 +45,18 @@ void gen8_upload_state_base_address(struct brw_context *brw)OUT_BATCH (0 );OUT_BATCH (mocs_wb <<16 );/* Surface state base address: */ -OUT_RELOC64 (brw->batch.bo,I915_GEM_DOMAIN_SAMPLER ,0 , - mocs_wb <<4 |1 ); +OUT_RELOC64_INSIDE_4G (brw->batch.bo,I915_GEM_DOMAIN_SAMPLER ,0 , + mocs_wb <<4 |1 );/* Dynamic state base address: */ -OUT_RELOC64 (brw->batch.bo, -I915_GEM_DOMAIN_RENDER |I915_GEM_DOMAIN_INSTRUCTION ,0 , - mocs_wb <<4 |1 ); +OUT_RELOC64_INSIDE_4G (brw->batch.bo, +I915_GEM_DOMAIN_RENDER |I915_GEM_DOMAIN_INSTRUCTION ,0 , + mocs_wb <<4 |1 );/* Indirect object base address: MEDIA_OBJECT data */ OUT_BATCH (mocs_wb <<4 |1 );OUT_BATCH (0 );/* Instruction base address: shader kernels (incl. SIP) */ -OUT_RELOC64 (brw->cache.bo,I915_GEM_DOMAIN_INSTRUCTION ,0 , - mocs_wb <<4 |1 ); - +OUT_RELOC64_INSIDE_4G (brw->cache.bo,I915_GEM_DOMAIN_INSTRUCTION ,0 , + mocs_wb <<4 |1 );/* General state buffer size */ OUT_BATCH (0xfffff001 );/* Dynamic state buffer size */ src/mesa/drivers/dri/i965/intel_batchbuffer.c +16
-4@@ -409,11 +409,23 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw, drm_intel_bo *buffer, uint32_t read_domains, uint32_t write_domain, - uint32_t delta) + uint32_t delta, + bool support_48bit_offset) { - int ret = drm_intel_bo_emit_reloc(brw->batch.bo, 4*brw->batch.used, - buffer, delta, - read_domains, write_domain); + int ret; + +/* Not all buffers can be allocated outside the first 4GB, and +* offset must be limited to 32-bits. +*/ +if (support_48bit_offset) +drm_intel_bo_emit_reloc_48bit (brw->batch.bo,4 *brw->batch.used, + buffer, delta, + read_domains, write_domain); +else +drm_intel_bo_emit_reloc (brw->batch.bo,4 *brw->batch.used, + buffer, delta, + read_domains, write_domain); +assert (ret ==0 ); (void ) ret;src/mesa/drivers/dri/i965/intel_batchbuffer.h +8
-3@@ -62,7 +62,8 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw,drm_intel_bo *buffer, uint32_t read_domains, uint32_t write_domain, - uint32_t offset); + uint32_t offset, + bool support_48bit_offset);static inline uint32_t float_as_int (float f) {union {@@ -167,7 +168,12 @@ intel_batchbuffer_advance(struct brw_context *brw)/* Handle 48-bit address relocations for Gen8+ */ #define OUT_RELOC64 (buf, read_domains, write_domain, delta) do { \ - intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta); \ + intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta, 1); \ +} while (0) + +/* Handle 48-bit address relocations for Gen8+, requesting 32-bit offset */ +#define OUT_RELOC64_INSIDE_4G (buf, read_domains, write_domain, delta) do { \ + intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta, 0); \ } while (0)#define ADVANCE_BATCH () intel_batchbuffer_advance(brw); --2.5.0
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH mesa v3] i965/gen8+: bo in state base address must be in 32-bit address range
Quoted 32 lines · Ilia Mirkin
Quoted 31 lines · Michel Thierry
Gen8+ supports 48-bit virtual addresses, but some objects must always be allocated inside the 32-bit address range.
In specific, any resource used with flat/heapless (0x00000000-0xfffff000) General State Heap or Intruction State Heap must be in a 32-bit range (GSH / ISH), because the General State Offset and Instruction State Offset are limited to 32-bits.
Use
drm_intel_bo_emit_reloc_48bitwhen the 4GB limit is not necessary, and the bo can be in the full address space.This commit introduces a dependency of libdrm 2.4.63, which introduces the
drm_intel_bo_emit_reloc_48bitfunction.v2: s/48baddress/48b_address/,
Only use inOUT_RELOC64cases,OUT_RELOCimplies a 32-bit address offset is needed (Ben)
v3: AddedOUT_RELOC64_INSIDE_4G, so it stands out when a 64-bit relocation
needs the 32-bit workaround (Chris)References: http://lists.freedesktop.org/archives/intel-gfx/2015-July/072612.html
Cc Ben Widawsky <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- configure.ac | 2 +- src/mesa/drivers/dri/i965/gen8_misc_state.c | 19 +++++++++++-------- src/mesa/drivers/dri/i965/intel_batchbuffer.c | 20 ++++++++++++++++---- src/mesa/drivers/dri/i965/intel_batchbuffer.h | 10 ++++++++-- 4 files changed, 36 insertions(+), 15 deletions(-)
Quoted 14 lines
configure.ac AC_SUBST([OSMESA_VERSION]) · line 71
Quoted 10 lines
configure.ac +1
-1@@ -68,7 +68,7 @@ AC_SUBST([OSMESA_VERSION]) dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.38 LIBDRM_RADEON_REQUIRED=2.4.56 -LIBDRM_INTEL_REQUIRED=2.4.60 +LIBDRM_INTEL_REQUIRED=2.4.63There is no such version. I think you need a release before you can commit this. Otherwise you'll cause pain for a whole lot of people.
Afaics Michel explicitly covered the way things will/should be merged in the cover letter.
-Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH mesa v3] i965/gen8+: bo in state base address must be in 32-bit address range
In reply to Michel ThierryQuoted 7 lines · Michel Thierry
Gen8+ supports 48-bit virtual addresses, but some objects must always be allocated inside the 32-bit address range.
In specific, any resource used with flat/heapless (0x00000000-0xfffff000) General State Heap or Intruction State Heap must be in a 32-bit range (GSH / ISH), because the General State Offset and Instruction State Offset are limited to 32-bits.
This doesn't look right. From the workaround text, it doesn't sound like this is a HW problem, it only affects GMM. In mesa, we don't use "heapless" (which I assume means setting the base to 0 and max range) for instructions, dynamic state or surface state. Surface state and dynamic state is always in our batch bo which is limited to 8k. Provided STATE_BASE_ADDRESS works correctly in the HW, the batch bo can be places anywhere in the aperture. Offsets to dynamic or surface state is relative to the beginning of the batch bo and will always be less than 4g. Instructions are in their own bo (brw->cache.bo), but again, we point instruction state base to it and all our shader stage setup code references the instructions relative to the beginning of the instruction bo.
Kristian
Quoted 141 lines
Use
drm_intel_bo_emit_reloc_48bitwhen the 4GB limit is not necessary, and the bo can be in the full address space.This commit introduces a dependency of libdrm 2.4.63, which introduces the
drm_intel_bo_emit_reloc_48bitfunction.v2: s/48baddress/48b_address/,
Only use inOUT_RELOC64cases,OUT_RELOCimplies a 32-bit address offset is needed (Ben)
v3: AddedOUT_RELOC64_INSIDE_4G, so it stands out when a 64-bit relocation
needs the 32-bit workaround (Chris)References: http://lists.freedesktop.org/archives/intel-gfx/2015-July/072612.html
Cc Ben Widawsky <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- configure.ac | 2 +- src/mesa/drivers/dri/i965/gen8_misc_state.c | 19 +++++++++++-------- src/mesa/drivers/dri/i965/intel_batchbuffer.c | 20 ++++++++++++++++---- src/mesa/drivers/dri/i965/intel_batchbuffer.h | 10 ++++++++-- 4 files changed, 36 insertions(+), 15 deletions(-)configure.ac +1
-1@@ -68,7 +68,7 @@ AC_SUBST([OSMESA_VERSION]) dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.38 LIBDRM_RADEON_REQUIRED=2.4.56 -LIBDRM_INTEL_REQUIRED=2.4.60 +LIBDRM_INTEL_REQUIRED=2.4.63 LIBDRM_NVVIEUX_REQUIRED=2.4.33 LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41" LIBDRM_FREEDRENO_REQUIRED=2.4.57src/mesa/drivers/dri/i965/gen8_misc_state.c +11
-8@@ -28,6 +28,10 @@/** * Define the base addresses which some state is referenced from. +* +* Use OUT_RELOC64_INSIDE_4G instead of OUT_RELOC64, the General State +* Offset and Instruction State Offset are limited to 32-bits by hardware, +* and must be located in the first 4GBs (32-bit offset). */ void gen8_upload_state_base_address (struct brw_context *brw) {@@ -41,19 +45,18 @@ void gen8_upload_state_base_address(struct brw_context *brw)OUT_BATCH (0 );OUT_BATCH (mocs_wb <<16 );/* Surface state base address: */ -OUT_RELOC64 (brw->batch.bo,I915_GEM_DOMAIN_SAMPLER ,0 , - mocs_wb <<4 |1 ); +OUT_RELOC64_INSIDE_4G (brw->batch.bo,I915_GEM_DOMAIN_SAMPLER ,0 , + mocs_wb <<4 |1 );/* Dynamic state base address: */ -OUT_RELOC64 (brw->batch.bo, -I915_GEM_DOMAIN_RENDER |I915_GEM_DOMAIN_INSTRUCTION ,0 , - mocs_wb <<4 |1 ); +OUT_RELOC64_INSIDE_4G (brw->batch.bo, +I915_GEM_DOMAIN_RENDER |I915_GEM_DOMAIN_INSTRUCTION ,0 , + mocs_wb <<4 |1 );/* Indirect object base address: MEDIA_OBJECT data */ OUT_BATCH (mocs_wb <<4 |1 );OUT_BATCH (0 );/* Instruction base address: shader kernels (incl. SIP) */ -OUT_RELOC64 (brw->cache.bo,I915_GEM_DOMAIN_INSTRUCTION ,0 , - mocs_wb <<4 |1 ); - +OUT_RELOC64_INSIDE_4G (brw->cache.bo,I915_GEM_DOMAIN_INSTRUCTION ,0 , + mocs_wb <<4 |1 );/* General state buffer size */ OUT_BATCH (0xfffff001 );/* Dynamic state buffer size */ src/mesa/drivers/dri/i965/intel_batchbuffer.c +16
-4@@ -409,11 +409,23 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw, drm_intel_bo *buffer, uint32_t read_domains, uint32_t write_domain, - uint32_t delta) + uint32_t delta, + bool support_48bit_offset) { - int ret = drm_intel_bo_emit_reloc(brw->batch.bo, 4*brw->batch.used, - buffer, delta, - read_domains, write_domain); + int ret; + +/* Not all buffers can be allocated outside the first 4GB, and +* offset must be limited to 32-bits. +*/ +if (support_48bit_offset) +drm_intel_bo_emit_reloc_48bit (brw->batch.bo,4 *brw->batch.used, + buffer, delta, + read_domains, write_domain); +else +drm_intel_bo_emit_reloc (brw->batch.bo,4 *brw->batch.used, + buffer, delta, + read_domains, write_domain); +assert (ret ==0 ); (void ) ret;src/mesa/drivers/dri/i965/intel_batchbuffer.h +8
-3@@ -62,7 +62,8 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw,drm_intel_bo *buffer, uint32_t read_domains, uint32_t write_domain, - uint32_t offset); + uint32_t offset, + bool support_48bit_offset);static inline uint32_t float_as_int (float f) {union {@@ -167,7 +168,12 @@ intel_batchbuffer_advance(struct brw_context *brw)/* Handle 48-bit address relocations for Gen8+ */ #define OUT_RELOC64 (buf, read_domains, write_domain, delta) do { \ - intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta); \ + intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta, 1); \ +} while (0) + +/* Handle 48-bit address relocations for Gen8+, requesting 32-bit offset */ +#define OUT_RELOC64_INSIDE_4G (buf, read_domains, write_domain, delta) do { \ + intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta, 0); \ } while (0)#define ADVANCE_BATCH () intel_batchbuffer_advance(brw); --2.5.0
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Intel-gfx] [PATCH mesa v3] i965/gen8+: bo in state base address must be in 32-bit address range
Hi,
Thanks for the comments,
Quoted 4 lines · Kristian Høgsberg
Quoted 3 lines · Michel Thierry
Gen8+ supports 48-bit virtual addresses, but some objects must always be allocated inside the 32-bit address range.
Quoted 8 lines
Quoted 4 lines
In specific, any resource used with flat/heapless (0x00000000-0xfffff000) General State Heap or Intruction State Heap must be in a 32-bit range (GSH / ISH), because the General State Offset and Instruction State Offset are limited to 32-bits.
This doesn't look right. From the workaround text, it doesn't sound like this is a HW problem, it only affects GMM. In mesa, we don't use "heapless" (which I assume means setting the base to 0 and max range)
It is a hw problem, specifically in the state base address command. General State Base Address and Instruction Base Address shouldn't be > 4GB.
Quoted 9 lines
for instructions, dynamic state or surface state. Surface state and dynamic state is always in our batch bo which is limited to 8k. Provided
STATE_BASE_ADDRESSworks correctly in the HW, the batch bo can be places anywhere in the aperture. Offsets to dynamic or surface state is relative to the beginning of the batch bo and will always be less than 4g. Instructions are in their own bo (brw->cache.bo), but again, we point instruction state base to it and all our shader stage setup code references the instructions relative to the beginning of the instruction bo.
I've seen the issue when the driver allocates mapped objects from bottom to top and the other bo's from top to bottom (gpu hangs). So I say this wa is needed.
-Michel
Quoted 140 lines
Kristian
Quoted 137 lines
Use
drm_intel_bo_emit_reloc_48bitwhen the 4GB limit is not necessary, and the bo can be in the full address space.This commit introduces a dependency of libdrm 2.4.63, which introduces the
drm_intel_bo_emit_reloc_48bitfunction.v2: s/48baddress/48b_address/,
Only use inOUT_RELOC64cases,OUT_RELOCimplies a 32-bit address offset is needed (Ben)
v3: AddedOUT_RELOC64_INSIDE_4G, so it stands out when a 64-bit relocation
needs the 32-bit workaround (Chris)References: http://lists.freedesktop.org/archives/intel-gfx/2015-July/072612.html
Cc Ben Widawsky <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- configure.ac | 2 +- src/mesa/drivers/dri/i965/gen8_misc_state.c | 19 +++++++++++-------- src/mesa/drivers/dri/i965/intel_batchbuffer.c | 20 ++++++++++++++++---- src/mesa/drivers/dri/i965/intel_batchbuffer.h | 10 ++++++++-- 4 files changed, 36 insertions(+), 15 deletions(-)configure.ac +1
-1@@ -68,7 +68,7 @@ AC_SUBST([OSMESA_VERSION]) dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.38 LIBDRM_RADEON_REQUIRED=2.4.56 -LIBDRM_INTEL_REQUIRED=2.4.60 +LIBDRM_INTEL_REQUIRED=2.4.63 LIBDRM_NVVIEUX_REQUIRED=2.4.33 LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41" LIBDRM_FREEDRENO_REQUIRED=2.4.57src/mesa/drivers/dri/i965/gen8_misc_state.c +11
-8@@ -28,6 +28,10 @@/** * Define the base addresses which some state is referenced from. +* +* Use OUT_RELOC64_INSIDE_4G instead of OUT_RELOC64, the General State +* Offset and Instruction State Offset are limited to 32-bits by hardware, +* and must be located in the first 4GBs (32-bit offset). */ void gen8_upload_state_base_address (struct brw_context *brw) {@@ -41,19 +45,18 @@ void gen8_upload_state_base_address(struct brw_context *brw)OUT_BATCH (0 );OUT_BATCH (mocs_wb <<16 );/* Surface state base address: */ -OUT_RELOC64 (brw->batch.bo,I915_GEM_DOMAIN_SAMPLER ,0 , - mocs_wb <<4 |1 ); +OUT_RELOC64_INSIDE_4G (brw->batch.bo,I915_GEM_DOMAIN_SAMPLER ,0 , + mocs_wb <<4 |1 );/* Dynamic state base address: */ -OUT_RELOC64 (brw->batch.bo, -I915_GEM_DOMAIN_RENDER |I915_GEM_DOMAIN_INSTRUCTION ,0 , - mocs_wb <<4 |1 ); +OUT_RELOC64_INSIDE_4G (brw->batch.bo, +I915_GEM_DOMAIN_RENDER |I915_GEM_DOMAIN_INSTRUCTION ,0 , + mocs_wb <<4 |1 );/* Indirect object base address: MEDIA_OBJECT data */ OUT_BATCH (mocs_wb <<4 |1 );OUT_BATCH (0 );/* Instruction base address: shader kernels (incl. SIP) */ -OUT_RELOC64 (brw->cache.bo,I915_GEM_DOMAIN_INSTRUCTION ,0 , - mocs_wb <<4 |1 ); - +OUT_RELOC64_INSIDE_4G (brw->cache.bo,I915_GEM_DOMAIN_INSTRUCTION ,0 , + mocs_wb <<4 |1 );/* General state buffer size */ OUT_BATCH (0xfffff001 );/* Dynamic state buffer size */ src/mesa/drivers/dri/i965/intel_batchbuffer.c +16
-4@@ -409,11 +409,23 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw, drm_intel_bo *buffer, uint32_t read_domains, uint32_t write_domain, - uint32_t delta) + uint32_t delta, + bool support_48bit_offset) { - int ret = drm_intel_bo_emit_reloc(brw->batch.bo, 4*brw->batch.used, - buffer, delta, - read_domains, write_domain); + int ret; + +/* Not all buffers can be allocated outside the first 4GB, and +* offset must be limited to 32-bits. +*/ +if (support_48bit_offset) +drm_intel_bo_emit_reloc_48bit (brw->batch.bo,4 *brw->batch.used, + buffer, delta, + read_domains, write_domain); +else +drm_intel_bo_emit_reloc (brw->batch.bo,4 *brw->batch.used, + buffer, delta, + read_domains, write_domain); +assert (ret ==0 ); (void ) ret;src/mesa/drivers/dri/i965/intel_batchbuffer.h +8
-2@@ -62,7 +62,8 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw,drm_intel_bo *buffer, uint32_t read_domains, uint32_t write_domain, - uint32_t offset); + uint32_t offset, + bool support_48bit_offset);static inline uint32_t float_as_int (float f) {union {@@ -167,7 +168,12 @@ intel_batchbuffer_advance(struct brw_context *brw)/* Handle 48-bit address relocations for Gen8+ */ #define OUT_RELOC64 (buf, read_domains, write_domain, delta) do { \ - intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta); \ + intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta, 1); \ +} while (0) + +/* Handle 48-bit address relocations for Gen8+, requesting 32-bit offset */ +#define OUT_RELOC64_INSIDE_4G (buf, read_domains, write_domain, delta) do { \ + intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta, 0); \ } while (0)
Quoted 8 lines
Quoted 8 lines
src/mesa/drivers/dri/i965/intel_batchbuffer.h +0
-1#define ADVANCE_BATCH () intel_batchbuffer_advance(brw); --2.5.0
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH mesa v3] i965/gen8+: bo in state base address must be in 32-bit address range
Quoted 38 lines · Michel Thierry
Hi,
Thanks for the comments,
Quoted 14 lines · Kristian Høgsberg
Quoted 9 lines · Michel Thierry
Gen8+ supports 48-bit virtual addresses, but some objects must always be allocated inside the 32-bit address range.
In specific, any resource used with flat/heapless (0x00000000-0xfffff000) General State Heap or Intruction State Heap must be in a 32-bit range (GSH / ISH), because the General State Offset and Instruction State Offset
are limited to 32-bits.Quoted 3 lines
This doesn't look right. From the workaround text, it doesn't sound like this is a HW problem, it only affects GMM. In mesa, we don't use "heapless" (which I assume means setting the base to 0 and max range)
It is a hw problem, specifically in the state base address command. General State Base Address and Instruction Base Address shouldn't be > 4GB.
Quoted 9 lines
for instructions, dynamic state or surface state. Surface state and dynamic state is always in our batch bo which is limited to 8k. Provided
STATE_BASE_ADDRESSworks correctly in the HW, the batch bo can be places anywhere in the aperture. Offsets to dynamic or surface state is relative to the beginning of the batch bo and will always be less than 4g. Instructions are in their own bo (brw->cache.bo), but again, we point instruction state base to it and all our shader stage setup code references the instructions relative to the beginning of the instruction bo.
Quoted 3 lines
I've seen the issue when the driver allocates mapped objects from bottom to top and the other bo's from top to bottom (gpu hangs). So I say this wa is needed.
mesa does use heapless for the scratch buffers, and on BDW+ that's the only address type that's relative to general state base address. So we need the workaround there, whether or not there's a HW limitation/bug.
I don't think there is a HW problem though. The driver I'm working on can use 48 bit ppgtt and Chris Wilson's softpin ioctl for userspace BO placement. I enabled that and made the userspace allocator place all BOs above 8g, and it all stilll worked. In particular, the instructions were above 8g and referenced relative to instruction base address. If the instruction base was limited to 4g, this would have hung the GPU.
The fact that the HW limits the size of the heaps to 4g can be restriction when we move to full 48 ppgtt, but for how mesa uses STATE_BASE_ADDRESS, it only affects general state base address.
Kristiain
Quoted 160 lines
-Michel
Quoted 158 lines
Kristian
Quoted 155 lines
Use
drm_intel_bo_emit_reloc_48bitwhen the 4GB limit is not necessary, and
the bo can be in the full address space.This commit introduces a dependency of libdrm 2.4.63, which introduces the
drm_intel_bo_emit_reloc_48bitfunction.v2: s/48baddress/48b_address/,
Only use inOUT_RELOC64cases,OUT_RELOCimplies a 32-bit address
offset
is needed (Ben)
v3: AddedOUT_RELOC64_INSIDE_4G, so it stands out when a 64-bit relocation
needs the 32-bit workaround (Chris)References:
http://lists.freedesktop.org/archives/intel-gfx/2015-July/072612.htmlCc Ben Widawsky <[email protected]>Cc Chris Wilson <[email protected]>Signed-off-by Michel Thierry <[email protected]>--- configure.ac | 2 +- src/mesa/drivers/dri/i965/gen8_misc_state.c | 19 +++++++++++-------- src/mesa/drivers/dri/i965/intel_batchbuffer.c | 20 ++++++++++++++++---- src/mesa/drivers/dri/i965/intel_batchbuffer.h | 10 ++++++++-- 4 files changed, 36 insertions(+), 15 deletions(-)configure.ac +1
-1@@ -68,7 +68,7 @@ AC_SUBST([OSMESA_VERSION]) dnl Versions for external dependencies LIBDRM_REQUIRED=2.4.38 LIBDRM_RADEON_REQUIRED=2.4.56 -LIBDRM_INTEL_REQUIRED=2.4.60 +LIBDRM_INTEL_REQUIRED=2.4.63 LIBDRM_NVVIEUX_REQUIRED=2.4.33 LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41" LIBDRM_FREEDRENO_REQUIRED=2.4.57src/mesa/drivers/dri/i965/gen8_misc_state.c +4
-0@@ -28,6 +28,10 @@/** * Define the base addresses which some state is referenced from. +* +* Use OUT_RELOC64_INSIDE_4G instead of OUT_RELOC64, the General State +* Offset and Instruction State Offset are limited to 32-bits by hardware, +* and must be located in the first 4GBs (32-bit offset). */ void gen8_upload_state_base_address (struct brw_context *brw){src/mesa/drivers/dri/i965/gen8_misc_state.c +7
-8@@ -41,19 +45,18 @@ void gen8_upload_state_base_address(struct brw_context *brw) OUT_BATCH(0);OUT_BATCH (mocs_wb <<16 );/* Surface state base address: */ -OUT_RELOC64 (brw->batch.bo,I915_GEM_DOMAIN_SAMPLER ,0 , - mocs_wb <<4 |1 ); +OUT_RELOC64_INSIDE_4G (brw->batch.bo,I915_GEM_DOMAIN_SAMPLER ,0 , + mocs_wb <<4 |1 );/* Dynamic state base address: */ -OUT_RELOC64 (brw->batch.bo, -I915_GEM_DOMAIN_RENDER |I915_GEM_DOMAIN_INSTRUCTION ,0 , - mocs_wb <<4 |1 ); +OUT_RELOC64_INSIDE_4G (brw->batch.bo, +I915_GEM_DOMAIN_RENDER |I915_GEM_DOMAIN_INSTRUCTION ,0 , + mocs_wb <<4 |1 );/* Indirect object base address: MEDIA_OBJECT data */ OUT_BATCH (mocs_wb <<4 |1 );OUT_BATCH (0 );/* Instruction base address: shader kernels (incl. SIP) */ -OUT_RELOC64 (brw->cache.bo,I915_GEM_DOMAIN_INSTRUCTION ,0 , - mocs_wb <<4 |1 ); - +OUT_RELOC64_INSIDE_4G (brw->cache.bo,I915_GEM_DOMAIN_INSTRUCTION ,0 , + mocs_wb <<4 |1 );/* General state buffer size */ OUT_BATCH(0xfffff001); /* Dynamic state buffer size */src/mesa/drivers/dri/i965/intel_batchbuffer.c +16
-4@@ -409,11 +409,23 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw, drm_intel_bo *buffer, uint32_t read_domains, uint32_t write_domain, - uint32_t delta) + uint32_t delta, + bool support_48bit_offset) { - int ret = drm_intel_bo_emit_reloc(brw->batch.bo, 4*brw->batch.used, - buffer, delta, - read_domains, write_domain); + int ret; + +/* Not all buffers can be allocated outside the first 4GB, and +* offset must be limited to 32-bits. +*/ +if (support_48bit_offset) +drm_intel_bo_emit_reloc_48bit (brw->batch.bo,4 *brw->batch.used, + buffer, delta, + read_domains, write_domain); +else +drm_intel_bo_emit_reloc (brw->batch.bo,4 *brw->batch.used, + buffer, delta, + read_domains, write_domain); +assert (ret ==0 ); (void ) ret;src/mesa/drivers/dri/i965/intel_batchbuffer.h +2
-1@@ -62,7 +62,8 @@ bool intel_batchbuffer_emit_reloc64(struct brw_context *brw, drm_intel_bo *buffer, uint32_t read_domains, uint32_t write_domain, - uint32_t offset); + uint32_t offset, + bool support_48bit_offset);static inline uint32_t float_as_int (float f) {union {src/mesa/drivers/dri/i965/intel_batchbuffer.h +5
-1@@ -167,7 +168,12 @@ intel_batchbuffer_advance(struct brw_context *brw)/* Handle 48-bit address relocations for Gen8+ */ #define OUT_RELOC64 (buf, read_domains, write_domain, delta) do { \ - intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta); \ + intel_batchbuffer_emit_reloc64(brw, buf, read_domains, write_domain, delta, 1); \ +}while (0 ) + +/* Handle 48-bit address relocations for Gen8+, requesting 32-bit offset */ +#define OUT_RELOC64_INSIDE_4G (buf, read_domains, write_domain, delta) do{ \
+ intel_batchbuffer_emit_reloc64(brw, buf,read_domains,write_domain,
delta, 0); \
} while (0)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
#define
ADVANCE_BATCH()intel_batchbuffer_advance(brw);
--
2.5.0_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev