[bug report] drm/amd/display: Update MALL SS NumWays calculation

Dan Carpenter dan.carpenter at oracle.com
Thu Oct 6 04:46:18 UTC 2022


Hello Alvin Lee,

The patch 525a65c77db5: "drm/amd/display: Update MALL SS NumWays
calculation" from Sep 14, 2022, leads to the following Smatch static
checker warning:

	drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_hwseq.c:282 dcn32_calculate_cab_allocation()
	warn: if statement not indented

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn32/dcn32_hwseq.c
    276 
    277         // Include cursor size for CAB allocation
    278         for (j = 0; j < dc->res_pool->pipe_count; j++) {
    279                 struct pipe_ctx *pipe = &ctx->res_ctx.pipe_ctx[j];
    280                 struct hubp *hubp = pipe->plane_res.hubp;
    281 
--> 282                 if (pipe->stream && pipe->plane_state && hubp)
    283                         /* Find the cursor plane and use the exact size instead of
    284                         using the max for calculation */

The code for this if statement is missing so it runs into the next if
statement.

    285 
    286                 if (hubp->curs_attr.width > 0) {
    287                                 // Round cursor width to next multiple of 64
    288                                 cursor_size = (((hubp->curs_attr.width + 63) / 64) * 64) * hubp->curs_attr.height;
    289 
    290                                 switch (pipe->stream->cursor_attributes.color_format) {
    291                                 case CURSOR_MODE_MONO:
    292                                         cursor_size /= 2;
    293                                         cursor_bpp = 4;
    294                                         break;
    295                                 case CURSOR_MODE_COLOR_1BIT_AND:
    296                                 case CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA:
    297                                 case CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA:
    298                                         cursor_size *= 4;
    299                                         cursor_bpp = 4;
    300                                         break;
    301 

regards,
dan carpenter


More information about the amd-gfx mailing list