From patchwork Mon Aug 20 23:55:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10570863 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 91FF1921 for ; Mon, 20 Aug 2018 23:55:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E00928DBE for ; Mon, 20 Aug 2018 23:55:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EDCF29CBB; Mon, 20 Aug 2018 23:55:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2681428DBE for ; Mon, 20 Aug 2018 23:55:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 18D166E294; Mon, 20 Aug 2018 23:55:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-x242.google.com (mail-qt0-x242.google.com [IPv6:2607:f8b0:400d:c0d::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 807336E294 for ; Mon, 20 Aug 2018 23:55:48 +0000 (UTC) Received: by mail-qt0-x242.google.com with SMTP id o15-v6so12285928qtk.6 for ; Mon, 20 Aug 2018 16:55:48 -0700 (PDT) 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:mime-version :content-disposition:user-agent; bh=U4Z/G1wosivYMPz/an1+2mihwWAws2MLqmRUGNRcQGw=; b=n3jWio0uPiv+m/7zz/E+I13nTatg2ruaoaPTRrp0z4Uh5tptlv3zqk7mgazdYairFS rBgtFuiu8ZXFvgRTJDzsSEs0cHrElk/IRw4vZDvFRWLrooluDi1LTMAMWFVpKNgjirjn KxJLLSsj3f2txmqRwm/SZn9/z0WG63Dn7W3LP67BtbeMtRmA+DBDOvMjK/8J2Qwo6TIG hN7ylwO2gX7ld0Z44jldFokQyD1CNkyPX0cPK5uFiuiYVe2lYQPg/VdBPwOPr6PvjiX5 bpexgI/8F3tMhB2aqq2ETgj4XZDyh+fou8QQIUqKMcCI9/0CSlmyE4hcQbW9R1afFaZU VuhA== X-Gm-Message-State: APzg51B09SQU0ZzuZH6rYHxjREN9YibU89gMaLyq/zFVuaYq4/YpGw+u rD32BPfXkfB8GeyM86n5o78= X-Google-Smtp-Source: ANB0VdageWmIcjz+qUATGtENU4+G36byb10ydd2mwopj7KDOD0dsSEMMeniqcbGNupHkrcCCHSQiwg== X-Received: by 2002:a0c:e549:: with SMTP id n9-v6mr7221182qvm.130.1534809347559; Mon, 20 Aug 2018 16:55:47 -0700 (PDT) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id k5-v6sm5835232qkf.53.2018.08.20.16.55.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Aug 2018 16:55:47 -0700 (PDT) Date: Mon, 20 Aug 2018 20:55:44 -0300 From: Rodrigo Siqueira To: Daniel Vetter , Gustavo Padovan , Sean Paul , Haneen Mohammed Subject: [PATCH] drm/vkms: Add support for vkms work without vblank Message-ID: <20180820235544.pip5dwvdn3pbk7ax@smtp.gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20180716 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Currently, vkms needs VBlank to work well. This patch adds another operation model that make vkms works without VBlank support. Signed-off-by: Rodrigo Siqueira --- drivers/gpu/drm/vkms/vkms_crtc.c | 10 ++++++++++ drivers/gpu/drm/vkms/vkms_drv.c | 12 ++++++++++-- drivers/gpu/drm/vkms/vkms_drv.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c index bfe6e0312cc4..001fa5c1d326 100644 --- a/drivers/gpu/drm/vkms/vkms_crtc.c +++ b/drivers/gpu/drm/vkms/vkms_crtc.c @@ -145,12 +145,22 @@ static const struct drm_crtc_funcs vkms_crtc_funcs = { static void vkms_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { + struct vkms_output *vkms_out = drm_crtc_to_vkms_output(crtc); + + if (vkms_out->disable_vblank) + return; + drm_crtc_vblank_on(crtc); } static void vkms_crtc_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { + struct vkms_output *vkms_out = drm_crtc_to_vkms_output(crtc); + + if (vkms_out->disable_vblank) + return; + drm_crtc_vblank_off(crtc); } diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 5d78bd97e69c..f30c4113d4c4 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -21,6 +21,10 @@ static struct vkms_device *vkms_device; +static bool disable_vblank; +module_param_named(disablevblank, disable_vblank, bool, 0444); +MODULE_PARM_DESC(disablevblank, "Disable vblank interrupt"); + static const struct file_operations vkms_driver_fops = { .owner = THIS_MODULE, .open = drm_open, @@ -105,9 +109,13 @@ static int __init vkms_init(void) goto out_fini; } - vkms_device->drm.irq_enabled = true; + vkms_device->output.disable_vblank = disable_vblank; + vkms_device->drm.irq_enabled = !disable_vblank ? true : false; + + if (disable_vblank) + DRM_INFO("Virtual Hardware mode enabled"); - ret = drm_vblank_init(&vkms_device->drm, 1); + ret = (disable_vblank) ? 0 : drm_vblank_init(&vkms_device->drm, 1); if (ret) { DRM_ERROR("Failed to vblank\n"); goto out_fini; diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h index f156c930366a..9ee862e6f7e5 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.h +++ b/drivers/gpu/drm/vkms/vkms_drv.h @@ -52,6 +52,7 @@ struct vkms_output { struct drm_encoder encoder; struct drm_connector connector; struct hrtimer vblank_hrtimer; + bool disable_vblank; ktime_t period_ns; struct drm_pending_vblank_event *event; bool crc_enabled;