From patchwork Wed Dec 5 16:29:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10714553 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E83DE17DB for ; Wed, 5 Dec 2018 16:30:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D65C82DC39 for ; Wed, 5 Dec 2018 16:30:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CAF912DC46; Wed, 5 Dec 2018 16:30:04 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CCE82DC39 for ; Wed, 5 Dec 2018 16:30:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727923AbeLEQaD (ORCPT ); Wed, 5 Dec 2018 11:30:03 -0500 Received: from mail-yw1-f67.google.com ([209.85.161.67]:35599 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727195AbeLEQaD (ORCPT ); Wed, 5 Dec 2018 11:30:03 -0500 Received: by mail-yw1-f67.google.com with SMTP id h32so8779766ywk.2 for ; Wed, 05 Dec 2018 08:30:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1VFBmLh7yCSA8aAVzBuiHPc5Af5h0q0mli7lxlnCI5U=; b=ZGNddYDMzaHkGVyLcSJ4dv6UsChtV8MmA8Fkks4NSAhf4TbCB/CDP/7ITqjRwFslX1 GBbF5NqLjTqCMdvwIsWjvH9hsvv8asFBY1Ur/yq4VSWthYE1NFNjrmXuxjbgoO82SCzX 8PX/NmfdeJ9XpEXPtysJ9lnJscnbwUJMTKO6TQS8hd/XbceladqJ0UiDn+MwuxtSd/74 XBGEjYJ+RD701W0JdLhvIgtRxlLavoRZLcW0eAt+FYSVnz6r1bpID6boL67E7VZu3PBo H2kQyYa8bQesG9XNV+nLfjW2pI7yH+21PhnwE6SYwExMl5at7nKB9spcFvH9qns6whCC KjyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1VFBmLh7yCSA8aAVzBuiHPc5Af5h0q0mli7lxlnCI5U=; b=KltFz+OZ4VSeeEl2VYctWafu2YzM7nw2+ZnKumKbIhhMXQ8rxCrOIUiBVqRV7QtDTH AX4f0YIG3ErL8teW48LbyCTZQSqQctFSW4wVQLw8zAN2neAEVNpJNsK9xRO0t9lLyQRE HVqLzsE2yXf2M/lxC2z8uIj/ciHw8M/aM/cElgI6HammXaba+krXwUzZfhEAtYoC1kcW OXbXqhA7WQk7By5y4KMYP31UCr0iJC5jmAB2g0vIz8fbmPBY2kX1CSyrNpjiutCOlTb4 SChTIDDMTWEi7cr7Rppd/jcQ/ISh4UkL/Ngxe+yDbMIPm3yAS2S1oGHVP7u/Wczoh06Q sxnA== X-Gm-Message-State: AA+aEWYr58x0GadB0taLohW2zbLTgaQckBxz5UXs+x6VlybZEXgJcbH+ oYAXxKCEXNBCriI5sunuE+d2HQ== X-Google-Smtp-Source: AFSGD/VRvirxxIZrwa2rpI2rSGu1PxPl5TT34tDl3O+pCLS4YVIxJDNDb39HMOwU4JgSFCcKlWL7yQ== X-Received: by 2002:a81:1688:: with SMTP id 130mr1312189yww.271.1544027400401; Wed, 05 Dec 2018 08:30:00 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id n133sm6460470ywb.55.2018.12.05.08.29.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 08:29:59 -0800 (PST) From: Sean Paul Cc: robdclark@gmail.com, jsanka@codeaurora.org, Sean Paul , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 1/9] drm/msm: Don't track crtcs in msm private struct Date: Wed, 5 Dec 2018 11:29:33 -0500 Message-Id: <20181205162958.25025-1-sean@poorly.run> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul drm core already tracks this, so we can just lean on that instead of tracking ourselves. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 9 ++- drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c | 10 +-- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 4 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c | 10 +-- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 12 +--- drivers/gpu/drm/msm/msm_drv.c | 79 +++++++++++++----------- drivers/gpu/drm/msm/msm_drv.h | 3 - 7 files changed, 62 insertions(+), 65 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 1969f0d07d865..3796a2978a40b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -497,6 +497,7 @@ static void _dpu_kms_setup_displays(struct drm_device *dev, static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) { struct msm_drm_private *priv; + struct drm_crtc *crtc; int i; if (!dpu_kms) { @@ -511,9 +512,8 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) } 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; + drm_for_each_crtc(crtc, dpu_kms->dev) + crtc->funcs->destroy(crtc); for (i = 0; i < priv->num_planes; i++) priv->planes[i]->funcs->destroy(priv->planes[i]); @@ -598,12 +598,11 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) ret = PTR_ERR(crtc); goto fail; } - priv->crtcs[priv->num_crtcs++] = crtc; } /* 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; + priv->encoders[i]->possible_crtcs = (1 << max_crtc_count) - 1; return 0; fail: diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c index b764d7f103127..7c597d21c97ba 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_irq.c @@ -15,6 +15,7 @@ * this program. If not, see . */ +#include #include #include "msm_drv.h" @@ -79,8 +80,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); @@ -91,9 +91,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_handle_vblank(dev, drm_crtc_index(crtc)); return IRQ_HANDLED; } diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c index e437aa806f7be..f7f678c55e3ac 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -373,7 +373,7 @@ static int modeset_init(struct mdp4_kms *mdp4_kms) goto fail; } - crtc = mdp4_crtc_init(dev, plane, priv->num_crtcs, i, + crtc = mdp4_crtc_init(dev, plane, ARRAY_SIZE(mdp4_crtcs), i, mdp4_crtcs[i]); if (IS_ERR(crtc)) { DRM_DEV_ERROR(dev->dev, "failed to construct crtc for %s\n", @@ -381,8 +381,6 @@ static int modeset_init(struct mdp4_kms *mdp4_kms) ret = PTR_ERR(crtc); goto fail; } - - priv->crtcs[priv->num_crtcs++] = crtc; } /* diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c index 280e368bc9bb8..c66a7fbd9b9c3 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_irq.c @@ -17,6 +17,7 @@ #include +#include #include #include "msm_drv.h" @@ -92,8 +93,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); @@ -104,9 +104,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_handle_vblank(dev, drm_crtc_index(crtc)); return IRQ_HANDLED; } diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index d27e35a217bd7..4fb70532b0484 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -520,7 +520,6 @@ 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; } /* @@ -530,7 +529,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) for (i = 0; i < priv->num_encoders; i++) { struct drm_encoder *encoder = priv->encoders[i]; - encoder->possible_crtcs = (1 << priv->num_crtcs) - 1; + encoder->possible_crtcs = (1 << num_crtcs) - 1; } return 0; @@ -589,12 +588,11 @@ static bool mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe, ktime_t *stime, ktime_t *etime, const struct drm_display_mode *mode) { - struct msm_drm_private *priv = dev->dev_private; struct drm_crtc *crtc; struct drm_encoder *encoder; int line, vsw, vbp, vactive_start, vactive_end, vfp_end; - crtc = priv->crtcs[pipe]; + crtc = drm_crtc_from_index(dev, pipe); if (!crtc) { DRM_ERROR("Invalid crtc %d\n", pipe); return false; @@ -646,14 +644,10 @@ static bool mdp5_get_scanoutpos(struct drm_device *dev, unsigned int pipe, static u32 mdp5_get_vblank_counter(struct drm_device *dev, unsigned int pipe) { - struct msm_drm_private *priv = dev->dev_private; struct drm_crtc *crtc; struct drm_encoder *encoder; - if (pipe >= priv->num_crtcs) - return 0; - - crtc = priv->crtcs[pipe]; + crtc = drm_crtc_from_index(dev, pipe); if (!crtc) return 0; diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 81bfac744a555..dcc671eba24dc 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -224,15 +224,19 @@ static void vblank_ctrl_worker(struct kthread_work *work) spin_lock_irqsave(&vbl_ctrl->lock, flags); list_for_each_entry_safe(vbl_ev, tmp, &vbl_ctrl->event_list, node) { + struct drm_crtc *crtc = drm_crtc_from_index(priv->dev, + vbl_ev->crtc_id); + + if (WARN_ON(!crtc)) + continue; + list_del(&vbl_ev->node); spin_unlock_irqrestore(&vbl_ctrl->lock, flags); if (vbl_ev->enable) - kms->funcs->enable_vblank(kms, - priv->crtcs[vbl_ev->crtc_id]); + kms->funcs->enable_vblank(kms, crtc); else - kms->funcs->disable_vblank(kms, - priv->crtcs[vbl_ev->crtc_id]); + kms->funcs->disable_vblank(kms, crtc); kfree(vbl_ev); @@ -270,12 +274,12 @@ static int msm_drm_uninit(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct drm_device *ddev = platform_get_drvdata(pdev); + struct drm_crtc *crtc; struct msm_drm_private *priv = ddev->dev_private; struct msm_kms *kms = priv->kms; struct msm_mdss *mdss = priv->mdss; struct msm_vblank_ctrl *vbl_ctrl = &priv->vblank_ctrl; struct vblank_event *vbl_ev, *tmp; - int i; /* We must cancel and cleanup any pending vblank enable/disable * work before drm_irq_uninstall() to avoid work re-enabling an @@ -288,17 +292,18 @@ static int msm_drm_uninit(struct device *dev) } /* clean up display commit/event worker threads */ - for (i = 0; i < priv->num_crtcs; i++) { - if (priv->disp_thread[i].thread) { - kthread_flush_worker(&priv->disp_thread[i].worker); - kthread_stop(priv->disp_thread[i].thread); - priv->disp_thread[i].thread = NULL; + drm_for_each_crtc(crtc, ddev) { + unsigned int pipe = drm_crtc_index(crtc); + if (priv->disp_thread[pipe].thread) { + kthread_flush_worker(&priv->disp_thread[pipe].worker); + kthread_stop(priv->disp_thread[pipe].thread); + priv->disp_thread[pipe].thread = NULL; } - if (priv->event_thread[i].thread) { - kthread_flush_worker(&priv->event_thread[i].worker); - kthread_stop(priv->event_thread[i].thread); - priv->event_thread[i].thread = NULL; + if (priv->event_thread[pipe].thread) { + kthread_flush_worker(&priv->event_thread[pipe].worker); + kthread_stop(priv->event_thread[pipe].thread); + priv->event_thread[pipe].thread = NULL; } } @@ -438,10 +443,11 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) { struct platform_device *pdev = to_platform_device(dev); struct drm_device *ddev; + struct drm_crtc *crtc; struct msm_drm_private *priv; struct msm_kms *kms; struct msm_mdss *mdss; - int ret, i; + int ret; struct sched_param param; ddev = drm_dev_alloc(drv, dev); @@ -547,39 +553,42 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) * other real time and normal priority task */ param.sched_priority = 16; - for (i = 0; i < priv->num_crtcs; i++) { + drm_for_each_crtc(crtc, ddev) { + unsigned int pipe = drm_crtc_index(crtc); /* initialize display thread */ - priv->disp_thread[i].crtc_id = priv->crtcs[i]->base.id; - kthread_init_worker(&priv->disp_thread[i].worker); - priv->disp_thread[i].dev = ddev; - priv->disp_thread[i].thread = + priv->disp_thread[pipe].crtc_id = crtc->base.id; + kthread_init_worker(&priv->disp_thread[pipe].worker); + priv->disp_thread[pipe].dev = ddev; + priv->disp_thread[pipe].thread = kthread_run(kthread_worker_fn, - &priv->disp_thread[i].worker, - "crtc_commit:%d", priv->disp_thread[i].crtc_id); - if (IS_ERR(priv->disp_thread[i].thread)) { + &priv->disp_thread[pipe].worker, + "crtc_commit:%d", + priv->disp_thread[pipe].crtc_id); + if (IS_ERR(priv->disp_thread[pipe].thread)) { DRM_DEV_ERROR(dev, "failed to create crtc_commit kthread\n"); - priv->disp_thread[i].thread = NULL; + priv->disp_thread[pipe].thread = NULL; goto err_msm_uninit; } - ret = sched_setscheduler(priv->disp_thread[i].thread, + ret = sched_setscheduler(priv->disp_thread[pipe].thread, SCHED_FIFO, ¶m); if (ret) dev_warn(dev, "disp_thread set priority failed: %d\n", ret); /* initialize event thread */ - priv->event_thread[i].crtc_id = priv->crtcs[i]->base.id; - kthread_init_worker(&priv->event_thread[i].worker); - priv->event_thread[i].dev = ddev; - priv->event_thread[i].thread = + priv->event_thread[pipe].crtc_id = crtc->base.id; + kthread_init_worker(&priv->event_thread[pipe].worker); + priv->event_thread[pipe].dev = ddev; + priv->event_thread[pipe].thread = kthread_run(kthread_worker_fn, - &priv->event_thread[i].worker, - "crtc_event:%d", priv->event_thread[i].crtc_id); - if (IS_ERR(priv->event_thread[i].thread)) { + &priv->event_thread[pipe].worker, + "crtc_event:%d", + priv->event_thread[pipe].crtc_id); + if (IS_ERR(priv->event_thread[pipe].thread)) { DRM_DEV_ERROR(dev, "failed to create crtc_event kthread\n"); - priv->event_thread[i].thread = NULL; + priv->event_thread[pipe].thread = NULL; goto err_msm_uninit; } @@ -590,14 +599,14 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) * frame_pending counters beyond 2. This can lead to commit * failure at crtc commit level. */ - ret = sched_setscheduler(priv->event_thread[i].thread, + ret = sched_setscheduler(priv->event_thread[pipe].thread, SCHED_FIFO, ¶m); if (ret) dev_warn(dev, "event_thread set priority failed:%d\n", ret); } - ret = drm_vblank_init(ddev, priv->num_crtcs); + ret = drm_vblank_init(ddev, ddev->mode_config.num_crtc); if (ret < 0) { DRM_DEV_ERROR(dev, "failed to initialize vblank\n"); goto err_msm_uninit; diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 71a03ce21da53..fc677da06e33b 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -194,9 +194,6 @@ struct msm_drm_private { unsigned int num_planes; struct drm_plane *planes[MAX_PLANES]; - unsigned int num_crtcs; - struct drm_crtc *crtcs[MAX_CRTCS]; - struct msm_drm_thread disp_thread[MAX_CRTCS]; struct msm_drm_thread event_thread[MAX_CRTCS]; From patchwork Wed Dec 5 16:29:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10714551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7D4C14E2 for ; Wed, 5 Dec 2018 16:30:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A77C12DC3E for ; Wed, 5 Dec 2018 16:30:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BA182DC4D; Wed, 5 Dec 2018 16:30:04 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 076C22DC3E for ; Wed, 5 Dec 2018 16:30:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727195AbeLEQaD (ORCPT ); Wed, 5 Dec 2018 11:30:03 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:33679 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727240AbeLEQaD (ORCPT ); Wed, 5 Dec 2018 11:30:03 -0500 Received: by mail-yw1-f66.google.com with SMTP id q11so8794688ywa.0 for ; Wed, 05 Dec 2018 08:30:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G94Eu5gU6RTEWJIidkNWF5B94PVih5AphIDwP6zjUto=; b=b7k8ToUXiTd4kbYxDxOPbDv8jMuq+YWsEe/Z9+DQE92Z5MTky0XPkG9PT3WpowWdGF chTxnvwpaWkTLCETNXjAkZF2USm/pOa4dQ10stekCFvYVsN8W2sVc0unUBp18UVqojG7 0GkYHf8FQg2fHCwpkoEdgp/0vh0Qu3i86bqW9PCJ3aVUJsXL0LLW5GG3+1tdeapnZi4b kUG4IqnEP0QSKiX+5AIHQV/4NTaincU3QaMmAvUsVuJyc5xelrKSA8PDxfuop+hLQDEd NkxUfAuezlGpu/1tRWoUnyFJwxdGsgNOJvHakEY6B+kHCIeqxyyOZ5qFy0d1NTZxvYBx df9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G94Eu5gU6RTEWJIidkNWF5B94PVih5AphIDwP6zjUto=; b=aRiBpm25QMSCC8h8tnaDQHZXTGZWLHklIBZHaWmEQXbtHohVtBoa0A0LN+iPuh0sa9 L/YMkkQH0VYwbYZkemY62ATKGmrRzyGx/EgiTCvB63E/I56TQHE1jsIT32bM3AwuhKvr WnJHWMuAmm+jt0Zghn8ZLopF3UmABgCjPQ11h3mNvYAFc29/AjeV3eBAx+Yp2H7wv0BG h1ivAF9KrDPw6QJfa96Xx/jd1eld9+Jmn4C5Jk4FZL0FHhaLssTWT6F1AA/fA8dCBcow pI51od0y7e8HrvExy9pdhXxJRvjJDO5sIlwzk3qV6gROdkoj0sT5R+DTJM8n+M/H+/KZ CSdg== X-Gm-Message-State: AA+aEWbiSkWmGnCCeRx4NyNiR9Gj6yDMgkR4LDOIJW5jWYTfGFDWjhxa iEW6y7OGbPSnCAgNkbPFMve/YQ== X-Google-Smtp-Source: AFSGD/VPX1EYnVaujezwu+IOoTPP21fgW5ultxTNtG0WCrFFoZgVKsgd/zLr2p7aRpPcep0U9hEUmA== X-Received: by 2002:a81:6a04:: with SMTP id f4mr24998434ywc.485.1544027402062; Wed, 05 Dec 2018 08:30:02 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id n133sm6460470ywb.55.2018.12.05.08.30.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 08:30:01 -0800 (PST) From: Sean Paul Cc: robdclark@gmail.com, jsanka@codeaurora.org, Sean Paul , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 2/9] drm/msm: Don't track encoders in msm private struct Date: Wed, 5 Dec 2018 11:29:34 -0500 Message-Id: <20181205162958.25025-2-sean@poorly.run> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog In-Reply-To: <20181205162958.25025-1-sean@poorly.run> References: <20181205162958.25025-1-sean@poorly.run> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul drm core already tracks this, so we can just lean on that instead of tracking ourselves. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 16 ++++++++-------- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 5 ----- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 12 ++++-------- drivers/gpu/drm/msm/msm_drv.h | 3 --- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 3796a2978a40b..cbebc04e2d6ef 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -457,8 +457,6 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev, return; } - priv->encoders[priv->num_encoders++] = encoder; - for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { if (!priv->dsi[i]) { DPU_DEBUG("invalid msm_dsi for ctrl %d\n", i); @@ -498,6 +496,7 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) { struct msm_drm_private *priv; struct drm_crtc *crtc; + struct drm_encoder *encoder; int i; if (!dpu_kms) { @@ -523,9 +522,8 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) 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; + drm_for_each_encoder(encoder, dpu_kms->dev) + encoder->funcs->destroy(encoder); } static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) @@ -534,6 +532,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; @@ -556,7 +555,8 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) */ _dpu_kms_setup_displays(dev, priv, dpu_kms); - max_crtc_count = min(catalog->mixer_count, priv->num_encoders); + max_crtc_count = min(catalog->mixer_count, + (u32)dev->mode_config.num_encoder); /* Create the planes, keeping track of one primary/cursor per crtc */ for (i = 0; i < catalog->sspp_count; i++) { @@ -601,8 +601,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 << max_crtc_count) - 1; + drm_for_each_encoder(encoder, dpu_kms->dev) + encoder->possible_crtcs = (1 << max_crtc_count) - 1; return 0; fail: diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c index f7f678c55e3ac..527a4ee06819f 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -266,7 +266,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; @@ -288,9 +287,6 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms, return ret; } } - - priv->encoders[priv->num_encoders++] = encoder; - break; case DRM_MODE_ENCODER_DSI: /* only DSI1 supported for now */ @@ -309,7 +305,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) { diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c index 4fb70532b0484..7cf54737944e4 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -332,7 +332,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); @@ -341,8 +340,6 @@ static struct drm_encoder *construct_encoder(struct mdp5_kms *mdp5_kms, return encoder; } - priv->encoders[priv->num_encoders++] = encoder; - return encoder; } @@ -455,6 +452,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) { struct drm_device *dev = mdp5_kms->dev; struct msm_drm_private *priv = dev->dev_private; + struct drm_encoder *encoder; const struct mdp5_cfg_hw *hw_cfg; unsigned int num_crtcs; int i, ret, pi = 0, ci = 0; @@ -478,7 +476,8 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) * 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((unsigned)dev->mode_config.num_encoder, + mdp5_kms->num_hwmixers); /* * Construct planes equaling the number of hw pipes, and CRTCs for the @@ -526,11 +525,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 << num_crtcs) - 1; - } return 0; diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index fc677da06e33b..c6eff08e80170 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -197,9 +197,6 @@ struct msm_drm_private { struct msm_drm_thread disp_thread[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]; From patchwork Wed Dec 5 16:29:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10714557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 55F3114E2 for ; Wed, 5 Dec 2018 16:30:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 455592D024 for ; Wed, 5 Dec 2018 16:30:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 395EA2DC14; Wed, 5 Dec 2018 16:30:07 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEC932D024 for ; Wed, 5 Dec 2018 16:30:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728115AbeLEQaG (ORCPT ); Wed, 5 Dec 2018 11:30:06 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:32949 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727240AbeLEQaG (ORCPT ); Wed, 5 Dec 2018 11:30:06 -0500 Received: by mail-yb1-f196.google.com with SMTP id f125so3909192ybc.0 for ; Wed, 05 Dec 2018 08:30:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s9WBbVUWnS8+gNiVBm0oOF4WfSw2JrldIInFTVe12gU=; b=S9fFV7NNzMkevQDxR7q8UUyU8Pja7t+hnFmzvS55wwwGpcgzz0RkN4f6+Xd2brl79+ fvX9NB3xNHYu1mrkiG2XyDudfliQAmYhuoTT1aQ0bY480ICfrWISJt6lI1IeGjBWZ2Mu 78AcTxkG9WfQvB4KJ286Nut3b7JFEfDjrVAVZFo8/WppYPq9CukQsAw4xq+L98i5Ptnw BrkGleyCf/1z9GiG2/Hyqan245mAtyMJVBihXK2rbVQcFA0hy/udGFJeYvW5Eu7aZOKl hky0xAYU7iizOo8ZI7tGdHGaNGzNm/DaH3hv96cOz36GB5gxh0lhLquLK4ERbNFdMSc4 chPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s9WBbVUWnS8+gNiVBm0oOF4WfSw2JrldIInFTVe12gU=; b=Jo/yee1UbMRdVhD25z6ac6suksG9nnJf4ll+eqR7YuLiNFJ6W/d9hoh1UKy7NXk9kg koeBqyo8yC6QMlIg8cT12l+rxkFS9VOBULU6LTSJkjtI2+Agd+NZeE3g2lUdeHqI+eYe ITDNCqyogIYNsYbwM+jQI9M46weuVhbbLP14snLmAHE+N77KHploOa6cMisz1Et4ycj1 IvyJhR/O6T6XO/O5o/rC5GLmZ9O9AcpPiuiUA1lL46EDvipLR4ALl6phKC6CwP1es30g mn/WUeyhGXO1MVqxrkybh9I4IYimrWsTfPQ7wWadqJYcoKghgO2YLyDMQuCX84jpLhY/ HYtg== X-Gm-Message-State: AA+aEWbq1PPFrb0CgkvSdFyqeC/MZLxMLaM/t8qHYz7QDolh3+VKwBre zqlEg0gag5c7AsoxlB/vxdX5BA== X-Google-Smtp-Source: AFSGD/VEvarS/KY3rXqQg613HZMzURDTmMxtS3lMhODpcs5QuX1kFdMcJf0tsMe6lnVClJbYvYdg/Q== X-Received: by 2002:a25:e094:: with SMTP id x142mr10335100ybg.42.1544027405051; Wed, 05 Dec 2018 08:30:05 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id n133sm6460470ywb.55.2018.12.05.08.30.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 08:30:04 -0800 (PST) From: Sean Paul Cc: robdclark@gmail.com, jsanka@codeaurora.org, Sean Paul , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 3/9] drm/msm: Don't track bridges in msm private struct Date: Wed, 5 Dec 2018 11:29:35 -0500 Message-Id: <20181205162958.25025-3-sean@poorly.run> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog In-Reply-To: <20181205162958.25025-1-sean@poorly.run> References: <20181205162958.25025-1-sean@poorly.run> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul drm core already tracks this, so we can just lean on that instead of tracking ourselves. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/dsi.c | 1 - drivers/gpu/drm/msm/edp/edp.c | 1 - drivers/gpu/drm/msm/hdmi/hdmi.c | 1 - drivers/gpu/drm/msm/msm_drv.h | 3 --- 4 files changed, 6 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 7b2a1e6a88107..97b906a9b3945 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -250,7 +250,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, goto fail; } - priv->bridges[priv->num_bridges++] = msm_dsi->bridge; priv->connectors[priv->num_connectors++] = msm_dsi->connector; return 0; diff --git a/drivers/gpu/drm/msm/edp/edp.c b/drivers/gpu/drm/msm/edp/edp.c index 6a63aba98a307..694c2d43011f6 100644 --- a/drivers/gpu/drm/msm/edp/edp.c +++ b/drivers/gpu/drm/msm/edp/edp.c @@ -188,7 +188,6 @@ int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev, encoder->bridge = edp->bridge; - priv->bridges[priv->num_bridges++] = edp->bridge; priv->connectors[priv->num_connectors++] = edp->connector; return 0; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index ace8aab072761..1901ae820ef0b 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -340,7 +340,6 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, encoder->bridge = hdmi->bridge; - 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 c6eff08e80170..1902713ed84b0 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -197,9 +197,6 @@ struct msm_drm_private { struct msm_drm_thread disp_thread[MAX_CRTCS]; struct msm_drm_thread event_thread[MAX_CRTCS]; - unsigned int num_bridges; - struct drm_bridge *bridges[MAX_BRIDGES]; - unsigned int num_connectors; struct drm_connector *connectors[MAX_CONNECTORS]; From patchwork Wed Dec 5 16:29:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10714561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F1F9113AF for ; Wed, 5 Dec 2018 16:30:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1A052D022 for ; Wed, 5 Dec 2018 16:30:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D58782DC14; Wed, 5 Dec 2018 16:30:08 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 639CF2D022 for ; Wed, 5 Dec 2018 16:30:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727240AbeLEQaH (ORCPT ); Wed, 5 Dec 2018 11:30:07 -0500 Received: from mail-yb1-f193.google.com ([209.85.219.193]:34392 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727177AbeLEQaH (ORCPT ); Wed, 5 Dec 2018 11:30:07 -0500 Received: by mail-yb1-f193.google.com with SMTP id a67-v6so8672817ybg.1 for ; Wed, 05 Dec 2018 08:30:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZLcCLmYrUSTqkm4Fxp5QX6ca0QRp5eb+NvG21zkSHXA=; b=MrWVsNz26LY6iRxmDb9+v2grf2ACGbPELX5fHps1kA2k5uML2xJeRzElc5j8QQFcjg JULUHXFmkOSTHyY7aZEAHwpfvCx3ZStyO88A6Z9/CLm0aupMNKBVgW/ZYjlLVV+i087k rNNfJQpjMwac7tZEMJUkFZgg5abMJPmGhXnGCbqIO+aWZWFDWgu0vBROns9wLITc/6nd 9nSdmnTP/e+WFSyI6oeGcRJF7q91DI0xOvI23GmyFWTjDZu8e2vqahrR8Y4rD5VXVT8I ep9ZDbQM6jefXmN3eYk7qQRIt9WzED1mzsOfPo6oI8WLNIWeafB1kty1veSGNlYtv7nl G0NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZLcCLmYrUSTqkm4Fxp5QX6ca0QRp5eb+NvG21zkSHXA=; b=THyFbDGePV13vdZsYSuh+TCA7oYCnoi/gREEooftFwc0YY+Os2Dy295cewqhn8XGup PLWlK8LzOBvd5h8tkRSrvF6doRFY1z4LnPA9fCRc3vcznTqF1oXOtOoUpAGcVISxekb2 8SAp1zhVJWS7rMOldta3d6pR+rB52xjrjyGP0+Y1I6+REcCQR24IUWuvOeeTWqpu1ZE8 4zr9ieuy0sjn/yramWe6v9t9HH/r7aMOcEh4lJZ7mFhSIuLa6jgohDJKwsEaXVEXPXWy IIagrMKT66yKmUzqWDuJpGtgtwuda/y3ff3TZAV5+5brOAbNzxT7yu0PjEBcqQLMJ8Jx 68Tw== X-Gm-Message-State: AA+aEWaiVJhpKzPBoARS7Opnv7hj5n3W3voy8FC/41kQTLqLTrcwvRlS mnwc7fCryT48m9zKyGrUgzAdwQ== X-Google-Smtp-Source: AFSGD/V0OW9eQwAeeF+zZBpXIVbKyTDvQxpLODp04wWiTK1Y3De3mqD9xuTPpfygiAI5dvM2R+A/fA== X-Received: by 2002:a25:14d5:: with SMTP id 204-v6mr24624704ybu.109.1544027406847; Wed, 05 Dec 2018 08:30:06 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id n133sm6460470ywb.55.2018.12.05.08.30.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 08:30:06 -0800 (PST) From: Sean Paul Cc: robdclark@gmail.com, jsanka@codeaurora.org, Sean Paul , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 4/9] drm/msm: Don't track planes in msm private struct Date: Wed, 5 Dec 2018 11:29:36 -0500 Message-Id: <20181205162958.25025-4-sean@poorly.run> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog In-Reply-To: <20181205162958.25025-1-sean@poorly.run> References: <20181205162958.25025-1-sean@poorly.run> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul drm core already tracks this, so we can just lean on that instead of tracking ourselves. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 7 +++---- 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.h | 3 --- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index cbebc04e2d6ef..8dede6cb9b7d7 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -496,6 +496,7 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) { struct msm_drm_private *priv; struct drm_crtc *crtc; + struct drm_plane *plane; struct drm_encoder *encoder; int i; @@ -514,9 +515,8 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) drm_for_each_crtc(crtc, dpu_kms->dev) crtc->funcs->destroy(crtc); - for (i = 0; i < priv->num_planes; i++) - priv->planes[i]->funcs->destroy(priv->planes[i]); - priv->num_planes = 0; + drm_for_each_plane(plane, dpu_kms->dev) + plane->funcs->destroy(plane); for (i = 0; i < priv->num_connectors; i++) priv->connectors[i]->funcs->destroy(priv->connectors[i]); @@ -581,7 +581,6 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms) ret = PTR_ERR(plane); goto fail; } - 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 527a4ee06819f..40e2b462a03e1 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -325,7 +325,6 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms, static int modeset_init(struct mdp4_kms *mdp4_kms) { struct drm_device *dev = mdp4_kms->dev; - struct msm_drm_private *priv = dev->dev_private; struct drm_plane *plane; struct drm_crtc *crtc; int i, ret; @@ -356,7 +355,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 7cf54737944e4..0a1fa40d375ce 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c @@ -451,7 +451,6 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms, static int modeset_init(struct mdp5_kms *mdp5_kms) { struct drm_device *dev = mdp5_kms->dev; - struct msm_drm_private *priv = dev->dev_private; struct drm_encoder *encoder; const struct mdp5_cfg_hw *hw_cfg; unsigned int num_crtcs; @@ -502,7 +501,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/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 1902713ed84b0..6cd61199d20a0 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -191,9 +191,6 @@ struct msm_drm_private { struct workqueue_struct *wq; - unsigned int num_planes; - struct drm_plane *planes[MAX_PLANES]; - struct msm_drm_thread disp_thread[MAX_CRTCS]; struct msm_drm_thread event_thread[MAX_CRTCS]; From patchwork Wed Dec 5 16:29:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10714565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2868914E2 for ; Wed, 5 Dec 2018 16:30:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 155422DC63 for ; Wed, 5 Dec 2018 16:30:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13B442DC14; Wed, 5 Dec 2018 16:30:12 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 886902DC51 for ; Wed, 5 Dec 2018 16:30:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727177AbeLEQaL (ORCPT ); Wed, 5 Dec 2018 11:30:11 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:37409 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727103AbeLEQaK (ORCPT ); Wed, 5 Dec 2018 11:30:10 -0500 Received: by mail-yw1-f65.google.com with SMTP id h193so8778455ywc.4 for ; Wed, 05 Dec 2018 08:30:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AFvJWLAJMpKA64yaJT6R+QidA40COE2wXiKPh9wS1Hc=; b=KG/LFGsj6AjdbTPdxMrdhy45VjlEiG+aN5oS4kGGwllskHUTQ8+ZI995eCcQzupz2k iOJzthpL8djiRpzz9G2/QKvNbAo4tkagTOmUTlwbso4SS8kWTNxN0ynCWEKDVDAIr2Yt 2uxtSsvir9qEAxwYl1F6UeZCdqjCEtykhi3pnVuxvcOMsYqDFpH0q9PTM7xvgPx5Y/t4 LC0i0pe0twQvFiVIK2FAxG+v6QRynXXjRAksJlMZklGQvmxh7MyV4B2Ur4osJOuxUjud QskhJB/nqrIPK63CYStIbNYEWnCP7xZ7KqOloNM/kcF0CKhqUjrSsd0w6viEVfoCD664 AMGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AFvJWLAJMpKA64yaJT6R+QidA40COE2wXiKPh9wS1Hc=; b=A/0IhrB+zbj+ta7ziQEzLtRvBUuWrwtd6ZtvzcEfBNu+CQfUdz5KCLS2JTgn5rPssD /M8l7N7IXbH20i/WalW65E1kdWJ1jc+QR6iklEU/BQVo1ZnD3uDCVwlI5mYM7lAd3l9g +SjnoASwr5YcNdB9gziXi6QNLHzqlzjaICA50J7fwRrXgUGQY2nm65ak6IYD8a4MaTCF p7tFoNd+wVT5r78YoYPT4FsfAHxtnSv3VRemDU66T0ovdDH0ge4X9HZg11uMUs5N4ehG VDv9+kyVyGfsEsGvLe2u4RS3mjp6MzVBWdvRGooGBUucCScFqfHo/hKe8SYIz2ZVcaRk zrpg== X-Gm-Message-State: AA+aEWaYcGWG3eI9yj7z2MLMGVEpsZaL8El8hQP+es2wGZTeuOUeZoT/ goET/TX15FnVDyncIkAxfI8zWTJQCXk= X-Google-Smtp-Source: AFSGD/VbhxsN8V44+ZdxDbMP9z+Ze8quGzlZDnPoB0Xw9ZvnJbLQsvF+iTMoMFatya0IKdEyVOqI3w== X-Received: by 2002:a81:1fd4:: with SMTP id f203mr24384944ywf.422.1544027408583; Wed, 05 Dec 2018 08:30:08 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id n133sm6460470ywb.55.2018.12.05.08.30.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 08:30:08 -0800 (PST) From: Sean Paul Cc: robdclark@gmail.com, jsanka@codeaurora.org, Sean Paul , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 5/9] drm/msm: Don't track connectors in msm private struct Date: Wed, 5 Dec 2018 11:29:37 -0500 Message-Id: <20181205162958.25025-5-sean@poorly.run> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog In-Reply-To: <20181205162958.25025-1-sean@poorly.run> References: <20181205162958.25025-1-sean@poorly.run> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul drm core already tracks this, so we can just lean on that instead of tracking ourselves. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 10 ++++++---- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 3 --- drivers/gpu/drm/msm/dsi/dsi.c | 2 -- drivers/gpu/drm/msm/edp/edp.c | 3 --- drivers/gpu/drm/msm/hdmi/hdmi.c | 3 --- drivers/gpu/drm/msm/msm_drv.h | 3 --- drivers/gpu/drm/msm/msm_fbdev.c | 2 +- 7 files changed, 7 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 8dede6cb9b7d7..4f2fcdfe2644e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -498,7 +498,8 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) struct drm_crtc *crtc; struct drm_plane *plane; struct drm_encoder *encoder; - int i; + struct drm_connector_list_iter conn_iter; + struct drm_connector *connector; if (!dpu_kms) { DPU_ERROR("invalid dpu_kms\n"); @@ -518,9 +519,10 @@ static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms) drm_for_each_plane(plane, dpu_kms->dev) plane->funcs->destroy(plane); - for (i = 0; i < priv->num_connectors; i++) - priv->connectors[i]->funcs->destroy(priv->connectors[i]); - priv->num_connectors = 0; + drm_connector_list_iter_begin(dpu_kms->dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) + connector->funcs->destroy(connector); + drm_connector_list_iter_end(&conn_iter); drm_for_each_encoder(encoder, dpu_kms->dev) encoder->funcs->destroy(encoder); diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c index 40e2b462a03e1..e86134fed2244 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c @@ -265,9 +265,6 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms, DRM_DEV_ERROR(dev->dev, "failed to initialize LVDS connector\n"); return PTR_ERR(connector); } - - priv->connectors[priv->num_connectors++] = connector; - break; case DRM_MODE_ENCODER_TMDS: encoder = mdp4_dtv_encoder_init(dev); diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 97b906a9b3945..e1d990f316732 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -250,8 +250,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, goto fail; } - priv->connectors[priv->num_connectors++] = msm_dsi->connector; - return 0; fail: /* bridge/connector are normally destroyed by drm: */ diff --git a/drivers/gpu/drm/msm/edp/edp.c b/drivers/gpu/drm/msm/edp/edp.c index 694c2d43011f6..10adf89d5d469 100644 --- a/drivers/gpu/drm/msm/edp/edp.c +++ b/drivers/gpu/drm/msm/edp/edp.c @@ -148,7 +148,6 @@ int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev, struct drm_encoder *encoder) { struct platform_device *pdev = edp->pdev; - struct msm_drm_private *priv = dev->dev_private; int ret; edp->encoder = encoder; @@ -188,8 +187,6 @@ int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev, encoder->bridge = edp->bridge; - priv->connectors[priv->num_connectors++] = edp->connector; - return 0; fail: diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index 1901ae820ef0b..ce564331e6080 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -291,7 +291,6 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev) int msm_hdmi_modeset_init(struct hdmi *hdmi, struct drm_device *dev, struct drm_encoder *encoder) { - struct msm_drm_private *priv = dev->dev_private; struct platform_device *pdev = hdmi->pdev; int ret; @@ -340,8 +339,6 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, encoder->bridge = hdmi->bridge; - priv->connectors[priv->num_connectors++] = hdmi->connector; - platform_set_drvdata(pdev, hdmi); return 0; diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 6cd61199d20a0..6c013addce68c 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -194,9 +194,6 @@ struct msm_drm_private { struct msm_drm_thread disp_thread[MAX_CRTCS]; struct msm_drm_thread event_thread[MAX_CRTCS]; - unsigned int num_connectors; - struct drm_connector *connectors[MAX_CONNECTORS]; - /* Properties */ struct drm_property *plane_property[PLANE_PROP_MAX_NUM]; diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index c03e860ba737f..a62ef39d65f25 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c @@ -174,7 +174,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) drm_fb_helper_prepare(dev, helper, &msm_fb_helper_funcs); - ret = drm_fb_helper_init(dev, helper, priv->num_connectors); + ret = drm_fb_helper_init(dev, helper, dev->mode_config.num_connector); if (ret) { DRM_DEV_ERROR(dev->dev, "could not init fbdev: ret=%d\n", ret); goto fail; From patchwork Wed Dec 5 16:29:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10714569 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 16EBE13AF for ; Wed, 5 Dec 2018 16:30:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 087412DC66 for ; Wed, 5 Dec 2018 16:30:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F143A2DC8E; Wed, 5 Dec 2018 16:30:12 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88A812DC6C for ; Wed, 5 Dec 2018 16:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727103AbeLEQaM (ORCPT ); Wed, 5 Dec 2018 11:30:12 -0500 Received: from mail-yw1-f67.google.com ([209.85.161.67]:40841 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728102AbeLEQaL (ORCPT ); Wed, 5 Dec 2018 11:30:11 -0500 Received: by mail-yw1-f67.google.com with SMTP id r130so8770801ywg.7 for ; Wed, 05 Dec 2018 08:30:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TcBxYvhDgOXfovQonTT/DRAOmEBO6f/w9cFOsK5SsY0=; b=HjP76d6L6hcsroUDYIjKs36mtFu7MX9gXXgUsvSsURJzgi6i2JieDa1J0WidyNTtQJ TK1QXU1vPGYWrEwI64qWO6F1HNSphd10oYUaiKC0pzGY/+ZTQkLfymXQXHNgmjQvm2YN QXBhRBGPXObH8sTHlIWQPxgpqaMTWIsAsU/O6YsUGcCRW4FEwTMtE0Dnjr6YpspsMGMX /XjX//VxixKnHsXajrp3QF+++R3Bt/W5N9SPqy7FoPk5CwqrnUSErE/Psnxtv23px51P ApvarlwBgHAdfMQNkOwmVtSpE7SX3gfo+tSZvIFMLo5LBC8Hkhg5aBbYmYuGWNbRvhO6 tmgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TcBxYvhDgOXfovQonTT/DRAOmEBO6f/w9cFOsK5SsY0=; b=nl2nFM14iBvrbrbPLrxaWSBchTWpTr3vAcv2TZEbSLRA9iZ27yaZz3LbAU7c+mN4xB 3Ozigrom24EsQUJN/3glXyC3kwz+rTiZSdwo17ynJeApxxEpy5VFCXNAX48gw+DPGK5A 3U0wlwA14ZO3yqJ/phj+k/zSu0abdlE8IMkNGwxoSVkm+aTs+7qOQueBbZQlYStfrezp YtZJ3Fxz1tnzb8RXnZU+mFwyPxCrkftkym4b+GIMXuspmG1zOuJM700J7AO7d4Q++zdD uhAO7ycACNuz/EpsufsNqfz0oSAQVCESEDP1Y/JSTXAzBMUUSSngcrg3G9amBsXqlK/d a3BA== X-Gm-Message-State: AA+aEWaX5W5SbgJHm7/PmOMhdAYlk+HcEzNCEpfZqNPqNTKZ4Fcgk/lW JeL/eJLSc4wTlCd4gSDddlEhhQ== X-Google-Smtp-Source: AFSGD/W4jpFkbycX57BeTCS88b1iYQ6t2HHTuFXwBxb8dw0+vUtoKM90J/XEHmLERdq2bKg7j8JoIg== X-Received: by 2002:a81:1492:: with SMTP id 140mr24359380ywu.333.1544027410762; Wed, 05 Dec 2018 08:30:10 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id n133sm6460470ywb.55.2018.12.05.08.30.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 08:30:10 -0800 (PST) From: Sean Paul Cc: robdclark@gmail.com, jsanka@codeaurora.org, Sean Paul , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 6/9] drm/msm: mdp5: Remove premultiplied from plane state Date: Wed, 5 Dec 2018 11:29:38 -0500 Message-Id: <20181205162958.25025-6-sean@poorly.run> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog In-Reply-To: <20181205162958.25025-1-sean@poorly.run> References: <20181205162958.25025-1-sean@poorly.run> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul It's always 0, and not exposed via property, so remove it and all affected code. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 13 +------------ drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h | 1 - drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 2 -- drivers/gpu/drm/msm/msm_drv.h | 1 - 4 files changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c index c5fde1a4191aa..035be33405f08 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c @@ -310,18 +310,7 @@ static void blend_setup(struct drm_crtc *crtc) DBG("Stage %d fg_alpha %x bg_alpha %x", i, fg_alpha, bg_alpha); - if (format->alpha_enable && pstates[i]->premultiplied) { - blend_op = MDP5_LM_BLEND_OP_MODE_FG_ALPHA(FG_CONST) | - MDP5_LM_BLEND_OP_MODE_BG_ALPHA(FG_PIXEL); - if (fg_alpha != 0xff) { - bg_alpha = fg_alpha; - blend_op |= - MDP5_LM_BLEND_OP_MODE_BG_MOD_ALPHA | - MDP5_LM_BLEND_OP_MODE_BG_INV_MOD_ALPHA; - } else { - blend_op |= MDP5_LM_BLEND_OP_MODE_BG_INV_ALPHA; - } - } else if (format->alpha_enable) { + if (format->alpha_enable) { blend_op = MDP5_LM_BLEND_OP_MODE_FG_ALPHA(FG_PIXEL) | MDP5_LM_BLEND_OP_MODE_BG_ALPHA(FG_PIXEL); if (fg_alpha != 0xff) { diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h index 854dfd30e8292..61b3331dcab9c 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h @@ -108,7 +108,6 @@ struct mdp5_plane_state { struct mdp5_hw_pipe *r_hwpipe; /* right hwpipe */ /* aligned with property */ - uint8_t premultiplied; uint8_t zpos; uint8_t alpha; diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c index 1a36d6f612826..e96aff8e55757 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c @@ -174,7 +174,6 @@ mdp5_plane_atomic_print_state(struct drm_printer *p, drm_printf(p, "\tright-hwpipe=%s\n", pstate->r_hwpipe ? pstate->r_hwpipe->name : "(null)"); - drm_printf(p, "\tpremultiplied=%u\n", pstate->premultiplied); drm_printf(p, "\tzpos=%u\n", pstate->zpos); drm_printf(p, "\talpha=%u\n", pstate->alpha); drm_printf(p, "\tstage=%s\n", stage2name(pstate->stage)); @@ -192,7 +191,6 @@ static void mdp5_plane_reset(struct drm_plane *plane) /* assign default blend parameters */ mdp5_state->alpha = 255; - mdp5_state->premultiplied = 0; if (plane->type == DRM_PLANE_TYPE_PRIMARY) mdp5_state->zpos = STAGE_BASE; diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 6c013addce68c..b6aa04511ded9 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -73,7 +73,6 @@ struct msm_file_private { enum msm_mdp_plane_property { PLANE_PROP_ZPOS, PLANE_PROP_ALPHA, - PLANE_PROP_PREMULTIPLIED, PLANE_PROP_MAX_NUM }; From patchwork Wed Dec 5 16:29:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10714571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF7E314E2 for ; Wed, 5 Dec 2018 16:30:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF7552D027 for ; Wed, 5 Dec 2018 16:30:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADAB22DC9E; Wed, 5 Dec 2018 16:30:14 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FF532DCAC for ; Wed, 5 Dec 2018 16:30:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727436AbeLEQaN (ORCPT ); Wed, 5 Dec 2018 11:30:13 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:36096 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727429AbeLEQaN (ORCPT ); Wed, 5 Dec 2018 11:30:13 -0500 Received: by mail-yb1-f196.google.com with SMTP id w203so4811221ybg.3 for ; Wed, 05 Dec 2018 08:30:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ctkl0GTGA80LHhrezbVlODyEHhudGv5yalbggZE0d84=; b=Wp1zzp81p1bbM4nxdaBQRPtS2/E7MfmVKSbVMdWu4LkhQ1zoywjQWklPJVb5Ad9Z+6 A3CMmHuT80wR1wuUZJB/dszqSCSauQneqgzPUx4J6PuUs1GnN18CLoBDM+hmTTPuipwz FSyyzKQPaFPx0ccLW2F2Q0u+LL3qa4jUFrZvyEmGmF6400U244V70/Q0X+LJf6Il6iv5 YvmhgF57uUmX85sYYgMhyBWAY/OdujdVFNsQZJUQZ+RdNqDI7mSRSC9CNXYtVx4fG2OJ 7AalsMjalCs6Fw9UMrzdEwyrANXjBGXna56spq6SFvwFWZ5xyxgSXxHdBGn8dn2FVfZa AfuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ctkl0GTGA80LHhrezbVlODyEHhudGv5yalbggZE0d84=; b=om1ERYHZ0PnbaEHicKz/TuJgbIaRuXWLl4cdfc4YeIQOtjd8vuY7y+rPSK7LoT4fRO SiuUPsDtspSyAPZrjRMuPcvF3cuJOjEMIhEFuabmxWAMTb8ZZsLofq4RhT1zL0L8jqOP 38+2Bwyl8OQMECkGj6LS+uuVksUtVopaj8my2RtWpIl8iyZHiQ5iZxDl6dC+ZUGhV17M BIv/ARJfjN4RqLQRCZiEfTMhsxHgIJ6qMKznR3MHQcUk5FZCDpWuYqAWXD70SnThelE/ fhi8WAYeMzXUTGArjv2IdHAUUAFXfQt8NOjckppZRlzT02eUlm40Vs/4Wgv2bdikbSi1 vKfw== X-Gm-Message-State: AA+aEWbeCEl8ygJrIrgmcyrKeJHhOL9W52FN8vZNq20uL+0olibMonb5 B+O8Cy5mzfFLinmerG/vmLhqFg== X-Google-Smtp-Source: AFSGD/V0SO0NhmNmRKRWBkGI8G9bWKVh/Ig/zorO4B8gt/UNAwcy5tS5XRNfz6byx3j8qJ+ZVwGhUA== X-Received: by 2002:a25:1986:: with SMTP id 128-v6mr24144629ybz.234.1544027412404; Wed, 05 Dec 2018 08:30:12 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id n133sm6460470ywb.55.2018.12.05.08.30.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 08:30:12 -0800 (PST) From: Sean Paul Cc: robdclark@gmail.com, jsanka@codeaurora.org, Sean Paul , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 7/9] drm/msm: mdp5: Remove alpha from plane state Date: Wed, 5 Dec 2018 11:29:39 -0500 Message-Id: <20181205162958.25025-7-sean@poorly.run> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog In-Reply-To: <20181205162958.25025-1-sean@poorly.run> References: <20181205162958.25025-1-sean@poorly.run> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul It's always 0xFF, so remove it and any code that relies on it being != 0xFF. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 27 ++++++---------------- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h | 1 - drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 4 ---- drivers/gpu/drm/msm/msm_drv.h | 1 - 4 files changed, 7 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c index 035be33405f08..bfa97ec063965 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c @@ -230,7 +230,7 @@ static void blend_setup(struct drm_crtc *crtc) struct mdp5_hw_mixer *r_mixer = pipeline->r_mixer; uint32_t r_lm = r_mixer ? r_mixer->lm : 0; struct mdp5_ctl *ctl = mdp5_cstate->ctl; - uint32_t blend_op, fg_alpha, bg_alpha, ctl_blend_flags = 0; + uint32_t blend_op, ctl_blend_flags = 0; unsigned long flags; enum mdp5_pipe stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { { SSPP_NONE } }; enum mdp5_pipe r_stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { { SSPP_NONE } }; @@ -300,44 +300,31 @@ static void blend_setup(struct drm_crtc *crtc) plane = pstates[i]->base.plane; blend_op = MDP5_LM_BLEND_OP_MODE_FG_ALPHA(FG_CONST) | MDP5_LM_BLEND_OP_MODE_BG_ALPHA(BG_CONST); - fg_alpha = pstates[i]->alpha; - bg_alpha = 0xFF - pstates[i]->alpha; if (!format->alpha_enable && bg_alpha_enabled) mixer_op_mode = 0; else mixer_op_mode |= mdp5_lm_use_fg_alpha_mask(i); - DBG("Stage %d fg_alpha %x bg_alpha %x", i, fg_alpha, bg_alpha); - if (format->alpha_enable) { blend_op = MDP5_LM_BLEND_OP_MODE_FG_ALPHA(FG_PIXEL) | - MDP5_LM_BLEND_OP_MODE_BG_ALPHA(FG_PIXEL); - if (fg_alpha != 0xff) { - bg_alpha = fg_alpha; - blend_op |= - MDP5_LM_BLEND_OP_MODE_FG_MOD_ALPHA | - MDP5_LM_BLEND_OP_MODE_FG_INV_MOD_ALPHA | - MDP5_LM_BLEND_OP_MODE_BG_MOD_ALPHA | - MDP5_LM_BLEND_OP_MODE_BG_INV_MOD_ALPHA; - } else { - blend_op |= MDP5_LM_BLEND_OP_MODE_BG_INV_ALPHA; - } + MDP5_LM_BLEND_OP_MODE_BG_ALPHA(FG_PIXEL) | + MDP5_LM_BLEND_OP_MODE_BG_INV_ALPHA; } mdp5_write(mdp5_kms, REG_MDP5_LM_BLEND_OP_MODE(lm, blender(i)), blend_op); mdp5_write(mdp5_kms, REG_MDP5_LM_BLEND_FG_ALPHA(lm, - blender(i)), fg_alpha); + blender(i)), 0xFF); mdp5_write(mdp5_kms, REG_MDP5_LM_BLEND_BG_ALPHA(lm, - blender(i)), bg_alpha); + blender(i)), 0); if (r_mixer) { mdp5_write(mdp5_kms, REG_MDP5_LM_BLEND_OP_MODE(r_lm, blender(i)), blend_op); mdp5_write(mdp5_kms, REG_MDP5_LM_BLEND_FG_ALPHA(r_lm, - blender(i)), fg_alpha); + blender(i)), 0xFF); mdp5_write(mdp5_kms, REG_MDP5_LM_BLEND_BG_ALPHA(r_lm, - blender(i)), bg_alpha); + blender(i)), 0); } } diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h index 61b3331dcab9c..8605a7dee44c1 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h @@ -109,7 +109,6 @@ struct mdp5_plane_state { /* aligned with property */ uint8_t zpos; - uint8_t alpha; /* assigned by crtc blender */ enum mdp_mixer_stage_id stage; diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c index e96aff8e55757..5ea06804cef2b 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c @@ -175,7 +175,6 @@ mdp5_plane_atomic_print_state(struct drm_printer *p, pstate->r_hwpipe ? pstate->r_hwpipe->name : "(null)"); drm_printf(p, "\tzpos=%u\n", pstate->zpos); - drm_printf(p, "\talpha=%u\n", pstate->alpha); drm_printf(p, "\tstage=%s\n", stage2name(pstate->stage)); } @@ -189,9 +188,6 @@ static void mdp5_plane_reset(struct drm_plane *plane) kfree(to_mdp5_plane_state(plane->state)); mdp5_state = kzalloc(sizeof(*mdp5_state), GFP_KERNEL); - /* assign default blend parameters */ - mdp5_state->alpha = 255; - if (plane->type == DRM_PLANE_TYPE_PRIMARY) mdp5_state->zpos = STAGE_BASE; else diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index b6aa04511ded9..a578bad540130 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -72,7 +72,6 @@ struct msm_file_private { enum msm_mdp_plane_property { PLANE_PROP_ZPOS, - PLANE_PROP_ALPHA, PLANE_PROP_MAX_NUM }; From patchwork Wed Dec 5 16:29:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10714575 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1EF1D13AF for ; Wed, 5 Dec 2018 16:30:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C9282DC67 for ; Wed, 5 Dec 2018 16:30:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A7632DCBC; Wed, 5 Dec 2018 16:30:17 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FDE42DC6A for ; Wed, 5 Dec 2018 16:30:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727645AbeLEQaQ (ORCPT ); Wed, 5 Dec 2018 11:30:16 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:40844 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727429AbeLEQaQ (ORCPT ); Wed, 5 Dec 2018 11:30:16 -0500 Received: by mail-yw1-f66.google.com with SMTP id r130so8770877ywg.7 for ; Wed, 05 Dec 2018 08:30:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MNSoVxpbDAFulqdzGJF0tl4VqfCNxxkqjPheU9YEYlw=; b=JsfnYwSiDbVg8UDNKp0/xqo+USjSJ5+Cz++lJBnnqrwzNtoFiWVyu36K9cD/bWSdvH G1et3oMTZ8cBQVnBZx0Y72/R10WAWFZML9s6XZtRnUUwuR0iHhnJji1eBLSmQLcdTBWo uPdJBmwlxg0rcM10/tjRvhxNfR+GoPiJDeikUpmhn1ovYCdCaBDxOUINCcAvXcftz5h8 hJWG/XGbaaM6GZ46vDoMigx95d9hTFPSZ8HMH5Su8iQGsacA42/IanZ1uTuWWxG08QL8 9UoGSydYQoYA5yCb6RlGAMvmJyuf/2o9WjLC9X4RcUlJCRwD3HDZwvCEuHL/gJvAou2o 0F+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MNSoVxpbDAFulqdzGJF0tl4VqfCNxxkqjPheU9YEYlw=; b=QayKF5r5GtBRQTVYTNTRH80Tvp+B+AkWrEVIvV80bp4O6Rt5sBWWOe5y6J1b3kBFY5 ZsmzS6IF9xRzYnnP1URo+SB6i3LSIHpUvb8Bnt1JLwIhSjY0ruvw58v/tJxajhOriLyI mdOZeC/xYIvpnsBFBKEsyYewVMFURuoRIXfSqYUycLySkfqrni6JEOkgAZnJIz6oWu7W hcaAOA6MchddpZNO0LBZN18inLOtDhwt7B4i343/PbJ8DmaJJHiAPVwYUwzDQfjaBiGd Zv1tIhEu8Fx8WC+H+3+PKrzrguYAPUmNGovZ+g5c2BoeZylSgIdEOZ1eUwQe8GuzlB6w fyZA== X-Gm-Message-State: AA+aEWYy0GAmX3QWm5S5hojyrOFGgllCtxy96UqFP3jGKpo97eKSUkwF 9lwTguIcji4kwuoxbhTJXebeRg== X-Google-Smtp-Source: AFSGD/UmIK9hweY+JfL6OWLn7wwkqPQ+HqLYhz6xDMri9ymyfbXwVLrv3kPD/sATAFzciCQsKJlTXg== X-Received: by 2002:a81:b657:: with SMTP id h23mr25241209ywk.378.1544027414070; Wed, 05 Dec 2018 08:30:14 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id n133sm6460470ywb.55.2018.12.05.08.30.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 08:30:13 -0800 (PST) From: Sean Paul Cc: robdclark@gmail.com, jsanka@codeaurora.org, Sean Paul , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 8/9] drm/msm: mdp5: Remove mdp5_plane_install_rotation_property() Date: Wed, 5 Dec 2018 11:29:40 -0500 Message-Id: <20181205162958.25025-8-sean@poorly.run> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog In-Reply-To: <20181205162958.25025-1-sean@poorly.run> References: <20181205162958.25025-1-sean@poorly.run> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Just call drm_plane_create_rotation_property() directly Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c index 5ea06804cef2b..41590588a6f39 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c @@ -52,17 +52,6 @@ static void mdp5_plane_destroy(struct drm_plane *plane) kfree(mdp5_plane); } -static void mdp5_plane_install_rotation_property(struct drm_device *dev, - struct drm_plane *plane) -{ - drm_plane_create_rotation_property(plane, - DRM_MODE_ROTATE_0, - DRM_MODE_ROTATE_0 | - DRM_MODE_ROTATE_180 | - DRM_MODE_REFLECT_X | - DRM_MODE_REFLECT_Y); -} - /* helper to install properties which are common to planes and crtcs */ static void mdp5_plane_install_properties(struct drm_plane *plane, struct drm_mode_object *obj) @@ -98,7 +87,12 @@ static void mdp5_plane_install_properties(struct drm_plane *plane, INSTALL_RANGE_PROPERTY(zpos, ZPOS, 1, 255, 1); - mdp5_plane_install_rotation_property(dev, plane); + drm_plane_create_rotation_property(plane, + DRM_MODE_ROTATE_0, + DRM_MODE_ROTATE_0 | + DRM_MODE_ROTATE_180 | + DRM_MODE_REFLECT_X | + DRM_MODE_REFLECT_Y); #undef INSTALL_RANGE_PROPERTY #undef INSTALL_ENUM_PROPERTY From patchwork Wed Dec 5 16:29:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10714579 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 72B9C13AF for ; Wed, 5 Dec 2018 16:30:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F70E2DCB5 for ; Wed, 5 Dec 2018 16:30:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51E472DC42; Wed, 5 Dec 2018 16:30:19 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91B042D024 for ; Wed, 5 Dec 2018 16:30:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726918AbeLEQaS (ORCPT ); Wed, 5 Dec 2018 11:30:18 -0500 Received: from mail-yw1-f67.google.com ([209.85.161.67]:40847 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727429AbeLEQaR (ORCPT ); Wed, 5 Dec 2018 11:30:17 -0500 Received: by mail-yw1-f67.google.com with SMTP id r130so8770918ywg.7 for ; Wed, 05 Dec 2018 08:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ngd2Aw/DW8VqdrZtDdTzB+U6Pf80gAkmc9rvJ2vnxo8=; b=egVH74RhhXbmixxLAHggGTDHVhm1VOE8Mmq5YZkZeW1i+TC63jNmIdj+NYMVP79qaY 4cdnLQG7IFP4WuPZDUUY4tpiFbTLz6vuyiieZY1qJ5JeCS2iF4ufSViWGM0z4nyfTtZf eTF22dH9G6tCm4mVRWj8xj1Q0J09L5XCbVpspvz9pwbEVlTWobl1D8BVXE/YVSIuuMkv KGC0lBtAOdfFafaVN13pifs2OCzCE4GVTudNtKidF5v9oBj+PUgu2F3QMDwVbJNBWR4w Otnm8STN6Chpe596VI+yPguZGaeED/o1/wbb+Bs23wTsTtvnyBHNV97I1Ju1D13h3aEO BimA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ngd2Aw/DW8VqdrZtDdTzB+U6Pf80gAkmc9rvJ2vnxo8=; b=XylCYMVqTFvkLa3hQIA+tm62pH1Vmp8D0hyPnKFtr7iJXcd8v3nLHOHyFkW+G2Lsa5 gZ6YPcvslbHjejW7OmcgL4+fkL0kyJuzgTWeXO52Hn+gitXEzUtj+wkMLZEgf2jzoNBY DwyGjV8e5I7eOiXa5Bcpn4k01muhsoW+NBMX35fXO0/VaXB92P1j2rJb99NtoZ6SOEXv WW6EVkPkKa/Ay+5hYfW1NsnNvoqxwANzxItsTujf6lxPt+bSxGyORUqCtKPHQiu0KlW7 CsytWVUQN8+KoDg81OldQ9COctApnXdQmbF/dUJitz8XYJ9gzCwoQSHqX4HUq3uzQV1h zdow== X-Gm-Message-State: AA+aEWakz8THco4Z0vbzvFLNFBlcXlUUoWsNsXvC9JnMQphPLYJXbFv6 MZPuuuRX2EDDINNx1Nyf5uW7A32r4Rc= X-Google-Smtp-Source: AFSGD/WIX8FCqz4FVWTStbtU/dFEvqvGAHDUzriYkEaOFZ/ghJxwW8jO9pqsaKjirTbHGSsdOXqqdA== X-Received: by 2002:a81:af27:: with SMTP id n39mr24976207ywh.452.1544027415700; Wed, 05 Dec 2018 08:30:15 -0800 (PST) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id n133sm6460470ywb.55.2018.12.05.08.30.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 08:30:15 -0800 (PST) From: Sean Paul Cc: robdclark@gmail.com, jsanka@codeaurora.org, Sean Paul , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Subject: [PATCH 9/9] drm/msm: mdp5: Remove custom property code in plane Date: Wed, 5 Dec 2018 11:29:41 -0500 Message-Id: <20181205162958.25025-9-sean@poorly.run> X-Mailer: git-send-email 2.20.0.rc1.387.gf8505762e3-goog In-Reply-To: <20181205162958.25025-1-sean@poorly.run> References: <20181205162958.25025-1-sean@poorly.run> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul mdp5 only exposes one custom property, and it's zpos. Fortunately, we have a standard zpos property now, we can remove the hand-rolled property code entirely from mdp5 and rely on core. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 2 +- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h | 3 - drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 101 +-------------------- drivers/gpu/drm/msm/msm_drv.h | 8 -- 4 files changed, 3 insertions(+), 111 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c index bfa97ec063965..4ccef117ced90 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c @@ -551,7 +551,7 @@ static int pstate_cmp(const void *a, const void *b) { struct plane_state *pa = (struct plane_state *)a; struct plane_state *pb = (struct plane_state *)b; - return pa->state->zpos - pb->state->zpos; + return pa->state->base.normalized_zpos - pb->state->base.normalized_zpos; } /* is there a helper for this? */ diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h index 8605a7dee44c1..44d03fc31e323 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h @@ -107,9 +107,6 @@ struct mdp5_plane_state { struct mdp5_hw_pipe *hwpipe; struct mdp5_hw_pipe *r_hwpipe; /* right hwpipe */ - /* aligned with property */ - uint8_t zpos; - /* assigned by crtc blender */ enum mdp_mixer_stage_id stage; }; diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c index 41590588a6f39..da999d236dff2 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c @@ -56,103 +56,13 @@ static void mdp5_plane_destroy(struct drm_plane *plane) static void mdp5_plane_install_properties(struct drm_plane *plane, struct drm_mode_object *obj) { - struct drm_device *dev = plane->dev; - struct msm_drm_private *dev_priv = dev->dev_private; - struct drm_property *prop; - -#define INSTALL_PROPERTY(name, NAME, init_val, fnc, ...) do { \ - prop = dev_priv->plane_property[PLANE_PROP_##NAME]; \ - if (!prop) { \ - prop = drm_property_##fnc(dev, 0, #name, \ - ##__VA_ARGS__); \ - if (!prop) { \ - dev_warn(dev->dev, \ - "Create property %s failed\n", \ - #name); \ - return; \ - } \ - dev_priv->plane_property[PLANE_PROP_##NAME] = prop; \ - } \ - drm_object_attach_property(&plane->base, prop, init_val); \ - } while (0) - -#define INSTALL_RANGE_PROPERTY(name, NAME, min, max, init_val) \ - INSTALL_PROPERTY(name, NAME, init_val, \ - create_range, min, max) - -#define INSTALL_ENUM_PROPERTY(name, NAME, init_val) \ - INSTALL_PROPERTY(name, NAME, init_val, \ - create_enum, name##_prop_enum_list, \ - ARRAY_SIZE(name##_prop_enum_list)) - - INSTALL_RANGE_PROPERTY(zpos, ZPOS, 1, 255, 1); - + drm_plane_create_zpos_property(plane, 1, 1, 255); drm_plane_create_rotation_property(plane, DRM_MODE_ROTATE_0, DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y); - -#undef INSTALL_RANGE_PROPERTY -#undef INSTALL_ENUM_PROPERTY -#undef INSTALL_PROPERTY -} - -static int mdp5_plane_atomic_set_property(struct drm_plane *plane, - struct drm_plane_state *state, struct drm_property *property, - uint64_t val) -{ - struct drm_device *dev = plane->dev; - struct mdp5_plane_state *pstate; - struct msm_drm_private *dev_priv = dev->dev_private; - int ret = 0; - - pstate = to_mdp5_plane_state(state); - -#define SET_PROPERTY(name, NAME, type) do { \ - if (dev_priv->plane_property[PLANE_PROP_##NAME] == property) { \ - pstate->name = (type)val; \ - DBG("Set property %s %d", #name, (type)val); \ - goto done; \ - } \ - } while (0) - - SET_PROPERTY(zpos, ZPOS, uint8_t); - - DRM_DEV_ERROR(dev->dev, "Invalid property\n"); - ret = -EINVAL; -done: - return ret; -#undef SET_PROPERTY -} - -static int mdp5_plane_atomic_get_property(struct drm_plane *plane, - const struct drm_plane_state *state, - struct drm_property *property, uint64_t *val) -{ - struct drm_device *dev = plane->dev; - struct mdp5_plane_state *pstate; - struct msm_drm_private *dev_priv = dev->dev_private; - int ret = 0; - - pstate = to_mdp5_plane_state(state); - -#define GET_PROPERTY(name, NAME, type) do { \ - if (dev_priv->plane_property[PLANE_PROP_##NAME] == property) { \ - *val = pstate->name; \ - DBG("Get property %s %lld", #name, *val); \ - goto done; \ - } \ - } while (0) - - GET_PROPERTY(zpos, ZPOS, uint8_t); - - DRM_DEV_ERROR(dev->dev, "Invalid property\n"); - ret = -EINVAL; -done: - return ret; -#undef SET_PROPERTY } static void @@ -168,7 +78,7 @@ mdp5_plane_atomic_print_state(struct drm_printer *p, drm_printf(p, "\tright-hwpipe=%s\n", pstate->r_hwpipe ? pstate->r_hwpipe->name : "(null)"); - drm_printf(p, "\tzpos=%u\n", pstate->zpos); + drm_printf(p, "\tzpos=%u\n", pstate->base.normalized_zpos); drm_printf(p, "\tstage=%s\n", stage2name(pstate->stage)); } @@ -182,11 +92,6 @@ static void mdp5_plane_reset(struct drm_plane *plane) kfree(to_mdp5_plane_state(plane->state)); mdp5_state = kzalloc(sizeof(*mdp5_state), GFP_KERNEL); - if (plane->type == DRM_PLANE_TYPE_PRIMARY) - mdp5_state->zpos = STAGE_BASE; - else - mdp5_state->zpos = STAGE0 + drm_plane_index(plane); - mdp5_state->base.plane = plane; plane->state = &mdp5_state->base; @@ -225,8 +130,6 @@ static const struct drm_plane_funcs mdp5_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, .destroy = mdp5_plane_destroy, - .atomic_set_property = mdp5_plane_atomic_set_property, - .atomic_get_property = mdp5_plane_atomic_get_property, .reset = mdp5_plane_reset, .atomic_duplicate_state = mdp5_plane_duplicate_state, .atomic_destroy_state = mdp5_plane_destroy_state, diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index a578bad540130..60a7da09cf3b3 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -70,11 +70,6 @@ struct msm_file_private { int queueid; }; -enum msm_mdp_plane_property { - PLANE_PROP_ZPOS, - PLANE_PROP_MAX_NUM -}; - struct msm_vblank_ctrl { struct kthread_work work; struct list_head event_list; @@ -192,9 +187,6 @@ struct msm_drm_private { struct msm_drm_thread disp_thread[MAX_CRTCS]; struct msm_drm_thread event_thread[MAX_CRTCS]; - /* Properties */ - struct drm_property *plane_property[PLANE_PROP_MAX_NUM]; - /* VRAM carveout, used when no IOMMU: */ struct { unsigned long size;