Reviewed-by: Marek Olšák <marek.ol...@amd.com> Marek
On Wed, Jun 20, 2018 at 3:25 PM, Grazvydas Ignotas <nota...@gmail.com> wrote: > This allows to avoid having to see garbage in Dying Light loading screen > at least, which probably expects Windows/NV behavior of all allocations > being zeroed by default. > > Analogous to radv flag with the same name. > --- > src/gallium/drivers/radeonsi/si_pipe.c | 1 + > src/gallium/drivers/radeonsi/si_pipe.h | 1 + > src/gallium/winsys/amdgpu/drm/amdgpu_bo.c | 3 +++ > src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 1 + > src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h | 1 + > 5 files changed, 7 insertions(+) > > diff --git a/src/gallium/drivers/radeonsi/si_pipe.c > b/src/gallium/drivers/radeonsi/si_pipe.c > index cc871b1..1c3405f 100644 > --- a/src/gallium/drivers/radeonsi/si_pipe.c > +++ b/src/gallium/drivers/radeonsi/si_pipe.c > @@ -80,10 +80,11 @@ static const struct debug_named_value debug_options[] = { > { "forcedma", DBG(FORCE_DMA), "Use asynchronous DMA for all > operations when possible." }, > { "nodma", DBG(NO_ASYNC_DMA), "Disable asynchronous DMA" }, > { "nowc", DBG(NO_WC), "Disable GTT write combining" }, > { "check_vm", DBG(CHECK_VM), "Check VM faults and dump debug info." }, > { "reserve_vmid", DBG(RESERVE_VMID), "Force VMID reservation per > context." }, > + { "zerovram", DBG(ZERO_VRAM), "Clear VRAM allocations." }, > > /* 3D engine options: */ > { "switch_on_eop", DBG(SWITCH_ON_EOP), "Program WD/IA to switch on > end-of-packet." }, > { "nooutoforder", DBG(NO_OUT_OF_ORDER), "Disable out-of-order > rasterization" }, > { "nodpbb", DBG(NO_DPBB), "Disable DPBB." }, > diff --git a/src/gallium/drivers/radeonsi/si_pipe.h > b/src/gallium/drivers/radeonsi/si_pipe.h > index eb0c226..60dc8b0 100644 > --- a/src/gallium/drivers/radeonsi/si_pipe.h > +++ b/src/gallium/drivers/radeonsi/si_pipe.h > @@ -139,10 +139,11 @@ enum { > DBG_FORCE_DMA, > DBG_NO_ASYNC_DMA, > DBG_NO_WC, > DBG_CHECK_VM, > DBG_RESERVE_VMID, > + DBG_ZERO_VRAM, > > /* 3D engine options: */ > DBG_SWITCH_ON_EOP, > DBG_NO_OUT_OF_ORDER, > DBG_NO_DPBB, > diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c > b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c > index df8b829..15916ad 100644 > --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c > +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c > @@ -426,10 +426,13 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct > amdgpu_winsys *ws, > if (flags & RADEON_FLAG_GTT_WC) > request.flags |= AMDGPU_GEM_CREATE_CPU_GTT_USWC; > if (flags & RADEON_FLAG_NO_INTERPROCESS_SHARING && > ws->info.has_local_buffers) > request.flags |= AMDGPU_GEM_CREATE_VM_ALWAYS_VALID; > + if (ws->zero_all_vram_allocs && > + (request.preferred_heap & AMDGPU_GEM_DOMAIN_VRAM)) > + request.flags |= AMDGPU_GEM_CREATE_VRAM_CLEARED; > > r = amdgpu_bo_alloc(ws->dev, &request, &buf_handle); > if (r) { > fprintf(stderr, "amdgpu: Failed to allocate a buffer:\n"); > fprintf(stderr, "amdgpu: size : %"PRIu64" bytes\n", size); > diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c > b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c > index caa7991..44429e2 100644 > --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c > +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c > @@ -60,10 +60,11 @@ static bool do_winsys_init(struct amdgpu_winsys *ws, int > fd) > } > > ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != > NULL; > ws->debug_all_bos = debug_get_option_all_bos(); > ws->reserve_vmid = strstr(debug_get_option("R600_DEBUG", ""), > "reserve_vmid") != NULL; > + ws->zero_all_vram_allocs = strstr(debug_get_option("R600_DEBUG", ""), > "zerovram") != NULL; > > return true; > > fail: > amdgpu_device_deinitialize(ws->dev); > diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h > b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h > index a6784e8..8079255 100644 > --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h > +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h > @@ -77,10 +77,11 @@ struct amdgpu_winsys { > ADDR_HANDLE addrlib; > > bool check_vm; > bool debug_all_bos; > bool reserve_vmid; > + bool zero_all_vram_allocs; > > /* List of all allocated buffers */ > simple_mtx_t global_bo_list_lock; > struct list_head global_bo_list; > unsigned num_buffers; > -- > 2.7.4 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev