Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp274537yba; Fri, 3 May 2019 01:22:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxMnvfF6P15v/xLuEEkWRBL3c38s+dbigwG6Ys7htYfkLMcbyrUTHJ0Yz6y2VetzlgqKdE X-Received: by 2002:a63:a55:: with SMTP id z21mr8697880pgk.440.1556871729744; Fri, 03 May 2019 01:22:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556871729; cv=none; d=google.com; s=arc-20160816; b=gje4oOqwjLX9ODnoW0NE2+74TOvBwJG2V2yr4eyVfXTpQplcERuoAxjctVb+bGnsh0 bmzE6BD0rHBAy4z+mOrrNQgXfL2p0ZgLihdahHKO8BDxs81QyH3qsbLx0+K3Wl9BhiLR Q1IZe4Mg/0N3ar7A8wyTE401B7gKEvnbPiulX2AmiDobmSLhjGHU8MFBp6+EJmgOSKC5 j1z32wOcwl5esFpmovCx83LL4BAPFMfIzkvEhHb3ARTuQYbubyVa4i+JAzmw90max5g2 z1B07TkWsGYNPqPEv+kGumsTxdiaZjdg3M7ww3/wwG/RIV3+weAwS7E4vz6SHRNAyZCB a+zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=olm/HHc2TtMktWFy0AL39rMg+fu96BKbplxl2mLW20s=; b=OAXXBjWV44Som7JkyMJmiLIRMm1Tu2QeCAEQwms6PbPnLUSU7X9CpFzEKD3axdQ5lj Vq4RMjcJ8fKf69/zxWAWLW7aDmsl/AuGGdOnIYrft1UTK4XewHAwbZUUqt7kmFzutrS1 US2dXxSsHBYPgY3090LpOibevsSYgAHcTYzgSud/e/GznE4upLChC8rxltiiIb9RKySP 59jUAqmxyiETr+srfGEfJQvTptN4xGjb1DESkKAKirILWaTh2d3Eas0/pHX8Y9YZmx/s LIqurQ+2yfOGEhsyd4X3uNCaW4nfGgaURurGZSNQQ+obCJD1Pm1s5eQ425XuNsnGirXl KuiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b="gjFeL3/y"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g123si1521447pfb.24.2019.05.03.01.21.54; Fri, 03 May 2019 01:22:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b="gjFeL3/y"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727279AbfECITb (ORCPT + 99 others); Fri, 3 May 2019 04:19:31 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:35968 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727263AbfECIT2 (ORCPT ); Fri, 3 May 2019 04:19:28 -0400 Received: by mail-ed1-f67.google.com with SMTP id a8so5052365edx.3 for ; Fri, 03 May 2019 01:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=olm/HHc2TtMktWFy0AL39rMg+fu96BKbplxl2mLW20s=; b=gjFeL3/yfxA7icwZNyqPlRo7tW8McJbcPyXfSxHt3cudl4hBRHFZmryuRgfVvcU8BH j6ftsq5UGzdkg8RTAZixE9LrIaqm2rKj2oHddcvb56a2qoaod0DCZMYM+GJZIOB1Qy34 2fJNGhPuN9O74gbJDTXfiy392AldSvwafn6hQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=olm/HHc2TtMktWFy0AL39rMg+fu96BKbplxl2mLW20s=; b=n0LqnuMTvdcXiGARnL6uOEUTa0cuP1hMj/FfBVJLbcn+sfCOc3ar4f91P/0m0aczlK reGMJosWVXBhWiV0iihNk8pnJhTUABc9SL6RBr/wy6qmmx5ScG6uzxb+9HrcX4/R+BsB byoQCtXhRtShoDjtnsQnlZ3cDkjl7pWw3pA1xR5q57s6kJiy2Eg+o+v4rwwe5azKcOoY gf3ePw0UmA/WcyPvc+HoziOXF7kqeEIGbOn1h32z3cUU4XTgyPafE1ksfLgXugE6+dkc R24ANwaLazJtOr6AcwPvTVJvhZQ6T9/b68BQbZ2KRz6i4Oz/pKQPrGxL3q2pNdk4txq9 A4YA== X-Gm-Message-State: APjAAAU1Mx0QLIZA9+HXkS2wJ1ard6r/7ClyjN9ReKpdsJCdBISfmH9N /HdxtlGdqN+MruUEMx/2geSXOw== X-Received: by 2002:a17:906:468e:: with SMTP id a14mr3139837ejr.152.1556871566696; Fri, 03 May 2019 01:19:26 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id f15sm250758eja.39.2019.05.03.01.19.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 May 2019 01:19:25 -0700 (PDT) Date: Fri, 3 May 2019 10:19:23 +0200 From: Daniel Vetter To: Sean Paul Cc: dri-devel@lists.freedesktop.org, Sean Paul , Daniel Vetter , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ben Skeggs , Laurent Pinchart , Kieran Bingham , Eric Anholt , Maarten Lankhorst , Maxime Ripard , David Airlie , linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org Subject: Re: [PATCH v3 04/10] drm: Convert connector_helper_funcs->atomic_check to accept drm_atomic_state Message-ID: <20190503081923.GJ3271@phenom.ffwll.local> Mail-Followup-To: Sean Paul , dri-devel@lists.freedesktop.org, Sean Paul , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Ben Skeggs , Laurent Pinchart , Kieran Bingham , Eric Anholt , Maarten Lankhorst , Maxime Ripard , David Airlie , linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org References: <20190502194956.218441-1-sean@poorly.run> <20190502194956.218441-5-sean@poorly.run> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190502194956.218441-5-sean@poorly.run> X-Operating-System: Linux phenom 4.14.0-3-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 02, 2019 at 03:49:46PM -0400, Sean Paul wrote: > From: Sean Paul > > Everyone who implements connector_helper_funcs->atomic_check reaches > into the connector state to get the atomic state. Instead of continuing > this pattern, change the callback signature to just give atomic state > and let the driver determine what it does and does not need from it. > > Eventually all atomic functions should do this, but that's just too much > busy work for me. > > Changes in v3: > - Added to the set > > Cc: Daniel Vetter > Cc: Ville Syrj?l? > Cc: Jani Nikula > Cc: Joonas Lahtinen > Cc: Rodrigo Vivi > Cc: Ben Skeggs > Cc: Laurent Pinchart > Cc: Kieran Bingham > Cc: Eric Anholt > Signed-off-by: Sean Paul Assuming it compiles everywhere and intel-gfx-ci approves too Acked-by: Daniel Vetter > --- > drivers/gpu/drm/drm_atomic_helper.c | 4 ++-- > drivers/gpu/drm/i915/intel_atomic.c | 8 +++++--- > drivers/gpu/drm/i915/intel_dp_mst.c | 7 ++++--- > drivers/gpu/drm/i915/intel_drv.h | 2 +- > drivers/gpu/drm/i915/intel_sdvo.c | 9 +++++---- > drivers/gpu/drm/i915/intel_tv.c | 8 +++++--- > drivers/gpu/drm/nouveau/dispnv50/disp.c | 5 +++-- > drivers/gpu/drm/rcar-du/rcar_lvds.c | 12 +++++++----- > drivers/gpu/drm/vc4/vc4_txp.c | 7 ++++--- > include/drm/drm_modeset_helper_vtables.h | 2 +- > 10 files changed, 37 insertions(+), 27 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c > index 9d9e47276839..fa5a367507c1 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -683,7 +683,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, > } > > if (funcs->atomic_check) > - ret = funcs->atomic_check(connector, new_connector_state); > + ret = funcs->atomic_check(connector, state); > if (ret) > return ret; > > @@ -725,7 +725,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, > continue; > > if (funcs->atomic_check) > - ret = funcs->atomic_check(connector, new_connector_state); > + ret = funcs->atomic_check(connector, state); > if (ret) > return ret; > } > diff --git a/drivers/gpu/drm/i915/intel_atomic.c b/drivers/gpu/drm/i915/intel_atomic.c > index b844e8840c6f..e8a5b82e9242 100644 > --- a/drivers/gpu/drm/i915/intel_atomic.c > +++ b/drivers/gpu/drm/i915/intel_atomic.c > @@ -103,12 +103,14 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector, > } > > int intel_digital_connector_atomic_check(struct drm_connector *conn, > - struct drm_connector_state *new_state) > + struct drm_atomic_state *state) > { > + struct drm_connector_state *new_state = > + drm_atomic_get_new_connector_state(state, conn); > struct intel_digital_connector_state *new_conn_state = > to_intel_digital_connector_state(new_state); > struct drm_connector_state *old_state = > - drm_atomic_get_old_connector_state(new_state->state, conn); > + drm_atomic_get_old_connector_state(state, conn); > struct intel_digital_connector_state *old_conn_state = > to_intel_digital_connector_state(old_state); > struct drm_crtc_state *crtc_state; > @@ -118,7 +120,7 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn, > if (!new_state->crtc) > return 0; > > - crtc_state = drm_atomic_get_new_crtc_state(new_state->state, new_state->crtc); > + crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc); > > /* > * These properties are handled by fastset, and might not end > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c > index 19d81cef2ab6..89cfec128ba0 100644 > --- a/drivers/gpu/drm/i915/intel_dp_mst.c > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c > @@ -143,9 +143,10 @@ static int intel_dp_mst_compute_config(struct intel_encoder *encoder, > > static int > intel_dp_mst_atomic_check(struct drm_connector *connector, > - struct drm_connector_state *new_conn_state) > + struct drm_atomic_state *state) > { > - struct drm_atomic_state *state = new_conn_state->state; > + struct drm_connector_state *new_conn_state = > + drm_atomic_get_new_connector_state(state, connector); > struct drm_connector_state *old_conn_state = > drm_atomic_get_old_connector_state(state, connector); > struct intel_connector *intel_connector = > @@ -155,7 +156,7 @@ intel_dp_mst_atomic_check(struct drm_connector *connector, > struct drm_dp_mst_topology_mgr *mgr; > int ret; > > - ret = intel_digital_connector_atomic_check(connector, new_conn_state); > + ret = intel_digital_connector_atomic_check(connector, state); > if (ret) > return ret; > > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > index f8c7b291fdc3..88571b8e8d62 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -2481,7 +2481,7 @@ int intel_digital_connector_atomic_set_property(struct drm_connector *connector, > struct drm_property *property, > u64 val); > int intel_digital_connector_atomic_check(struct drm_connector *conn, > - struct drm_connector_state *new_state); > + struct drm_atomic_state *state); > struct drm_connector_state * > intel_digital_connector_duplicate_state(struct drm_connector *connector); > > diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c > index 68f497493d43..72ea164b971c 100644 > --- a/drivers/gpu/drm/i915/intel_sdvo.c > +++ b/drivers/gpu/drm/i915/intel_sdvo.c > @@ -2342,9 +2342,10 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = { > }; > > static int intel_sdvo_atomic_check(struct drm_connector *conn, > - struct drm_connector_state *new_conn_state) > + struct drm_atomic_state *state) > { > - struct drm_atomic_state *state = new_conn_state->state; > + struct drm_connector_state *new_conn_state = > + drm_atomic_get_new_connector_state(state, conn); > struct drm_connector_state *old_conn_state = > drm_atomic_get_old_connector_state(state, conn); > struct intel_sdvo_connector_state *old_state = > @@ -2356,13 +2357,13 @@ static int intel_sdvo_atomic_check(struct drm_connector *conn, > (memcmp(&old_state->tv, &new_state->tv, sizeof(old_state->tv)) || > memcmp(&old_conn_state->tv, &new_conn_state->tv, sizeof(old_conn_state->tv)))) { > struct drm_crtc_state *crtc_state = > - drm_atomic_get_new_crtc_state(new_conn_state->state, > + drm_atomic_get_new_crtc_state(state, > new_conn_state->crtc); > > crtc_state->connectors_changed = true; > } > > - return intel_digital_connector_atomic_check(conn, new_conn_state); > + return intel_digital_connector_atomic_check(conn, state); > } > > static const struct drm_connector_helper_funcs intel_sdvo_connector_helper_funcs = { > diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c > index 3924c4944e1f..a41c5b467c14 100644 > --- a/drivers/gpu/drm/i915/intel_tv.c > +++ b/drivers/gpu/drm/i915/intel_tv.c > @@ -1817,16 +1817,18 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = { > }; > > static int intel_tv_atomic_check(struct drm_connector *connector, > - struct drm_connector_state *new_state) > + struct drm_atomic_state *state) > { > + struct drm_connector_state *new_state; > struct drm_crtc_state *new_crtc_state; > struct drm_connector_state *old_state; > > + new_state = drm_atomic_get_new_connector_state(state, connector); > if (!new_state->crtc) > return 0; > > - old_state = drm_atomic_get_old_connector_state(new_state->state, connector); > - new_crtc_state = drm_atomic_get_new_crtc_state(new_state->state, new_state->crtc); > + old_state = drm_atomic_get_old_connector_state(state, connector); > + new_crtc_state = drm_atomic_get_new_crtc_state(state, new_state->crtc); > > if (old_state->tv.mode != new_state->tv.mode || > old_state->tv.margins.left != new_state->tv.margins.left || > diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c > index 4b1650f51955..7ba373f493b2 100644 > --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c > +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c > @@ -948,11 +948,12 @@ nv50_mstc_get_modes(struct drm_connector *connector) > > static int > nv50_mstc_atomic_check(struct drm_connector *connector, > - struct drm_connector_state *new_conn_state) > + struct drm_atomic_state *state) > { > - struct drm_atomic_state *state = new_conn_state->state; > struct nv50_mstc *mstc = nv50_mstc(connector); > struct drm_dp_mst_topology_mgr *mgr = &mstc->mstm->mgr; > + struct drm_connector_state *new_conn_state = > + drm_atomic_get_new_connector_state(state, connector); > struct drm_connector_state *old_conn_state = > drm_atomic_get_old_connector_state(state, connector); > struct drm_crtc_state *crtc_state; > diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c > index 620b51aab291..5b81ba2a7f27 100644 > --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c > +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c > @@ -92,13 +92,15 @@ static int rcar_lvds_connector_get_modes(struct drm_connector *connector) > } > > static int rcar_lvds_connector_atomic_check(struct drm_connector *connector, > - struct drm_connector_state *state) > + struct drm_atomic_state *state) > { > struct rcar_lvds *lvds = connector_to_rcar_lvds(connector); > const struct drm_display_mode *panel_mode; > + struct drm_connector_state *conn_state; > struct drm_crtc_state *crtc_state; > > - if (!state->crtc) > + conn_state = drm_atomic_get_new_connector_state(state, connector); > + if (!conn_state->crtc) > return 0; > > if (list_empty(&connector->modes)) { > @@ -110,9 +112,9 @@ static int rcar_lvds_connector_atomic_check(struct drm_connector *connector, > struct drm_display_mode, head); > > /* We're not allowed to modify the resolution. */ > - crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc); > - if (IS_ERR(crtc_state)) > - return PTR_ERR(crtc_state); > + crtc_state = drm_atomic_get_crtc_state(state, conn_state->crtc); > + if (!crtc_state) > + return -EINVAL; > > if (crtc_state->mode.hdisplay != panel_mode->hdisplay || > crtc_state->mode.vdisplay != panel_mode->vdisplay) > diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c > index c8b89a78f9f4..96f91c1b4b6e 100644 > --- a/drivers/gpu/drm/vc4/vc4_txp.c > +++ b/drivers/gpu/drm/vc4/vc4_txp.c > @@ -221,17 +221,18 @@ static const u32 txp_fmts[] = { > }; > > static int vc4_txp_connector_atomic_check(struct drm_connector *conn, > - struct drm_connector_state *conn_state) > + struct drm_atomic_state *state) > { > + struct drm_connector_state *conn_state; > struct drm_crtc_state *crtc_state; > struct drm_framebuffer *fb; > int i; > > + conn_state = drm_atomic_get_new_connector_state(state, conn); > if (!conn_state->writeback_job || !conn_state->writeback_job->fb) > return 0; > > - crtc_state = drm_atomic_get_new_crtc_state(conn_state->state, > - conn_state->crtc); > + crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); > > fb = conn_state->writeback_job->fb; > if (fb->width != crtc_state->mode.hdisplay || > diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h > index de57fb40cb6e..adc8b7cf64b5 100644 > --- a/include/drm/drm_modeset_helper_vtables.h > +++ b/include/drm/drm_modeset_helper_vtables.h > @@ -1020,7 +1020,7 @@ struct drm_connector_helper_funcs { > * deadlock. > */ > int (*atomic_check)(struct drm_connector *connector, > - struct drm_connector_state *state); > + struct drm_atomic_state *state); > > /** > * @atomic_commit: > -- > Sean Paul, Software Engineer, Google / Chromium OS > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch