Hi Dongwon,

On 20/3/24 04:42, dongwon....@intel.com wrote:
From: Dongwon Kim <dongwon....@intel.com>

It is safer to create, initialize, and access all the parameters
in QemuDmaBuf from a central location, ui/console, instead of
hw/virtio-gpu or hw/vfio modules.

Cc: Marc-André Lureau <marcandre.lur...@redhat.com>
Cc: Vivek Kasireddy <vivek.kasire...@intel.com>
Signed-off-by: Dongwon Kim <dongwon....@intel.com>
---
  hw/display/virtio-gpu-udmabuf.c | 27 +++++++---------
  hw/vfio/display.c               | 35 ++++++++++++---------
  include/hw/vfio/vfio-common.h   |  2 +-
  include/hw/virtio/virtio-gpu.h  |  2 +-
  include/ui/console.h            | 10 ++++++
  ui/console.c                    | 55 +++++++++++++++++++++++++++++++++
  6 files changed, 98 insertions(+), 33 deletions(-)


diff --git a/include/ui/console.h b/include/ui/console.h
index a4a49ffc64..0b823efb2e 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -279,6 +279,7 @@ typedef struct DisplayChangeListenerOps {
      /* optional */
      void (*dpy_gl_cursor_position)(DisplayChangeListener *dcl,
                                     uint32_t pos_x, uint32_t pos_y);
+
      /* optional */
      void (*dpy_gl_release_dmabuf)(DisplayChangeListener *dcl,
                                    QemuDmaBuf *dmabuf);
@@ -358,6 +359,15 @@ void dpy_gl_cursor_dmabuf(QemuConsole *con, QemuDmaBuf 
*dmabuf,
                            bool have_hot, uint32_t hot_x, uint32_t hot_y);
  void dpy_gl_cursor_position(QemuConsole *con,
                              uint32_t pos_x, uint32_t pos_y);
+QemuDmaBuf *dpy_gl_create_dmabuf(uint32_t width, uint32_t height,
+                                 uint32_t stride, uint32_t x,
+                                 uint32_t y, uint32_t backing_width,
+                                 uint32_t backing_height, uint32_t fourcc,
+                                 uint32_t modifier, uint32_t dmabuf_fd,
+                                 bool allow_fences);

In order to ease review, can we split this patch, introducing getters,
then adding the create method as final patch?

Also consider enabling scripts/git.orderfile.

Regards,

Phil.

+uint32_t dpy_gl_dmabuf_get_width(QemuDmaBuf *dmabuf);
+uint32_t dpy_gl_dmabuf_get_height(QemuDmaBuf *dmabuf);
+int32_t dpy_gl_dmabuf_get_fd(QemuDmaBuf *dmabuf);
  void dpy_gl_release_dmabuf(QemuConsole *con,
                             QemuDmaBuf *dmabuf);
  void dpy_gl_update(QemuConsole *con,


Reply via email to