<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 2017-10-31 11:50 AM, Samuel Pitoiset
      wrote:<br>
    </div>
    <blockquote
      cite="mid:078f3ca7-e108-6ce6-4e07-65d8f569eb45@gmail.com"
      type="cite">
      <br>
      <br>
      On 10/31/2017 04:40 PM, Andrey Grodzovsky wrote:
      <br>
      <blockquote type="cite">Signed-off-by: Andrey Grodzovsky
        <a class="moz-txt-link-rfc2396E" href="mailto:andrey.grodzovsky@amd.com"><andrey.grodzovsky@amd.com></a>
        <br>
        ---
        <br>
          configure.ac                                  | 2 +-
        <br>
          src/gallium/drivers/radeon/r600_pipe_common.c | 1 +
        <br>
          src/gallium/drivers/radeon/r600_pipe_common.h | 1 +
        <br>
          src/gallium/winsys/amdgpu/drm/amdgpu_cs.c     | 8 ++++++++
        <br>
          src/gallium/winsys/amdgpu/drm/amdgpu_cs.h     | 3 +++
        <br>
          src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 1 +
        <br>
          src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h | 1 +
        <br>
          7 files changed, 16 insertions(+), 1 deletion(-)
        <br>
        <br>
        diff --git a/configure.ac b/configure.ac
        <br>
        index 9aa02f5..efc653a 100644
        <br>
        --- a/configure.ac
        <br>
        +++ b/configure.ac
        <br>
        @@ -74,7 +74,7 @@ AC_SUBST([OPENCL_VERSION])
        <br>
          # in the first entry.
        <br>
          LIBDRM_REQUIRED=2.4.75
        <br>
          LIBDRM_RADEON_REQUIRED=2.4.71
        <br>
        -LIBDRM_AMDGPU_REQUIRED=2.4.85
        <br>
        +LIBDRM_AMDGPU_REQUIRED=2.4.86
        <br>
          LIBDRM_INTEL_REQUIRED=2.4.75
        <br>
          LIBDRM_NVVIEUX_REQUIRED=2.4.66
        <br>
          LIBDRM_NOUVEAU_REQUIRED=2.4.66
        <br>
        diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c
        b/src/gallium/drivers/radeon/r600_pipe_common.c
        <br>
        index b77d859..3364dac 100644
        <br>
        --- a/src/gallium/drivers/radeon/r600_pipe_common.c
        <br>
        +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
        <br>
        @@ -851,6 +851,7 @@ static const struct debug_named_value
        common_debug_options[] = {
        <br>
              { "dpbb", DBG(DPBB), "Enable DPBB." },
        <br>
              { "dfsm", DBG(DFSM), "Enable DFSM." },
        <br>
              { "nooutoforder", DBG(NO_OUT_OF_ORDER), "Disable
        out-of-order rasterization" },
        <br>
        +    { "reserve_vmid", DBG(RESERVE_VMID), "Force VMID resrvation
        per context." },
        <br>
      </blockquote>
      <br>
      "reservation".
      <br>
      <br>
      Can you also explain a bit what that stuff is? :)
      <br>
    </blockquote>
    <br>
    It allows to have fixed VMID assigned to a process, otherwise each
    time a command is processed the next available VMID is assigned <br>
    according to a policy in KMD (amdgpu_vm_grab_id).<br>
    <br>
    Thanks,<br>
    Andrey<br>
    <br>
    <span style="color: rgb(176, 204, 232); font-family: "Source Sans Pro", sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: 0.2px; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(23, 51, 79); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"></span>
    <blockquote
      cite="mid:078f3ca7-e108-6ce6-4e07-65d8f569eb45@gmail.com"
      type="cite">
      <br>
      Thanks!
      <br>
      <br>
      <blockquote type="cite">        DEBUG_NAMED_VALUE_END /* must be
        last */
        <br>
          };
        <br>
        diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h
        b/src/gallium/drivers/radeon/r600_pipe_common.h
        <br>
        index a7c91cb..94c8d4f 100644
        <br>
        --- a/src/gallium/drivers/radeon/r600_pipe_common.h
        <br>
        +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
        <br>
        @@ -107,6 +107,7 @@ enum {
        <br>
              DBG_NO_DISCARD_RANGE,
        <br>
              DBG_NO_WC,
        <br>
              DBG_CHECK_VM,
        <br>
        +    DBG_RESERVE_VMID,
        <br>
                /* 3D engine options: */
        <br>
              DBG_SWITCH_ON_EOP,
        <br>
        diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
        b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
        <br>
        index 8f43e93..1155492 100644
        <br>
        --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
        <br>
        +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
        <br>
        @@ -256,6 +256,14 @@ static struct radeon_winsys_ctx
        *amdgpu_ctx_create(struct radeon_winsys *ws)
        <br>
                goto error_create;
        <br>
             }
        <br>
          +   if (ctx->ws->reserve_vmid) {
        <br>
        +       r = amdgpu_vm_reserve_vmid(ctx->ctx, 0);
        <br>
        +       if (r) {
        <br>
        +        fprintf(stderr, "amdgpu: amdgpu_cs_ctx_create failed.
        (%i)\n", r);
        <br>
        +        goto error_create;
        <br>
        +       }
        <br>
        +   }
        <br>
        +
        <br>
             alloc_buffer.alloc_size =
        ctx->ws->info.gart_page_size;
        <br>
             alloc_buffer.phys_alignment =
        ctx->ws->info.gart_page_size;
        <br>
             alloc_buffer.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
        <br>
        diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
        b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
        <br>
        index 1c3d0f0..d023841 100644
        <br>
        --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
        <br>
        +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
        <br>
        @@ -162,6 +162,9 @@ static inline bool
        amdgpu_fence_is_syncobj(struct amdgpu_fence *fence)
        <br>
          static inline void amdgpu_ctx_unref(struct amdgpu_ctx *ctx)
        <br>
          {
        <br>
             if (p_atomic_dec_zero(&ctx->refcount)) {
        <br>
        +      if (ctx->ws->reserve_vmid)
        <br>
        +         amdgpu_vm_unreserve_vmid(ctx->ctx, 0);
        <br>
        +
        <br>
                amdgpu_cs_ctx_free(ctx->ctx);
        <br>
                amdgpu_bo_free(ctx->user_fence_bo);
        <br>
                FREE(ctx);
        <br>
        diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
        b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
        <br>
        index a210a27..b80a988 100644
        <br>
        --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
        <br>
        +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
        <br>
        @@ -73,6 +73,7 @@ static bool do_winsys_init(struct
        amdgpu_winsys *ws, int fd)
        <br>
               ws->check_vm = strstr(debug_get_option("R600_DEBUG",
        ""), "check_vm") != NULL;
        <br>
             ws->debug_all_bos = debug_get_option_all_bos();
        <br>
        +   ws->reserve_vmid = strstr(debug_get_option("R600_DEBUG",
        ""), "reserve_vmid") != NULL;
        <br>
               return true;
        <br>
          diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
        b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
        <br>
        index 8b62e2d..b4a3422 100644
        <br>
        --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
        <br>
        +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
        <br>
        @@ -81,6 +81,7 @@ struct amdgpu_winsys {
        <br>
               bool check_vm;
        <br>
             bool debug_all_bos;
        <br>
        +   bool reserve_vmid;
        <br>
               /* List of all allocated buffers */
        <br>
             mtx_t global_bo_list_lock;
        <br>
        <br>
      </blockquote>
    </blockquote>
    <br>
  </body>
</html>