Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp347567pxb; Sat, 10 Apr 2021 05:00:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrMlZXBuTNdymtPVI3y569q8128D4nzXd/BQ1tMa0RWUUTvmNTdV3P7YY0YbbYZqEBXYI4 X-Received: by 2002:a17:902:c948:b029:e9:8f01:fa8e with SMTP id i8-20020a170902c948b02900e98f01fa8emr12479810pla.37.1618056057863; Sat, 10 Apr 2021 05:00:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618056057; cv=none; d=google.com; s=arc-20160816; b=uSf4ca1rUO+DqGLy1rzIx1LgNTwDUwH2qgCn82+cY+durZZExi/zjWeQV6uydAlscJ QGi6n2TIOrjudEqIzDnPQkD777E7ASURQ1INNhmwg1yjB8LpFwDDLwDaXYPPp5uG5aXb NP+N2gJiSas0Id6+Qtl3lfMK+5WuHT9V1olZeI5jvlwjK9Qy5ArEe8+WYhzppWP3VFE0 G6FTBipRweXFhOKC4MqwUNB+CJ/on1hX8At0vUbeKO/c06Ev65m2mmLYjPbDP5+YkNsI V7fQzcgHbT8RqMoiIvEegZYzspi7Hwjbhga5NwrHwyuoY3JhHAZNqcqwevcG3RhRXYMG j0Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=oIg1PZztVGwUrvL59kCF7lno2imG3ao8dwwj173iJJg=; b=SdV8b3/wN0lO9ea+C2lEtxmK6mTXvAWWsqCQWhNBRCbSmi7eqbOPuM86QpSNKSa5Ec livvu8uQ97vnrn02rB+6F56l27OniV0BXqcHpZrKitVGlStzepY75rAch2ShuLeNvVzv X2ZVttYgy79F0aR6eAFAxFDAfGETzOl2NdJgjToTFlimjdmgWCSfmZosUiTmVW4sDxI4 b6kGncn5tfXZxTNaz0k6pCqB9yFmff/chKFnjNE4Ooaip8DIgTenefR+5g4REQ4ve3A6 aQ/nixghPLX22M+QlcMigirp3KjXd+ORDQZfZ96tjEZtzp+94UWfShdSdFI2ZxFrkht3 WjMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hCVrunnf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w3si5971383pgk.397.2021.04.10.05.00.45; Sat, 10 Apr 2021 05:00:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hCVrunnf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234392AbhDJL7u (ORCPT + 99 others); Sat, 10 Apr 2021 07:59:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234373AbhDJL7s (ORCPT ); Sat, 10 Apr 2021 07:59:48 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 750E8C061762 for ; Sat, 10 Apr 2021 04:59:33 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id y20-20020a1c4b140000b029011f294095d3so6078868wma.3 for ; Sat, 10 Apr 2021 04:59:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=oIg1PZztVGwUrvL59kCF7lno2imG3ao8dwwj173iJJg=; b=hCVrunnfC4XSpSuHvr+t8Ad3yv+jvcqtRdn1MVwjo9qafi1ey02UCnbky88iapyEGK b7ai06ECDwXssJUmRj5TGGYooLCZdJ7bnXJrAii5ryXrbDbHoKTAsdcycIJFM0QlfXYe I7h6vjWnbhBWLLKYP9fDW2z+w2ceL9MOCyFveuBO1OB+QWRi7BzEGknXqwbsL1N8aC+Q 0sGkdi8czUKoPtRxEz0A6rdr1joASL42R0jNifAqe8qmh2OCskE5+qqS5oI19cBu8biL nxeyrNWUmUbDPv0DtWmoQMSK5utITs9Bk5hZ2mHHt6sib2AsV+Gm1ZRJuK2vWZgXexrb eY2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=oIg1PZztVGwUrvL59kCF7lno2imG3ao8dwwj173iJJg=; b=enYShrf4/wIWekASqxcNKRnWKlpMWxrK6TKepuHnKRQXfKRwQMKCdPYV4xGfDYig0z kNHQ5yEehNevCqShdjhxD79tMxiax9lNbpr9hFiBbaggMSB/GzIhfR79xONSs1Z2fwTa ACEEigOFBaRKCRQeLqOhyik6mN/R5eLgJvvefLFho6bAlbb+fvYDGDI6Rcnb/OKy5y+H W8B3OfC/tQF4VaiWewYzO2HlEHCsvkTeQAvg7vFDTQJmTPHlz+sCEeWzW9YnbQS8Pp8g emNoCxXb4wxfLe7JmE9hqS8njmOvmpQyVtv9BM18oqMLrwR1JT4QKCbTS8ecqLzg5Djy ihyA== X-Gm-Message-State: AOAM530WKsxBK0ZlH0hHHa0cvPfAN/1sfZjlp0yt51LhRuBggpGe46/R IL4gc3lbHYE3LdbDNXOMx41/Ee+hhMQ= X-Received: by 2002:a7b:ce8f:: with SMTP id q15mr17760290wmj.37.1618055972174; Sat, 10 Apr 2021 04:59:32 -0700 (PDT) Received: from smtp.gmail.com (a95-92-181-29.cpe.netcabo.pt. [95.92.181.29]) by smtp.gmail.com with ESMTPSA id o7sm8832627wrs.16.2021.04.10.04.59.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Apr 2021 04:59:31 -0700 (PDT) Date: Sat, 10 Apr 2021 08:59:24 -0300 From: Melissa Wen To: Sumera Priyadarsini Cc: rodrigosiqueiramelo@gmail.com, hamohammed.sa@gmail.com, daniel@ffwll.ch, airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V4 2/2] drm/vkms: Add support for virtual hardware mode Message-ID: <20210410115924.g3e45tdkbmscwncu@smtp.gmail.com> References: <062516fb20fdd8408f10b657cb280d89d59bbc34.1617602076.git.sylphrenadin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <062516fb20fdd8408f10b657cb280d89d59bbc34.1617602076.git.sylphrenadin@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/05, Sumera Priyadarsini wrote: > Add a virtual hardware or vblank-less mode as a module to > enable VKMS to emulate virtual graphic drivers. > > Add a new drm_crtc_helper_funcs struct, > vkms_virtual_crtc_helper_funcs() which holds the atomic helpers > for virtual hardware mode. Change the existing > vkms_crtc_helper_funcs struct to vkms_vblank_crtc_helper_funcs > which holds atomic helpers for the vblank mode. I would say `rename' not `change' > This makes the code flow clearer and easier to test > virtual hardware mode. > > The first patch of this patchset added the function vkms_crtc_composer() > for plane composition which is used in case of vblank-less mode and > is directly called in the atomic hook in vkms_crtc_atomic_begin(). Probably this statement will change when you move the vkms_crtc_composer to here. > However, some crc captures still use vblanks which causes the crc-based > igt tests to crash. Currently, I am unsure about how to approach the > one-shot implementation of crc reads so I am still working on that. > > This patchset has been tested with the igt tests- kms_writeback, kms_atomic, > kms_lease, kms_flip, kms_pipe_get_crc and preserves results except for Although the test results remain the same, you should also check the log. In kms_flip, the substests flip-vs-panning-vs-hang and flip-vs-panning-interruptible raised an error: [drm:vkms_composer_common [vkms]] *ERROR* Cannot allocate memory for output frame. Please, also check for leak. > subtests related to crc reads and skips tests that rely on vertical > blanking. This patchset must be tested after incorporating the > igt-tests patch: > https://lists.freedesktop.org/archives/igt-dev/2021-February/029355.html . prefer to use the patckwork link > > The patch is based on Rodrigo Siqueira's > patch(https://patchwork.freedesktop.org/patch/316851/?series=48469&rev=3) > and the ensuing review. > > Signed-off-by: Sumera Priyadarsini > --- > Changes in V3: > - Refactor patchset(Melissa) > Changes in V2: > - Add atomic helper functions in a separate struct for virtual hardware > mode (Daniel) > - Remove spinlock across 'vkms_output->lock' in vkms_crtc.c(Daniel) > - Add vkms_composer_common() (Daniel) > --- > drivers/gpu/drm/vkms/vkms_crtc.c | 51 +++++++++++++++++++++++--------- > drivers/gpu/drm/vkms/vkms_drv.c | 18 +++++++---- > drivers/gpu/drm/vkms/vkms_drv.h | 1 + > 3 files changed, 51 insertions(+), 19 deletions(-) > > diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c > index 57bbd32e9beb..e6286f98d5b6 100644 > --- a/drivers/gpu/drm/vkms/vkms_crtc.c > +++ b/drivers/gpu/drm/vkms/vkms_crtc.c > @@ -222,20 +222,20 @@ static int vkms_crtc_atomic_check(struct drm_crtc *crtc, > return 0; > } > > -static void vkms_crtc_atomic_enable(struct drm_crtc *crtc, > - struct drm_atomic_state *state) > +static void vkms_vblank_crtc_atomic_enable(struct drm_crtc *crtc, > + struct drm_atomic_state *state) > { > drm_crtc_vblank_on(crtc); > } > > -static void vkms_crtc_atomic_disable(struct drm_crtc *crtc, > - struct drm_atomic_state *state) > +static void vkms_vblank_crtc_atomic_disable(struct drm_crtc *crtc, > + struct drm_atomic_state *state) > { > drm_crtc_vblank_off(crtc); > } > > -static void vkms_crtc_atomic_begin(struct drm_crtc *crtc, > - struct drm_atomic_state *state) > +static void vkms_vblank_crtc_atomic_begin(struct drm_crtc *crtc, > + struct drm_atomic_state *state) > { > struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc); > > @@ -245,8 +245,8 @@ static void vkms_crtc_atomic_begin(struct drm_crtc *crtc, > spin_lock_irq(&vkms_output->lock); > } > > -static void vkms_crtc_atomic_flush(struct drm_crtc *crtc, > - struct drm_atomic_state *state) > +static void vkms_vblank_crtc_atomic_flush(struct drm_crtc *crtc, > + struct drm_atomic_state *state) > { > struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc); > > @@ -268,18 +268,38 @@ static void vkms_crtc_atomic_flush(struct drm_crtc *crtc, > spin_unlock_irq(&vkms_output->lock); > } > > -static const struct drm_crtc_helper_funcs vkms_crtc_helper_funcs = { > +/* > + * Crtc functions for virtual hardware/vblankless mode > + */ > +static void vkms_virtual_crtc_atomic_flush(struct drm_crtc *crtc, > + struct drm_atomic_state *state) > +{ > + struct vkms_output *vkms_output = drm_crtc_to_vkms_output(crtc); > + struct vkms_crtc_state *vkms_state = to_vkms_crtc_state(crtc->state); > + > + vkms_crtc_composer(vkms_state); > + > + vkms_output->composer_state = to_vkms_crtc_state(crtc->state); > +} > + > +static const struct drm_crtc_helper_funcs vkms_vblank_crtc_helper_funcs = { > .atomic_check = vkms_crtc_atomic_check, > - .atomic_begin = vkms_crtc_atomic_begin, > - .atomic_flush = vkms_crtc_atomic_flush, > - .atomic_enable = vkms_crtc_atomic_enable, > - .atomic_disable = vkms_crtc_atomic_disable, > + .atomic_begin = vkms_vblank_crtc_atomic_begin, > + .atomic_flush = vkms_vblank_crtc_atomic_flush, > + .atomic_enable = vkms_vblank_crtc_atomic_enable, > + .atomic_disable = vkms_vblank_crtc_atomic_disable, > +}; > + > +static const struct drm_crtc_helper_funcs vkms_virtual_crtc_helper_funcs = { > + .atomic_check = vkms_crtc_atomic_check, > + .atomic_flush = vkms_virtual_crtc_atomic_flush, > }; > > int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, > struct drm_plane *primary, struct drm_plane *cursor) > { > struct vkms_output *vkms_out = drm_crtc_to_vkms_output(crtc); > + struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev); > int ret; > > ret = drm_crtc_init_with_planes(dev, crtc, primary, cursor, > @@ -289,7 +309,10 @@ int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, > return ret; > } > > - drm_crtc_helper_add(crtc, &vkms_crtc_helper_funcs); > + if (vkmsdev->config->virtual_hw) > + drm_crtc_helper_add(crtc, &vkms_virtual_crtc_helper_funcs); > + else > + drm_crtc_helper_add(crtc, &vkms_vblank_crtc_helper_funcs); > > spin_lock_init(&vkms_out->lock); > spin_lock_init(&vkms_out->composer_lock); > diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c > index 2173b82606f6..945c4495d62a 100644 > --- a/drivers/gpu/drm/vkms/vkms_drv.c > +++ b/drivers/gpu/drm/vkms/vkms_drv.c > @@ -44,6 +44,11 @@ static bool enable_writeback = true; > module_param_named(enable_writeback, enable_writeback, bool, 0444); > MODULE_PARM_DESC(enable_writeback, "Enable/Disable writeback connector support"); > > +static bool enable_virtual_hw = false; > +module_param_named(enable_virtual_hw, enable_virtual_hw, bool, 0444); > +MODULE_PARM_DESC(enable_virtual_hw, "Enable/Disable virtual hardware mode(virtual \ > +hardware mode disables vblank interrupts)"); > + > DEFINE_DRM_GEM_FOPS(vkms_driver_fops); > > static void vkms_release(struct drm_device *dev) > @@ -159,12 +164,14 @@ static int vkms_create(struct vkms_config *config) > goto out_devres; > } > > - vkms_device->drm.irq_enabled = true; > + vkms_device->drm.irq_enabled = !vkms_device->config->virtual_hw; > > - ret = drm_vblank_init(&vkms_device->drm, 1); > - if (ret) { > - DRM_ERROR("Failed to vblank\n"); > - goto out_devres; > + if (!vkms_device->config->virtual_hw) { > + ret = drm_vblank_init(&vkms_device->drm, 1); > + if (ret) { > + DRM_ERROR("Failed to vblank\n"); > + goto out_devres; > + } > } > > ret = vkms_modeset_init(vkms_device); > @@ -198,6 +205,7 @@ static int __init vkms_init(void) > > config->cursor = enable_cursor; > config->writeback = enable_writeback; > + config->virtual_hw = enable_virtual_hw; > > return vkms_create(config); > } > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h > index 538315140585..a44f530ffaf0 100644 > --- a/drivers/gpu/drm/vkms/vkms_drv.h > +++ b/drivers/gpu/drm/vkms/vkms_drv.h > @@ -85,6 +85,7 @@ struct vkms_device; > struct vkms_config { > bool writeback; > bool cursor; > + bool virtual_hw; > /* only set when instantiated */ > struct vkms_device *dev; Checkpatch complained of several lines. Please, take a look at this too. Thanks, Melissa > }; > -- > 2.25.1 >