Skip to contentSkip to conversation

drm/amd/display: Simplify the calculation of variables

PATCH New Jiapeng Chong 2 participants 2 messages Jan 18, 2024 – Jan 21, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: Simplify the calculation of variables

./drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c:703:47-49: WARNING !A || A && B is equivalent to !A || B.

---
 drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c +2 -2
index a0ce681b26c6..118aaf4389bc 100644
@@ -700,9 +700,9 @@ static void free_unused_pipes_for_plane(struct dml2_context *ctx, struct dc_stat
 	for (i = 0; i < ctx->config.dcn_pipe_count; i++) {
 		if (state->res_ctx.pipe_ctx[i].plane_state == plane &&
 			state->res_ctx.pipe_ctx[i].stream->stream_id == stream_id &&
-			(!is_plane_duplicate || (is_plane_duplicate &&
+			(!is_plane_duplicate ||
 			ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_index[state->res_ctx.pipe_ctx[i].pipe_idx] == plane_index)) &&
-			!is_pipe_used(pool, state->res_ctx.pipe_ctx[i].pipe_idx)) {
+			!is_pipe_used(pool, state->res_ctx.pipe_ctx[i].pipe_idx) {
 			free_pipe(&state->res_ctx.pipe_ctx[i]);
 		}
 	}
Signature · 1 line
2.20.1.7.g153144c
#1 lore raw
kernel test robot noticed the following build errors:

Hi Jiapeng,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on linus/master v6.7 next-20240119] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jiapeng-Chong/drm-amd-display-Simplify-the-calculation-of-variables/20240118-102628
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20240118022315.107671-1-jiapeng.chong%40linux.alibaba.com
patch subject: [PATCH] drm/amd/display: Simplify the calculation of variables
config: powerpc64-randconfig-001-20240121 (https://download.01.org/0day-ci/archive/20240121/[email protected]/config)
compiler: powerpc64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240121/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All error/warnings (new ones prefixed by >>):

drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_dc_resource_mgmt.c: In function 'free_unused_pipes_for_plane':

>> drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_dc_resource_mgmt.c:685:25: error: expected identifier before '!' token
     685 |                         !is_pipe_used(pool, state->res_ctx.pipe_ctx[i].pipe_idx) {
         |                         ^
   drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_dc_resource_mgmt.c: At top level:
>> drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_dc_resource_mgmt.c:669:13: warning: 'free_pipe' defined but not used [-Wunused-function]
     669 | static void free_pipe(struct pipe_ctx *pipe)
         |             ^~~~~~~~~
>> drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_dc_resource_mgmt.c:655:13: warning: 'is_pipe_used' defined but not used [-Wunused-function]

655 | static bool is_pipe_used(const struct dc_plane_pipe_pool *pool, unsigned int pipe_idx)
| ^~~~~~~~~~~~

vim +/free_pipe +669 drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_dc_resource_mgmt.c

7966f319c66d94 Qingqing Zhuo 2023-07-28 654

7966f319c66d94 Qingqing Zhuo 2023-07-28 @655  static bool is_pipe_used(const struct dc_plane_pipe_pool *pool, unsigned int pipe_idx)
7966f319c66d94 Qingqing Zhuo 2023-07-28  656  {
7966f319c66d94 Qingqing Zhuo 2023-07-28  657  	int i, j;
7966f319c66d94 Qingqing Zhuo 2023-07-28  658  
7966f319c66d94 Qingqing Zhuo 2023-07-28  659  	for (i = 0; i < pool->num_pipes_assigned_to_plane_for_odm_combine; i++) {
7966f319c66d94 Qingqing Zhuo 2023-07-28  660  		for (j = 0; j < pool->num_pipes_assigned_to_plane_for_mpcc_combine; j++) {
7966f319c66d94 Qingqing Zhuo 2023-07-28  661  			if (pool->pipes_assigned_to_plane[i][j] == pipe_idx && pool->pipe_used[i][j])
7966f319c66d94 Qingqing Zhuo 2023-07-28  662  				return true;
7966f319c66d94 Qingqing Zhuo 2023-07-28  663  		}
7966f319c66d94 Qingqing Zhuo 2023-07-28  664  	}
7966f319c66d94 Qingqing Zhuo 2023-07-28  665  
7966f319c66d94 Qingqing Zhuo 2023-07-28  666  	return false;
7966f319c66d94 Qingqing Zhuo 2023-07-28  667  }
7966f319c66d94 Qingqing Zhuo 2023-07-28  668  
7966f319c66d94 Qingqing Zhuo 2023-07-28 @669  static void free_pipe(struct pipe_ctx *pipe)
7966f319c66d94 Qingqing Zhuo 2023-07-28  670  {
7966f319c66d94 Qingqing Zhuo 2023-07-28  671  	memset(pipe, 0, sizeof(struct pipe_ctx));
7966f319c66d94 Qingqing Zhuo 2023-07-28  672  }
7966f319c66d94 Qingqing Zhuo 2023-07-28  673  
e47d7ca7574a12 Sung Joon Kim 2023-08-09  674  static void free_unused_pipes_for_plane(struct dml2_context *ctx, struct dc_state *state,
35c1d9664cbfa3 Sung Joon Kim 2023-10-11  675  	const struct dc_plane_state *plane, const struct dc_plane_pipe_pool *pool, unsigned int stream_id, int plane_index)
7966f319c66d94 Qingqing Zhuo 2023-07-28  676  {
7966f319c66d94 Qingqing Zhuo 2023-07-28  677  	int i;
35c1d9664cbfa3 Sung Joon Kim 2023-10-11  678  	bool is_plane_duplicate = ctx->v20.scratch.plane_duplicate_exists;
35c1d9664cbfa3 Sung Joon Kim 2023-10-11  679  
7966f319c66d94 Qingqing Zhuo 2023-07-28  680  	for (i = 0; i < ctx->config.dcn_pipe_count; i++) {
e47d7ca7574a12 Sung Joon Kim 2023-08-09  681  		if (state->res_ctx.pipe_ctx[i].plane_state == plane &&
e47d7ca7574a12 Sung Joon Kim 2023-08-09  682  			state->res_ctx.pipe_ctx[i].stream->stream_id == stream_id &&
972e9cc65f78f2 Jiapeng Chong 2024-01-18  683  			(!is_plane_duplicate ||
35c1d9664cbfa3 Sung Joon Kim 2023-10-11  684  			ctx->v20.scratch.dml_to_dc_pipe_mapping.dml_pipe_idx_to_plane_index[state->res_ctx.pipe_ctx[i].pipe_idx] == plane_index)) &&
972e9cc65f78f2 Jiapeng Chong 2024-01-18 @685  			!is_pipe_used(pool, state->res_ctx.pipe_ctx[i].pipe_idx) {
7966f319c66d94 Qingqing Zhuo 2023-07-28  686  			free_pipe(&state->res_ctx.pipe_ctx[i]);
7966f319c66d94 Qingqing Zhuo 2023-07-28  687  		}
7966f319c66d94 Qingqing Zhuo 2023-07-28  688  	}
7966f319c66d94 Qingqing Zhuo 2023-07-28  689  }

7966f319c66d94 Qingqing Zhuo 2023-07-28 690

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki