From nobody Sun May 19 20:29:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1636111952959429.16692654928977; Fri, 5 Nov 2021 04:32:32 -0700 (PDT) Received: from localhost ([::1]:46258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mixSR-0001Co-5Q for importer@patchew.org; Fri, 05 Nov 2021 07:32:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixQz-0000Ge-BQ for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:31:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20684) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixQu-0005gz-Pn for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:30:59 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-468-CB2_tzUQOXq34MwGxK1A9w-1; Fri, 05 Nov 2021 07:30:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7F9118125C2; Fri, 5 Nov 2021 11:30:50 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ED83319739; Fri, 5 Nov 2021 11:30:49 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id DA7B41805C87; Fri, 5 Nov 2021 12:30:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636111855; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Sz+ztSdf9OvDhhII4ky1/JIbp6rFCOj+PUGmfgQIy8Q=; b=U82RADn+4MqSVg4MMg0ZKuIs2TBd7N4qKM3jwHgxQeTl3Af5a+5+knMAwt9/UuqAUCCc3T o8eE30ggDXIR9rbBN37HYRzcRTFlk0j/HPkKgkINmRCAYwEse9lQS5nSyLBEqG83zDW9oW VXnOX3pen1tEfFU7XM2TTHVA0Xrp4Lg= X-MC-Unique: CB2_tzUQOXq34MwGxK1A9w-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 1/6] virtio-gpu: splitting one extended mode guest fb into n-scanouts Date: Fri, 5 Nov 2021 12:30:38 +0100 Message-Id: <20211105113043.4059361-2-kraxel@redhat.com> In-Reply-To: <20211105113043.4059361-1-kraxel@redhat.com> References: <20211105113043.4059361-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.648, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dongwon Kim , Vivek Kasireddy , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1636111955566100001 Content-Type: text/plain; charset="utf-8" From: Dongwon Kim When guest is running Linux/X11 with extended multiple displays mode enable= d, the guest shares one scanout resource each time containing whole surface rather than sharing individual display output separately. This extended fra= me is properly splited and rendered on the corresponding scanout surfaces but not in case of blob-resource (zero copy). This code change lets the qemu split this one large surface data into multi= ple in case of blob-resource as well so that each sub frame then can be blitted properly to each scanout. v2: resizing qemu console in virtio_gpu_update_dmabuf to scanout's width and height v3: updating stub function of virtio_gpu_update_dmabuf to match the type Cc: Gerd Hoffmann Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim Message-Id: <20211104065153.28897-5-dongwon.kim@intel.com> Signed-off-by: Gerd Hoffmann Reviewed-by: Mark Cave-Ayland --- include/hw/virtio/virtio-gpu.h | 5 +++-- include/ui/console.h | 4 ++++ hw/display/virtio-gpu-udmabuf-stubs.c | 3 ++- hw/display/virtio-gpu-udmabuf.c | 22 ++++++++++++++-------- hw/display/virtio-gpu.c | 4 ++-- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 24c6628944ea..acfba7c76c10 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -187,7 +187,7 @@ struct VirtIOGPU { =20 struct { QTAILQ_HEAD(, VGPUDMABuf) bufs; - VGPUDMABuf *primary; + VGPUDMABuf *primary[VIRTIO_GPU_MAX_SCANOUTS]; } dmabuf; }; =20 @@ -273,7 +273,8 @@ void virtio_gpu_fini_udmabuf(struct virtio_gpu_simple_r= esource *res); int virtio_gpu_update_dmabuf(VirtIOGPU *g, uint32_t scanout_id, struct virtio_gpu_simple_resource *res, - struct virtio_gpu_framebuffer *fb); + struct virtio_gpu_framebuffer *fb, + struct virtio_gpu_rect *r); =20 /* virtio-gpu-3d.c */ void virtio_gpu_virgl_process_cmd(VirtIOGPU *g, diff --git a/include/ui/console.h b/include/ui/console.h index b6bedc5f4152..6d678924f6fd 100644 --- a/include/ui/console.h +++ b/include/ui/console.h @@ -167,6 +167,10 @@ typedef struct QemuDmaBuf { uint32_t fourcc; uint64_t modifier; uint32_t texture; + uint32_t x; + uint32_t y; + uint32_t scanout_width; + uint32_t scanout_height; bool y0_top; void *sync; int fence_fd; diff --git a/hw/display/virtio-gpu-udmabuf-stubs.c b/hw/display/virtio-gpu-= udmabuf-stubs.c index 81f661441ab9..f692e1351034 100644 --- a/hw/display/virtio-gpu-udmabuf-stubs.c +++ b/hw/display/virtio-gpu-udmabuf-stubs.c @@ -20,7 +20,8 @@ void virtio_gpu_fini_udmabuf(struct virtio_gpu_simple_res= ource *res) int virtio_gpu_update_dmabuf(VirtIOGPU *g, uint32_t scanout_id, struct virtio_gpu_simple_resource *res, - struct virtio_gpu_framebuffer *fb) + struct virtio_gpu_framebuffer *fb, + struct virtio_gpu_rect *r) { /* nothing (stub) */ return 0; diff --git a/hw/display/virtio-gpu-udmabuf.c b/hw/display/virtio-gpu-udmabu= f.c index 60ea7f8f4972..1597921c51fc 100644 --- a/hw/display/virtio-gpu-udmabuf.c +++ b/hw/display/virtio-gpu-udmabuf.c @@ -171,7 +171,8 @@ static VGPUDMABuf *virtio_gpu_create_dmabuf(VirtIOGPU *g, uint32_t scanout_id, struct virtio_gpu_simple_resource *res, - struct virtio_gpu_framebuffer *fb) + struct virtio_gpu_framebuffer *fb, + struct virtio_gpu_rect *r) { VGPUDMABuf *dmabuf; =20 @@ -183,6 +184,10 @@ static VGPUDMABuf dmabuf->buf.width =3D fb->width; dmabuf->buf.height =3D fb->height; dmabuf->buf.stride =3D fb->stride; + dmabuf->buf.x =3D r->x; + dmabuf->buf.y =3D r->y; + dmabuf->buf.scanout_width =3D r->width; + dmabuf->buf.scanout_height =3D r->height; dmabuf->buf.fourcc =3D qemu_pixman_to_drm_format(fb->format); dmabuf->buf.fd =3D res->dmabuf_fd; dmabuf->buf.allow_fences =3D true; @@ -196,24 +201,25 @@ static VGPUDMABuf int virtio_gpu_update_dmabuf(VirtIOGPU *g, uint32_t scanout_id, struct virtio_gpu_simple_resource *res, - struct virtio_gpu_framebuffer *fb) + struct virtio_gpu_framebuffer *fb, + struct virtio_gpu_rect *r) { struct virtio_gpu_scanout *scanout =3D &g->parent_obj.scanout[scanout_= id]; VGPUDMABuf *new_primary, *old_primary =3D NULL; =20 - new_primary =3D virtio_gpu_create_dmabuf(g, scanout_id, res, fb); + new_primary =3D virtio_gpu_create_dmabuf(g, scanout_id, res, fb, r); if (!new_primary) { return -EINVAL; } =20 - if (g->dmabuf.primary) { - old_primary =3D g->dmabuf.primary; + if (g->dmabuf.primary[scanout_id]) { + old_primary =3D g->dmabuf.primary[scanout_id]; } =20 - g->dmabuf.primary =3D new_primary; + g->dmabuf.primary[scanout_id] =3D new_primary; qemu_console_resize(scanout->con, - new_primary->buf.width, - new_primary->buf.height); + new_primary->buf.scanout_width, + new_primary->buf.scanout_height); dpy_gl_scanout_dmabuf(scanout->con, &new_primary->buf); =20 if (old_primary) { diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 182e0868b09d..d78b9700c7de 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -517,9 +517,9 @@ static void virtio_gpu_resource_flush(VirtIOGPU *g, console_has_gl(scanout->con)) { dpy_gl_update(scanout->con, 0, 0, scanout->width, scanout->height); - return; } } + return; } =20 if (!res->blob && @@ -627,7 +627,7 @@ static void virtio_gpu_do_set_scanout(VirtIOGPU *g, =20 if (res->blob) { if (console_has_gl(scanout->con)) { - if (!virtio_gpu_update_dmabuf(g, scanout_id, res, fb)) { + if (!virtio_gpu_update_dmabuf(g, scanout_id, res, fb, r)) { virtio_gpu_update_scanout(g, scanout_id, res, r); return; } --=20 2.31.1 From nobody Sun May 19 20:29:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1636112028921342.6139611933422; Fri, 5 Nov 2021 04:33:48 -0700 (PDT) Received: from localhost ([::1]:48542 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mixTf-0002jz-Ss for importer@patchew.org; Fri, 05 Nov 2021 07:33:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixRK-0000rW-O6 for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:31:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52943) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixRI-0005sm-SP for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:31:22 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-419--pgRH9-xOGinLvLhzTnnyQ-1; Fri, 05 Nov 2021 07:31:16 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 00B8410A8E00; Fri, 5 Nov 2021 11:31:15 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A222367841; Fri, 5 Nov 2021 11:30:52 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E58831805C88; Fri, 5 Nov 2021 12:30:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636111880; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lODvWHawrxeefp7Sfh3pVLwboPKJFLzIPyItZpDI+xo=; b=QdHD2LimiArB/mBo3bdufQ7ClhwOd/N0igs+69+PcnetNqgC9qAqpuj+r/nhhtXqsGdaHV RuDHWxFDY0AVAIoIp1LzaNBoVaitjvfoEkYiDym7Zg2xcaGzX1HRuA5JT12/jKzLmRyLEE zriLCSyuyfl3QdkTeWaL7mhk3Vt+n9E= X-MC-Unique: -pgRH9-xOGinLvLhzTnnyQ-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 2/6] ui/gtk-egl: un-tab and re-tab should destroy egl surface and context Date: Fri, 5 Nov 2021 12:30:39 +0100 Message-Id: <20211105113043.4059361-3-kraxel@redhat.com> In-Reply-To: <20211105113043.4059361-1-kraxel@redhat.com> References: <20211105113043.4059361-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.648, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Khairul Anuar Romli , Dongwon Kim , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1636112030001100001 Content-Type: text/plain; charset="utf-8" From: Dongwon Kim An old esurface should be destroyed and set to be NULL when doing un-tab and re-tab so that a new esurface an context can be created for the window widget that those will be bound to. v2: enabling opengl specific routines only when CONFIG_OPENGL is set Cc: Gerd Hoffmann Signed-off-by: Dongwon Kim Signed-off-by: Khairul Anuar Romli Message-Id: <20211104065153.28897-1-dongwon.kim@intel.com> Signed-off-by: Gerd Hoffmann Reviewed-by: Mark Cave-Ayland --- ui/gtk.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index b0564d80c191..8da673c18c72 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -1242,6 +1242,16 @@ static gboolean gd_tab_window_close(GtkWidget *widge= t, GdkEvent *event, vc->tab_item, vc->label); gtk_widget_destroy(vc->window); vc->window =3D NULL; +#if defined(CONFIG_OPENGL) + if (vc->gfx.esurface) { + eglDestroySurface(qemu_egl_display, vc->gfx.esurface); + vc->gfx.esurface =3D NULL; + } + if (vc->gfx.ectx) { + eglDestroyContext(qemu_egl_display, vc->gfx.ectx); + vc->gfx.ectx =3D NULL; + } +#endif return TRUE; } =20 @@ -1271,6 +1281,16 @@ static void gd_menu_untabify(GtkMenuItem *item, void= *opaque) if (!vc->window) { gtk_widget_set_sensitive(vc->menu_item, false); vc->window =3D gtk_window_new(GTK_WINDOW_TOPLEVEL); +#if defined(CONFIG_OPENGL) + if (vc->gfx.esurface) { + eglDestroySurface(qemu_egl_display, vc->gfx.esurface); + vc->gfx.esurface =3D NULL; + } + if (vc->gfx.esurface) { + eglDestroyContext(qemu_egl_display, vc->gfx.ectx); + vc->gfx.ectx =3D NULL; + } +#endif gd_widget_reparent(s->notebook, vc->window, vc->tab_item); =20 g_signal_connect(vc->window, "delete-event", --=20 2.31.1 From nobody Sun May 19 20:29:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1636112041000484.62928441007034; Fri, 5 Nov 2021 04:34:01 -0700 (PDT) Received: from localhost ([::1]:49374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mixTs-0003JU-16 for importer@patchew.org; Fri, 05 Nov 2021 07:34:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41106) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixRb-0001B9-OV for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:31:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46891) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixRY-00069I-4k for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:31:39 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-596-ZPkayAguMI2vAjXca6kC9Q-1; Fri, 05 Nov 2021 07:31:33 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 085A910A8E01; Fri, 5 Nov 2021 11:31:33 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EFAA77086C; Fri, 5 Nov 2021 11:31:16 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id F05F41805C89; Fri, 5 Nov 2021 12:30:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636111895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ThnwXs6eJaKWY7i+9xqYNEt83lxa+2NVwhi+YQpQr5Y=; b=G1mZLaSDZbHAx2qgqt55RZatGTOecUIapb8LMfVWoEeumLswMAi7iqSFNFaiocApxIHriM rLq/uP2Jryu02DiwIQrp9cUkb4NjtIGxjFvzsNP+jg60uCjk0sEAXH79bfFxm0Kjo+0djt jhaCwiEt+6+jorAbpJU7lJh0xEs+QmE= X-MC-Unique: ZPkayAguMI2vAjXca6kC9Q-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 3/6] ui/gtk-egl: make sure the right context is set as the current Date: Fri, 5 Nov 2021 12:30:40 +0100 Message-Id: <20211105113043.4059361-4-kraxel@redhat.com> In-Reply-To: <20211105113043.4059361-1-kraxel@redhat.com> References: <20211105113043.4059361-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.648, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dongwon Kim , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1636112042766100003 Content-Type: text/plain; charset="utf-8" From: Dongwon Kim Making the vc->gfx.ectx current before handling texture associated with it Cc: Gerd Hoffmann Signed-off-by: Dongwon Kim Message-Id: <20211104065153.28897-2-dongwon.kim@intel.com> Signed-off-by: Gerd Hoffmann Reviewed-by: Mark Cave-Ayland --- ui/gtk-egl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index e912b200755a..21649950983f 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -152,6 +152,7 @@ void gd_egl_refresh(DisplayChangeListener *dcl) } vc->gfx.gls =3D qemu_gl_init_shader(); if (vc->gfx.ds) { + surface_gl_destroy_texture(vc->gfx.gls, vc->gfx.ds); surface_gl_create_texture(vc->gfx.gls, vc->gfx.ds); } } @@ -178,6 +179,8 @@ void gd_egl_switch(DisplayChangeListener *dcl, surface_height(vc->gfx.ds) =3D=3D surface_height(surface)) { resized =3D false; } + eglMakeCurrent(qemu_egl_display, vc->gfx.esurface, + vc->gfx.esurface, vc->gfx.ectx); =20 surface_gl_destroy_texture(vc->gfx.gls, vc->gfx.ds); vc->gfx.ds =3D surface; @@ -237,6 +240,9 @@ void gd_egl_scanout_dmabuf(DisplayChangeListener *dcl, #ifdef CONFIG_GBM VirtualConsole *vc =3D container_of(dcl, VirtualConsole, gfx.dcl); =20 + eglMakeCurrent(qemu_egl_display, vc->gfx.esurface, + vc->gfx.esurface, vc->gfx.ectx); + egl_dmabuf_import_texture(dmabuf); if (!dmabuf->texture) { return; --=20 2.31.1 From nobody Sun May 19 20:29:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1636112246997425.26243927321207; Fri, 5 Nov 2021 04:37:26 -0700 (PDT) Received: from localhost ([::1]:33176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mixXC-0002t5-2S for importer@patchew.org; Fri, 05 Nov 2021 07:37:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixS1-0001YD-Cy for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:32:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:53943) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixRy-0007Xi-PR for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:32:04 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-69-f762FkPGNT2LNpRH2MihoA-1; Fri, 05 Nov 2021 07:32:00 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BCC3910A8E03; Fri, 5 Nov 2021 11:31:59 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5233D60BF1; Fri, 5 Nov 2021 11:31:36 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 085711805C8A; Fri, 5 Nov 2021 12:30:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636111922; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WJXL/UmY6ljRpvIvfLf3+K7wjsFA295w8PrPqULNY2c=; b=Lyx1sUpY6Tkyp2FGxP3QtojARgGSnEggYnJZAYkbfjPhY52fom3L2WrfTL+bqzWTtxj+zt BoQeU/UT9IEuTOFGbzn2JrXyJSMsTDeCounh5J2vVpCU7a5HEO3VOlwKbj71INKrdb94Yd VPO1CEhZC9mSS/goVdROo4giRUJqgBA= X-MC-Unique: f762FkPGNT2LNpRH2MihoA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 4/6] ui/gtk-egl: guest fb texture needs to be regenerated when reinitializing egl Date: Fri, 5 Nov 2021 12:30:41 +0100 Message-Id: <20211105113043.4059361-5-kraxel@redhat.com> In-Reply-To: <20211105113043.4059361-1-kraxel@redhat.com> References: <20211105113043.4059361-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.648, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dongwon Kim , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1636112248279100001 Content-Type: text/plain; charset="utf-8" From: Dongwon Kim If guest fb is backed by dmabuf (blob-resource), the texture bound to the old context needs to be recreated in case the egl is re-initialized (e.g. new window for vc is created in case of detaching/reattaching of the tab) v2: call egl_dmabuf_release_texutre instead of putting 0 to dmabuf->texture (Vivek Kasireddy) Cc: Gerd Hoffmann Signed-off-by: Dongwon Kim Message-Id: <20211104065153.28897-3-dongwon.kim@intel.com> Signed-off-by: Gerd Hoffmann Reviewed-by: Mark Cave-Ayland --- ui/gtk-egl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 21649950983f..f2026e4b5c9b 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -155,6 +155,10 @@ void gd_egl_refresh(DisplayChangeListener *dcl) surface_gl_destroy_texture(vc->gfx.gls, vc->gfx.ds); surface_gl_create_texture(vc->gfx.gls, vc->gfx.ds); } + if (vc->gfx.guest_fb.dmabuf) { + egl_dmabuf_release_texture(vc->gfx.guest_fb.dmabuf); + gd_egl_scanout_dmabuf(dcl, vc->gfx.guest_fb.dmabuf); + } } =20 graphic_hw_update(dcl->con); --=20 2.31.1 From nobody Sun May 19 20:29:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1636112109541243.26526577712002; Fri, 5 Nov 2021 04:35:09 -0700 (PDT) Received: from localhost ([::1]:54946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mixUy-0006yU-Go for importer@patchew.org; Fri, 05 Nov 2021 07:35:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixRi-0001It-MB for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:31:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:37904) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixRf-0006fc-QV for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:31:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-243-6yOdlHuXNLK1idYMu5I2Lw-1; Fri, 05 Nov 2021 07:31:38 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A86C810A8E03; Fri, 5 Nov 2021 11:31:37 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A9EB19739; Fri, 5 Nov 2021 11:31:36 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 135151805C8B; Fri, 5 Nov 2021 12:30:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636111901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rXYjACikUidj+AsIdBr61Ue9utUDEhdyOPn+Z22X2pU=; b=apfQPZTCo0ISW3gNrP2n08meHWiX7Yu6ycekTOO83rQ219B87CQlfQmFsLW0HgqxfjSxOX cRqiG83/CS6xyHL/sbzSD8sX0oDgAm+l9AghNUQvf5E0RgMcViqYdoKaYyKzxqEwt5HHbS Se1DOFKFKBySxsE834+AOAEbIvdkjQg= X-MC-Unique: 6yOdlHuXNLK1idYMu5I2Lw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 5/6] ui/gtk: gd_draw_event returns FALSE when no cairo surface is bound Date: Fri, 5 Nov 2021 12:30:42 +0100 Message-Id: <20211105113043.4059361-6-kraxel@redhat.com> In-Reply-To: <20211105113043.4059361-1-kraxel@redhat.com> References: <20211105113043.4059361-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.648, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dongwon Kim , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1636112109954100001 Content-Type: text/plain; charset="utf-8" From: Dongwon Kim gd_draw_event shouldn't try to repaint if surface does not exist for the VC. Cc: Gerd Hoffmann Signed-off-by: Dongwon Kim Message-Id: <20211104065153.28897-4-dongwon.kim@intel.com> Signed-off-by: Gerd Hoffmann Reviewed-by: Mark Cave-Ayland --- ui/gtk.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 8da673c18c72..d2892ea6b4a9 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -778,6 +778,9 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_= t *cr, void *opaque) if (!vc->gfx.ds) { return FALSE; } + if (!vc->gfx.surface) { + return FALSE; + } =20 vc->gfx.dcl.update_interval =3D gd_monitor_update_interval(vc->window ? vc->window : s->window); --=20 2.31.1 From nobody Sun May 19 20:29:56 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1636112121159117.16547409081068; Fri, 5 Nov 2021 04:35:21 -0700 (PDT) Received: from localhost ([::1]:55784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mixVA-0007W7-7B for importer@patchew.org; Fri, 05 Nov 2021 07:35:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixRj-0001Ky-CD for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:31:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48759) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mixRh-0006kD-0U for qemu-devel@nongnu.org; Fri, 05 Nov 2021 07:31:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-ulgDOllmO8qtJ29AVNe5bA-1; Fri, 05 Nov 2021 07:31:41 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 384821006AA3; Fri, 5 Nov 2021 11:31:40 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DC33519739; Fri, 5 Nov 2021 11:31:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1E2E21805C8C; Fri, 5 Nov 2021 12:30:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636111904; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jepb0sxPU4MnEldnynn07wp15ustYFOmjzojh9N9SRY=; b=TWLMATvePZDPP6UrlFUjFajv7GRtsqEE9RGNcqWIFi28ihFJMsPSQMaEVYv48xXRJ4gS+t NUA608gx4j5JNv/wFJCZRXzsc4Ki4BsHkL2Xws4/9ph/KljMqgUBVbRTJF1XkkTk21usfI dMawqmq+ChLdzh47qQFeF984kB6RUYY= X-MC-Unique: ulgDOllmO8qtJ29AVNe5bA-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PULL 6/6] ui/gtk-egl: blitting partial guest fb to the proper scanout surface Date: Fri, 5 Nov 2021 12:30:43 +0100 Message-Id: <20211105113043.4059361-7-kraxel@redhat.com> In-Reply-To: <20211105113043.4059361-1-kraxel@redhat.com> References: <20211105113043.4059361-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.648, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dongwon Kim , Vivek Kasireddy , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1636112122807100003 Content-Type: text/plain; charset="utf-8" From: Dongwon Kim eb_fb_blit should be able to blit partial image of guest display (blob res) in case multiple displays are configured for the guest and they are set as = extended- desktop mode. v2: egl_fb includes dmabuf info then make egl_fb_blit position and size parameters programmed in dmabuf structure (previously position/size parameters were given to egl_fb_blit separately) (Vivek Kasireddy) changed the commit message as there is no interface change to egl_fb_bl= it Cc: Gerd Hoffmann Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim Message-Id: <20211104065153.28897-6-dongwon.kim@intel.com> Signed-off-by: Gerd Hoffmann Reviewed-by: Mark Cave-Ayland --- ui/egl-helpers.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c index 385a3fa75223..3a88245b6780 100644 --- a/ui/egl-helpers.c +++ b/ui/egl-helpers.c @@ -90,14 +90,31 @@ void egl_fb_setup_new_tex(egl_fb *fb, int width, int he= ight) =20 void egl_fb_blit(egl_fb *dst, egl_fb *src, bool flip) { - GLuint y1, y2; + GLuint x1 =3D 0; + GLuint y1 =3D 0; + GLuint x2, y2; + GLuint w =3D src->width; + GLuint h =3D src->height; =20 glBindFramebuffer(GL_READ_FRAMEBUFFER, src->framebuffer); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst->framebuffer); glViewport(0, 0, dst->width, dst->height); - y1 =3D flip ? src->height : 0; - y2 =3D flip ? 0 : src->height; - glBlitFramebuffer(0, y1, src->width, y2, + + if (src->dmabuf) { + x1 =3D src->dmabuf->x; + y1 =3D src->dmabuf->y; + w =3D src->dmabuf->scanout_width; + h =3D src->dmabuf->scanout_height; + } + + w =3D (x1 + w) > src->width ? src->width - x1 : w; + h =3D (y1 + h) > src->height ? src->height - y1 : h; + + y2 =3D flip ? y1 : h + y1; + y1 =3D flip ? h + y1 : y1; + x2 =3D x1 + w; + + glBlitFramebuffer(x1, y1, x2, y2, 0, 0, dst->width, dst->height, GL_COLOR_BUFFER_BIT, GL_LINEAR); } --=20 2.31.1