diff mbox

[1/6] virtio-gpu: move virtio_gpu_gl_block

Message ID 20170505104101.30589-2-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann May 5, 2017, 10:40 a.m. UTC
Move to virtio-gpu-3d.c where all the other virgl code lives too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/hw/virtio/virtio-gpu.h |  1 +
 hw/display/virtio-gpu-3d.c     | 16 ++++++++++++++++
 hw/display/virtio-gpu.c        | 18 ++----------------
 3 files changed, 19 insertions(+), 16 deletions(-)

Comments

Philippe Mathieu-Daudé May 5, 2017, 11:47 a.m. UTC | #1
On 05/05/2017 07:40 AM, Gerd Hoffmann wrote:
> Move to virtio-gpu-3d.c where all the other virgl code lives too.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  include/hw/virtio/virtio-gpu.h |  1 +
>  hw/display/virtio-gpu-3d.c     | 16 ++++++++++++++++
>  hw/display/virtio-gpu.c        | 18 ++----------------
>  3 files changed, 19 insertions(+), 16 deletions(-)
>
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index f3ffdceca4..83f474ffc3 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -169,6 +169,7 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
>                                    struct virtio_gpu_ctrl_command *cmd);
>  void virtio_gpu_virgl_fence_poll(VirtIOGPU *g);
>  void virtio_gpu_virgl_reset(VirtIOGPU *g);
> +void virtio_gpu_gl_block(void *opaque, bool block);
>  int virtio_gpu_virgl_init(VirtIOGPU *g);
>
>  #endif
> diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
> index f49b7fe8cd..8c106a662d 100644
> --- a/hw/display/virtio-gpu-3d.c
> +++ b/hw/display/virtio-gpu-3d.c
> @@ -600,6 +600,22 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g)
>      }
>  }
>
> +void virtio_gpu_gl_block(void *opaque, bool block)
> +{
> +    VirtIOGPU *g = opaque;
> +
> +    if (block) {
> +        g->renderer_blocked++;
> +    } else {
> +        g->renderer_blocked--;
> +    }
> +    assert(g->renderer_blocked >= 0);
> +
> +    if (g->renderer_blocked == 0) {
> +        virtio_gpu_process_cmdq(g);
> +    }
> +}
> +
>  int virtio_gpu_virgl_init(VirtIOGPU *g)
>  {
>      int ret;
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index e1056f34df..cfb5dfa336 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -929,28 +929,14 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
>      return 0;
>  }
>
> -static void virtio_gpu_gl_block(void *opaque, bool block)
> -{
> -    VirtIOGPU *g = opaque;
> -
> -    if (block) {
> -        g->renderer_blocked++;
> -    } else {
> -        g->renderer_blocked--;
> -    }
> -    assert(g->renderer_blocked >= 0);
> -
> -    if (g->renderer_blocked == 0) {
> -        virtio_gpu_process_cmdq(g);
> -    }
> -}
> -
>  const GraphicHwOps virtio_gpu_ops = {
>      .invalidate = virtio_gpu_invalidate_display,
>      .gfx_update = virtio_gpu_update_display,
>      .text_update = virtio_gpu_text_update,
>      .ui_info = virtio_gpu_ui_info,
> +#ifdef CONFIG_VIRGL
>      .gl_block = virtio_gpu_gl_block,
> +#endif
>  };
>
>  static const VMStateDescription vmstate_virtio_gpu_scanout = {
>
Marc-André Lureau May 5, 2017, 11:57 a.m. UTC | #2
On Fri, May 5, 2017 at 2:49 PM Gerd Hoffmann <kraxel@redhat.com> wrote:

> Move to virtio-gpu-3d.c where all the other virgl code lives too.
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>

 Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  include/hw/virtio/virtio-gpu.h |  1 +
>  hw/display/virtio-gpu-3d.c     | 16 ++++++++++++++++
>  hw/display/virtio-gpu.c        | 18 ++----------------
>  3 files changed, 19 insertions(+), 16 deletions(-)
>
> diff --git a/include/hw/virtio/virtio-gpu.h
> b/include/hw/virtio/virtio-gpu.h
> index f3ffdceca4..83f474ffc3 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -169,6 +169,7 @@ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
>                                    struct virtio_gpu_ctrl_command *cmd);
>  void virtio_gpu_virgl_fence_poll(VirtIOGPU *g);
>  void virtio_gpu_virgl_reset(VirtIOGPU *g);
> +void virtio_gpu_gl_block(void *opaque, bool block);
>  int virtio_gpu_virgl_init(VirtIOGPU *g);
>
>  #endif
> diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
> index f49b7fe8cd..8c106a662d 100644
> --- a/hw/display/virtio-gpu-3d.c
> +++ b/hw/display/virtio-gpu-3d.c
> @@ -600,6 +600,22 @@ void virtio_gpu_virgl_reset(VirtIOGPU *g)
>      }
>  }
>
> +void virtio_gpu_gl_block(void *opaque, bool block)
> +{
> +    VirtIOGPU *g = opaque;
> +
> +    if (block) {
> +        g->renderer_blocked++;
> +    } else {
> +        g->renderer_blocked--;
> +    }
> +    assert(g->renderer_blocked >= 0);
> +
> +    if (g->renderer_blocked == 0) {
> +        virtio_gpu_process_cmdq(g);
> +    }
> +}
> +
>  int virtio_gpu_virgl_init(VirtIOGPU *g)
>  {
>      int ret;
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index e1056f34df..cfb5dfa336 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -929,28 +929,14 @@ static int virtio_gpu_ui_info(void *opaque, uint32_t
> idx, QemuUIInfo *info)
>      return 0;
>  }
>
> -static void virtio_gpu_gl_block(void *opaque, bool block)
> -{
> -    VirtIOGPU *g = opaque;
> -
> -    if (block) {
> -        g->renderer_blocked++;
> -    } else {
> -        g->renderer_blocked--;
> -    }
> -    assert(g->renderer_blocked >= 0);
> -
> -    if (g->renderer_blocked == 0) {
> -        virtio_gpu_process_cmdq(g);
> -    }
> -}
> -
>  const GraphicHwOps virtio_gpu_ops = {
>      .invalidate = virtio_gpu_invalidate_display,
>      .gfx_update = virtio_gpu_update_display,
>      .text_update = virtio_gpu_text_update,
>      .ui_info = virtio_gpu_ui_info,
> +#ifdef CONFIG_VIRGL
>      .gl_block = virtio_gpu_gl_block,
> +#endif
>  };
>
>  static const VMStateDescription vmstate_virtio_gpu_scanout = {
> --
> 2.9.3
>
>
> --
Marc-André Lureau
diff mbox

Patch

diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index f3ffdceca4..83f474ffc3 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -169,6 +169,7 @@  void virtio_gpu_virgl_process_cmd(VirtIOGPU *g,
                                   struct virtio_gpu_ctrl_command *cmd);
 void virtio_gpu_virgl_fence_poll(VirtIOGPU *g);
 void virtio_gpu_virgl_reset(VirtIOGPU *g);
+void virtio_gpu_gl_block(void *opaque, bool block);
 int virtio_gpu_virgl_init(VirtIOGPU *g);
 
 #endif
diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c
index f49b7fe8cd..8c106a662d 100644
--- a/hw/display/virtio-gpu-3d.c
+++ b/hw/display/virtio-gpu-3d.c
@@ -600,6 +600,22 @@  void virtio_gpu_virgl_reset(VirtIOGPU *g)
     }
 }
 
+void virtio_gpu_gl_block(void *opaque, bool block)
+{
+    VirtIOGPU *g = opaque;
+
+    if (block) {
+        g->renderer_blocked++;
+    } else {
+        g->renderer_blocked--;
+    }
+    assert(g->renderer_blocked >= 0);
+
+    if (g->renderer_blocked == 0) {
+        virtio_gpu_process_cmdq(g);
+    }
+}
+
 int virtio_gpu_virgl_init(VirtIOGPU *g)
 {
     int ret;
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index e1056f34df..cfb5dfa336 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -929,28 +929,14 @@  static int virtio_gpu_ui_info(void *opaque, uint32_t idx, QemuUIInfo *info)
     return 0;
 }
 
-static void virtio_gpu_gl_block(void *opaque, bool block)
-{
-    VirtIOGPU *g = opaque;
-
-    if (block) {
-        g->renderer_blocked++;
-    } else {
-        g->renderer_blocked--;
-    }
-    assert(g->renderer_blocked >= 0);
-
-    if (g->renderer_blocked == 0) {
-        virtio_gpu_process_cmdq(g);
-    }
-}
-
 const GraphicHwOps virtio_gpu_ops = {
     .invalidate = virtio_gpu_invalidate_display,
     .gfx_update = virtio_gpu_update_display,
     .text_update = virtio_gpu_text_update,
     .ui_info = virtio_gpu_ui_info,
+#ifdef CONFIG_VIRGL
     .gl_block = virtio_gpu_gl_block,
+#endif
 };
 
 static const VMStateDescription vmstate_virtio_gpu_scanout = {