linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Dave Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics <intel-gfx@lists.freedesktop.org>,
	DRI <dri-devel@lists.freedesktop.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Maxime Ripard <maxime@cerno.tech>
Subject: linux-next: manual merge of the drm tree with the drm-misc-fixes tree
Date: Tue, 30 Nov 2021 10:33:53 +1100	[thread overview]
Message-ID: <20211130103353.0ab1a44f@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 6144 bytes --]

Hi all,

Today's linux-next merge of the drm tree got a conflict in:

  drivers/gpu/drm/vc4/vc4_kms.c

between commits:

  f927767978d2 ("drm/vc4: kms: Fix return code check")
  d354699e2292 ("drm/vc4: kms: Don't duplicate pending commit")

from the drm-misc-fixes tree and commit:

  16e101051f32 ("drm/vc4: Increase the core clock based on HVS load")

from the drm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/gpu/drm/vc4/vc4_kms.c
index b61792d2aa65,79d4d9dd1394..000000000000
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@@ -337,12 -340,21 +340,21 @@@ static void vc4_atomic_commit_tail(stru
  	struct drm_device *dev = state->dev;
  	struct vc4_dev *vc4 = to_vc4_dev(dev);
  	struct vc4_hvs *hvs = vc4->hvs;
 -	struct drm_crtc_state *old_crtc_state;
  	struct drm_crtc_state *new_crtc_state;
+ 	struct vc4_hvs_state *new_hvs_state;
  	struct drm_crtc *crtc;
  	struct vc4_hvs_state *old_hvs_state;
 +	unsigned int channel;
  	int i;
  
+ 	old_hvs_state = vc4_hvs_get_old_global_state(state);
 -	if (WARN_ON(!old_hvs_state))
++	if (WARN_ON(IS_ERR(old_hvs_state)))
+ 		return;
+ 
+ 	new_hvs_state = vc4_hvs_get_new_global_state(state);
 -	if (WARN_ON(!new_hvs_state))
++	if (WARN_ON(IS_ERR(new_hvs_state)))
+ 		return;
+ 
  	for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
  		struct vc4_crtc_state *vc4_crtc_state;
  
@@@ -353,32 -365,31 +365,36 @@@
  		vc4_hvs_mask_underrun(dev, vc4_crtc_state->assigned_channel);
  	}
  
- 	old_hvs_state = vc4_hvs_get_old_global_state(state);
- 	if (IS_ERR(old_hvs_state))
- 		return;
+ 	if (vc4->hvs->hvs5) {
+ 		unsigned long core_rate = max_t(unsigned long,
+ 						500000000,
+ 						new_hvs_state->core_clock_rate);
+ 
+ 		clk_set_min_rate(hvs->core_clk, core_rate);
+ 	}
  
 -	for_each_old_crtc_in_state(state, crtc, old_crtc_state, i) {
 -		struct vc4_crtc_state *vc4_crtc_state =
 -			to_vc4_crtc_state(old_crtc_state);
 -		unsigned int channel = vc4_crtc_state->assigned_channel;
 +	for (channel = 0; channel < HVS_NUM_CHANNELS; channel++) {
 +		struct drm_crtc_commit *commit;
  		int ret;
  
 -		if (channel == VC4_HVS_CHANNEL_DISABLED)
 +		if (!old_hvs_state->fifo_state[channel].in_use)
  			continue;
  
 -		if (!old_hvs_state->fifo_state[channel].in_use)
 +		commit = old_hvs_state->fifo_state[channel].pending_commit;
 +		if (!commit)
  			continue;
  
 -		ret = drm_crtc_commit_wait(old_hvs_state->fifo_state[channel].pending_commit);
 +		ret = drm_crtc_commit_wait(commit);
  		if (ret)
  			drm_err(dev, "Timed out waiting for commit\n");
 +
 +		drm_crtc_commit_put(commit);
 +		old_hvs_state->fifo_state[channel].pending_commit = NULL;
  	}
  
 +	if (vc4->hvs->hvs5)
 +		clk_set_min_rate(hvs->core_clk, 500000000);
 +
  	drm_atomic_helper_commit_modeset_disables(dev, state);
  
  	vc4_ctm_commit(vc4, state);
@@@ -667,11 -673,19 +678,13 @@@ vc4_hvs_channels_duplicate_state(struc
  
  	__drm_atomic_helper_private_obj_duplicate_state(obj, &state->base);
  
- 
  	for (i = 0; i < HVS_NUM_CHANNELS; i++) {
  		state->fifo_state[i].in_use = old_state->fifo_state[i].in_use;
+ 		state->fifo_state[i].fifo_load = old_state->fifo_state[i].fifo_load;
 -
 -		if (!old_state->fifo_state[i].pending_commit)
 -			continue;
 -
 -		state->fifo_state[i].pending_commit =
 -			drm_crtc_commit_get(old_state->fifo_state[i].pending_commit);
  	}
  
+ 	state->core_clock_rate = old_state->core_clock_rate;
+ 
  	return &state->base;
  }
  
@@@ -826,6 -840,76 +839,76 @@@ static int vc4_pv_muxing_atomic_check(s
  	return 0;
  }
  
+ static int
+ vc4_core_clock_atomic_check(struct drm_atomic_state *state)
+ {
+ 	struct vc4_dev *vc4 = to_vc4_dev(state->dev);
+ 	struct drm_private_state *priv_state;
+ 	struct vc4_hvs_state *hvs_new_state;
+ 	struct vc4_load_tracker_state *load_state;
+ 	struct drm_crtc_state *old_crtc_state, *new_crtc_state;
+ 	struct drm_crtc *crtc;
+ 	unsigned int num_outputs;
+ 	unsigned long pixel_rate;
+ 	unsigned long cob_rate;
+ 	unsigned int i;
+ 
+ 	priv_state = drm_atomic_get_private_obj_state(state,
+ 						      &vc4->load_tracker);
+ 	if (IS_ERR(priv_state))
+ 		return PTR_ERR(priv_state);
+ 
+ 	load_state = to_vc4_load_tracker_state(priv_state);
+ 
+ 	hvs_new_state = vc4_hvs_get_global_state(state);
 -	if (!hvs_new_state)
 -		return -EINVAL;
++	if (IS_ERR(hvs_new_state))
++		return PTR_ERR(hvs_new_state);
+ 
+ 	for_each_oldnew_crtc_in_state(state, crtc,
+ 				      old_crtc_state,
+ 				      new_crtc_state,
+ 				      i) {
+ 		if (old_crtc_state->active) {
+ 			struct vc4_crtc_state *old_vc4_state =
+ 				to_vc4_crtc_state(old_crtc_state);
+ 			unsigned int channel = old_vc4_state->assigned_channel;
+ 
+ 			hvs_new_state->fifo_state[channel].fifo_load = 0;
+ 		}
+ 
+ 		if (new_crtc_state->active) {
+ 			struct vc4_crtc_state *new_vc4_state =
+ 				to_vc4_crtc_state(new_crtc_state);
+ 			unsigned int channel = new_vc4_state->assigned_channel;
+ 
+ 			hvs_new_state->fifo_state[channel].fifo_load =
+ 				new_vc4_state->hvs_load;
+ 		}
+ 	}
+ 
+ 	cob_rate = 0;
+ 	num_outputs = 0;
+ 	for (i = 0; i < HVS_NUM_CHANNELS; i++) {
+ 		if (!hvs_new_state->fifo_state[i].in_use)
+ 			continue;
+ 
+ 		num_outputs++;
+ 		cob_rate += hvs_new_state->fifo_state[i].fifo_load;
+ 	}
+ 
+ 	pixel_rate = load_state->hvs_load;
+ 	if (num_outputs > 1) {
+ 		pixel_rate = (pixel_rate * 40) / 100;
+ 	} else {
+ 		pixel_rate = (pixel_rate * 60) / 100;
+ 	}
+ 
+ 	hvs_new_state->core_clock_rate = max(cob_rate, pixel_rate);
+ 
+ 	return 0;
+ }
+ 
+ 
  static int
  vc4_atomic_check(struct drm_device *dev, struct drm_atomic_state *state)
  {

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2021-11-29 23:34 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 23:33 Stephen Rothwell [this message]
2021-11-30  8:58 ` linux-next: manual merge of the drm tree with the drm-misc-fixes tree Maxime Ripard
2021-11-30 20:35   ` Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2023-11-22  0:29 Stephen Rothwell
2023-11-28 10:04 ` Geert Uytterhoeven
2023-09-28  2:05 Stephen Rothwell
2023-06-27  1:54 Stephen Rothwell
2023-07-11  1:17 ` Stephen Rothwell
2022-11-21  2:06 Stephen Rothwell
2022-07-11  2:47 Stephen Rothwell
2022-07-11  8:05 ` Christian König
2022-07-17 23:44   ` Stephen Rothwell
2022-07-19  7:35     ` Geert Uytterhoeven
2022-07-27  2:55     ` Stephen Rothwell
2022-07-27  3:24       ` Dave Airlie
2022-07-27  5:37         ` Stephen Rothwell
2022-03-18  0:55 Stephen Rothwell
2022-03-18  1:06 ` Stephen Rothwell
2021-12-22  3:50 Stephen Rothwell
2021-12-22  7:31 ` Christian König
2021-10-22  0:53 Stephen Rothwell
2021-06-17  1:42 Stephen Rothwell
2021-04-09  3:12 Stephen Rothwell
2021-03-18  1:02 Stephen Rothwell
2021-03-18  6:51 ` Tomi Valkeinen
2020-07-28  3:41 Stephen Rothwell
2020-05-01  3:45 Stephen Rothwell
2020-03-01 23:43 Stephen Rothwell
2019-09-15 21:18 Mark Brown
2019-09-16  5:29 ` Vasily Khoruzhick
2019-09-17  2:43   ` Qiang Yu
2019-08-26  3:06 Stephen Rothwell
2019-08-29 10:11 ` james qian wang (Arm Technology China)
2018-11-26  2:37 Stephen Rothwell
2018-03-08  0:47 Stephen Rothwell
2017-12-13 23:59 Stephen Rothwell
2017-01-17  0:59 Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211130103353.0ab1a44f@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=maxime@cerno.tech \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).