Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Extend capability to get multiple ROI CRCs

[Why & How]
We already extend our dm, dc and dmub to support setting of multiple CRC
instances, now extend the capability to return back the ROI/CRC pair result
from psp by specifying activated ROI instances.

Reviewed-by: HaoPing Liu <haoping.liu@amd.com>
Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Signed-off-by: Roman Li <roman.li@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Wayne Lin and committed by
Alex Deucher
1e36774f d566fc42

+29 -7
+29 -7
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c
··· 343 343 struct amdgpu_dm_connector *aconnector; 344 344 uint8_t phy_inst; 345 345 struct amdgpu_display_manager *dm; 346 + struct crc_data crc_cpy[MAX_CRC_WINDOW_NUM]; 347 + unsigned long flags; 348 + uint8_t roi_idx = 0; 346 349 int ret; 350 + int i; 347 351 348 352 crtc_ctx = container_of(work, struct secure_display_crtc_context, notify_ta_work); 349 353 crtc = crtc_ctx->crtc; ··· 376 372 } 377 373 mutex_unlock(&crtc->dev->mode_config.mutex); 378 374 375 + spin_lock_irqsave(&crtc->dev->event_lock, flags); 376 + memcpy(crc_cpy, crtc_ctx->crc_info.crc, sizeof(struct crc_data) * MAX_CRC_WINDOW_NUM); 377 + spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 378 + 379 379 /* need lock for multiple crtcs to use the command buffer */ 380 380 mutex_lock(&psp->securedisplay_context.mutex); 381 - 382 - psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd, 383 - TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC); 384 - 385 - securedisplay_cmd->securedisplay_in_message.send_roi_crc.phy_id = phy_inst; 386 - 387 381 /* PSP TA is expected to finish data transmission over I2C within current frame, 388 382 * even there are up to 4 crtcs request to send in this frame. 389 383 */ 390 - ret = psp_securedisplay_invoke(psp, TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC); 384 + if (dm->secure_display_ctx.support_mul_roi) { 385 + psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd, 386 + TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC_V2); 387 + 388 + securedisplay_cmd->securedisplay_in_message.send_roi_crc_v2.phy_id = phy_inst; 389 + 390 + for (i = 0; i < MAX_CRC_WINDOW_NUM; i++) { 391 + if (crc_cpy[i].crc_ready) 392 + roi_idx |= 1 << i; 393 + } 394 + securedisplay_cmd->securedisplay_in_message.send_roi_crc_v2.roi_idx = roi_idx; 395 + 396 + ret = psp_securedisplay_invoke(psp, TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC_V2); 397 + } else { 398 + psp_prep_securedisplay_cmd_buf(psp, &securedisplay_cmd, 399 + TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC); 400 + 401 + securedisplay_cmd->securedisplay_in_message.send_roi_crc.phy_id = phy_inst; 402 + 403 + ret = psp_securedisplay_invoke(psp, TA_SECUREDISPLAY_COMMAND__SEND_ROI_CRC); 404 + } 391 405 392 406 if (!ret) { 393 407 if (securedisplay_cmd->status != TA_SECUREDISPLAY_STATUS__SUCCESS)