From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 1/4] ui/egl: fix framebuffer reads
Date: Thu, 19 Sep 2019 09:09:15 +0200 [thread overview]
Message-ID: <20190919070918.16059-2-kraxel@redhat.com> (raw)
In-Reply-To: <20190919070918.16059-1-kraxel@redhat.com>
Fix egl_fb_read() to use the (destination) surface size instead of the
(source) framebuffer source for glReadPixels. Pass the DisplaySurface
instead of the pixeldata pointer to egl_fb_read() to make this possible.
With that in place framebuffer reads work fine even if the surface and
framebuffer sizes don't match, so we can remove the guest-triggerable
asserts in egl_scanout_flush().
Buglink: https://bugzilla.redhat.com//show_bug.cgi?id=1749659
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20190909073911.24787-1-kraxel@redhat.com
---
include/ui/egl-helpers.h | 2 +-
ui/egl-headless.c | 4 +---
ui/egl-helpers.c | 6 +++---
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h
index dad19e9873fb..94a4b3e6f3bd 100644
--- a/include/ui/egl-helpers.h
+++ b/include/ui/egl-helpers.h
@@ -25,7 +25,7 @@ void egl_fb_setup_for_tex(egl_fb *fb, int width, int height,
GLuint texture, bool delete);
void egl_fb_setup_new_tex(egl_fb *fb, int width, int height);
void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip);
-void egl_fb_read(void *dst, egl_fb *src);
+void egl_fb_read(DisplaySurface *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,
diff --git a/ui/egl-headless.c b/ui/egl-headless.c
index 05b2e7d7b17f..fe2a0d1eab98 100644
--- a/ui/egl-headless.c
+++ b/ui/egl-headless.c
@@ -133,8 +133,6 @@ static void egl_scanout_flush(DisplayChangeListener *dcl,
if (!edpy->guest_fb.texture || !edpy->ds) {
return;
}
- assert(surface_width(edpy->ds) == edpy->guest_fb.width);
- assert(surface_height(edpy->ds) == edpy->guest_fb.height);
assert(surface_format(edpy->ds) == PIXMAN_x8r8g8b8);
if (edpy->cursor_fb.texture) {
@@ -149,7 +147,7 @@ static void egl_scanout_flush(DisplayChangeListener *dcl,
egl_fb_blit(&edpy->blit_fb, &edpy->guest_fb, edpy->y_0_top);
}
- egl_fb_read(surface_data(edpy->ds), &edpy->blit_fb);
+ egl_fb_read(edpy->ds, &edpy->blit_fb);
dpy_gfx_update(edpy->dcl.con, x, y, w, h);
}
diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index edc53f6d3464..7c530c2825be 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -102,12 +102,12 @@ void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip)
GL_COLOR_BUFFER_BIT, GL_LINEAR);
}
-void egl_fb_read(void *dst, egl_fb *src)
+void egl_fb_read(DisplaySurface *dst, egl_fb *src)
{
glBindFramebuffer(GL_READ_FRAMEBUFFER, src->framebuffer);
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
- glReadPixels(0, 0, src->width, src->height,
- GL_BGRA, GL_UNSIGNED_BYTE, dst);
+ glReadPixels(0, 0, surface_width(dst), surface_height(dst),
+ GL_BGRA, GL_UNSIGNED_BYTE, surface_data(dst));
}
void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip)
--
2.18.1
next prev parent reply other threads:[~2019-09-19 7:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-19 7:09 [Qemu-devel] [PULL 0/4] Ui 20190919 patches Gerd Hoffmann
2019-09-19 7:09 ` Gerd Hoffmann [this message]
2019-09-19 7:09 ` [Qemu-devel] [PULL 2/4] vnc: fix websocket field in events Gerd Hoffmann
2019-09-19 7:09 ` [Qemu-devel] [PULL 3/4] ui: add an embedded Barrier client Gerd Hoffmann
2019-09-19 7:09 ` [Qemu-devel] [PULL 4/4] vnc: fix memory leak when vnc disconnect Gerd Hoffmann
2019-09-19 7:31 ` Li Qiang
2019-09-19 10:13 ` [Qemu-devel] [PULL 0/4] Ui 20190919 patches Peter Maydell
2019-09-19 11:48 ` Gerd Hoffmann
2019-09-19 17:10 ` Peter Maydell
2019-09-19 21:45 ` no-reply
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=20190919070918.16059-2-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).