From patchwork Thu Jan 24 01:31:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cameron Esfahani via X-Patchwork-Id: 1030250 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nongnu.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=me.com header.i=@me.com header.b="Y1+yFtjb"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43lPlp6gmLz9s7h for ; Thu, 24 Jan 2019 12:32:21 +1100 (AEDT) Received: from localhost ([127.0.0.1]:44664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gmTsQ-00034i-4F for incoming@patchwork.ozlabs.org; Wed, 23 Jan 2019 20:32:18 -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 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== 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) 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 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: , X-Patchwork-Original-From: Chen Zhang via Qemu-devel From: Cameron Esfahani via Reply-To: Chen Zhang Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" When a gtk-egl window (for gvt-g DMABuf) was zoomed, the cursor plane buffer did not zoom covariantly, resulting in a mismatched cursor size. In this patch, `egl_texture_blend()` is augmented with two extra parameters to convey the size for a scaled viewport, as in `egl_texture_blend2()`.  Signed-off-by: Chen Zhang 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 flip); void egl_texture_blend(QemuGLShader *gls, egl_fb *dst, egl_fb *src, bool flip, 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); }