diff mbox series

[v2] ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey scales of viewport

Message ID 23B229B3-3095-4DFB-8369-866784808D30@me.com
State New
Headers show
Series [v2] ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey scales of viewport | expand

Commit Message

Cameron Esfahani via Jan. 25, 2019, 7:47 a.m. UTC
From 0be823a56682be57fe0370bb91e4062ec7b47be5 Mon Sep 17 00:00:00 2001
From: Chen Zhang <tgfbeta@me.com>
Date: Fri, 25 Jan 2019 15:33:08 +0800
Subject: [PATCH v2] ui/egl-helpers: Augment parameter list of
 egl_texture_blend() to convey scales of viewport.

 This would help gtk-egl display showing scaled DMABuf cursor images when
 gtk window was zoomed. A default scale of (1.0, 1.0) was presumed for
 call sites where no scaling is needed.

Signed-off-by: Chen Zhang <tgfbeta@me.com>
---
 include/ui/egl-helpers.h | 2 +-
 ui/egl-headless.c        | 3 ++-
 ui/egl-helpers.c         | 9 +++++----
 ui/gtk-egl.c             | 3 ++-
 ui/spice-display.c       | 2 +-
 5 files changed, 11 insertions(+), 8 deletions(-)

Comments

no-reply@patchew.org Jan. 31, 2019, 6:01 p.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/23B229B3-3095-4DFB-8369-866784808D30@me.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 23B229B3-3095-4DFB-8369-866784808D30@me.com
Subject: [Qemu-devel] [PATCH v2] ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey scales of viewport
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
2176ef4 ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey scales of viewport

=== OUTPUT BEGIN ===
ERROR: Author email address is mangled by the mailing list
#2: 
Author: Chen Zhang via Qemu-devel <qemu-devel@nongnu.org>

total: 1 errors, 0 warnings, 53 lines checked

Commit 2176ef43afd4 (ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey scales of viewport) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/23B229B3-3095-4DFB-8369-866784808D30@me.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Gerd Hoffmann Feb. 5, 2019, 9:14 a.m. UTC | #2
On Fri, Jan 25, 2019 at 03:47:23PM +0800, Chen Zhang wrote:
> From 0be823a56682be57fe0370bb91e4062ec7b47be5 Mon Sep 17 00:00:00 2001
> From: Chen Zhang <tgfbeta@me.com>
> Date: Fri, 25 Jan 2019 15:33:08 +0800
> Subject: [PATCH v2] ui/egl-helpers: Augment parameter list of
>  egl_texture_blend() to convey scales of viewport.
> 
>  This would help gtk-egl display showing scaled DMABuf cursor images when
>  gtk window was zoomed. A default scale of (1.0, 1.0) was presumed for
>  call sites where no scaling is needed.

Added to UI patch queue.

thanks,
  Gerd
diff mbox series

Patch

diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h
index 3fc656a..b976cb8 100644
--- a/include/ui/egl-helpers.h
+++ b/include/ui/egl-helpers.h
@@ -27,7 +27,7 @@  void egl_fb_read(void *dst, egl_fb *src);
 
 void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip);
 void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip,
-                       int x, int y);
+                       int x, int y, double scale_x, double scale_y);
 
 #ifdef CONFIG_OPENGL_DMABUF
 
diff --git a/ui/egl-headless.c b/ui/egl-headless.c
index 519e7ba..e67b47a 100644
--- a/ui/egl-headless.c
+++ b/ui/egl-headless.c
@@ -142,7 +142,8 @@  static void egl_scanout_flush(DisplayChangeListener *dcl,
         egl_texture_blit(edpy->gls, &edpy->blit_fb, &edpy->guest_fb,
                          !edpy->y_0_top);
         egl_texture_blend(edpy->gls, &edpy->blit_fb, &edpy->cursor_fb,
-                          !edpy->y_0_top, edpy->pos_x, edpy->pos_y);
+                          !edpy->y_0_top, edpy->pos_x, edpy->pos_y,
+                          1.0, 1.0);
     } else {
         /* no cursor -> use simple framebuffer blit */
         egl_fb_blit(&edpy->blit_fb, &edpy->guest_fb, edpy->y_0_top);
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 5e115b3..e90eef8 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -120,14 +120,15 @@  void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip)
 }
 
 void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip,
-                       int x, int y)
+                       int x, int y, double scale_x, double scale_y)
 {
     glBindFramebuffer(GL_FRAMEBUFFER_EXT, dst->framebuffer);
+    int w = scale_x * src->width;
+    int h = scale_y * src->height;
     if (flip) {
-        glViewport(x, y, src->width, src->height);
+        glViewport(x, y, w, h);
     } else {
-        glViewport(x, dst->height - src->height - y,
-                   src->width, src->height);
+        glViewport(x, dst->height - h - y, w, h);
     }
     glEnable(GL_TEXTURE_2D);
     glBindTexture(GL_TEXTURE_2D, src->texture);
diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c
index afd1714..42801b6 100644
--- a/ui/gtk-egl.c
+++ b/ui/gtk-egl.c
@@ -278,7 +278,8 @@  void gd_egl_scanout_flush(DisplayChangeListener *dcl,
                          vc->gfx.y0_top);
         egl_texture_blend(vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.cursor_fb,
                           vc->gfx.y0_top,
-                          vc->gfx.cursor_x, vc->gfx.cursor_y);
+                          vc->gfx.cursor_x, vc->gfx.cursor_y,
+                          vc->gfx.scale_x, vc->gfx.scale_y);
     } else {
         egl_fb_blit(&vc->gfx.win_fb, &vc->gfx.guest_fb, !vc->gfx.y0_top);
     }
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 52f8cb5..aea6f6e 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -1090,7 +1090,7 @@  static void qemu_spice_gl_update(DisplayChangeListener *dcl,
         egl_texture_blit(ssd->gls, &ssd->blit_fb, &ssd->guest_fb,
                          !y_0_top);
         egl_texture_blend(ssd->gls, &ssd->blit_fb, &ssd->cursor_fb,
-                          !y_0_top, x, y);
+                          !y_0_top, x, y, 1.0, 1.0);
         glFlush();
     }