From patchwork Wed Apr 6 10:12:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12803088 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 B5856C433EF for ; Wed, 6 Apr 2022 10:12:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A483A10E354; Wed, 6 Apr 2022 10:12:52 +0000 (UTC) Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by gabe.freedesktop.org (Postfix) with ESMTPS id A9B7D10E30E for ; Wed, 6 Apr 2022 10:12:51 +0000 (UTC) Received: by mail-lf1-x12f.google.com with SMTP id b21so3231091lfb.5 for ; Wed, 06 Apr 2022 03:12:51 -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=Y7XhTOS8dyDsJq/tLHxB8s8UpB/ZC8LdUdSKfZZti7Q=; b=lBMNDe7gQCC4ebFNFGkC26gogyipiwJpnq+UUgho6W5FDPVtZBBJ2TbdeFuD8Iyws+ 0Cmjjd3a0qkYR7ffYMxGZTDCCyCDSyC1fD/L9e0WpxuJ/9lOOSu3wvby4164Vt0A5v82 wgr+U7vIb9Vn39TSzE7EnXeyutb87PFKKZn1aKLpZrB2o7WsbZX4IMOba2V2z9wEq5Ul pxNRKtcTzfWjzg8AmtL4Kne50qx+kWZuFgjqDD8gYEdD/q4tCCfnxKaVDShJcHtEKYd7 CJh6PIa+skjqafUh/UJqNC/lxBCWT1ZoW78W2NnC/9J4AqKabCf62PtwBx1Tv4HJAssl RdFA== 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=Y7XhTOS8dyDsJq/tLHxB8s8UpB/ZC8LdUdSKfZZti7Q=; b=OKo60KA6Ey8Hs6c4Zudtxa+S93aG9v2Fz2Wz7d7bIQcQ/YJU3nN71tCFvZ+SZ+/xPl lSqgzblnaG5HiZ1QlJUXTYIOnHcLQ2p1ZTyhGEjP8o/76l66QkWJocNckDCodBhH5mKU cDjaNFceNzZtG9i+UkjFNg4hvw3lilVAZ8200Qqrp3ENuC3/zONzjOBeLXm6lpn57fWi DLgZxa3f02oApXzZrCe2Va1mRsyx6UWO6cRh588DblSmFvX3Vj+qKoXhdrtmuWENsGRQ 8Q9Kvmgv43L6IflPEpqz84NJJAJf+/lSJMwo0NMCc4Y0sRaRRr6irbw6SwIHDBPcuVcv RFyg== X-Gm-Message-State: AOAM530xt1xadO/1hT/ESB8EDOEJD6xR9ejE61EOLefDk5m1rdHdJ5ff wPdjEPvNpq70HPxomZH9182AM5PZxyOG9g== X-Google-Smtp-Source: ABdhPJyLBSnTtkWo/vQTUbP0vBJBZvPflYJTgehBeZ456ZJrkY0WQK6Nu1zweHG/3EPRSjO68Tok4w== X-Received: by 2002:a19:7501:0:b0:44a:2f6f:3ae8 with SMTP id y1-20020a197501000000b0044a2f6f3ae8mr5430428lfe.143.1649239969985; Wed, 06 Apr 2022 03:12:49 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id i4-20020a056512340400b0044a310f72f6sm1782154lfr.250.2022.04.06.03.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 03:12:49 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Subject: [PATCH v2 1/3] drm/msm/dpu: remove manual destruction of DRM objects Date: Wed, 6 Apr 2022 13:12:45 +0300 Message-Id: <20220406101247.483649-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406101247.483649-1-dmitry.baryshkov@linaro.org> References: <20220406101247.483649-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. Reviewed-by: Stephen Boyd Signed-off-by: Dmitry Baryshkov --- 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 Wed Apr 6 10:12:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12803091 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 91BB5C433F5 for ; Wed, 6 Apr 2022 10:13:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E74210EC99; Wed, 6 Apr 2022 10:12:56 +0000 (UTC) Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8229E10E759 for ; Wed, 6 Apr 2022 10:12:53 +0000 (UTC) Received: by mail-lf1-x12c.google.com with SMTP id m3so3184304lfj.11 for ; Wed, 06 Apr 2022 03:12:53 -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=FE6MvnURSjfbK37LkPPxzBMps2ILsbNccb9PZm35uUY=; b=mpoYhMKZ+o4x4KT+byOPfYhZac7KhjkQPEfuSQgQLMrp4BXVDSdhwoDZbRyuIKBiXA 8vxtDwuqaIapUeN9hetIBliDwIKMMf2SuMVszUPcjznPb7gZalGUHd0NjXiKHKEmBNU+ aI2zQHqsz6ncGQKEGhtj707cooPbPZVg6RpXFVOB6+O8/tbmYy9js82/io5oG2z6KeEH LTmpDoo8L9K6jYtto7OmJNr8qp5+lUbjUKktnBH9NxYkjjmLnEwc0z3Z2jgZ4KBChgau jSIepOBbGLiM2/dwxiwHdhusqqbGPXL0I9+DBsX3KaK1Qt/C1W4XLoCUhlkyIkLtBHWH OB3Q== 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=FE6MvnURSjfbK37LkPPxzBMps2ILsbNccb9PZm35uUY=; b=EwHicSwaQjt4+Fp+VZqNkcUdGkVUSEFb2dqV0OZACrAD5ZzFwNYg6S4OFbFS1MnYjO +wK+AmbVQCjJY+BgkYYbmOl6eAmBxMDDaHXqnlORVhh1qpBsVTIbcSFQHKQhbD6jkfvw OtwaqU6kXzU7LfSL1VxnGo9iIFd1PbBNloF3tklMkrI5YgeE6MlBU9Vked1LefPj2ctZ FG5CfmfIp/44Bc+b/UcMRqknDP+SIeeoZ4C9b0nap6W68Orx8p5j7iFlrmrpVaJZwa5V DTqbpNz0PQ+ROQBxjKQVJv6BEdaqaU8V4Rgy3riV2x7K1EwHqChlcUPWNvgBXOY2WNj7 fZkA== X-Gm-Message-State: AOAM531ZqMyzCuTiNgXr4McGEU2UTWKXeNIyJG19lsZv2GYj4TBUMsRw f2aPvcdToSExBNC30/FCKhByVQ== X-Google-Smtp-Source: ABdhPJxewWHmM56gH2X7UlQdsdnqP32bRtqY3BkZHZiecYcUmIlsIwToxFqKqokI9ghZwYyWJhYGoQ== X-Received: by 2002:a05:6512:555:b0:44a:a75c:885c with SMTP id h21-20020a056512055500b0044aa75c885cmr5507568lfl.80.1649239971136; Wed, 06 Apr 2022 03:12:51 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id i4-20020a056512340400b0044a310f72f6sm1782154lfr.250.2022.04.06.03.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 03:12:50 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Subject: [PATCH v2 2/3] drm/msm: loop over encoders using drm_for_each_encoder() Date: Wed, 6 Apr 2022 13:12:46 +0300 Message-Id: <20220406101247.483649-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406101247.483649-1-dmitry.baryshkov@linaro.org> References: <20220406101247.483649-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. Reviewed-by: Stephen Boyd Signed-off-by: Dmitry Baryshkov --- 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 Wed Apr 6 10:12:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 12803090 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 5176FC433EF for ; Wed, 6 Apr 2022 10:13:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07C6710EB6B; Wed, 6 Apr 2022 10:12:56 +0000 (UTC) Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0DAFF10E3EE for ; Wed, 6 Apr 2022 10:12:54 +0000 (UTC) Received: by mail-lj1-x234.google.com with SMTP id s13so2526906ljd.5 for ; Wed, 06 Apr 2022 03:12:53 -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=diKijHPQ7w3gdeTbXE9/TYW2r2t2O1HLm+7iYSPSNXI=; b=JS0hHLBPj5kE5JX8gAJTZ37DMJJvQ0o6lJGLh/3FKIAH9OTkKr5C1usNq3cc10VUk3 VThm74tKhUvfbac+lgZ4xxJzTXIhcpQmnvAy2kSZC0TCkcG7F4Q+CWUNaUuIXA+kZjOq y/JaIOhmxlYUDJiM3dYP/yMMQnsyVi6pu4OnZXEIaOoBbjPAF/Nf4DLFj40peZ24fLc2 +wO6r//E9yKjMwV0HIIpW24LjdAhVh2iJ0s7gQOtbpI31YUFfoNCjuERZuM5+Avamg/0 QMxFeU1/mNHMmxFRY8EJ1RYCQcxd2BSkf/B8DnHYEdX9NGG6hzgg9r4fQ0HsENpQOUxh 2i0A== 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=diKijHPQ7w3gdeTbXE9/TYW2r2t2O1HLm+7iYSPSNXI=; b=c3C1zTdKAz3LzB3gfNDOJTNUCZtinCOn7L69MiUIqjA0ySYZ27KudGY9zGMhdSwi+5 SsCfybehZyNlhiXiACvYcRYWEe9KqR1ubSN7WZfT4HmvrylHX5cHEgFzjYfEALVjBFFE TJSFrcQpEUPO93k9Z+986sv/43sw6G8w6xIfgQaD7XrVN49pBysiE1ZXZG9X44YnGeze BplDhD1N83/oHw1cT33reeNNayII1CWtL6wAuBPibGZwQrYZn9GQ3U+Rd+Xwp/s3rvkn KeIx4Wc09bFmmLj3x7JE3loYmsB3/vw9KHtmXAaNDLFKfPp/mjrQnZpLqdrZ8ACJeaNW uyug== X-Gm-Message-State: AOAM531IPe5jp60TrjEpT8erCr99ngmmU4trkTJSGBOGoghljpVywsPJ 3FTwEgmlMagSWc6LPJDrRxMkgg== X-Google-Smtp-Source: ABdhPJwFB4is/m74CC69A/xxyhPnpR4gPFnZlz4nh6yHIIqDKOODoEqjTrlicdov58Fw0sLz0eX9zg== X-Received: by 2002:a05:651c:893:b0:249:4023:3818 with SMTP id d19-20020a05651c089300b0024940233818mr4964411ljq.44.1649239972263; Wed, 06 Apr 2022 03:12:52 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id i4-20020a056512340400b0044a310f72f6sm1782154lfr.250.2022.04.06.03.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 03:12:51 -0700 (PDT) From: Dmitry Baryshkov To: Bjorn Andersson , Rob Clark , Sean Paul , Abhinav Kumar Subject: [PATCH v2 3/3] drm/msm: don't store created planes, connectors and encoders Date: Wed, 6 Apr 2022 13:12:47 +0300 Message-Id: <20220406101247.483649-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406101247.483649-1-dmitry.baryshkov@linaro.org> References: <20220406101247.483649-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 Reviewed-by: Stephen Boyd --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 13 +++++++------ 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 | 12 ------------ 7 files changed, 13 insertions(+), 34 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..ecdc7cdae71d 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; @@ -675,6 +671,7 @@ static int _dpu_kms_setup_displays(struct drm_device *dev, return rc; } +#define MAX_PLANES 20 static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) { struct drm_device *dev; @@ -682,6 +679,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 +698,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 +727,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..7d4373ba6218 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -46,10 +46,7 @@ struct msm_gem_vma; struct msm_disp_state; #define MAX_CRTCS 8 -#define MAX_PLANES 20 -#define MAX_ENCODERS 8 #define MAX_BRIDGES 8 -#define MAX_CONNECTORS 8 #define FRAC_16_16(mult, div) (((mult) << 16) / (div)) @@ -184,23 +181,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];