From: "VURDIGERENATARAJ, CHANDAN" <CHANDAN.VURDIGERENATARAJ@amd.com>
To: "Zhang, Dingchen (David)" <Dingchen.Zhang@amd.com>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Wang, Chao-kai \(Stylon\)" <Stylon.Wang@amd.com>,
"Li, Sun peng \(Leo\)" <Sunpeng.Li@amd.com>,
"Lakha, Bhawanpreet" <Bhawanpreet.Lakha@amd.com>,
"Zhuo, Qingqing \(Lillian\)" <Qingqing.Zhuo@amd.com>,
"Siqueira, Rodrigo" <Rodrigo.Siqueira@amd.com>,
"Li, Roman" <Roman.Li@amd.com>,
"Chiu, Solomon" <Solomon.Chiu@amd.com>,
"Zuo, Jerry" <Jerry.Zuo@amd.com>,
"Pillai, Aurabindo" <Aurabindo.Pillai@amd.com>,
"Lin, Wayne" <Wayne.Lin@amd.com>,
"Wentland, Harry" <Harry.Wentland@amd.com>,
"Gutierrez, Agustin" <Agustin.Gutierrez@amd.com>,
"Kotarac, Pavle" <Pavle.Kotarac@amd.com>
Subject: RE: [PATCH 03/17] drm/amd/display: combine dirty rectangles in DMUB FW
Date: Mon, 9 May 2022 08:12:12 +0000 [thread overview]
Message-ID: <MW4PR12MB566853776D089737D2CCDC6496C69@MW4PR12MB5668.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20220505142323.2566949-4-dingchen.zhang@amd.com>
Hi,
Why is the DC_MAX_DIRTY_RECTS set to 3? What causes this limitation?
>[why]
>In PSR-SU design, the DMUB FW handles the combination of multiple dirty rectangles.
>
>[how]
>- create DC dmub update dirty rectangle helper which sends the
> dirty rectangles per pipe from DC to DMUB, and DMUB FW will
> handle to combine the dirty RECTs
>- call the helper from DC commit plane update function.
>
>Signed-off-by: David Zhang <dingchen.zhang@amd.com>
>---
> drivers/gpu/drm/amd/display/dc/core/dc.c | 54 ++++++++++++++++++++++
> drivers/gpu/drm/amd/display/dc/dc.h | 3 ++
> drivers/gpu/drm/amd/display/dc/dc_stream.h | 5 ++
> 3 files changed, 62 insertions(+)
>
>diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
>index c2fcd67bcc4d..0649d84b71b6 100644
>--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
>+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
>@@ -72,6 +72,9 @@
> #include "dmub/dmub_srv.h"
>
> #include "i2caux_interface.h"
>+
>+#include "dce/dmub_psr.h"
>+
> #include "dce/dmub_hw_lock_mgr.h"
>
> #include "dc_trace.h"
>@@ -2842,6 +2845,55 @@ static void commit_planes_do_stream_update(struct dc *dc,
> }
> }
>
>+void dc_dmub_update_dirty_rect(struct dc *dc,
>+ int surface_count,
>+ struct dc_stream_state *stream,
>+ struct dc_surface_update *srf_updates,
>+ struct dc_state *context)
>+{
>+ union dmub_rb_cmd cmd;
>+ struct dc_context *dc_ctx = dc->ctx;
>+ struct dmub_cmd_update_dirty_rect_data *update_dirty_rect;
>+ unsigned int i, j;
>+
>+ if (stream->link->psr_settings.psr_version != DC_PSR_VERSION_SU_1)
>+ return;
>+
>+ memset(&cmd, 0x0, sizeof(cmd));
>+ cmd.update_dirty_rect.header.type = DMUB_CMD__UPDATE_DIRTY_RECT;
>+ cmd.update_dirty_rect.header.sub_type = 0;
>+ cmd.update_dirty_rect.header.payload_bytes =
>+ sizeof(cmd.update_dirty_rect) -
>+ sizeof(cmd.update_dirty_rect.header);
>+ update_dirty_rect = &cmd.update_dirty_rect.update_dirty_rect_data;
>+ for (i = 0; i < surface_count; i++) {
>+ struct dc_plane_state *plane_state = srf_updates[i].surface;
>+ const struct dc_flip_addrs *flip_addr = srf_updates[i].flip_addr;
>+
>+ if (!srf_updates[i].surface || !flip_addr)
>+ continue;
>+ /* Do not send in immediate flip mode */
>+ if (srf_updates[i].surface->flip_immediate)
>+ continue;
>+
>+ update_dirty_rect->dirty_rect_count = flip_addr->dirty_rect_count;
>+ memcpy(update_dirty_rect->src_dirty_rects, flip_addr->dirty_rects,
>+ sizeof(flip_addr->dirty_rects));
>+ for (j = 0; j < dc->res_pool->pipe_count; j++) {
>+ struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
>+
>+ if (pipe_ctx->stream != stream)
>+ continue;
>+ if (pipe_ctx->plane_state != plane_state)
>+ continue;
>+
>+ update_dirty_rect->pipe_idx = j;
>+ dc_dmub_srv_cmd_queue(dc_ctx->dmub_srv, &cmd);
>+ dc_dmub_srv_cmd_execute(dc_ctx->dmub_srv);
>+ }
>+ }
>+}
>+
> static void commit_planes_for_stream(struct dc *dc,
> struct dc_surface_update *srf_updates,
> int surface_count,
>@@ -2934,6 +2986,8 @@ static void commit_planes_for_stream(struct dc *dc,
> */
> dc->hwss.pipe_control_lock(dc, top_pipe_to_program, true);
>
>+ dc_dmub_update_dirty_rect(dc, surface_count, stream, srf_updates,
>+context);
>+
> // Stream updates
> if (stream_update)
> commit_planes_do_stream_update(dc, stream, stream_update, update_type, context); diff --git >a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
>index 942bfb8fd851..85f3303e7843 100644
>--- a/drivers/gpu/drm/amd/display/dc/dc.h
>+++ b/drivers/gpu/drm/amd/display/dc/dc.h
>@@ -1134,12 +1134,15 @@ void dc_3dlut_func_retain(struct dc_3dlut *lut);
> * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such
> * as frame durations and DCC format can also be set.
> */
>+#define DC_MAX_DIRTY_RECTS 3
> struct dc_flip_addrs {
> struct dc_plane_address address;
> unsigned int flip_timestamp_in_us;
> bool flip_immediate;
> /* TODO: add flip duration for FreeSync */
> bool triplebuffer_flips;
>+ unsigned int dirty_rect_count;
>+ struct rect dirty_rects[DC_MAX_DIRTY_RECTS];
> };
>
> void dc_post_update_surfaces_to_stream(
>diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h b/drivers/gpu/drm/amd/display/dc/dc_stream.h
>index 58941f4defb3..58036469c62a 100644
>--- a/drivers/gpu/drm/amd/display/dc/dc_stream.h
>+++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h
>@@ -529,4 +529,9 @@ bool dc_stream_get_crtc_position(struct dc *dc,
>
> struct pipe_ctx *dc_stream_get_pipe_ctx(struct dc_stream_state *stream);
>
>+void dc_dmub_update_dirty_rect(struct dc *dc,
>+ int surface_count,
>+ struct dc_stream_state *stream,
>+ struct dc_surface_update *srf_updates,
>+ struct dc_state *context);
> #endif /* DC_STREAM_H_ */
>--
>2.25.1
next prev parent reply other threads:[~2022-05-09 8:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-05 14:23 [PATCH 00/17] enable PSR-SU MPO for amdpgu David Zhang
2022-05-05 14:23 ` [PATCH 01/17] drm/amd/display: align dmub cmd header to latest dmub FW to support PSR-SU David Zhang
2022-05-05 14:23 ` [PATCH 02/17] drm/amd/display: feed PSR-SU as psr version to dmub FW David Zhang
2022-05-05 14:23 ` [PATCH 03/17] drm/amd/display: combine dirty rectangles in DMUB FW David Zhang
2022-05-09 8:12 ` VURDIGERENATARAJ, CHANDAN [this message]
2022-05-09 13:41 ` Zhang, Dingchen (David)
2022-05-05 14:23 ` [PATCH 04/17] drm/amd/display: update GSP1 generic info packet for PSRSU David Zhang
2022-05-05 14:23 ` [PATCH 05/17] drm/amd/display: revise Start/End SDP data David Zhang
2022-05-09 8:26 ` VURDIGERENATARAJ, CHANDAN
2022-05-09 14:02 ` Zhang, Dingchen (David)
2022-05-05 14:23 ` [PATCH 06/17] drm/amd/display: program PSR2 DPCD Configuration David Zhang
2022-05-05 14:23 ` [PATCH 07/17] drm/amd/display: Passing Y-granularity to dmub fw David Zhang
2022-05-05 14:23 ` [PATCH 08/17] drm/amd/display: Set default value of line_capture_indication David Zhang
2022-05-05 14:23 ` [PATCH 09/17] drm/amd/display: add vline time in micro sec to PSR context David Zhang
2022-05-05 14:23 ` [PATCH 10/17] drm/amd/display: fix system hang when PSR exits David Zhang
2022-05-05 14:23 ` [PATCH 11/17] drm/amd/display: Set PSR level to enable ALPM by default David Zhang
2022-05-05 14:23 ` [PATCH 12/17] drm/amd/display: use HW lock mgr for PSR-SU David Zhang
2022-05-05 14:23 ` [PATCH 13/17] drm/amd/display: PSRSU+DSC WA for specific TCON David Zhang
2022-05-05 14:23 ` [PATCH 14/17] drm/amd/display: add shared helpers to update psr config fields to power module David Zhang
2022-05-09 8:42 ` VURDIGERENATARAJ, CHANDAN
2022-05-09 14:09 ` Zhang, Dingchen (David)
2022-05-05 14:23 ` [PATCH 15/17] drm/amd/display: calculate psr config settings in runtime in DM David Zhang
2022-05-05 14:23 ` [PATCH 16/17] drm/amd/display: update cursor position to DMUB FW David Zhang
2022-05-05 14:23 ` [PATCH 17/17] drm/amd/display: Implement MPO PSR SU David Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MW4PR12MB566853776D089737D2CCDC6496C69@MW4PR12MB5668.namprd12.prod.outlook.com \
--to=chandan.vurdigerenataraj@amd.com \
--cc=Agustin.Gutierrez@amd.com \
--cc=Aurabindo.Pillai@amd.com \
--cc=Bhawanpreet.Lakha@amd.com \
--cc=Dingchen.Zhang@amd.com \
--cc=Harry.Wentland@amd.com \
--cc=Jerry.Zuo@amd.com \
--cc=Pavle.Kotarac@amd.com \
--cc=Qingqing.Zhuo@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Roman.Li@amd.com \
--cc=Solomon.Chiu@amd.com \
--cc=Stylon.Wang@amd.com \
--cc=Sunpeng.Li@amd.com \
--cc=Wayne.Lin@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).