All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Olšák" <maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx mailing list
	<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH libdrm] amdgpu: add amdgpu_bo_handle_type_kms_noimport
Date: Tue, 24 Jul 2018 14:11:18 -0400	[thread overview]
Message-ID: <CAAxE2A54HMsqwyGhTn_0kt483qKd5G5UFuZD1-X+JWDZYn-5fg@mail.gmail.com> (raw)
In-Reply-To: <20180712004750.2024-1-maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Christian,

Would you please give me an Rb if the patch is OK with you? I have
spoken with Michel and he would be OK with me pushing it as long as it
gets an Rb from either you or Alex.

Thanks,
Marek

On Wed, Jul 11, 2018 at 8:47 PM, Marek Olšák <maraeo@gmail.com> wrote:
> From: Marek Olšák <marek.olsak@amd.com>
>
> ---
>  amdgpu/amdgpu.h    | 7 ++++++-
>  amdgpu/amdgpu_bo.c | 4 ++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h
> index 36f91058..be83b457 100644
> --- a/amdgpu/amdgpu.h
> +++ b/amdgpu/amdgpu.h
> @@ -77,21 +77,26 @@ struct drm_amdgpu_info_hw_ip;
>   *
>  */
>  enum amdgpu_bo_handle_type {
>         /** GEM flink name (needs DRM authentication, used by DRI2) */
>         amdgpu_bo_handle_type_gem_flink_name = 0,
>
>         /** KMS handle which is used by all driver ioctls */
>         amdgpu_bo_handle_type_kms = 1,
>
>         /** DMA-buf fd handle */
> -       amdgpu_bo_handle_type_dma_buf_fd = 2
> +       amdgpu_bo_handle_type_dma_buf_fd = 2,
> +
> +       /** KMS handle, but re-importing as a DMABUF handle through
> +        *  drmPrimeHandleToFD is forbidden. (Glamor does that)
> +        */
> +       amdgpu_bo_handle_type_kms_noimport = 3,
>  };
>
>  /** Define known types of GPU VM VA ranges */
>  enum amdgpu_gpu_va_range
>  {
>         /** Allocate from "normal"/general range */
>         amdgpu_gpu_va_range_general = 0
>  };
>
>  enum amdgpu_sw_info {
> diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
> index 9e37b149..d29be244 100644
> --- a/amdgpu/amdgpu_bo.c
> +++ b/amdgpu/amdgpu_bo.c
> @@ -234,20 +234,22 @@ int amdgpu_bo_export(amdgpu_bo_handle bo,
>         case amdgpu_bo_handle_type_gem_flink_name:
>                 r = amdgpu_bo_export_flink(bo);
>                 if (r)
>                         return r;
>
>                 *shared_handle = bo->flink_name;
>                 return 0;
>
>         case amdgpu_bo_handle_type_kms:
>                 amdgpu_add_handle_to_table(bo);
> +               /* fall through */
> +       case amdgpu_bo_handle_type_kms_noimport:
>                 *shared_handle = bo->handle;
>                 return 0;
>
>         case amdgpu_bo_handle_type_dma_buf_fd:
>                 amdgpu_add_handle_to_table(bo);
>                 return drmPrimeHandleToFD(bo->dev->fd, bo->handle,
>                                           DRM_CLOEXEC | DRM_RDWR,
>                                           (int*)shared_handle);
>         }
>         return -EINVAL;
> @@ -299,20 +301,21 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
>                 bo = util_hash_table_get(dev->bo_flink_names,
>                                          (void*)(uintptr_t)shared_handle);
>                 break;
>
>         case amdgpu_bo_handle_type_dma_buf_fd:
>                 bo = util_hash_table_get(dev->bo_handles,
>                                          (void*)(uintptr_t)shared_handle);
>                 break;
>
>         case amdgpu_bo_handle_type_kms:
> +       case amdgpu_bo_handle_type_kms_noimport:
>                 /* Importing a KMS handle in not allowed. */
>                 pthread_mutex_unlock(&dev->bo_table_mutex);
>                 return -EPERM;
>
>         default:
>                 pthread_mutex_unlock(&dev->bo_table_mutex);
>                 return -EINVAL;
>         }
>
>         if (bo) {
> @@ -368,20 +371,21 @@ int amdgpu_bo_import(amdgpu_device_handle dev,
>                 util_hash_table_set(dev->bo_flink_names,
>                                     (void*)(uintptr_t)bo->flink_name, bo);
>                 break;
>
>         case amdgpu_bo_handle_type_dma_buf_fd:
>                 bo->handle = shared_handle;
>                 bo->alloc_size = dma_buf_size;
>                 break;
>
>         case amdgpu_bo_handle_type_kms:
> +       case amdgpu_bo_handle_type_kms_noimport:
>                 assert(0); /* unreachable */
>         }
>
>         /* Initialize it. */
>         atomic_set(&bo->refcount, 1);
>         bo->dev = dev;
>         pthread_mutex_init(&bo->cpu_access_mutex, NULL);
>
>         util_hash_table_set(dev->bo_handles, (void*)(uintptr_t)bo->handle, bo);
>         pthread_mutex_unlock(&dev->bo_table_mutex);
> --
> 2.17.1
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2018-07-24 18:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12  0:47 [PATCH libdrm] amdgpu: add amdgpu_bo_handle_type_kms_noimport Marek Olšák
     [not found] ` <20180712004750.2024-1-maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-07-12  1:14   ` Zhang, Jerry (Junwei)
     [not found]     ` <5B46AB60.1000808-5C7GfCeVMHo@public.gmane.org>
2018-07-12  1:29       ` Marek Olšák
2018-07-12  1:39       ` Zhang, Jerry (Junwei)
2018-07-12  2:09   ` zhoucm1
     [not found]     ` <ccb1d49f-ab4f-f561-f328-809ea34edcb0-5C7GfCeVMHo@public.gmane.org>
2018-07-12  2:41       ` Marek Olšák
2018-07-12  7:31   ` Michel Dänzer
     [not found]     ` <9a8d8f7f-a468-fd5b-dec5-472ce9c88483-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-12 17:03       ` Marek Olšák
     [not found]         ` <CAAxE2A6Vz08sWXiaB6B-F4_P7Fy6uDuJ7aF2gHLXZ4N3zj9sXw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-13  8:28           ` Michel Dänzer
     [not found]             ` <a291b3b5-25bc-385a-5242-9bd75ec423e9-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-13 18:47               ` Marek Olšák
     [not found]                 ` <CAAxE2A7ffmO=Tv_DSWhPciF+y5q_wbaBYgcqHvxQVkeVfhBhdg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-16 16:05                   ` Michel Dänzer
     [not found]                     ` <31980a46-1d16-8ead-cc2b-5a5b9eb4d530-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-16 18:51                       ` Marek Olšák
     [not found]                         ` <CAAxE2A5SUypT+huhKKdSAWXZ8x+wgPSy2FGqLRTj_io+L1qLqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-17  8:57                           ` Michel Dänzer
     [not found]                             ` <97d0f539-1a98-f9fc-1ed5-5de7c5a8c3d0-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-17 18:14                               ` Marek Olšák
     [not found]                                 ` <CAAxE2A5ij49A-62_wqD6923nn1w6gT6iY-jeC2HUP3ksYacZQQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-18 15:55                                   ` Michel Dänzer
     [not found]                                     ` <b2335e6f-0553-a3a8-0157-f4dc99ac9cea-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-20  3:48                                       ` Marek Olšák
2018-07-17  6:50                       ` Christian König
     [not found]                         ` <5374dffa-45c9-1bd6-79b9-cc4450a96aeb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-07-17  7:26                           ` Michel Dänzer
     [not found]                             ` <126a68a9-43f4-c747-89d1-114dc29ea4e9-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-17  7:33                               ` Christian König
     [not found]                                 ` <3cc456c1-929d-4aee-2e8b-7d4edb023382-5C7GfCeVMHo@public.gmane.org>
2018-07-17  7:46                                   ` Michel Dänzer
     [not found]                                     ` <0f28de35-1928-2af3-8b8d-13c61b25e285-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-17  7:59                                       ` Christian König
     [not found]                                         ` <45bab640-d574-b822-e5c8-69fe67626a9a-5C7GfCeVMHo@public.gmane.org>
2018-07-17  8:03                                           ` Michel Dänzer
     [not found]                                             ` <988daf71-51ef-65e7-48ed-9dc2f3acb3a1-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-17  8:19                                               ` Christian König
     [not found]                                                 ` <a5be38fa-4da6-642f-b297-21261820a908-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-07-17  8:30                                                   ` Michel Dänzer
     [not found]                                                     ` <9a3c0fb3-c6a8-d59f-89cf-ec32ff6ed630-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-07-17  8:35                                                       ` Christian König
2018-07-24 18:11   ` Marek Olšák [this message]
     [not found]     ` <CAAxE2A54HMsqwyGhTn_0kt483qKd5G5UFuZD1-X+JWDZYn-5fg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-07-25  8:30       ` Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAxE2A54HMsqwyGhTn_0kt483qKd5G5UFuZD1-X+JWDZYn-5fg@mail.gmail.com \
    --to=maraeo-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.