* [PATCH] drm/amd/display: optimize code runtime a bit
@ 2020-09-21 11:42 Bernard Zhao
2020-09-21 19:33 ` Alex Deucher
0 siblings, 1 reply; 5+ messages in thread
From: Bernard Zhao @ 2020-09-21 11:42 UTC (permalink / raw)
To: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Airlie, Daniel Vetter, Rodrigo Siqueira, Jun Lei, Aric Cyr,
Wenjing Liu, abdoulaye berthe, Michael Strauss, Brandon Syu,
Martin Leung, amd-gfx, dri-devel, linux-kernel
Cc: opensource.kernel, Bernard Zhao
Static function dal_ddc_i2c_payloads_destroy is only called
in dal_ddc_service_query_ddc_data, the parameter is &payloads
, there is no point NULL risk, so no need to check.
This change is to make the code run a bit fast.
Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
index b984eecca58b..6dcc666738fc 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
@@ -150,9 +150,6 @@ static uint32_t dal_ddc_i2c_payloads_get_count(struct i2c_payloads *p)
static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads *p)
{
- if (!p)
- return;
-
dal_vector_destruct(&p->payloads);
}
--
2.28.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd/display: optimize code runtime a bit
2020-09-21 11:42 [PATCH] drm/amd/display: optimize code runtime a bit Bernard Zhao
@ 2020-09-21 19:33 ` Alex Deucher
2020-09-22 0:57 ` Bernard
0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2020-09-21 19:33 UTC (permalink / raw)
To: Bernard Zhao
Cc: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Airlie, Daniel Vetter, Rodrigo Siqueira, Jun Lei, Aric Cyr,
Wenjing Liu, abdoulaye berthe, Michael Strauss, Brandon Syu,
Martin Leung, amd-gfx list, Maling list - DRI developers, LKML,
opensource.kernel
On Mon, Sep 21, 2020 at 9:14 AM Bernard Zhao <bernard@vivo.com> wrote:
>
> Static function dal_ddc_i2c_payloads_destroy is only called
> in dal_ddc_service_query_ddc_data, the parameter is &payloads
> , there is no point NULL risk, so no need to check.
> This change is to make the code run a bit fast.
>
How about just getting rid of dal_ddc_i2c_payloads_destroy() and just
call dal_vector_destruct() directly.
Alex
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
> drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
> index b984eecca58b..6dcc666738fc 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
> @@ -150,9 +150,6 @@ static uint32_t dal_ddc_i2c_payloads_get_count(struct i2c_payloads *p)
>
> static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads *p)
> {
> - if (!p)
> - return;
> -
> dal_vector_destruct(&p->payloads);
> }
>
> --
> 2.28.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re:Re: [PATCH] drm/amd/display: optimize code runtime a bit
2020-09-21 19:33 ` Alex Deucher
@ 2020-09-22 0:57 ` Bernard
0 siblings, 0 replies; 5+ messages in thread
From: Bernard @ 2020-09-22 0:57 UTC (permalink / raw)
To: Alex Deucher
Cc: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Airlie, Daniel Vetter, Rodrigo Siqueira, Jun Lei, Aric Cyr,
Wenjing Liu, abdoulaye berthe, Michael Strauss, Brandon Syu,
Martin Leung, amd-gfx list, Maling list - DRI developers, LKML,
opensource.kernel
From: Alex Deucher <alexdeucher@gmail.com>
Date: 2020-09-22 03:33:20
To: Bernard Zhao <bernard@vivo.com>
Cc: Harry Wentland <harry.wentland@amd.com>,Leo Li <sunpeng.li@amd.com>,Alex Deucher <alexander.deucher@amd.com>,"Christian König" <christian.koenig@amd.com>,David Airlie <airlied@linux.ie>,Daniel Vetter <daniel@ffwll.ch>,Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>,Jun Lei <Jun.Lei@amd.com>,Aric Cyr <aric.cyr@amd.com>,Wenjing Liu <wenjing.liu@amd.com>,abdoulaye berthe <abdoulaye.berthe@amd.com>,Michael Strauss <michael.strauss@amd.com>,Brandon Syu <Brandon.Syu@amd.com>,Martin Leung <martin.leung@amd.com>,amd-gfx list <amd-gfx@lists.freedesktop.org>,Maling list - DRI developers <dri-devel@lists.freedesktop.org>,LKML <linux-kernel@vger.kernel.org>,opensource.kernel@vivo.com
Subject: Re: [PATCH] drm/amd/display: optimize code runtime a bit>On Mon, Sep 21, 2020 at 9:14 AM Bernard Zhao <bernard@vivo.com> wrote:
>>
>> Static function dal_ddc_i2c_payloads_destroy is only called
>> in dal_ddc_service_query_ddc_data, the parameter is &payloads
>> , there is no point NULL risk, so no need to check.
>> This change is to make the code run a bit fast.
>>
>
>How about just getting rid of dal_ddc_i2c_payloads_destroy() and just
>call dal_vector_destruct() directly.
Good idea, I will resubmit a patch, thanks!
BR//Bernard
>Alex
>
>
>> Signed-off-by: Bernard Zhao <bernard@vivo.com>
>> ---
>> drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c | 3 ---
>> 1 file changed, 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
>> index b984eecca58b..6dcc666738fc 100644
>> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
>> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_ddc.c
>> @@ -150,9 +150,6 @@ static uint32_t dal_ddc_i2c_payloads_get_count(struct i2c_payloads *p)
>>
>> static void dal_ddc_i2c_payloads_destroy(struct i2c_payloads *p)
>> {
>> - if (!p)
>> - return;
>> -
>> dal_vector_destruct(&p->payloads);
>> }
>>
>> --
>> 2.28.0
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/amd/display: optimize code runtime a bit
2020-09-10 2:05 Bernard Zhao
@ 2020-09-15 19:18 ` Alex Deucher
0 siblings, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2020-09-15 19:18 UTC (permalink / raw)
To: Bernard Zhao
Cc: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Airlie, Daniel Vetter, Rodrigo Siqueira, Wenjing Liu,
Aric Cyr, abdoulaye berthe, Hersen Wu, jinlong zhang,
amd-gfx list, Maling list - DRI developers, LKML,
opensource.kernel
Applied. Thanks!
Alex
On Thu, Sep 10, 2020 at 3:23 AM Bernard Zhao <bernard@vivo.com> wrote:
>
> In fnction is_cr_done & is_ch_eq_done, when done = false
> happened once, no need to circle left ln_count.
> This change is to make the code run a bit fast.
>
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
> drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> index b2be6ad5101d..53e30be8b66a 100644
> --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
> @@ -373,34 +373,30 @@ static void dpcd_set_lt_pattern_and_lane_settings(
> static bool is_cr_done(enum dc_lane_count ln_count,
> union lane_status *dpcd_lane_status)
> {
> - bool done = true;
> uint32_t lane;
> /*LANEx_CR_DONE bits All 1's?*/
> for (lane = 0; lane < (uint32_t)(ln_count); lane++) {
> if (!dpcd_lane_status[lane].bits.CR_DONE_0)
> - done = false;
> + return false;
> }
> - return done;
> -
> + return true;
> }
>
> static bool is_ch_eq_done(enum dc_lane_count ln_count,
> union lane_status *dpcd_lane_status,
> union lane_align_status_updated *lane_status_updated)
> {
> - bool done = true;
> uint32_t lane;
> if (!lane_status_updated->bits.INTERLANE_ALIGN_DONE)
> - done = false;
> + return false;
> else {
> for (lane = 0; lane < (uint32_t)(ln_count); lane++) {
> if (!dpcd_lane_status[lane].bits.SYMBOL_LOCKED_0 ||
> !dpcd_lane_status[lane].bits.CHANNEL_EQ_DONE_0)
> - done = false;
> + return false;
> }
> }
> - return done;
> -
> + return true;
> }
>
> static void update_drive_settings(
> --
> 2.28.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] drm/amd/display: optimize code runtime a bit
@ 2020-09-10 2:05 Bernard Zhao
2020-09-15 19:18 ` Alex Deucher
0 siblings, 1 reply; 5+ messages in thread
From: Bernard Zhao @ 2020-09-10 2:05 UTC (permalink / raw)
To: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Airlie, Daniel Vetter, Rodrigo Siqueira, Wenjing Liu,
Aric Cyr, abdoulaye berthe, Hersen Wu, jinlong zhang, amd-gfx,
dri-devel, linux-kernel
Cc: opensource.kernel, Bernard Zhao
In fnction is_cr_done & is_ch_eq_done, when done = false
happened once, no need to circle left ln_count.
This change is to make the code run a bit fast.
Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
index b2be6ad5101d..53e30be8b66a 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
@@ -373,34 +373,30 @@ static void dpcd_set_lt_pattern_and_lane_settings(
static bool is_cr_done(enum dc_lane_count ln_count,
union lane_status *dpcd_lane_status)
{
- bool done = true;
uint32_t lane;
/*LANEx_CR_DONE bits All 1's?*/
for (lane = 0; lane < (uint32_t)(ln_count); lane++) {
if (!dpcd_lane_status[lane].bits.CR_DONE_0)
- done = false;
+ return false;
}
- return done;
-
+ return true;
}
static bool is_ch_eq_done(enum dc_lane_count ln_count,
union lane_status *dpcd_lane_status,
union lane_align_status_updated *lane_status_updated)
{
- bool done = true;
uint32_t lane;
if (!lane_status_updated->bits.INTERLANE_ALIGN_DONE)
- done = false;
+ return false;
else {
for (lane = 0; lane < (uint32_t)(ln_count); lane++) {
if (!dpcd_lane_status[lane].bits.SYMBOL_LOCKED_0 ||
!dpcd_lane_status[lane].bits.CHANNEL_EQ_DONE_0)
- done = false;
+ return false;
}
}
- return done;
-
+ return true;
}
static void update_drive_settings(
--
2.28.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-22 0:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21 11:42 [PATCH] drm/amd/display: optimize code runtime a bit Bernard Zhao
2020-09-21 19:33 ` Alex Deucher
2020-09-22 0:57 ` Bernard
-- strict thread matches above, loose matches on Subject: below --
2020-09-10 2:05 Bernard Zhao
2020-09-15 19:18 ` Alex Deucher
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).