From patchwork Tue Apr 5 23:50:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12802173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EBD59C433F5 for ; Tue, 5 Apr 2022 23:51:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B06FC10E32B; Tue, 5 Apr 2022 23:51:03 +0000 (UTC) Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C39A10E2E6 for ; Tue, 5 Apr 2022 23:51:03 +0000 (UTC) Received: by mail-lf1-x129.google.com with SMTP id h7so1235703lfl.2 for ; Tue, 05 Apr 2022 16:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=g8HxgIzIziq2OPXz19ooLUkTn3BguDIOwpX2djsD+HY=; b=P8RMabMdq4cwuY8w13Ud8vFPiw6cnkxqe3MbSGE9965Ye6eJ+Y/UqF+6rDVOqffmd4 HSg7gWsjMdz+PiGTimTBKlfSvaam00z56zgxoHIeNb1LceTKU0LwBIWSZCaOIIr6GiU6 aAf3bzrplG+HVSCIVyVY7dmlWcr/3E0087ryUeEYU7n7/v7pV2O5NamgRcQSuNnifvB1 BSegDDD2fvD+NZFsuU6wn4CLSFTNz+JBCxPgBGPLnZNTkDwtpwzVvOtKK5mLX6LxWyPL LHBE2XlQTW0PeEocHa/fiGTBESbcLm5XcwjUZ3iRni/XQpK8ueY1r6GSBbY11d8z5ui3 mB0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=g8HxgIzIziq2OPXz19ooLUkTn3BguDIOwpX2djsD+HY=; b=0x4CP8XgAZctIPL5Yv7OKaOefi2DSjTjVdvNrpSIaDyn1k6A/JItCxdv/kaS3UBeCG vfXYSNBoZ3XkJrsgHu3yrfSLpheKlvsEaAntZYhy35ku6olsIXNdM1KJ+XVWujY5RnkH fNadfQX8Ds2T+UxCPGGjfkrksF4EK+5OOQoUvdNCbjuaVL7Iji7FaoYWZJL8nbUHLE3q VKA/QIJLOsNiWyMC+CWwOq5Qzrf8QnlAnJx8fM2YDVX8EXtnxa9kqXCB4KozDVZshq6o NPum+UBjl7Ns1m8NUDIlHDbfD1twpdPOOG4XeOK86UDw50i5U6yPVrZ51wVN2oovo2Zu 9ljA== X-Gm-Message-State: AOAM530QmbJZ6KyMxH8QojtjZPao63RH13yuhEM9oKvObPdji0VdoC4B IEhk1NAEM8BVOBLRPRx+IzPQ3g== X-Google-Smtp-Source: ABdhPJwUuy03sVyyX7SdKutpm2TdEedWDMODXc0jfw0XMizE3ABHzmKRS9JmwP0YF7WkHkpH2dwbLw== X-Received: by 2002:a19:4f1a:0:b0:44a:22fa:704 with SMTP id d26-20020a194f1a000000b0044a22fa0704mr4148471lfb.59.1649202661533; Tue, 05 Apr 2022 16:51:01 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id f26-20020a19381a000000b0044ad7a29b4csm1645280lfa.37.2022.04.05.16.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:51:01 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Subject: [PATCH 1/3] drm/msm/dpu: remove manual destruction of DRM objects Date: Wed, 6 Apr 2022 02:50:57 +0300 Message-Id: <20220405235059.359738-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405235059.359738-1-dmitry.baryshkov@linaro.org> References: <20220405235059.359738-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Remove manual removal of DRM modesetting objects, it is done anyway by the drm_mode_config_cleanup() called from msm_drm_uninit(). Other MSM display drivers (MDP4, MDP5) do not manually destroy objects and trust generic code to do it's work. Signed-off-by: Dmitry Baryshkov Reviewed-by: Stephen Boyd --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 33 +++---------------------- 1 file changed, 3 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index e29796c4f27b..d0525a9ea92b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -675,30 +675,6 @@ static int _dpu_kms_setup_displays(struct drm_device *dev, return rc; } -static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) -{ - struct msm_drm_private *priv; - int i; - - priv = dpu_kms->dev->dev_private; - - for (i = 0; i < priv->num_crtcs; i++) - priv->crtcs[i]->funcs->destroy(priv->crtcs[i]); - priv->num_crtcs = 0; - - for (i = 0; i < priv->num_planes; i++) - priv->planes[i]->funcs->destroy(priv->planes[i]); - priv->num_planes = 0; - - for (i = 0; i < priv->num_connectors; i++) - priv->connectors[i]->funcs->destroy(priv->connectors[i]); - priv->num_connectors = 0; - - for (i = 0; i < priv->num_encoders; i++) - priv->encoders[i]->funcs->destroy(priv->encoders[i]); - priv->num_encoders = 0; -} - static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) { struct drm_device *dev; @@ -721,7 +697,7 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) */ ret = _dpu_kms_setup_displays(dev, priv, dpu_kms); if (ret) - goto fail; + return ret; max_crtc_count = min(catalog->mixer_count, priv->num_encoders); @@ -746,7 +722,7 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) if (IS_ERR(plane)) { DPU_ERROR("dpu_plane_init failed\n"); ret = PTR_ERR(plane); - goto fail; + return ret; } priv->planes[priv->num_planes++] = plane; @@ -763,7 +739,7 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) crtc = dpu_crtc_init(dev, primary_planes[i], cursor_planes[i]); if (IS_ERR(crtc)) { ret = PTR_ERR(crtc); - goto fail; + return ret; } priv->crtcs[priv->num_crtcs++] = crtc; } @@ -773,9 +749,6 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) priv->encoders[i]->possible_crtcs = (1 << priv->num_crtcs) - 1; return 0; -fail: - _dpu_kms_drm_obj_destroy(dpu_kms); - return ret; } static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) From patchwork Tue Apr 5 23:50:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12802175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED18AC433EF for ; Tue, 5 Apr 2022 23:51:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6F72C10E5DE; Tue, 5 Apr 2022 23:51:05 +0000 (UTC) Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1DD3510E428 for ; Tue, 5 Apr 2022 23:51:04 +0000 (UTC) Received: by mail-lf1-x12e.google.com with SMTP id z12so1165198lfu.10 for ; Tue, 05 Apr 2022 16:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GdBxSh9sm8JFxfcg4oZuWWjNQ4XkQKxAD+ykd2e7Nqo=; b=a1MrN49R7Y+OXVs56RUzeKwoND1E0SLksNg3VGcWXZTzNDbb3zzEMPXJ6ku+pX72/L jnsqp2kp4B35YeytTJBtFtRNj8Mig39RygT8v2RsUDzsaPAxTRPL4Iks6eOQqOBZD+PO qrG448SjP8q+oKjNU5JRQqK/4fh28kjGZ8JH6Zqd9qFD150qhjvabZEkW49HqsC60LOa VSQRxwFxvmtDtXZPO1r9je3+sqTRkz6De0c1Q6QPRvdzK7iXjv6TGeluHzCjQR0F1KhD o9UqaYP8kkSysqjfNg049A35T64SFNz1vmHo3xaLz2MmBOxG1dcYbIZ3LAhAR03at1g2 umMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GdBxSh9sm8JFxfcg4oZuWWjNQ4XkQKxAD+ykd2e7Nqo=; b=rhRMh1tPDYJZytro1GuNyEfNLbuIJS58Nqfj48bIn5n/VjDpoXhX4DzJVee4KtjBjo NnWsdZx6N1CzQl8siUjMGgI3MMcyCawW0PdAoZ2hMS3Nj+jk7l7qbv4dFUj/g6ato03Z J94HcUpGK/7Cgl4nYa6FdzVOqtyb+yJinxgMkZVXDGpROcjs0Dqj/8mGJBmRVIyANl2h 1rVyMyOM3y3hqAWbfJRGJuHXPRjmebm10K9Jgx3ADsHLdKdcPJe1KdQ7oVk19MeI7bzq mMISUkGFEYNn7rUJtC3FGnemsFrEpfpLpDswZoBZIyVXeHjQ01uTwa+FNMRiN8IgKr6y xyQA== X-Gm-Message-State: AOAM531tKwk6+GkBTSfoMQxrQX2KImMCMfPeufLbIm2hZBJDP3XK4fih ksMaS4pz9dhi0Q96jgqXoWq/1w== X-Google-Smtp-Source: ABdhPJxbihuuvB0EymKlPYm1DN2/hIoDbDRW283pP9l8yyUgGD4CiLfRQ2M+4enOXS9v/1+CCveTXg== X-Received: by 2002:a05:6512:3052:b0:44a:5104:5646 with SMTP id b18-20020a056512305200b0044a51045646mr4095313lfb.286.1649202662488; Tue, 05 Apr 2022 16:51:02 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id f26-20020a19381a000000b0044ad7a29b4csm1645280lfa.37.2022.04.05.16.51.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:51:02 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Subject: [PATCH 2/3] drm/msm: loop over encoders using drm_for_each_encoder() Date: Wed, 6 Apr 2022 02:50:58 +0300 Message-Id: <20220405235059.359738-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405235059.359738-1-dmitry.baryshkov@linaro.org> References: <20220405235059.359738-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Rather than manually looping over encoders array, use standard drm_for_each_encoder() macro. Signed-off-by: Dmitry Baryshkov Reviewed-by: Stephen Boyd --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 5 +++-- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 ++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index d0525a9ea92b..0bc33243dae8 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -681,6 +681,7 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) struct drm_plane *primary_planes[MAX_PLANES], *plane; struct drm_plane *cursor_planes[MAX_PLANES] = { NULL }; struct drm_crtc *crtc; + struct drm_encoder *encoder; struct msm_drm_private *priv; struct dpu_mdss_cfg *catalog; @@ -745,8 +746,8 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) } /* All CRTCs are compatible with all encoders */ - for (i = 0; i < priv->num_encoders; i++) - priv->encoders[i]->possible_crtcs = (1 << priv->num_crtcs) - 1; + drm_for_each_encoder(encoder, dev) + encoder->possible_crtcs = (1 << priv->num_crtcs) - 1; return 0; } diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 3b92372e7bdf..2ba06f979f72 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -434,6 +434,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) int i, ret, pi = 0, ci = 0; struct drm_plane *primary[MAX_BASES] = { NULL }; struct drm_plane *cursor[MAX_BASES] = { NULL }; + struct drm_encoder *encoder; /* * Construct encoders and modeset initialize connector devices @@ -499,11 +500,8 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) * Now that we know the number of crtcs we've created, set the possible * crtcs for the encoders */ - for (i = 0; i < priv->num_encoders; i++) { - struct drm_encoder *encoder = priv->encoders[i]; - + drm_for_each_encoder(encoder, dev) encoder->possible_crtcs = (1 << priv->num_crtcs) - 1; - } return 0; From patchwork Tue Apr 5 23:50:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12802176 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33B57C433EF for ; Tue, 5 Apr 2022 23:51:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A52E10EA23; Tue, 5 Apr 2022 23:51:07 +0000 (UTC) Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9A45C10E428 for ; Tue, 5 Apr 2022 23:51:05 +0000 (UTC) Received: by mail-lf1-x131.google.com with SMTP id e16so1137754lfc.13 for ; Tue, 05 Apr 2022 16:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nupzTGEBU6qZB3QvYeGIWfzRAuDNUHc7ze0LvzWnebs=; b=OxZ0blf6MH5ytIdeKK8SrW/3MJcmu7DJ+xAwYvBLcf6RDejBLcHfHCgQdyzjB7atyZ nT2yzJYcYmM7hfl9dHzAih0g6Qa91Ias8r/UTB7b8ew9bAA839MyDbDtU45RXUe5AASz txDkk5y9CVkm9Ig0o4ZKZdFKzUJK059I79tl4A0JB7EL/wnSSLMJ6J8xKRzRqvOeKcxt 9WR5rWUppPLlpAepj8Z4TQS7xUq1/S7H3WOe7yW24M/D/c66ntykk1QDMEw9wdABHzKk zavkz7LTrEIAvX/YLbxCjxY50COncGWLZ/y+RD3eNgTRgesIhYAllMGcwNoWtJQ7a6qg PXog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nupzTGEBU6qZB3QvYeGIWfzRAuDNUHc7ze0LvzWnebs=; b=uggYPXz1STBY19B9YT0TH6e8Joftc1UC2xObxoOyUphRpRgSYm/hnAlB45XaTUyf1z +QIjvZnBSCD5LEx2CQdgCeMOCwiWgjOSeSW2WvGhmyx6jEeNtW9BqLlt4ux/xiP4d6rH JVCpaYbl0O5ypnsMjsC+bxA5P8aNFihvjF54qDXJjy72o7P7ESuOH8HrKpKwguNdiZtN Y9u48CPvyckDxsfNRWSx0K/o+RSQaH9nCK3iL+g0mTCYGw8QRYFrnIM6nVS7rjYlK59I bXTwZxnJW1GPzE4FtsWTte9CIDV4++QgSOpDb51Ves0lT8wyuxPOg2fmpZrqZpdhC6ZV uMNQ== X-Gm-Message-State: AOAM530+eWzyHJDT2QGluj0Xw7DhoBFG/ALaQhgmuvAUjy/vNX2eJ7/2 3qcCQj8RhQ5JxBSldGXnq1qTtg== X-Google-Smtp-Source: ABdhPJw/4qjYA0tk/15l2INLdAOVQq3xOnS7ZVDOJkLoL/pXMk2PHzmAY9QIvpP9oUiDy2hxAAL8pg== X-Received: by 2002:a05:6512:158e:b0:44a:12b5:7fea with SMTP id bp14-20020a056512158e00b0044a12b57feamr3951998lfb.411.1649202663583; Tue, 05 Apr 2022 16:51:03 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id f26-20020a19381a000000b0044ad7a29b4csm1645280lfa.37.2022.04.05.16.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:51:03 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Subject: [PATCH 3/3] drm/msm: don't store created planes, connectors and encoders Date: Wed, 6 Apr 2022 02:50:59 +0300 Message-Id: <20220405235059.359738-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405235059.359738-1-dmitry.baryshkov@linaro.org> References: <20220405235059.359738-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd , freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There is no point now in storing arrays of creates planes, connectors and encoders. Remove them from struct msm_drm_private. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 12 ++++++------ drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 7 ------- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 11 ++++++----- drivers/gpu/drm/msm/dp/dp_display.c | 2 -- drivers/gpu/drm/msm/dsi/dsi.c | 1 - drivers/gpu/drm/msm/hdmi/hdmi.c | 1 - drivers/gpu/drm/msm/msm_drv.h | 9 --------- 7 files changed, 12 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 0bc33243dae8..903be362cbce 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -565,8 +565,6 @@ static int _dpu_kms_initialize_dsi(struct drm_device *dev, return PTR_ERR(encoder); } - priv->encoders[priv->num_encoders++] = encoder; - memset(&info, 0, sizeof(info)); info.intf_type = encoder->encoder_type; @@ -629,8 +627,6 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, return rc; } - priv->encoders[priv->num_encoders++] = encoder; - info.num_of_h_tiles = 1; info.h_tile_instance[0] = i; info.capabilities = MSM_DISPLAY_CAP_VID_MODE; @@ -682,6 +678,7 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) struct drm_plane *cursor_planes[MAX_PLANES] = { NULL }; struct drm_crtc *crtc; struct drm_encoder *encoder; + unsigned int num_encoders; struct msm_drm_private *priv; struct dpu_mdss_cfg *catalog; @@ -700,7 +697,11 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) if (ret) return ret; - max_crtc_count = min(catalog->mixer_count, priv->num_encoders); + num_encoders = 0; + drm_for_each_encoder(encoder, dev) + num_encoders++; + + max_crtc_count = min(catalog->mixer_count, num_encoders); /* Create the planes, keeping track of one primary/cursor per crtc */ for (i = 0; i < catalog->sspp_count; i++) { @@ -725,7 +726,6 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) ret = PTR_ERR(plane); return ret; } - priv->planes[priv->num_planes++] = plane; if (type == DRM_PLANE_TYPE_CURSOR) cursor_planes[cursor_planes_idx++] = plane; diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c index 3cf476c55158..1862eba51bbb 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -229,9 +229,6 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms, return PTR_ERR(connector); } - priv->encoders[priv->num_encoders++] = encoder; - priv->connectors[priv->num_connectors++] = connector; - break; case DRM_MODE_ENCODER_TMDS: encoder = mdp4_dtv_encoder_init(dev); @@ -252,8 +249,6 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms, } } - priv->encoders[priv->num_encoders++] = encoder; - break; case DRM_MODE_ENCODER_DSI: /* only DSI1 supported for now */ @@ -272,7 +267,6 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms, /* TODO: Add DMA_S later? */ encoder->possible_crtcs = 1 << DMA_P; - priv->encoders[priv->num_encoders++] = encoder; ret = msm_dsi_modeset_init(priv->dsi[dsi_id], dev, encoder); if (ret) { @@ -324,7 +318,6 @@ static int modeset_init(struct mdp4_kms *mdp4_kms) ret = PTR_ERR(plane); goto fail; } - priv->planes[priv->num_planes++] = plane; } for (i = 0; i < ARRAY_SIZE(mdp4_crtcs); i++) { diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 2ba06f979f72..dbfe54de975c 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -319,7 +319,6 @@ static struct drm_encoder *construct_encoder(struct mdp5_kms *mdp5_kms, struct mdp5_ctl *ctl) { struct drm_device *dev = mdp5_kms->dev; - struct msm_drm_private *priv = dev->dev_private; struct drm_encoder *encoder; encoder = mdp5_encoder_init(dev, intf, ctl); @@ -328,8 +327,6 @@ static struct drm_encoder *construct_encoder(struct mdp5_kms *mdp5_kms, return encoder; } - priv->encoders[priv->num_encoders++] = encoder; - return encoder; } @@ -435,6 +432,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) struct drm_plane *primary[MAX_BASES] = { NULL }; struct drm_plane *cursor[MAX_BASES] = { NULL }; struct drm_encoder *encoder; + unsigned int num_encoders; /* * Construct encoders and modeset initialize connector devices @@ -446,12 +444,16 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) goto fail; } + num_encoders = 0; + drm_for_each_encoder(encoder, dev) + num_encoders++; + /* * We should ideally have less number of encoders (set up by parsing * the MDP5 interfaces) than the number of layer mixers present in HW, * but let's be safe here anyway */ - num_crtcs = min(priv->num_encoders, mdp5_kms->num_hwmixers); + num_crtcs = min(num_encoders, mdp5_kms->num_hwmixers); /* * Construct planes equaling the number of hw pipes, and CRTCs for the @@ -476,7 +478,6 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) DRM_DEV_ERROR(dev->dev, "failed to construct plane %d (%d)\n", i, ret); goto fail; } - priv->planes[priv->num_planes++] = plane; if (type == DRM_PLANE_TYPE_PRIMARY) primary[pi++] = plane; diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 178b774a5fbd..ad7a18a0dece 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -1541,8 +1541,6 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, dp_priv->panel->connector = dp_display->connector; - priv->connectors[priv->num_connectors++] = dp_display->connector; - dp_display->bridge = msm_dp_bridge_init(dp_display, dev, encoder); if (IS_ERR(dp_display->bridge)) { ret = PTR_ERR(dp_display->bridge); diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index c12e66aa42a3..1fe020ee1018 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -273,7 +273,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, } priv->bridges[priv->num_bridges++] = msm_dsi->bridge; - priv->connectors[priv->num_connectors++] = msm_dsi->connector; return 0; fail: diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index ec324352e862..baa6f1aaadf6 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -322,7 +322,6 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, } priv->bridges[priv->num_bridges++] = hdmi->bridge; - priv->connectors[priv->num_connectors++] = hdmi->connector; platform_set_drvdata(pdev, hdmi); diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index d661debb50f1..ee3093890d97 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -184,23 +184,14 @@ struct msm_drm_private { struct workqueue_struct *wq; - unsigned int num_planes; - struct drm_plane *planes[MAX_PLANES]; - unsigned int num_crtcs; struct drm_crtc *crtcs[MAX_CRTCS]; struct msm_drm_thread event_thread[MAX_CRTCS]; - unsigned int num_encoders; - struct drm_encoder *encoders[MAX_ENCODERS]; - unsigned int num_bridges; struct drm_bridge *bridges[MAX_BRIDGES]; - unsigned int num_connectors; - struct drm_connector *connectors[MAX_CONNECTORS]; - /* Properties */ struct drm_property *plane_property[PLANE_PROP_MAX_NUM];