[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 06/14] ui/egl-helpers: Augment parameter list of egl_
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 06/14] ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey scales of viewport |
Date: |
Tue, 5 Feb 2019 11:57:50 +0100 |
From: Chen Zhang <address@hidden>
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 <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
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(-)
diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h
index 3fc656a7ba..b976cb8728 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 519e7bad32..e67b47aeff 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 5e115b3fb4..e90eef8c9c 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 afd17148c0..42801b688b 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 52f8cb5ae1..aea6f6ebce 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();
}
--
2.9.3
- [Qemu-devel] [PULL 00/14] Ui 20190205 patches, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 13/14] keymap: pass full keyboard state to keysym2scancode, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 01/14] Remove deprecated -no-frame option, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 04/14] ui/sdl_keysym: Remove obsolete SDL1.2 related code, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 03/14] ui: listen for GDK_SMOOTH_SCROLL events, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 11/14] kbd-state: use state tracker for gtk, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 06/14] ui/egl-helpers: Augment parameter list of egl_texture_blend() to convey scales of viewport,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 05/14] ui/cocoa.m: Fix macOS 10.14 deprecation warnings, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 02/14] ui: don't send any event if delta_y == 0, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 08/14] sdl2: remove sdl2_reset_keys() function, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 09/14] kbd-state: use state tracker for sdl2, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 12/14] kbd-state: use state tracker for vnc, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 10/14] sdl2: use only QKeyCode in sdl2_process_key(), Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 14/14] keymap: fix keyup mappings, Gerd Hoffmann, 2019/02/05
- [Qemu-devel] [PULL 07/14] kbd-state: add keyboard state tracker, Gerd Hoffmann, 2019/02/05
- Re: [Qemu-devel] [PULL 00/14] Ui 20190205 patches, Peter Maydell, 2019/02/05