All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Rui <ray.huang@amd.com>
To: Akihiko Odaki <akihiko.odaki@daynix.com>
Cc: "Gerd Hoffmann" <kraxel@redhat.com>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Anthony PERARD" <anthony.perard@citrix.com>,
	"Antonio Caggiano" <quic_acaggian@quicinc.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	"Robert Beckett" <bob.beckett@collabora.com>,
	"Dmitry Osipenko" <dmitry.osipenko@collabora.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"Gurchetan Singh" <gurchetansingh@chromium.org>,
	"Albert Esteve" <aesteve@redhat.com>,
	"ernunes@redhat.com" <ernunes@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Alyssa Ross" <hi@alyssa.is>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"Koenig, Christian" <Christian.Koenig@amd.com>,
	"Ragiadakou, Xenia" <Xenia.Ragiadakou@amd.com>,
	"Pelloux-Prayer,
	Pierre-Eric" <Pierre-eric.Pelloux-prayer@amd.com>,
	"Huang, Honglei1" <Honglei1.Huang@amd.com>,
	"Zhang, Julia" <Julia.Zhang@amd.com>,
	"Chen, Jiqian" <Jiqian.Chen@amd.com>,
	"Antonio Caggiano" <antonio.caggiano@collabora.com>
Subject: Re: [QEMU PATCH v5 06/13] virtio-gpu: Support context init feature with virglrenderer
Date: Mon, 18 Sep 2023 14:20:52 +0800	[thread overview]
Message-ID: <ZQfsRDk/H3VMDgw+@amd.com> (raw)
In-Reply-To: <6e4887e7-f850-43aa-b9c6-6eb80b37bbc2@daynix.com>

On Mon, Sep 18, 2023 at 02:07:25PM +0800, Akihiko Odaki wrote:
> On 2023/09/18 14:43, Huang Rui wrote:
> > On Sun, Sep 17, 2023 at 01:49:19PM +0800, Akihiko Odaki wrote:
> >> On 2023/09/17 14:45, Huang Rui wrote:
> >>> On Sat, Sep 16, 2023 at 06:42:04PM +0800, Akihiko Odaki wrote:
> >>>> On 2023/09/16 19:32, Huang Rui wrote:
> >>>>> On Fri, Sep 15, 2023 at 11:20:46PM +0800, Akihiko Odaki wrote:
> >>>>>> On 2023/09/15 20:11, Huang Rui wrote:
> >>>>>>> Patch "virtio-gpu: CONTEXT_INIT feature" has added the context_init
> >>>>>>> feature flags.
> >>>>>>> We would like to enable the feature with virglrenderer, so add to create
> >>>>>>> virgl renderer context with flags using context_id when valid.
> >>>>>>>
> >>>>>>> Originally-by: Antonio Caggiano <antonio.caggiano@collabora.com>
> >>>>>>> Signed-off-by: Huang Rui <ray.huang@amd.com>
> >>>>>>> ---
> >>>>>>>
> >>>>>>> V4 -> V5:
> >>>>>>>         - Inverted patch 5 and 6 because we should configure
> >>>>>>>           HAVE_VIRGL_CONTEXT_INIT firstly. (Philippe)
> >>>>>>>
> >>>>>>>      hw/display/virtio-gpu-virgl.c | 13 +++++++++++--
> >>>>>>>      hw/display/virtio-gpu.c       |  2 ++
> >>>>>>>      2 files changed, 13 insertions(+), 2 deletions(-)
> >>>>>>>
> >>>>>>> diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
> >>>>>>> index 8bb7a2c21f..312953ec16 100644
> >>>>>>> --- a/hw/display/virtio-gpu-virgl.c
> >>>>>>> +++ b/hw/display/virtio-gpu-virgl.c
> >>>>>>> @@ -106,8 +106,17 @@ static void virgl_cmd_context_create(VirtIOGPU *g,
> >>>>>>>          trace_virtio_gpu_cmd_ctx_create(cc.hdr.ctx_id,
> >>>>>>>                                          cc.debug_name);
> >>>>>>>      
> >>>>>>> -    virgl_renderer_context_create(cc.hdr.ctx_id, cc.nlen,
> >>>>>>> -                                  cc.debug_name);
> >>>>>>> +    if (cc.context_init) {
> >>>>>>> +#ifdef HAVE_VIRGL_CONTEXT_INIT
> >>>>>>> +        virgl_renderer_context_create_with_flags(cc.hdr.ctx_id,
> >>>>>>> +                                                 cc.context_init,
> >>>>>>> +                                                 cc.nlen,
> >>>>>>> +                                                 cc.debug_name);
> >>>>>>> +        return;
> >>>>>>> +#endif
> >>>>>>
> >>>>>> This should deal with the case when context_init is set while
> >>>>>> HAVE_VIRGL_CONTEXT_INIT is not defined.
> >>>>>
> >>>>> Actually, I received the comment below before:
> >>>>>
> >>>>> https://lore.kernel.org/qemu-devel/32588d0e-a1f2-30c4-5e9f-e6e7c4190b65@linaro.org/
> >>>>>
> >>>>> At original patch set, I have the case while HAVE_VIRGL_CONTEXT_INIT is set
> >>>>> but HAVE_VIRGL_CONTEXT_INIT is not defined. But I think we may encounter
> >>>>> the case that virgl_renderer_context_create_with_flags is not defined in
> >>>>> virglrenderer early version. Should I bring the error message back?
> >>>>>
> >>>>> Thanks,
> >>>>> Ray
> >>>>
> >>>> I suggest checking VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED instead of
> >>>> reporting an error here. Perhaps it may be easier to add #ifdef around:
> >>>>    > +    DEFINE_PROP_BIT("context_init", VirtIOGPU, parent_obj.conf.flags,
> >>>>    > +                    VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED, false),
> >>>
> >>> How about below changes: >
> >>> ---
> >>> diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
> >>> index 8bb7a2c21f..54a3cfe136 100644
> >>> --- a/hw/display/virtio-gpu-virgl.c
> >>> +++ b/hw/display/virtio-gpu-virgl.c
> >>> @@ -106,8 +106,15 @@ static void virgl_cmd_context_create(VirtIOGPU *g,
> >>>        trace_virtio_gpu_cmd_ctx_create(cc.hdr.ctx_id,
> >>>                                        cc.debug_name);
> >>>
> >>> -    virgl_renderer_context_create(cc.hdr.ctx_id, cc.nlen,
> >>> -                                  cc.debug_name);
> >>> +    if (cc.context_init && virtio_gpu_context_init_enabled(g->conf)) {
> >>> +        virgl_renderer_context_create_with_flags(cc.hdr.ctx_id,
> >>> +                                                 cc.context_init,
> >>> +                                                 cc.nlen,
> >>> +                                                 cc.debug_name);
> >>> +        return;
> >>> +    }
> >>> +
> >>> +    virgl_renderer_context_create(cc.hdr.ctx_id, cc.nlen, cc.debug_name);
> >>>    }
> >>>
> >>>    static void virgl_cmd_context_destroy(VirtIOGPU *g,
> >>> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> >>> index be16efbd38..6ff2c8e92d 100644
> >>> --- a/hw/display/virtio-gpu.c
> >>> +++ b/hw/display/virtio-gpu.c
> >>> @@ -1508,6 +1508,10 @@ static Property virtio_gpu_properties[] = {
> >>>        DEFINE_PROP_BIT("blob", VirtIOGPU, parent_obj.conf.flags,
> >>>                        VIRTIO_GPU_FLAG_BLOB_ENABLED, false),
> >>>        DEFINE_PROP_SIZE("hostmem", VirtIOGPU, parent_obj.conf.hostmem, 0),
> >>> +#ifdef HAVE_VIRGL_CONTEXT_INIT
> >>> +    DEFINE_PROP_BIT("context_init", VirtIOGPU, parent_obj.conf.flags,
> >>> +                    VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED, true),
> >>> +#endif
> >>>        DEFINE_PROP_END_OF_LIST(),
> >>>    };
> >>>
> >>
> >> It looks better, but not having #ifdef around
> >> virgl_renderer_context_create_with_flags() will result in a link error
> >> with old virglrenderer.
> > 
> > Hmm, right, it seems that we have to have a "#ifdef" around here. Or do you
> > have any better idea?
> 
> Having #ifdef is the right direction.

OK, so we can use cc.context_init and make sure context_init function
enabled. Please check below:

---
diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index 8bb7a2c21f..8363674ebc 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -106,8 +106,17 @@ static void virgl_cmd_context_create(VirtIOGPU *g,
     trace_virtio_gpu_cmd_ctx_create(cc.hdr.ctx_id,
                                     cc.debug_name);

-    virgl_renderer_context_create(cc.hdr.ctx_id, cc.nlen,
-                                  cc.debug_name);
+    if (cc.context_init && virtio_gpu_context_init_enabled(g->parent_obj.conf)) {
+#ifdef HAVE_VIRGL_CONTEXT_INIT
+        virgl_renderer_context_create_with_flags(cc.hdr.ctx_id,
+                                                 cc.context_init,
+                                                 cc.nlen,
+                                                 cc.debug_name);
+        return;
+#endif
+    }
+
+    virgl_renderer_context_create(cc.hdr.ctx_id, cc.nlen, cc.debug_name);
 }

 static void virgl_cmd_context_destroy(VirtIOGPU *g,
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index be16efbd38..6ff2c8e92d 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1508,6 +1508,10 @@ static Property virtio_gpu_properties[] = {
     DEFINE_PROP_BIT("blob", VirtIOGPU, parent_obj.conf.flags,
                     VIRTIO_GPU_FLAG_BLOB_ENABLED, false),
     DEFINE_PROP_SIZE("hostmem", VirtIOGPU, parent_obj.conf.hostmem, 0),
+#ifdef HAVE_VIRGL_CONTEXT_INIT
+    DEFINE_PROP_BIT("context_init", VirtIOGPU, parent_obj.conf.flags,
+                    VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED, true),
+#endif
     DEFINE_PROP_END_OF_LIST(),
 };



  reply	other threads:[~2023-09-18  6:21 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 11:11 [QEMU PATCH v5 00/13] Support blob memory and venus on qemu Huang Rui
2023-09-15 11:11 ` [QEMU PATCH v5 01/13] virtio: Add shared memory capability Huang Rui
2023-09-15 11:11 ` [QEMU PATCH v5 02/13] virtio-gpu: CONTEXT_INIT feature Huang Rui
2023-09-15 11:11 ` [QEMU PATCH v5 03/13] virtio-gpu: hostmem Huang Rui
2023-09-15 11:11 ` [QEMU PATCH v5 04/13] virtio-gpu: blob prep Huang Rui
2023-09-15 11:11 ` [QEMU PATCH v5 05/13] virtio-gpu: Configure context init for virglrenderer Huang Rui
2023-09-19  8:17   ` Marc-André Lureau
2023-09-20  8:04     ` Huang Rui
2023-10-10 11:41   ` Dmitry Osipenko
2023-10-10 11:51     ` Daniel P. Berrangé
2023-10-17 17:46       ` Dmitry Osipenko
2023-09-15 11:11 ` [QEMU PATCH v5 06/13] virtio-gpu: Support context init feature with virglrenderer Huang Rui
2023-09-15 15:20   ` Akihiko Odaki
2023-09-16 10:32     ` Huang Rui
2023-09-16 10:42       ` Akihiko Odaki
2023-09-17  5:45         ` Huang Rui
2023-09-17  5:49           ` Akihiko Odaki
2023-09-18  5:43             ` Huang Rui
2023-09-18  6:07               ` Akihiko Odaki
2023-09-18  6:20                 ` Huang Rui [this message]
2023-09-18  6:22                   ` Akihiko Odaki
2023-09-15 16:58   ` Akihiko Odaki
2023-09-16 10:36     ` Huang Rui
2023-09-15 11:11 ` [QEMU PATCH v5 07/13] softmmu/memory: enable automatic deallocation of memory regions Huang Rui
2023-09-15 15:11   ` Akihiko Odaki
2023-09-19 10:28     ` Xenia Ragiadakou
2023-09-19 10:44       ` Akihiko Odaki
2023-09-19 14:21         ` Xenia Ragiadakou
2023-09-19 22:18           ` Akihiko Odaki
2023-09-20  8:57             ` Xenia Ragiadakou
2023-09-20 10:18               ` Akihiko Odaki
2023-09-15 11:11 ` [QEMU PATCH v5 08/13] virtio-gpu: Don't require udmabuf when blobs and virgl are enabled Huang Rui
2023-09-15 11:11 ` [QEMU PATCH v5 09/13] virtio-gpu: Handle resource blob commands Huang Rui
2023-09-15 16:04   ` Akihiko Odaki
2023-09-15 16:37     ` Akihiko Odaki
2023-09-20  5:50       ` Huang Rui
2023-09-20  5:50         ` Huang Rui via
2023-09-20  5:54         ` Akihiko Odaki
2023-09-20  6:11           ` Huang Rui
2023-09-20  6:11             ` Huang Rui via
2023-09-18  8:36     ` Huang Rui
2023-09-18  8:39       ` Akihiko Odaki
2023-09-19  8:44   ` Marc-André Lureau
2023-09-20  8:41     ` Huang Rui
2023-09-15 11:11 ` [QEMU PATCH v5 10/13] virtio-gpu: Resource UUID Huang Rui
2023-09-15 16:48   ` Akihiko Odaki
2023-09-20  7:55     ` Huang Rui
2023-09-19  9:00   ` Marc-André Lureau
2023-09-20 10:00     ` Huang Rui
2023-09-15 11:11 ` [QEMU PATCH v5 11/13] virtio-gpu: Support Venus capset Huang Rui
2023-09-19  9:02   ` Marc-André Lureau
2023-09-20 10:06     ` Huang Rui
2023-09-15 11:11 ` [QEMU PATCH v5 12/13] virtio-gpu: Initialize Venus Huang Rui
2023-10-10 12:10   ` Dmitry Osipenko
2023-09-15 11:11 ` [QEMU PATCH v5 13/13] virtio-gpu: Enable virglrenderer render server flag for venus Huang Rui
2023-10-10 11:48   ` Dmitry Osipenko
2023-10-10 11:57 ` [QEMU PATCH v5 00/13] Support blob memory and venus on qemu Dmitry Osipenko

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=ZQfsRDk/H3VMDgw+@amd.com \
    --to=ray.huang@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Honglei1.Huang@amd.com \
    --cc=Jiqian.Chen@amd.com \
    --cc=Julia.Zhang@amd.com \
    --cc=Pierre-eric.Pelloux-prayer@amd.com \
    --cc=Xenia.Ragiadakou@amd.com \
    --cc=aesteve@redhat.com \
    --cc=akihiko.odaki@daynix.com \
    --cc=alex.bennee@linaro.org \
    --cc=anthony.perard@citrix.com \
    --cc=antonio.caggiano@collabora.com \
    --cc=bob.beckett@collabora.com \
    --cc=dgilbert@redhat.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=ernunes@redhat.com \
    --cc=gurchetansingh@chromium.org \
    --cc=hi@alyssa.is \
    --cc=kraxel@redhat.com \
    --cc=mst@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quic_acaggian@quicinc.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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.