From patchwork Fri May 25 01:25:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haneen Mohammed X-Patchwork-Id: 10426511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A5A906025B for ; Fri, 25 May 2018 07:32:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EF2429594 for ; Fri, 25 May 2018 07:32:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83D45295A2; Fri, 25 May 2018 07:32:36 +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 23CB829594 for ; Fri, 25 May 2018 07:32:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 517CB6E8CA; Fri, 25 May 2018 07:31:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id E63C86E837 for ; Fri, 25 May 2018 01:26:01 +0000 (UTC) Received: by mail-wr0-x244.google.com with SMTP id x9-v6so6310865wrl.13 for ; Thu, 24 May 2018 18:26:01 -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=Qh3zd1DlOlqdlewJh7Iq+wAe2qKkEGvtt7bRnidtDyA=; b=oEa+5QO1OQKYKZIWRAykSSgqalO7Vf4ST421a5cnsd8JRUyTtVvDko/ZS987Z5A21t U2H5rPEKjvBje/uoq/aZm/80GZ/szZASMng9qngtRlTmwkBa5tDy/+kcP7ECQGiYlRMq k1ntkROW6YgFlkFU0gicniK79CB4Zr4iX41VxsyxpHyByONGrYVbj9sgJ14G4aozrHgu YrQWQRVRr/ZU+NV76G+TOx1jQg4j9gb9Znze1fs1nwUVsvXxT7cwE/SWE/EMRNrUrTFm t2pYVjmb/ylXPEg55tKcur8e4eGPo34NAQLl5zPjnlzg/VThHDpisR5jXNvjcsn7PlDO 0Xnw== X-Gm-Message-State: ALKqPwfx9aRSee8sjEAE8mU/WyEvW+sJRuOnc1yTYpynkYAe7qtkHrON VQJ1fZ/LF8J1XwU3iBc/H8D9TX68 X-Google-Smtp-Source: AB8JxZo7wpO3lRObM+wfW2blp1zZcfIqe4541zjopp56mLhYaISlOCITmOX83omJiNE3aojS/MvKhg== X-Received: by 2002:adf:ae59:: with SMTP id u25-v6mr223602wrd.157.1527211560027; Thu, 24 May 2018 18:26:00 -0700 (PDT) Received: from haneen-vb ([188.50.38.73]) by smtp.gmail.com with ESMTPSA id v15-v6sm4719878wmf.47.2018.05.24.18.25.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 May 2018 18:25:59 -0700 (PDT) Date: Fri, 25 May 2018 04:25:55 +0300 From: Haneen Mohammed To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: Add checks for atomic_[duplicate/destroy]_state with atomic drivers Message-ID: <20180525012555.GA8448@haneen-vb> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) X-Mailman-Approved-At: Fri, 25 May 2018 07:31:42 +0000 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: rodrigosiqueiramelo@gmail.com, David Airlie , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch add checks for atomic_[duplicate/destroy]_state of drm_[connector/crtc/plane]_funcs for atomic drivers in the relevant drm_*_init functions since these callback are mandatory for atomic drivers. Update the kerneldoc comments for those callbacks. Signed-off-by: Haneen Mohammed --- drivers/gpu/drm/drm_connector.c | 4 ++++ drivers/gpu/drm/drm_crtc.c | 4 ++++ drivers/gpu/drm/drm_plane.c | 4 ++++ include/drm/drm_connector.h | 4 ++++ include/drm/drm_crtc.h | 4 ++++ include/drm/drm_plane.h | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b3cde897cd80..ab291f4f339a 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -195,6 +195,10 @@ int drm_connector_init(struct drm_device *dev, struct ida *connector_ida = &drm_connector_enum_list[connector_type].ida; + WARN_ON(drm_drv_uses_atomic_modeset(dev) && + (!funcs->atomic_destroy_state || + !funcs->atomic_duplicate_state)); + ret = __drm_mode_object_add(dev, &connector->base, DRM_MODE_OBJECT_CONNECTOR, false, drm_connector_free); diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 03583887cfec..d1933c5f2524 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -286,6 +286,10 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc, if (WARN_ON(config->num_crtc >= 32)) return -EINVAL; + WARN_ON(drm_drv_uses_atomic_modeset(dev) && + (!funcs->atomic_destroy_state || + !funcs->atomic_duplicate_state)); + crtc->dev = dev; crtc->funcs = funcs; diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 6d2a6e428a3e..e0efb06eec31 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -177,6 +177,10 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, if (WARN_ON(config->num_total_plane >= 32)) return -EINVAL; + WARN_ON(drm_drv_uses_atomic_modeset(dev) && + (!funcs->atomic_destroy_state || + !funcs->atomic_duplicate_state)); + ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); if (ret) return ret; diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 675cc3f8cf85..65b6c86ecd50 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -608,6 +608,8 @@ struct drm_connector_funcs { * cleaned up by calling the @atomic_destroy_state hook in this * structure. * + * This callback is mandatory for atomic drivers. + * * Atomic drivers which don't subclass &struct drm_connector_state should use * drm_atomic_helper_connector_duplicate_state(). Drivers that subclass the * state structure to extend it with driver-private state should use @@ -634,6 +636,8 @@ struct drm_connector_funcs { * * Destroy a state duplicated with @atomic_duplicate_state and release * or unreference all resources it references + * + * This callback is mandatory for atomic drivers. */ void (*atomic_destroy_state)(struct drm_connector *connector, struct drm_connector_state *state); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index a2d81d2907a9..26511d6775d7 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -503,6 +503,8 @@ struct drm_crtc_funcs { * cleaned up by calling the @atomic_destroy_state hook in this * structure. * + * This callback is mandatory for atomic drivers. + * * Atomic drivers which don't subclass &struct drm_crtc_state should use * drm_atomic_helper_crtc_duplicate_state(). Drivers that subclass the * state structure to extend it with driver-private state should use @@ -529,6 +531,8 @@ struct drm_crtc_funcs { * * Destroy a state duplicated with @atomic_duplicate_state and release * or unreference all resources it references + * + * This callback is mandatory for atomic drivers. */ void (*atomic_destroy_state)(struct drm_crtc *crtc, struct drm_crtc_state *state); diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index f7bf4a48b1c3..d6d68b466649 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -277,6 +277,8 @@ struct drm_plane_funcs { * cleaned up by calling the @atomic_destroy_state hook in this * structure. * + * This callback is mandatory for atomic drivers. + * * Atomic drivers which don't subclass &struct drm_plane_state should use * drm_atomic_helper_plane_duplicate_state(). Drivers that subclass the * state structure to extend it with driver-private state should use @@ -303,6 +305,8 @@ struct drm_plane_funcs { * * Destroy a state duplicated with @atomic_duplicate_state and release * or unreference all resources it references + * + * This callback is mandatory for atomic drivers. */ void (*atomic_destroy_state)(struct drm_plane *plane, struct drm_plane_state *state);