From patchwork Thu Mar 14 18:48:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Siqueira X-Patchwork-Id: 10853425 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 DF620139A for ; Thu, 14 Mar 2019 18:48:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD1682A687 for ; Thu, 14 Mar 2019 18:48:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE4612A69B; Thu, 14 Mar 2019 18:48:53 +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 75CCC2A687 for ; Thu, 14 Mar 2019 18:48:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7AA46E1E2; Thu, 14 Mar 2019 18:48:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by gabe.freedesktop.org (Postfix) with ESMTPS id 491156E1E2 for ; Thu, 14 Mar 2019 18:48:50 +0000 (UTC) Received: by mail-qt1-x843.google.com with SMTP id t28so7322240qte.6 for ; Thu, 14 Mar 2019 11:48:50 -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=8cM79lmLd/ECaJiKfKdj2dQxFYEDPHOyvVSsOhDFry8=; b=B6ONQsgfSvic4nfiROPCndCx8Yl3loBWVsezAHcBuPImHlx8uTqfT6KYQDuW66mf9n 0Wt3D2KMULXc2HqllQJzCXFPnKVivfbLj2GrrUa7fsPM5q18UU0e4wAvwCU26wM3L6tE 7zA0JEhvhLcMunSVO4DkEB3Thau2ECVAcMPVpwCsrdHPyM6v0yYYEFSuoVmNT8kp1W7B qBXpPtft5OblaU+NlU0A3sGskiOY/GfUCTC/a1B7Rz7hBjTDaa6PXBeFXBWvjffsjVbY OW/KSYSjoOD+3xb6Nb49ee6Z7b8j94a/lnJKUYvqQRBH+86OSRxA1NoUtsacB+Z+3YRw ayBw== X-Gm-Message-State: APjAAAXJZ8VHN8CSpP1XZKQTxDU+SbFaB7o2IaSvw7Drylnvh0s0UH7d YfFYDfajt6VbF8K0rOZgDbA= X-Google-Smtp-Source: APXvYqwHyo8jiEIxF7tRdJf4YX/JzDpgBTnwhfniMYeEAR891xtbMIxizsZe2E/GdEU2QXf/IOrrcg== X-Received: by 2002:ac8:1789:: with SMTP id o9mr41037678qtj.234.1552589329290; Thu, 14 Mar 2019 11:48:49 -0700 (PDT) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id l129sm8696028qkb.44.2019.03.14.11.48.46 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 14 Mar 2019 11:48:48 -0700 (PDT) Date: Thu, 14 Mar 2019 15:48:45 -0300 From: Rodrigo Siqueira To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Daniel Vetter , Gerd Hoffmann Subject: [PATCH V2] drm/atomic-helper: Make atomic_enable/disable crtc callbacks optional Message-ID: <20190314184845.gjmvkamobj4dilyp@smtp.gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20180716 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=8cM79lmLd/ECaJiKfKdj2dQxFYEDPHOyvVSsOhDFry8=; b=Utd2BA6XENNVHrWhIbBeXCShQSo9xKdm8WX38mB+ar02fi6zzTTqsSsO0ltygm883m +8eGc+d+XVChiLGVNZdNVbpk1Ta5F5q6S96iOeFowMS9Eav40WLNQpOHHhUHYftTrvGY lAc2XEXxVp72V90VkrXIQj6ijRNn4ditOYXuQSYI4hFuwWlYFkTs0vsWBCNZcK8IrYtb xHAEzoLV+GKHhVPmR3hJCbsQV+cG9tUaoXtvoqy0NsIW2rGQO7npVuDMfYcdehsdSj3b iQxOc9RSKzDeWIz/CqaBwjwxr4BrFr3aY+2UtxO+wOuwbMo8H0MmsaqnEUBfhXlwDT2J EXOQ== 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Allow atomic_enable and atomic_disable operations from drm_crtc_helper_funcs struct optional. With this, the target display drivers don't need to define a dummy function if they don't need one. Changes since v2: * Don't make funcs optional * Update kerneldoc for atomic_enable/disable * Replace "if (funcs->atomic_enable)" by "if (funcs->commit)" * Improve commit message Signed-off-by: Rodrigo Siqueira Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 5 ++--- include/drm/drm_modeset_helper_vtables.h | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 540a77a2ade9..d506e13c2945 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1034,7 +1034,7 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) funcs->atomic_disable(crtc, old_crtc_state); else if (funcs->disable) funcs->disable(crtc); - else + else if (funcs->dpms) funcs->dpms(crtc, DRM_MODE_DPMS_OFF); if (!(dev->irq_enabled && dev->num_crtcs)) @@ -1277,10 +1277,9 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, if (new_crtc_state->enable) { DRM_DEBUG_ATOMIC("enabling [CRTC:%d:%s]\n", crtc->base.id, crtc->name); - if (funcs->atomic_enable) funcs->atomic_enable(crtc, old_crtc_state); - else + else if (funcs->commit) funcs->commit(crtc); } } diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h index cfb7be40bed7..ce4de6b1e444 100644 --- a/include/drm/drm_modeset_helper_vtables.h +++ b/include/drm/drm_modeset_helper_vtables.h @@ -418,6 +418,8 @@ struct drm_crtc_helper_funcs { * Drivers can use the @old_crtc_state input parameter if the operations * needed to enable the CRTC don't depend solely on the new state but * also on the transition between the old state and the new state. + * + * This function is optional. */ void (*atomic_enable)(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state); @@ -441,6 +443,8 @@ struct drm_crtc_helper_funcs { * parameter @old_crtc_state which could be used to access the old * state. Atomic drivers should consider to use this one instead * of @disable. + * + * This function is optional. */ void (*atomic_disable)(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state);