Subject: linux-next: manual merge of the drm tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 16 Sep 2024 14:15:17 +1000

Hi all,

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

  drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c

between commit:

  e835d5144f5e ("drm/amd/display: Avoid race between dcn35_set_drr() and dc_state_destruct()")

from Linus' tree and commit:

  be7a6a517164 ("drm/amd/display: Check stream pointer is initialized before accessing")

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/amd/display/dc/hwss/dcn35/dcn35_hwseq.c
index d5e9aec52a05,a4c6decee0f8..000000000000
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c
@@@ -1462,17 -1414,10 +1414,17 @@@ void dcn35_set_drr(struct pipe_ctx **pi
  	params.vertical_total_mid_frame_num = adjust.v_total_mid_frame_num;
  
  	for (i = 0; i < num_pipes; i++) {
 -		if ((pipe_ctx[i]->stream_res.tg != NULL) && pipe_ctx[i]->stream_res.tg->funcs) {
 +		/* dc_state_destruct() might null the stream resources, so fetch tg
 +		 * here first to avoid a race condition. The lifetime of the pointee
 +		 * itself (the timing_generator object) is not a problem here.
 +		 */
 +		struct timing_generator *tg = pipe_ctx[i]->stream_res.tg;
 +
 +		if ((tg != NULL) && tg->funcs) {
- 			struct dc_crtc_timing *timing = &pipe_ctx[i]->stream->timing;
- 			struct dc *dc = pipe_ctx[i]->stream->ctx->dc;
 +
- 			if (dc->debug.static_screen_wait_frames) {
+ 			if (pipe_ctx[i]->stream && pipe_ctx[i]->stream->ctx->dc->debug.static_screen_wait_frames) {
+ 				struct dc_crtc_timing *timing = &pipe_ctx[i]->stream->timing;
+ 				struct dc *dc = pipe_ctx[i]->stream->ctx->dc;
  				unsigned int frame_rate = timing->pix_clk_100hz / (timing->h_total * timing->v_total);
  
  				if (frame_rate >= 120 && dc->caps.ips_support &&