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

drm/amd/display: Only flush delta from last command execution

[Why]
We're currently flushing commands that had been previously been
flushed or are currently being processed by the DMCUB when we don't
immediately wait for idle after command execution.

[How]
Avoiding reflushing the data by keeping track of the last wptr.

We'll treat this as the actual rptr by creating a copy of the inbox
and modifying the copy's rptr.

Reviewed-by: Eric Yang <Eric.Yang2@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Nicholas Kazlauskas and committed by
Alex Deucher
a53b554b c09bb36d

+9 -1
+1
drivers/gpu/drm/amd/display/dmub/dmub_srv.h
··· 411 411 struct dmub_srv_base_funcs funcs; 412 412 struct dmub_srv_hw_funcs hw_funcs; 413 413 struct dmub_rb inbox1_rb; 414 + uint32_t inbox1_last_wptr; 414 415 /** 415 416 * outbox1_rb is accessed without locks (dal & dc) 416 417 * and to be used only in dmub_srv_stat_get_notification()
+8 -1
drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
··· 609 609 610 610 enum dmub_status dmub_srv_cmd_execute(struct dmub_srv *dmub) 611 611 { 612 + struct dmub_rb flush_rb; 613 + 612 614 if (!dmub->hw_init) 613 615 return DMUB_STATUS_INVALID; 614 616 ··· 619 617 * been flushed to framebuffer memory. Otherwise DMCUB might 620 618 * read back stale, fully invalid or partially invalid data. 621 619 */ 622 - dmub_rb_flush_pending(&dmub->inbox1_rb); 620 + flush_rb = dmub->inbox1_rb; 621 + flush_rb.rptr = dmub->inbox1_last_wptr; 622 + dmub_rb_flush_pending(&flush_rb); 623 623 624 624 dmub->hw_funcs.set_inbox1_wptr(dmub, dmub->inbox1_rb.wrpt); 625 + 626 + dmub->inbox1_last_wptr = dmub->inbox1_rb.wrpt; 627 + 625 628 return DMUB_STATUS_OK; 626 629 } 627 630