From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5BE3CC433F5 for ; Thu, 23 Sep 2021 23:43:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C8E7E60F6F for ; Thu, 23 Sep 2021 23:43:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C8E7E60F6F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTYNM-0003Zc-Q6 for qemu-devel@archiver.kernel.org; Thu, 23 Sep 2021 19:43:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTYLM-0002UR-QW for qemu-devel@nongnu.org; Thu, 23 Sep 2021 19:41:33 -0400 Received: from mga17.intel.com ([192.55.52.151]:34826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTYLK-0007OC-Q0 for qemu-devel@nongnu.org; Thu, 23 Sep 2021 19:41:32 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10116"; a="204124271" X-IronPort-AV: E=Sophos;i="5.85,318,1624345200"; d="scan'208";a="204124271" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2021 16:41:20 -0700 X-IronPort-AV: E=Sophos;i="5.85,318,1624345200"; d="scan'208";a="475780626" Received: from dongwonk-mobl.amr.corp.intel.com ([10.255.69.218]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2021 16:41:19 -0700 Date: Thu, 23 Sep 2021 16:41:17 -0700 From: Dongwon Kim To: Gerd Hoffmann Subject: Re: [PATCH] ui/gtk: skip any extra draw of same guest scanout blob res Message-ID: <20210923234117.GA265@dongwonk-MOBL.amr.corp.intel.com> References: <20210916234156.5505-1-dongwon.kim@intel.com> <20210917100202.vrdadmmqbeebwp5g@sirius.home.kraxel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210917100202.vrdadmmqbeebwp5g@sirius.home.kraxel.org> User-Agent: Mutt/1.9.4 (2018-02-28) Received-SPF: pass client-ip=192.55.52.151; envelope-from=dongwon.kim@intel.com; helo=mga17.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org, Vivek Kasireddy Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Fri, Sep 17, 2021 at 12:02:02PM +0200, Gerd Hoffmann wrote: > Hi, > > > + bool draw_submitted; > > + QemuMutex mutex; > > Why the mutex? I think all the code runs while holding the BQL so it > should be serialized. Gerd, I did more experiment and verified mutex is actually not required. I think I had some wrong belief after seeing some of sync problem resolved after adding mutex but the code sequence was different at that time.. I will remove mutex. > > > +#ifdef CONFIG_GBM > > + if (dmabuf) { > > + qemu_mutex_lock(&dmabuf->mutex); > > + if (!dmabuf->draw_submitted) { > > + qemu_mutex_unlock(&dmabuf->mutex); > > + return; > > + } else { > > + dmabuf->draw_submitted = false; > > + } > > + } > > +#endif > > Factoring out that into helper functions is probably a good idea. Then > have stub functions for the CONFIG_GBM=no case and *alot* less #ifdefs > in the code ... > There are oter places controlled by #ifdef CONFIG_GBM. What about taking care of CONFIG_GBM altogher after v2 (same but no mutex) of this patch? > thanks, > Gerd >