From patchwork Sat May 7 17:09:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 570502 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 A6F53C433FE for ; Sat, 7 May 2022 17:09:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231552AbiEGRNS (ORCPT ); Sat, 7 May 2022 13:13:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243682AbiEGRNM (ORCPT ); Sat, 7 May 2022 13:13:12 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6505E1A073 for ; Sat, 7 May 2022 10:09:25 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id p26so4025191lfh.10 for ; Sat, 07 May 2022 10:09:25 -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=NzygQfKaqxUN99VFssPvB6WUeLsx3+QcBbNDEkCRpbg=; b=nOqdkoUfgDzqeU7e9JGMkBSD98aE1d0/dRdjv/WiNhyhZ7lqXjBAyR8Yoy/lHpiJLJ NBJlFx6eUoU6SnInFQCqCIFsj5HvOmjOvBCiG71quFYNJ0HnFdHULLg4pcil4x0DJpit CHFRYXPncMLcOnSx7Xl0CY5TmHv8ByLPLpD4x28op0b9MsK3IjK7F7Kb7UBcugZ/xVGr xVjzH/iL9hThP4WjOmp1hgNLQXYEiU1oQFSJkCkZPJeW8RyIa8ErGmRiCcbYYZ+IJh8Q 1aGBZ6BfHh2o9/kAELh7t92wZds0pLp4Vd5YVXvBxb1im37HeqgkKo2wrMDnBZRAsFWI W1lg== 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=NzygQfKaqxUN99VFssPvB6WUeLsx3+QcBbNDEkCRpbg=; b=IONfm4BlCGU6NrGsHNwwjEYW5+U8jiZNVtmgloUEitQm/STigPLgIMSF+SR2UnWHfE wBrDSywvPlzfr9EDVxk35k3+jXzB5N5MARdaxfO4oxOq2aGZTaNnjPbdAU7LtmCh/4Bv wYcfu93mCNzCg8QcvPLFg61iDf/jtiHdplVAImpdUut0QqzwQodzmFwSCdpLbcVLM6pb vI9sF+xWeNiAV67+YAIkDfUWck53npl4xhurYN/a9KYlcIgUYEYwVsiCl4iZHLME85FU WY2WWkb7FuhhHEHhZ4h5chD6dBTjtAcAt34f4BhTy6R00qHiP3LSilJWeziFrY0CYw6I fBMw== X-Gm-Message-State: AOAM530cpTAYjIGEdpqMNcW4S/l9q+5gtNKUpPYCLYStaxHXK4ZjFCuO 6ttgLd0tIomA19R91ITWDvEHrEJE3RFJuQ== X-Google-Smtp-Source: ABdhPJyHWSoma8yU9uXEMXFj4Hng1G6xTNnzJFh+/QHTS715VFATXhoOiPi+VVoUddbzqC9+fRto3A== X-Received: by 2002:a05:6512:3f0e:b0:471:acdd:590c with SMTP id y14-20020a0565123f0e00b00471acdd590cmr6712966lfa.520.1651943363758; Sat, 07 May 2022 10:09:23 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id n14-20020a05651203ee00b0047255d211f9sm1175308lfq.296.2022.05.07.10.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 10:09:23 -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 v2 1/3] drm/msm/mdp4: convert to drm_crtc_handle_vblank() Date: Sat, 7 May 2022 20:09:20 +0300 Message-Id: <20220507170922.1723712-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 4d49f3ba6a96..ddcdd5e87853 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c @@ -69,8 +69,7 @@ irqreturn_t mdp4_irq(struct msm_kms *kms) 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); @@ -81,9 +80,9 @@ irqreturn_t mdp4_irq(struct msm_kms *kms) 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 17:09:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 570760 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 6FBA3C433F5 for ; Sat, 7 May 2022 17:09:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243499AbiEGRNT (ORCPT ); Sat, 7 May 2022 13:13:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244043AbiEGRNN (ORCPT ); Sat, 7 May 2022 13:13:13 -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 0F0BA1A38C for ; Sat, 7 May 2022 10:09:26 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id t25so17283028lfg.7 for ; Sat, 07 May 2022 10:09:25 -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=Fl5gRxPQwePsJhPtYdJYGhgQW5l6J6j4kwqCPdVck7I=; b=tQmFPaqB9Wjl+V8ASR5ujTk90TnQRMRKrZJq1wWao21lnAonDnDH1sLiiieAHNWwKr dfkPAQ8VipHgdgvwmiwuSd2PLt87xxgsdRpeScDn3PJTiJWXAcQm4Ekd3cViOg/E0WxI 199FgXNZ1y+ugyHXORtg+jpnXpjgk38ykc0YGvCEChtHM/VKKzi7NoQOPKKAANfye4wi TzpqyTx006ncWPnEFz2r/c/xvaAdURw3EVo/ngT0GkMVgB+5SJRZg993W/iHvEW8TphC ODYzN4Jwail+j7CLKodJUl8WTwon9I3Zclqk1yPMBRrjdxnM0/bfScW+H081OwPNc81M FQ+w== 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=Fl5gRxPQwePsJhPtYdJYGhgQW5l6J6j4kwqCPdVck7I=; b=LX+nQl13HRpvEC1l3HbU98/SOaSpIVuC12AupKCa5R7lAEVSK07FmVmiZA2yMYJDZn tCoxveZPUvjQ1xHIsyIxrUDhkxZta/qcUZCv4kz6ZGsYQO8+oVbCOjrlx5kdqaD81Pic Cq/82s4cJBiFIHVIhZBmkkCN+1lYESsFF4BdaSPSj35cFN6yz+Uku659GJMkEAY7N6ga F7uIXuTdAjxnS7rBWR9SEtgzvY9GEF+AwGNwhA2H4P1Ua8xdC6Bau9C/iUqfx8rb95kc oWmiA8gaPA0LAKOeVM82GvjaMitK44D4ERH9fP8gOOAlM8XEkLuokQz0tclLC6Q1MceW nDBg== X-Gm-Message-State: AOAM531utcF/3IJigH10s1vikKBDojIzgIZdTJU+DYhbKWi8vhhNgnHn Z1rFDA7JtEH1q5i0TIk9i3fXuA== X-Google-Smtp-Source: ABdhPJxwRZ4sDrgrxB/oQOREsq+0eXzVLyq7Pkp+V1PlVr7UQIfmJVUYFBzgKY9UsfJ90edg5I75mw== X-Received: by 2002:a05:6512:b0e:b0:44a:a5a0:f60e with SMTP id w14-20020a0565120b0e00b0044aa5a0f60emr6790155lfu.669.1651943364389; Sat, 07 May 2022 10:09:24 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id n14-20020a05651203ee00b0047255d211f9sm1175308lfq.296.2022.05.07.10.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 10:09:24 -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 v2 2/3] drm/msm/mdp5: convert to drm_crtc_handle_vblank() Date: Sat, 7 May 2022 20:09:21 +0300 Message-Id: <20220507170922.1723712-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220507170922.1723712-1-dmitry.baryshkov@linaro.org> References: <20220507170922.1723712-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 Reviewed-by: Abhinav Kumar --- 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 9b4c8d92ff32..43443a435d59 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c @@ -82,8 +82,7 @@ irqreturn_t mdp5_irq(struct msm_kms *kms) 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); @@ -94,9 +93,9 @@ irqreturn_t mdp5_irq(struct msm_kms *kms) 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 17:09:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 570501 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 B466EC433FE for ; Sat, 7 May 2022 17:09:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355155AbiEGRNU (ORCPT ); Sat, 7 May 2022 13:13:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348471AbiEGRNO (ORCPT ); Sat, 7 May 2022 13:13:14 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAB34205E6 for ; Sat, 7 May 2022 10:09:26 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id y32so17296443lfa.6 for ; Sat, 07 May 2022 10:09:26 -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=jHDRJOheaN9Ke/+xaTIfLp8HPoD3ikp08lVBr1HW+Kw=; b=pyWcSSNgvp7yQdVCBADdq13hmeOTh4B0SCaxGwrkdYe0hf0Xz35oprHFfQQFE64VtZ HrzPAG319W1oRtdjeCkCSAq4UH3sVPRHrFuYrlczKJUpuzmgaTb+AnL5YeFsLiVrvMP4 snDDhrxVobpaDPhvyG9/ljW/ZtRGzOVCTGo59GcqyTYaXkJmTTLwvuwJ/9SBRLlG3lPp 7d/kSdY0W62n56j9Pxud56xuFOElyhgu+wEYvvb8tH1WB5C15P80scJG/BMRH5PChQoP k6FDZDQBDUxpq5nip6UAK6Zh5VxULoVhCuBlUzjiXp1Or5UZ3hwrNtUp2HpXEiLge3Ai dArg== 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=jHDRJOheaN9Ke/+xaTIfLp8HPoD3ikp08lVBr1HW+Kw=; b=GYQrA3ATsiW5n0NYJS+OQeMPEGSpFqkFeIiE//0oymCn30sWhTytolavNyjJgdt3wI us0hkCCpk95KCdHrQtrAa3bn8qDjoQzt+zOkcOqJw4aRlPnQhpBGP0AF6zR/BIMrij8g uzfadgK2diMs0mztYn8rFOfc4HsJLro7Eot+zuen8lwzCUqIuhuYq1z3rwet5eY+uOTV QrXlmlwm2pCoUn4pAEBKPmXKbRxpvn8jlcP6CwPA+O0pkZ090JRigtodAhXeixoeX8L/ JAHQ3wc8X5q+euNL2eYGR9ZzC7L9RtuFhTXQ6G9VByB5hw3mTSQ3MdxweOugc10mZhFx 20Eg== X-Gm-Message-State: AOAM530eDpRzzFpVCXvDJxrglFnsK0ASzCq+HciUxh0L+dt4MuXyDd5o RffL2p/aeWj3vJy3IVlVxZWGKg== X-Google-Smtp-Source: ABdhPJzigrCUwpoqfPE1LC+g/sENWK+0OQhGslut0HmshE54YWflI28/IMe4QI56N4AukhGmDZuOCA== X-Received: by 2002:a19:4343:0:b0:474:d7a:634d with SMTP id m3-20020a194343000000b004740d7a634dmr2909583lfj.168.1651943365097; Sat, 07 May 2022 10:09:25 -0700 (PDT) Received: from eriador.lan ([37.153.55.125]) by smtp.gmail.com with ESMTPSA id n14-20020a05651203ee00b0047255d211f9sm1175308lfq.296.2022.05.07.10.09.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 May 2022 10:09:24 -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, kernel test robot Subject: [PATCH v2 3/3] drm/msm: stop storing the array of CRTCs in struct msm_drm_private Date: Sat, 7 May 2022 20:09:22 +0300 Message-Id: <20220507170922.1723712-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220507170922.1723712-1-dmitry.baryshkov@linaro.org> References: <20220507170922.1723712-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 Reported-by: kernel test robot Signed-off-by: Dmitry Baryshkov --- Changes since v1: - Intialize the index variable in msm_drm_init() / event thread initialization. --- 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 | 29 ++++++++++++------------ drivers/gpu/drm/msm/msm_drv.h | 3 +-- 5 files changed, 19 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 2b9d931474e0..c84859fb2d9b 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 fb48c8c19ec3..7449c1693e45 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -337,7 +337,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 3d5621a68f85..36808990f840 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -497,7 +497,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 4a3dda23e3e0..db676a142ac1 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -144,7 +144,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; }; @@ -157,15 +157,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; @@ -175,7 +175,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; @@ -349,6 +349,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()) @@ -422,12 +423,14 @@ 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) { + i = drm_crtc_index(crtc); + /* 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"); @@ -558,25 +561,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];