From patchwork Sat May 7 01:00:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 570507 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8984CC433EF for ; Sat, 7 May 2022 01:00:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445135AbiEGBEe (ORCPT ); Fri, 6 May 2022 21:04:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445137AbiEGBEe (ORCPT ); Fri, 6 May 2022 21:04:34 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE61026105 for ; Fri, 6 May 2022 18:00:48 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id u23so9466305lfc.1 for ; Fri, 06 May 2022 18:00:48 -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:mime-version :content-transfer-encoding; bh=bbmCDtr+s7sU7U2DzR9HyFUOOK+AZ9mHXobR+YuUukY=; b=S4fWE6cToix3IrUwEdSdjlJMpkGe3zBnnhDbfNhBHfUc8NVYF1LCaE88zKEbaoTWBM 6CCuMw5YY8m1o1WcBSAAfwqoLuFQo+VjhVAnVX/Wo/WAaFqw4siH1EZCjs6TKOGOCtPH IcoIEg+uQ02a0+OReTK2ewLOEbqj3eCkA0qgtCbKGhCI8h8zyvEAq3txhFE5zgOZA9t8 06kbuCEnsyNCadgvKVgBrNS1MUD3i5UH/+uD8OtWmlB1iREu0KWsJI/PXrerd93SGEsW KR4hHcRbfi36fXFQkAKf0mRoWt8ehPkylUFeUuR/jIxcUvMyVCVIvJTY/Hy/uvnwd/mr IYgw== 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:mime-version :content-transfer-encoding; bh=bbmCDtr+s7sU7U2DzR9HyFUOOK+AZ9mHXobR+YuUukY=; b=zkbVu8nkGZEgdka3wOA9bw4gtfhEAx08SS7vX3kRo1zqj+ccMYWF7Xv5Jx2vWVab9a a/fAnVLNE9VjCuDdJTXsoXGgYvbP1uyxSp1WPeYa6GVuWn5fj3YAEGyuH+nQhH60W48k ewaqYgUNFDcv1ZyLGm7d5hyC3XRe8zQL+1KV4U9nkFl9bzw/mIg0df7mFjU2fm+m510t /1h5nm9VPB29zx0DWgQqFAWxB7RAEF/Cg1DYFf3JSE89C8znoVLOjDV8W/wEC0/Potck AWwWwMM0rFx9L6QeBs41v/5TamlzXTBBk5d0H479496Uqmtk1Net0p0YKwyBJK5CbQUr 0p3g== X-Gm-Message-State: AOAM532x50T/iYVU2gYiCCRmylQJ9K0yVSNt4olg2wj7leIiHA3kPvfr TNOa/RNPZDNqwb9tK3KhbIkYRA== X-Google-Smtp-Source: ABdhPJw4hX89GyYjec7dVISjZoAnB97kSOaFNSp9tHTSGNmwmxKLBjswpYqXoEiXK6CJvYmo+/JX9A== X-Received: by 2002:a05:6512:3405:b0:473:a5e5:1659 with SMTP id i5-20020a056512340500b00473a5e51659mr4208479lfr.379.1651885247159; Fri, 06 May 2022 18:00:47 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id m8-20020a0565120a8800b0047255d21123sm886335lfu.82.2022.05.06.18.00.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 18:00:46 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 1/3] drm/msm/mdp4: convert to drm_crtc_handle_vblank() Date: Sat, 7 May 2022 04:00:44 +0300 Message-Id: <20220507010046.1667809-1-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Stop using deprecated drm_handle_vblank(), use drm_crtc_handle_vblank() instead. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c index 87675c162eea..62cc566756e8 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c @@ -72,8 +72,7 @@ static irqreturn_t mdp4_irq(int irq, void *arg) struct mdp_kms *mdp_kms = to_mdp_kms(kms); struct mdp4_kms *mdp4_kms = to_mdp4_kms(mdp_kms); struct drm_device *dev = mdp4_kms->dev; - struct msm_drm_private *priv = dev->dev_private; - unsigned int id; + struct drm_crtc *crtc; uint32_t status, enable; enable = mdp4_read(mdp4_kms, REG_MDP4_INTR_ENABLE); @@ -84,9 +83,9 @@ static irqreturn_t mdp4_irq(int irq, void *arg) mdp_dispatch_irqs(mdp_kms, status); - for (id = 0; id < priv->num_crtcs; id++) - if (status & mdp4_crtc_vblank(priv->crtcs[id])) - drm_handle_vblank(dev, id); + drm_for_each_crtc(crtc, dev) + if (status & mdp4_crtc_vblank(crtc)) + drm_crtc_handle_vblank(crtc); return IRQ_HANDLED; } From patchwork Sat May 7 01:00: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: 570762 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1C33C4332F for ; Sat, 7 May 2022 01:00:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445136AbiEGBEf (ORCPT ); Fri, 6 May 2022 21:04:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445139AbiEGBEe (ORCPT ); Fri, 6 May 2022 21:04:34 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B5122D1F7 for ; Fri, 6 May 2022 18:00:49 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id c15so11043716ljr.9 for ; Fri, 06 May 2022 18:00:49 -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=zsynBbueSToYzX5WMMz7SkW3IlbctHxAF7JF9/2O4nY=; b=WAdHJaX982/fR1DGH3s8YtXLo96nhQCg98G0gDgIU1fZstmx5WubyFH8Yc8lKr6PyD sAuirokaBXI9YZ3GlCsAGotxOP9w7gyc4IbQXIkvLYQMf+nXF16Lku3G9wRoKf1d96H8 IMSOnL3iN9DGaiK+ABvkIF2Dc4zBe6cl1ms/Bi1BbZ8PyC2kWqfcp/1/xzM3a+u1cwLO SxT9NIfjSIIHWFu76CwtLpbJ+j6yAWnHiQrZhk0HxXNbOirvB5ntWuIamPHDzdKXLcuR cv60RMMfH3lVSfqb1iI/qNHFp5v+UpxZlXG4oOBhngcpd3mYC9AbV9phBzNpVOAUH4ok +ZUg== 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=zsynBbueSToYzX5WMMz7SkW3IlbctHxAF7JF9/2O4nY=; b=nRp7Pjvjs/bfcEBc8TNzorTyXcIHRSW85crY2AoIP0qGeAQYJVwK+28EZUaH1RaC3l 6bhdMYliIEDNCW1x5QfpLv1fLiej2K9ZIF1BiTHNqJQ8VgCEWfmRF1lQw7e7pM3gBwQD nOn2Q1wf3c90I7gaqYE8RXDjhspnVNsFO5UZfJKMetj8zobP9R38ZDW+0SRR08YdVoHx t7p0nVEl0pxMpKFPXOvoL2vAwCZgxOtoCUdaY7+jFWjsak3vZ6M+wlXRONKQUp0WCpn0 t5ZzQiPqhZ2meUt8+dOavp098/ZE5mruyM2LWgAs+iNYQAs+tWpTaJXDMDvwVzGxEtBW P0KA== X-Gm-Message-State: AOAM533pkciQOpviQXpogO6rKWQE2Ds3k/yoNqFtrtQMWjwoMCtc7LLd zDWwxXT/66mit9xJrs/gRMZKoA== X-Google-Smtp-Source: ABdhPJypb/gJ6z2lXz/aRu6eSZL+QrLD7NYp78yWw0SrcxAm8OzLPDD40inSRGuwO9m05QLRoNniSg== X-Received: by 2002:a2e:9e03:0:b0:24f:153c:c479 with SMTP id e3-20020a2e9e03000000b0024f153cc479mr3740299ljk.13.1651885247869; Fri, 06 May 2022 18:00:47 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id m8-20020a0565120a8800b0047255d21123sm886335lfu.82.2022.05.06.18.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 18:00:47 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 2/3] drm/msm/mdp5: convert to drm_crtc_handle_vblank() Date: Sat, 7 May 2022 04:00:45 +0300 Message-Id: <20220507010046.1667809-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220507010046.1667809-1-dmitry.baryshkov@linaro.org> References: <20220507010046.1667809-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Stop using deprecated drm_handle_vblank(), use drm_crtc_handle_vblank() instead. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c index d573ff29d5a4..18cc62f1e7ec 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c @@ -85,8 +85,7 @@ static irqreturn_t mdp5_irq(int irq, void *arg) struct mdp_kms *mdp_kms = to_mdp_kms(kms); struct mdp5_kms *mdp5_kms = to_mdp5_kms(mdp_kms); struct drm_device *dev = mdp5_kms->dev; - struct msm_drm_private *priv = dev->dev_private; - unsigned int id; + struct drm_crtc *crtc; uint32_t status, enable; enable = mdp5_read(mdp5_kms, REG_MDP5_INTR_EN); @@ -97,9 +96,9 @@ static irqreturn_t mdp5_irq(int irq, void *arg) mdp_dispatch_irqs(mdp_kms, status); - for (id = 0; id < priv->num_crtcs; id++) - if (status & mdp5_crtc_vblank(priv->crtcs[id])) - drm_handle_vblank(dev, id); + drm_for_each_crtc(crtc, dev) + if (status & mdp5_crtc_vblank(crtc)) + drm_crtc_handle_vblank(crtc); return IRQ_HANDLED; } From patchwork Sat May 7 01:00: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: 570506 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F22D5C433FE for ; Sat, 7 May 2022 01:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1445139AbiEGBEg (ORCPT ); Fri, 6 May 2022 21:04:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445137AbiEGBEf (ORCPT ); Fri, 6 May 2022 21:04:35 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78D9D344C0 for ; Fri, 6 May 2022 18:00:50 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id t25so15142189lfg.7 for ; Fri, 06 May 2022 18:00:50 -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=GpQPa4NJralQOF83QKrzZctApIFLbKGQLHmuL/U72to=; b=JXkuvSBpLZFGG6zLq4LqsjIHdtMQeLvd5PF2PXJkhnDI45JwFU7of+bRvNKkOgYLjM XKvUhOizsjEZmT2x6UowE0MXKQelZ/PJXfNbjaQpyXayLulZ/xz1mx10KNP4DDMXDGUE USiA5YiH+lyjVqnVIjHlT0QIXakUjlR3gzm+to0tuLKIXG5CUu6aNECD/d7GC8waIOHC /WTuMOn+wgaO2BWMO8M9tAqdirLr6Bozxw/dbs8ySYJBxECMAHA2Ndks28HGJi4MLW0B UFT21fscWpBNA9033nd8SbIV3dgezVCoz06poP2a9aBarQ08s4Tqqyhjz3htaphaDEsY qPkA== 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=GpQPa4NJralQOF83QKrzZctApIFLbKGQLHmuL/U72to=; b=vpYw5yVflBeOr6WaB9BJUTzEpXrIddblQdSKwMc95TWqvyAsJkf/uhjgabmzndEaHF xjWCl+goPCZYfqYJPkOm/8n3siMdAp2Bw4da9Nq6CVeAuTWzUZbsrcw7LXzTRoTQ9pQ0 m+kkjY1x58sWKQ9YeaFrSxIY+rQrHNUJ4dsCnl4y0XlHMveNKZJC3hHFoH0PCw6cxyfl ScQnq5JnSKZHxbIPUp0Lo88Y+/SWthOLnUbJi6pPJCJjwkHQBc539eSWta+gu1pptBuT XwKLlijmOb0vMCzPVHw02m4rCGtMdpc2y2cvgh32b+o1pmwnsTx+W+Guqk4QPODEIHHC Qd1w== X-Gm-Message-State: AOAM531Ap4w548vI8bPDJJ+zFEHF7APwL/PZ+zhtpbwODySGEnlRDRfh Fl+RXXGS/Jj3tfsJcGSoKwTeZJVpp01QSQ== X-Google-Smtp-Source: ABdhPJwPs3fa9PDP17FJQZM7Nsg6kkMR2y0Xy1UUWbGqgk3o1myyMjU8LYeYEJ80OICy1EEfsgP1Gw== X-Received: by 2002:ac2:5f8c:0:b0:471:ffe8:c5b4 with SMTP id r12-20020ac25f8c000000b00471ffe8c5b4mr4313668lfe.472.1651885248710; Fri, 06 May 2022 18:00:48 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id m8-20020a0565120a8800b0047255d21123sm886335lfu.82.2022.05.06.18.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 18:00:48 -0700 (PDT) From: Dmitry Baryshkov To: Rob Clark , Sean Paul , Abhinav Kumar Cc: Stephen Boyd , David Airlie , Daniel Vetter , Bjorn Andersson , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 3/3] drm/msm: stop storing the array of CRTCs in struct msm_drm_private Date: Sat, 7 May 2022 04:00:46 +0300 Message-Id: <20220507010046.1667809-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220507010046.1667809-1-dmitry.baryshkov@linaro.org> References: <20220507010046.1667809-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Handling the array of CRTC duplicate the struct msm_drm_private duplicates a list of CRTCs in the drm_device. Drop it and use the existing list for CRTC enumeration. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 2 +- drivers/gpu/drm/msm/msm_drv.c | 27 ++++++++++++------------ drivers/gpu/drm/msm/msm_drv.h | 3 +-- 5 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 494978da7785..f89dcb903869 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -808,7 +808,7 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) ret = PTR_ERR(crtc); return ret; } - priv->crtcs[priv->num_crtcs++] = crtc; + priv->num_crtcs++; } /* All CRTCs are compatible with all encoders */ diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c index b7aced272af9..375643a14198 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -335,7 +335,7 @@ static int modeset_init(struct mdp4_kms *mdp4_kms) goto fail; } - priv->crtcs[priv->num_crtcs++] = crtc; + priv->num_crtcs++; } /* diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 18cf0ff4da6c..35242e76de10 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -495,7 +495,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) DRM_DEV_ERROR(dev->dev, "failed to construct crtc %d (%d)\n", i, ret); goto fail; } - priv->crtcs[priv->num_crtcs++] = crtc; + priv->num_crtcs++; } /* diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index d2fbe54fec4d..576d346cc860 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -98,7 +98,7 @@ static void msm_irq_uninstall(struct drm_device *dev) struct msm_vblank_work { struct work_struct work; - int crtc_id; + struct drm_crtc *crtc; bool enable; struct msm_drm_private *priv; }; @@ -111,15 +111,15 @@ static void vblank_ctrl_worker(struct work_struct *work) struct msm_kms *kms = priv->kms; if (vbl_work->enable) - kms->funcs->enable_vblank(kms, priv->crtcs[vbl_work->crtc_id]); + kms->funcs->enable_vblank(kms, vbl_work->crtc); else - kms->funcs->disable_vblank(kms, priv->crtcs[vbl_work->crtc_id]); + kms->funcs->disable_vblank(kms, vbl_work->crtc); kfree(vbl_work); } static int vblank_ctrl_queue_work(struct msm_drm_private *priv, - int crtc_id, bool enable) + struct drm_crtc *crtc, bool enable) { struct msm_vblank_work *vbl_work; @@ -129,7 +129,7 @@ static int vblank_ctrl_queue_work(struct msm_drm_private *priv, INIT_WORK(&vbl_work->work, vblank_ctrl_worker); - vbl_work->crtc_id = crtc_id; + vbl_work->crtc = crtc; vbl_work->enable = enable; vbl_work->priv = priv; @@ -303,6 +303,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) struct msm_drm_private *priv = dev_get_drvdata(dev); struct drm_device *ddev; struct msm_kms *kms; + struct drm_crtc *crtc; int ret, i; if (drm_firmware_drivers_only()) @@ -376,12 +377,12 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) ddev->mode_config.funcs = &mode_config_funcs; ddev->mode_config.helper_private = &mode_config_helper_funcs; - for (i = 0; i < priv->num_crtcs; i++) { + drm_for_each_crtc(crtc, ddev) { /* initialize event thread */ - priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id; + priv->event_thread[i].crtc = crtc; priv->event_thread[i].dev = ddev; priv->event_thread[i].worker = kthread_create_worker(0, - "crtc_event:%d", priv->event_thread[i].crtc_id); + "crtc_event:%d", priv->event_thread[i].crtc->base.id); if (IS_ERR(priv->event_thread[i].worker)) { ret = PTR_ERR(priv->event_thread[i].worker); DRM_DEV_ERROR(dev, "failed to create crtc_event kthread\n"); @@ -517,25 +518,23 @@ static void msm_postclose(struct drm_device *dev, struct drm_file *file) int msm_crtc_enable_vblank(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; - unsigned int pipe = crtc->index; struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; if (!kms) return -ENXIO; - drm_dbg_vbl(dev, "crtc=%u", pipe); - return vblank_ctrl_queue_work(priv, pipe, true); + drm_dbg_vbl(dev, "crtc=%u", crtc->base.id); + return vblank_ctrl_queue_work(priv, crtc, true); } void msm_crtc_disable_vblank(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; - unsigned int pipe = crtc->index; struct msm_drm_private *priv = dev->dev_private; struct msm_kms *kms = priv->kms; if (!kms) return; - drm_dbg_vbl(dev, "crtc=%u", pipe); - vblank_ctrl_queue_work(priv, pipe, false); + drm_dbg_vbl(dev, "crtc=%u", crtc->base.id); + vblank_ctrl_queue_work(priv, crtc, false); } /* diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index fdbaad53eb84..2ba57c575e13 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -102,7 +102,7 @@ struct msm_display_topology { /* Commit/Event thread specific structure */ struct msm_drm_thread { struct drm_device *dev; - unsigned int crtc_id; + struct drm_crtc *crtc; struct kthread_worker *worker; }; @@ -178,7 +178,6 @@ struct msm_drm_private { struct workqueue_struct *wq; unsigned int num_crtcs; - struct drm_crtc *crtcs[MAX_CRTCS]; struct msm_drm_thread event_thread[MAX_CRTCS];