Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2582119ybl; Thu, 29 Aug 2019 10:04:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyIKeSjM7EnHiN/qkQ7iowPmRgeKb9cEsD+f7+ZFySYCSdPImK6AUTG1ehjn6DcVTMnEd5Y X-Received: by 2002:a17:902:7d8b:: with SMTP id a11mr10993907plm.306.1567098244587; Thu, 29 Aug 2019 10:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567098244; cv=none; d=google.com; s=arc-20160816; b=amWIQ4ns59CNYDboWrkP6KK4Whw+NOy2r72JR1jQ4pvhRP99ZbnRihsUh9piQhD45n PfF5gK9Jgzr5JA8TX0Hk259CW0ujx91xL04/Tq/w1IYjjhKs05ke9CF2jqq0AxQIHToG Um68XdcafAHr6dCw5qRoMDUQrDHyxLdzA0zaNz5XriMniniYdehoj4awnl8KkI55gUbE fogSUYiGJTdUaHgM+ugUgE5He+BVed/tL+Fsm4ajkdQPNN+iHdfbNxyLX/8atwnv6xCB lzazG9G3g06WKRakgTwPZ04z/cUy50LWUBN4MR78e37vIF6vcsPQaVIfO1pSlVMuwCik 6DMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R26A7eGC2bYAjlkhXeodHJW1qjZp52CqJHU1AmTfXXE=; b=VeeDDtGImLFoSxrtuDSDEAcmhtbPjaoEFYVCPwf7soyzWOimSp7nM9m6Frr8yEH/Zk 9dEdw5Nhk4vIenhPODmPn7SJb5g+d4kwHjzYFALACw5TfcOpedsJOZXjnJCW45bUbF1h vfWIfrmQn0mtBmuuVFjjPLo6ko8CUUsGzaXDpGBdbuZTz2B2JrEA6cRf6tuL1PMOenL6 7s4IiEMplTJBddL/yCKHMQempnin2YMEniUDDqlmAdbzAMdoNuGUINhqLCBz+HcYO/ee QhgCrHWmbHhMwCII97HvCyGeq+vmt1xNGkadihLMoh5a47WuC8OtY2aH5/QHFlEzZVXS 5M8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G6TzcO1o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id u13si2519015pgf.382.2019.08.29.10.03.48; Thu, 29 Aug 2019 10:04:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G6TzcO1o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727426AbfH2RCy (ORCPT + 99 others); Thu, 29 Aug 2019 13:02:54 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:41863 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726661AbfH2RCx (ORCPT ); Thu, 29 Aug 2019 13:02:53 -0400 Received: by mail-pg1-f194.google.com with SMTP id x15so1897049pgg.8; Thu, 29 Aug 2019 10:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R26A7eGC2bYAjlkhXeodHJW1qjZp52CqJHU1AmTfXXE=; b=G6TzcO1oHLR5eCdTHgCaBOKo2Fp3pDJMUAtLyG0R1ycSpuuC8Hhaskl8Cxb4qZBWOA yDOcB214tyJoKv3QfwrA5IM/2iUjRHwzSjqjt+UDTwJ4/2+onp9nfc0jVhD5R5i5SoDa 4CbO3yM4r287zhFOkhonXRy+ho6zIp5uIUXjLm0fq8vK6N9yn5NkuPbbVxCLcrvpY/a9 A97WrRKHJOmD8lYn0vP/4VM4w2INbQ0v/YA7XmOi9kQdCZ4+CJ8nnad/wCBl0HgqtGr5 mHk47X9bORScmBNyYZhaYRJSaqGPUUVxFyss2iZLnSLv5CMuJq4ltXcbo4qHXo6FmSnN HPTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R26A7eGC2bYAjlkhXeodHJW1qjZp52CqJHU1AmTfXXE=; b=jCS/SVLQlshCrI3ZZWhtqZxBTQMRTZF4axYBsKnu62dAsDA/RmGMjYkh8USZRjIEjZ /w1nPEd4PvPC3pK/ZwgjeBmydJT71WMhWOZCMtKh2SP1Lz9EEu90XF48fgIKice4yzYl oPIOuWOHLwIaLP9WMlWdIzLG6bvhVlMZn+KA+MwPcwRFrxh00t3Ahp5HiG/XtVdKxETX ix99rceFzwmEFZqmAYPYIEcDXcZM8djH6lvG2jo0aCbdl3OX+U7wHPSaCaSq6mmzDnNc T+u0OuhZvqM0i5Jt/G1FtbsBiBtzbm9XRN5dLjnYi0K/5UckffeU7brw1Tz7p2W78Bqu k0sA== X-Gm-Message-State: APjAAAVIvMD5KC8OOBI80lh/+MuMlLoz7g0iy1YKtTpNfJNGR1oAJh8B Hq8P6M5QViouSGl4B2SfrZs= X-Received: by 2002:a17:90a:1b0d:: with SMTP id q13mr11060679pjq.102.1567098172986; Thu, 29 Aug 2019 10:02:52 -0700 (PDT) Received: from localhost ([100.118.89.196]) by smtp.gmail.com with ESMTPSA id b123sm4398901pfg.64.2019.08.29.10.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 10:02:52 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: Rob Clark , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Jeykumar Sankaran , Jordan Crouse , Greg Kroah-Hartman , Sravanthi Kollukuduru , Bruce Wang , Jonathan Marek , Mamta Shukla , Enrico Weigelt , Thomas Gleixner , Georgi Djakov , Allison Randal , Boris Brezillon , linux-arm-msm@vger.kernel.org (open list:DRM DRIVER FOR MSM ADRENO GPU), freedreno@lists.freedesktop.org (open list:DRM DRIVER FOR MSM ADRENO GPU), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 06/10] drm/msm: add kms->flush_commit() Date: Thu, 29 Aug 2019 09:45:14 -0700 Message-Id: <20190829164601.11615-7-robdclark@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190829164601.11615-1-robdclark@gmail.com> References: <20190829164601.11615-1-robdclark@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Clark Add ->flush_commit(crtc_mask). Currently a no-op, but kms backends should migrate writing flush registers to this hook, so we can decouple pushing updates to hardware, and flushing the updates. Once we add async commit support, the hw updates will be pushed down to the hw synchronously, but flushing the updates will be deferred until as close to vblank as possible, so that multiple updates can be combined in a single frame. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 ++++ drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 6 ++++ drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 ++++ drivers/gpu/drm/msm/msm_atomic.c | 9 ++++-- drivers/gpu/drm/msm/msm_kms.h | 40 ++++++++++++++++++++++-- 5 files changed, 63 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 606815e50625..efbf8fd343de 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -278,6 +278,11 @@ static void dpu_kms_prepare_commit(struct msm_kms *kms, } } +static void dpu_kms_flush_commit(struct msm_kms *kms, unsigned crtc_mask) +{ + /* TODO */ +} + /* * Override the encoder enable since we need to setup the inline rotator and do * some crtc magic before enabling any bridge that might be present. @@ -678,6 +683,7 @@ static const struct msm_kms_funcs kms_funcs = { .irq_uninstall = dpu_irq_uninstall, .irq = dpu_irq, .prepare_commit = dpu_kms_prepare_commit, + .flush_commit = dpu_kms_flush_commit, .commit = dpu_kms_commit, .wait_flush = dpu_kms_wait_flush, .complete_commit = dpu_kms_complete_commit, diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c index a6a056df5878..78ce2c8a9a38 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -107,6 +107,11 @@ static void mdp4_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st drm_crtc_vblank_get(crtc); } +static void mdp4_flush_commit(struct msm_kms *kms, unsigned crtc_mask) +{ + /* TODO */ +} + static void mdp4_wait_flush(struct msm_kms *kms, unsigned crtc_mask) { struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms)); @@ -178,6 +183,7 @@ static const struct mdp_kms_funcs kms_funcs = { .enable_vblank = mdp4_enable_vblank, .disable_vblank = mdp4_disable_vblank, .prepare_commit = mdp4_prepare_commit, + .flush_commit = mdp4_flush_commit, .wait_flush = mdp4_wait_flush, .complete_commit = mdp4_complete_commit, .get_format = mdp_get_format, diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 7a19526eef50..eff1b000258e 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -154,6 +154,11 @@ static void mdp5_prepare_commit(struct msm_kms *kms, struct drm_atomic_state *st mdp5_smp_prepare_commit(mdp5_kms->smp, &global_state->smp); } +static void mdp5_flush_commit(struct msm_kms *kms, unsigned crtc_mask) +{ + /* TODO */ +} + static void mdp5_wait_flush(struct msm_kms *kms, unsigned crtc_mask) { struct mdp5_kms *mdp5_kms = to_mdp5_kms(to_mdp_kms(kms)); @@ -272,6 +277,7 @@ static const struct mdp_kms_funcs kms_funcs = { .irq = mdp5_irq, .enable_vblank = mdp5_enable_vblank, .disable_vblank = mdp5_disable_vblank, + .flush_commit = mdp5_flush_commit, .prepare_commit = mdp5_prepare_commit, .wait_flush = mdp5_wait_flush, .complete_commit = mdp5_complete_commit, diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_atomic.c index bdcc92fbacb3..e3537df848fa 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -54,16 +54,21 @@ void msm_atomic_commit_tail(struct drm_atomic_state *state) kms->funcs->prepare_commit(kms, state); + /* + * Push atomic updates down to hardware: + */ drm_atomic_helper_commit_modeset_disables(dev, state); - drm_atomic_helper_commit_planes(dev, state, 0); - drm_atomic_helper_commit_modeset_enables(dev, state); + /* + * Flush hardware updates: + */ if (kms->funcs->commit) { DRM_DEBUG_ATOMIC("triggering commit\n"); kms->funcs->commit(kms, state); } + kms->funcs->flush_commit(kms, crtc_mask); kms->funcs->wait_flush(kms, crtc_mask); kms->funcs->complete_commit(kms, crtc_mask); diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h index 10dd171b43f8..bb70c1758c72 100644 --- a/drivers/gpu/drm/msm/msm_kms.h +++ b/drivers/gpu/drm/msm/msm_kms.h @@ -30,12 +30,47 @@ struct msm_kms_funcs { irqreturn_t (*irq)(struct msm_kms *kms); int (*enable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc); void (*disable_vblank)(struct msm_kms *kms, struct drm_crtc *crtc); - /* modeset, bracketing atomic_commit(): */ + + /* + * Atomic commit handling: + */ + + /** + * Prepare for atomic commit. This is called after any previous + * (async or otherwise) commit has completed. + */ void (*prepare_commit)(struct msm_kms *kms, struct drm_atomic_state *state); + + /** + * Flush an atomic commit. This is called after the hardware + * updates have already been pushed down to effected planes/ + * crtcs/encoders/connectors. + */ + void (*flush_commit)(struct msm_kms *kms, unsigned crtc_mask); + + /* TODO remove ->commit(), use ->flush_commit() instead: */ void (*commit)(struct msm_kms *kms, struct drm_atomic_state *state); - void (*complete_commit)(struct msm_kms *kms, unsigned crtc_mask); + + /** + * Wait for any in-progress flush to complete on the specified + * crtcs. This should not block if there is no in-progress + * commit (ie. don't just wait for a vblank), as it will also + * be called before ->prepare_commit() to ensure any potential + * "async" commit has completed. + */ void (*wait_flush)(struct msm_kms *kms, unsigned crtc_mask); + /** + * Clean up are commit is completed. This is called after + * ->wait_flush(), to give the backend a chance to do any + * post-commit cleanup. + */ + void (*complete_commit)(struct msm_kms *kms, unsigned crtc_mask); + + /* + * Format handling: + */ + /* get msm_format w/ optional format modifiers from drm_mode_fb_cmd2 */ const struct msm_format *(*get_format)(struct msm_kms *kms, const uint32_t format, @@ -45,6 +80,7 @@ struct msm_kms_funcs { const struct msm_format *msm_fmt, const struct drm_mode_fb_cmd2 *cmd, struct drm_gem_object **bos); + /* misc: */ long (*round_pixclk)(struct msm_kms *kms, unsigned long rate, struct drm_encoder *encoder); -- 2.21.0