From nobody Fri Nov 7 11:25:31 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 15482935945821009.4086834512037; Wed, 23 Jan 2019 17:33:14 -0800 (PST) Received: from localhost ([127.0.0.1]:44668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmTt4-0003Lq-3P for importer@patchew.org; Wed, 23 Jan 2019 20:32:58 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmTs1-00032V-Vd for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:31:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gmTs0-0000El-Dm for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:31:53 -0500 Received: from st43p00im-zteg10061901.me.com ([17.58.63.168]:33366) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gmTs0-0000Di-6F for qemu-devel@nongnu.org; Wed, 23 Jan 2019 20:31:52 -0500 Received: from localhost (pv33p36im-webms003.me.com [17.142.221.25]) by st43p00im-zteg10061901.me.com (Postfix) with ESMTP id 52E3F8600EB; Thu, 24 Jan 2019 01:31:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1548293509; bh=epdoOE4hcHC1w89AjQj2Ya5xlZmGL/gm0lApCYnZHr8=; h=To:From:Subject:Date:Message-id:Content-Type:MIME-Version; b=Y1+yFtjbOXKgt3rh1IoOL1mmrXWdxfHWevpLoLxLpAm2tvvF1sWlhBIFq9hSRLZBP mpwfOtdA/6PXZtiMuf6De1ARtgWULAhAMOzBIa/HLfx+Oy1PHUQlvTuQm1f9iLwpqm 1JpE+pnjoAVQ2gxgfw/GbtQQNcqn1NhNREqWF4ayMYPT+EQgOPLW777yRcoB1tICYN vtfpNclaxhUCoKyYCptNRuif9enRkyHUTpLaDPck1bg5JNgBGQvscwtL1knutJgF73 nH0n4veGfLqgbWvnxukaaeqXHdOu/U1dCiOF4G0Pw1tXnQvIq1OvgCOC6SQYmgDcGI qouE9b/9MMMgA== To: qemu-devel@nongnu.org Date: Thu, 24 Jan 2019 01:31:45 GMT X-Mailer: iCloud MailClient1822Hotfix2 MailServer1821B37.10000-1821B-0-3ae025191697 Message-id: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-01-24_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=705 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1901240008 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 17.58.63.168 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: [Qemu-devel] [PATCH]gtk-egl: Blend cursor buffer within a scaled viewport X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Chen Zhang via Qemu-devel Reply-To: Chen Zhang Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8"; format="flowed" When a gtk-egl window (for gvt-g DMABuf) was=C2=A0zoomed, the cursor plane = buffer did not zoom covariantly, resulting in a=C2=A0mismatched cursor size= . In this patch, `egl_texture_blend()` is augmented with two extra paramete= rs to convey the size for a scaled viewport, as in `egl_texture_blend2()`.= =C2=A0 Signed-off-by: Chen Zhang --- include/ui/egl-helpers.h | 2 ++ ui/egl-helpers.c | 18 ++++++++++++++++++ ui/gtk-egl.c | 8 +++++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/include/ui/egl-helpers.h b/include/ui/egl-helpers.h index 3fc656a..63ffc2d 100644 --- a/include/ui/egl-helpers.h +++ b/include/ui/egl-helpers.h @@ -28,6 +28,8 @@ void egl_fb_read(void *dst, egl_fb *src); void egl_texture_blit(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool fli= p); void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool fl= ip, int x, int y); +void egl_texture_blend2(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool = flip, + int x, int y, int w, int h); #ifdef CONFIG_OPENGL_DMABUF diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index 5e115b3..9dddee9 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -137,6 +137,24 @@ void egl_texture_blend(QemuGLShader *gls, egl_fb *dst,= egl_fb *src, bool flip, glDisable(GL_BLEND); } +void egl_texture_blend2(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool = flip, + int x, int y, int w, int h) +{ + glBindFramebuffer(GL_FRAMEBUFFER_EXT, dst->framebuffer); + if (flip) { + glViewport(x, y, w, h); + } else { + glViewport(x, dst->height - h - y, + w, h); + } + glEnable(GL_TEXTURE_2D); + glBindTexture(GL_TEXTURE_2D, src->texture); + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + qemu_gl_run_texture_blit(gls, flip); + glDisable(GL_BLEND); +} + /* ---------------------------------------------------------------------- */ #ifdef CONFIG_OPENGL_DMABUF diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index afd1714..afff0e1 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -276,9 +276,11 @@ void gd_egl_scanout_flush(DisplayChangeListener *dcl, if (vc->gfx.cursor_fb.texture) { egl_texture_blit(vc->gfx.gls, &vc->gfx.win_fb, &vc->gfx.guest_fb, 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); + egl_texture_blend2(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.scale_x * vc->gfx.cursor_fb.width, + vc->gfx.scale_x * vc->gfx.cursor_fb.height); } else { egl_fb_blit(&vc->gfx.win_fb, &vc->gfx.guest_fb, !vc->gfx.y0_top); } --=20 2.7.4