lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_O3gX_fpMN1Bzd3Av7Kfoc+EC0t_pcJLVipHeRgv32jcg@mail.gmail.com>
Date:   Tue, 5 Jul 2022 11:23:16 -0400
From:   Alex Deucher <alexdeucher@...il.com>
To:     Maíra Canal <mairacanal@...eup.net>
Cc:     Harry Wentland <harry.wentland@....com>,
        Leo Li <sunpeng.li@....com>,
        Rodrigo Siqueira <Rodrigo.Siqueira@....com>,
        Alex Deucher <alexander.deucher@....com>,
        Christian Koenig <christian.koenig@....com>,
        xinhui pan <Xinhui.Pan@....com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Maling list - DRI developers 
        <dri-devel@...ts.freedesktop.org>,
        amd-gfx list <amd-gfx@...ts.freedesktop.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drm/amd/display: Remove duplicate code across dcn30 and dcn31

Applied.  Thanks!

Alex

On Thu, Jun 30, 2022 at 4:18 PM Maíra Canal <mairacanal@...eup.net> wrote:
>
> The function CalculateBytePerPixelAnd256BBlockSizes was defined four
> times: on display_mode_vba_30.c, display_rq_dlg_calc_30.c,
> display_mode_vba_31.c and display_rq_dlg_calc_31.c. In order to avoid
> code duplication, the CalculateBytePerPixelAnd256BBlockSizes is defined
> on display_mode_vba_30.h and used across dcn30 and dcn31.
>
> Signed-off-by: Maíra Canal <mairacanal@...eup.net>
> ---
>  .../dc/dml/dcn30/display_mode_vba_30.c        |  21 +---
>  .../dc/dml/dcn30/display_mode_vba_30.h        |  11 ++
>  .../dc/dml/dcn30/display_rq_dlg_calc_30.c     |  93 +--------------
>  .../dc/dml/dcn31/display_mode_vba_31.c        | 106 +-----------------
>  .../dc/dml/dcn31/display_rq_dlg_calc_31.c     |  91 +--------------
>  5 files changed, 23 insertions(+), 299 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
> index fb4aa4c800bf..842eb94ebe04 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
> @@ -712,18 +712,6 @@ static double CalculateUrgentLatency(
>                 double UrgentLatencyAdjustmentFabricClockReference,
>                 double FabricClockSingle);
>
> -static bool CalculateBytePerPixelAnd256BBlockSizes(
> -               enum source_format_class SourcePixelFormat,
> -               enum dm_swizzle_mode SurfaceTiling,
> -               unsigned int *BytePerPixelY,
> -               unsigned int *BytePerPixelC,
> -               double       *BytePerPixelDETY,
> -               double       *BytePerPixelDETC,
> -               unsigned int *BlockHeight256BytesY,
> -               unsigned int *BlockHeight256BytesC,
> -               unsigned int *BlockWidth256BytesY,
> -               unsigned int *BlockWidth256BytesC);
> -
>  void dml30_recalculate(struct display_mode_lib *mode_lib)
>  {
>         ModeSupportAndSystemConfiguration(mode_lib);
> @@ -2095,7 +2083,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
>         DTRACE("   return_bus_bw      = %f", v->ReturnBW);
>
>         for (k = 0; k < v->NumberOfActivePlanes; ++k) {
> -               CalculateBytePerPixelAnd256BBlockSizes(
> +               dml30_CalculateBytePerPixelAnd256BBlockSizes(
>                                 v->SourcePixelFormat[k],
>                                 v->SurfaceTiling[k],
>                                 &v->BytePerPixelY[k],
> @@ -3165,7 +3153,7 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
>
>         for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k) {
>
> -               CalculateBytePerPixelAnd256BBlockSizes(
> +               dml30_CalculateBytePerPixelAnd256BBlockSizes(
>                                 mode_lib->vba.SourcePixelFormat[k],
>                                 mode_lib->vba.SurfaceTiling[k],
>                                 &BytePerPixY[k],
> @@ -3218,7 +3206,7 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
>                         &dummysinglestring);
>  }
>
> -static bool CalculateBytePerPixelAnd256BBlockSizes(
> +void dml30_CalculateBytePerPixelAnd256BBlockSizes(
>                 enum source_format_class SourcePixelFormat,
>                 enum dm_swizzle_mode SurfaceTiling,
>                 unsigned int *BytePerPixelY,
> @@ -3305,7 +3293,6 @@ static bool CalculateBytePerPixelAnd256BBlockSizes(
>                 *BlockWidth256BytesY = 256U / *BytePerPixelY / *BlockHeight256BytesY;
>                 *BlockWidth256BytesC = 256U / *BytePerPixelC / *BlockHeight256BytesC;
>         }
> -       return true;
>  }
>
>  static double CalculateTWait(
> @@ -3709,7 +3696,7 @@ void dml30_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
>         /*Bandwidth Support Check*/
>
>         for (k = 0; k <= v->NumberOfActivePlanes - 1; k++) {
> -               CalculateBytePerPixelAnd256BBlockSizes(
> +               dml30_CalculateBytePerPixelAnd256BBlockSizes(
>                                 v->SourcePixelFormat[k],
>                                 v->SurfaceTiling[k],
>                                 &v->BytePerPixelY[k],
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.h b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.h
> index 4e249eaabfdb..daaf0883b84d 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.h
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.h
> @@ -39,5 +39,16 @@ double dml30_CalculateWriteBackDISPCLK(
>                 long   WritebackDestinationWidth,
>                 unsigned int HTotal,
>                 unsigned int WritebackLineBufferSize);
> +void dml30_CalculateBytePerPixelAnd256BBlockSizes(
> +               enum source_format_class SourcePixelFormat,
> +               enum dm_swizzle_mode SurfaceTiling,
> +               unsigned int *BytePerPixelY,
> +               unsigned int *BytePerPixelC,
> +               double       *BytePerPixelDETY,
> +               double       *BytePerPixelDETC,
> +               unsigned int *BlockHeight256BytesY,
> +               unsigned int *BlockHeight256BytesC,
> +               unsigned int *BlockWidth256BytesY,
> +               unsigned int *BlockWidth256BytesC);
>
>  #endif /* __DML30_DISPLAY_MODE_VBA_H__ */
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
> index 747167083dea..8179be1f34bb 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
> @@ -29,6 +29,7 @@
>  #include "../display_mode_vba.h"
>  #include "../dml_inline_defs.h"
>  #include "display_rq_dlg_calc_30.h"
> +#include "display_mode_vba_30.h"
>
>  static bool is_dual_plane(enum source_format_class source_format)
>  {
> @@ -275,96 +276,6 @@ static void handle_det_buf_split(struct display_mode_lib *mode_lib,
>                 full_swath_bytes_packed_c);
>  }
>
> -static bool CalculateBytePerPixelAnd256BBlockSizes(
> -               enum source_format_class SourcePixelFormat,
> -               enum dm_swizzle_mode SurfaceTiling,
> -               unsigned int *BytePerPixelY,
> -               unsigned int *BytePerPixelC,
> -               double       *BytePerPixelDETY,
> -               double       *BytePerPixelDETC,
> -               unsigned int *BlockHeight256BytesY,
> -               unsigned int *BlockHeight256BytesC,
> -               unsigned int *BlockWidth256BytesY,
> -               unsigned int *BlockWidth256BytesC)
> -{
> -       if (SourcePixelFormat == dm_444_64) {
> -               *BytePerPixelDETY = 8;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 8;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_444_32 || SourcePixelFormat == dm_rgbe) {
> -               *BytePerPixelDETY = 4;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 4;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_444_16) {
> -               *BytePerPixelDETY = 2;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 2;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_444_8) {
> -               *BytePerPixelDETY = 1;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 1;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_rgbe_alpha) {
> -               *BytePerPixelDETY = 4;
> -               *BytePerPixelDETC = 1;
> -               *BytePerPixelY = 4;
> -               *BytePerPixelC = 1;
> -       } else if (SourcePixelFormat == dm_420_8) {
> -               *BytePerPixelDETY = 1;
> -               *BytePerPixelDETC = 2;
> -               *BytePerPixelY = 1;
> -               *BytePerPixelC = 2;
> -       } else if (SourcePixelFormat == dm_420_12) {
> -               *BytePerPixelDETY = 2;
> -               *BytePerPixelDETC = 4;
> -               *BytePerPixelY = 2;
> -               *BytePerPixelC = 4;
> -       } else {
> -               *BytePerPixelDETY = 4.0 / 3;
> -               *BytePerPixelDETC = 8.0 / 3;
> -               *BytePerPixelY = 2;
> -               *BytePerPixelC = 4;
> -       }
> -
> -       if ((SourcePixelFormat == dm_444_64 || SourcePixelFormat == dm_444_32
> -                       || SourcePixelFormat == dm_444_16 || SourcePixelFormat == dm_444_8
> -                       || SourcePixelFormat == dm_mono_16 || SourcePixelFormat == dm_mono_8
> -                       || SourcePixelFormat == dm_rgbe)) {
> -               if (SurfaceTiling == dm_sw_linear) {
> -                       *BlockHeight256BytesY = 1;
> -               } else if (SourcePixelFormat == dm_444_64) {
> -                       *BlockHeight256BytesY = 4;
> -               } else if (SourcePixelFormat == dm_444_8) {
> -                       *BlockHeight256BytesY = 16;
> -               } else {
> -                       *BlockHeight256BytesY = 8;
> -               }
> -               *BlockWidth256BytesY = 256U / *BytePerPixelY / *BlockHeight256BytesY;
> -               *BlockHeight256BytesC = 0;
> -               *BlockWidth256BytesC = 0;
> -       } else {
> -               if (SurfaceTiling == dm_sw_linear) {
> -                       *BlockHeight256BytesY = 1;
> -                       *BlockHeight256BytesC = 1;
> -               } else if (SourcePixelFormat == dm_rgbe_alpha) {
> -                       *BlockHeight256BytesY = 8;
> -                       *BlockHeight256BytesC = 16;
> -               } else if (SourcePixelFormat == dm_420_8) {
> -                       *BlockHeight256BytesY = 16;
> -                       *BlockHeight256BytesC = 8;
> -               } else {
> -                       *BlockHeight256BytesY = 8;
> -                       *BlockHeight256BytesC = 8;
> -               }
> -               *BlockWidth256BytesY = 256U / *BytePerPixelY / *BlockHeight256BytesY;
> -               *BlockWidth256BytesC = 256U / *BytePerPixelC / *BlockHeight256BytesC;
> -       }
> -       return true;
> -}
> -
>  static void get_meta_and_pte_attr(struct display_mode_lib *mode_lib,
>         display_data_rq_dlg_params_st *rq_dlg_param,
>         display_data_rq_misc_params_st *rq_misc_param,
> @@ -450,7 +361,7 @@ static void get_meta_and_pte_attr(struct display_mode_lib *mode_lib,
>         double byte_per_pixel_det_y = 0;
>         double byte_per_pixel_det_c = 0;
>
> -       CalculateBytePerPixelAnd256BBlockSizes((enum source_format_class)(source_format),
> +       dml30_CalculateBytePerPixelAnd256BBlockSizes((enum source_format_class)(source_format),
>                 (enum dm_swizzle_mode)(tiling),
>                 &bytes_per_element_y,
>                 &bytes_per_element_c,
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
> index 448fbbcdf88a..9957313da732 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
> @@ -26,6 +26,7 @@
>  #include "dc.h"
>  #include "dc_link.h"
>  #include "../display_mode_lib.h"
> +#include "dml/dcn30/display_mode_vba_30.h"
>  #include "display_mode_vba_31.h"
>  #include "../dml_inline_defs.h"
>
> @@ -86,17 +87,6 @@ typedef struct {
>  #define BPP_INVALID 0
>  #define BPP_BLENDED_PIPE 0xffffffff
>
> -static bool CalculateBytePerPixelAnd256BBlockSizes(
> -               enum source_format_class SourcePixelFormat,
> -               enum dm_swizzle_mode SurfaceTiling,
> -               unsigned int *BytePerPixelY,
> -               unsigned int *BytePerPixelC,
> -               double *BytePerPixelDETY,
> -               double *BytePerPixelDETC,
> -               unsigned int *BlockHeight256BytesY,
> -               unsigned int *BlockHeight256BytesC,
> -               unsigned int *BlockWidth256BytesY,
> -               unsigned int *BlockWidth256BytesC);
>  static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib);
>  static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation(struct display_mode_lib *mode_lib);
>  static unsigned int dscceComputeDelay(
> @@ -2220,7 +2210,7 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
>         DTRACE("   return_bus_bw      = %f", v->ReturnBW);
>
>         for (k = 0; k < v->NumberOfActivePlanes; ++k) {
> -               CalculateBytePerPixelAnd256BBlockSizes(
> +               dml30_CalculateBytePerPixelAnd256BBlockSizes(
>                                 v->SourcePixelFormat[k],
>                                 v->SurfaceTiling[k],
>                                 &v->BytePerPixelY[k],
> @@ -3415,7 +3405,7 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
>
>         for (k = 0; k < v->NumberOfActivePlanes; ++k) {
>
> -               CalculateBytePerPixelAnd256BBlockSizes(
> +               dml30_CalculateBytePerPixelAnd256BBlockSizes(
>                                 v->SourcePixelFormat[k],
>                                 v->SurfaceTiling[k],
>                                 &BytePerPixY[k],
> @@ -3469,94 +3459,6 @@ static void DisplayPipeConfiguration(struct display_mode_lib *mode_lib)
>                         &dummysinglestring);
>  }
>
> -static bool CalculateBytePerPixelAnd256BBlockSizes(
> -               enum source_format_class SourcePixelFormat,
> -               enum dm_swizzle_mode SurfaceTiling,
> -               unsigned int *BytePerPixelY,
> -               unsigned int *BytePerPixelC,
> -               double *BytePerPixelDETY,
> -               double *BytePerPixelDETC,
> -               unsigned int *BlockHeight256BytesY,
> -               unsigned int *BlockHeight256BytesC,
> -               unsigned int *BlockWidth256BytesY,
> -               unsigned int *BlockWidth256BytesC)
> -{
> -       if (SourcePixelFormat == dm_444_64) {
> -               *BytePerPixelDETY = 8;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 8;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_444_32 || SourcePixelFormat == dm_rgbe) {
> -               *BytePerPixelDETY = 4;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 4;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_444_16) {
> -               *BytePerPixelDETY = 2;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 2;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_444_8) {
> -               *BytePerPixelDETY = 1;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 1;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_rgbe_alpha) {
> -               *BytePerPixelDETY = 4;
> -               *BytePerPixelDETC = 1;
> -               *BytePerPixelY = 4;
> -               *BytePerPixelC = 1;
> -       } else if (SourcePixelFormat == dm_420_8) {
> -               *BytePerPixelDETY = 1;
> -               *BytePerPixelDETC = 2;
> -               *BytePerPixelY = 1;
> -               *BytePerPixelC = 2;
> -       } else if (SourcePixelFormat == dm_420_12) {
> -               *BytePerPixelDETY = 2;
> -               *BytePerPixelDETC = 4;
> -               *BytePerPixelY = 2;
> -               *BytePerPixelC = 4;
> -       } else {
> -               *BytePerPixelDETY = 4.0 / 3;
> -               *BytePerPixelDETC = 8.0 / 3;
> -               *BytePerPixelY = 2;
> -               *BytePerPixelC = 4;
> -       }
> -
> -       if ((SourcePixelFormat == dm_444_64 || SourcePixelFormat == dm_444_32 || SourcePixelFormat == dm_444_16 || SourcePixelFormat == dm_444_8 || SourcePixelFormat == dm_mono_16
> -                       || SourcePixelFormat == dm_mono_8 || SourcePixelFormat == dm_rgbe)) {
> -               if (SurfaceTiling == dm_sw_linear) {
> -                       *BlockHeight256BytesY = 1;
> -               } else if (SourcePixelFormat == dm_444_64) {
> -                       *BlockHeight256BytesY = 4;
> -               } else if (SourcePixelFormat == dm_444_8) {
> -                       *BlockHeight256BytesY = 16;
> -               } else {
> -                       *BlockHeight256BytesY = 8;
> -               }
> -               *BlockWidth256BytesY = 256U / *BytePerPixelY / *BlockHeight256BytesY;
> -               *BlockHeight256BytesC = 0;
> -               *BlockWidth256BytesC = 0;
> -       } else {
> -               if (SurfaceTiling == dm_sw_linear) {
> -                       *BlockHeight256BytesY = 1;
> -                       *BlockHeight256BytesC = 1;
> -               } else if (SourcePixelFormat == dm_rgbe_alpha) {
> -                       *BlockHeight256BytesY = 8;
> -                       *BlockHeight256BytesC = 16;
> -               } else if (SourcePixelFormat == dm_420_8) {
> -                       *BlockHeight256BytesY = 16;
> -                       *BlockHeight256BytesC = 8;
> -               } else {
> -                       *BlockHeight256BytesY = 8;
> -                       *BlockHeight256BytesC = 8;
> -               }
> -               *BlockWidth256BytesY = 256U / *BytePerPixelY / *BlockHeight256BytesY;
> -               *BlockWidth256BytesC = 256U / *BytePerPixelC / *BlockHeight256BytesC;
> -       }
> -       return true;
> -}
> -
>  static double CalculateTWait(unsigned int PrefetchMode, double DRAMClockChangeLatency, double UrgentLatency, double SREnterPlusExitTime)
>  {
>         if (PrefetchMode == 0) {
> @@ -4066,7 +3968,7 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
>         /*Bandwidth Support Check*/
>
>         for (k = 0; k < v->NumberOfActivePlanes; k++) {
> -               CalculateBytePerPixelAnd256BBlockSizes(
> +               dml30_CalculateBytePerPixelAnd256BBlockSizes(
>                                 v->SourcePixelFormat[k],
>                                 v->SurfaceTiling[k],
>                                 &v->BytePerPixelY[k],
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c
> index dd570689c095..c94cf6e01e25 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c
> +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn31/display_rq_dlg_calc_31.c
> @@ -27,94 +27,7 @@
>  #include "../display_mode_vba.h"
>  #include "../dml_inline_defs.h"
>  #include "display_rq_dlg_calc_31.h"
> -
> -static bool CalculateBytePerPixelAnd256BBlockSizes(
> -               enum source_format_class SourcePixelFormat,
> -               enum dm_swizzle_mode SurfaceTiling,
> -               unsigned int *BytePerPixelY,
> -               unsigned int *BytePerPixelC,
> -               double *BytePerPixelDETY,
> -               double *BytePerPixelDETC,
> -               unsigned int *BlockHeight256BytesY,
> -               unsigned int *BlockHeight256BytesC,
> -               unsigned int *BlockWidth256BytesY,
> -               unsigned int *BlockWidth256BytesC)
> -{
> -       if (SourcePixelFormat == dm_444_64) {
> -               *BytePerPixelDETY = 8;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 8;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_444_32 || SourcePixelFormat == dm_rgbe) {
> -               *BytePerPixelDETY = 4;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 4;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_444_16) {
> -               *BytePerPixelDETY = 2;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 2;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_444_8) {
> -               *BytePerPixelDETY = 1;
> -               *BytePerPixelDETC = 0;
> -               *BytePerPixelY = 1;
> -               *BytePerPixelC = 0;
> -       } else if (SourcePixelFormat == dm_rgbe_alpha) {
> -               *BytePerPixelDETY = 4;
> -               *BytePerPixelDETC = 1;
> -               *BytePerPixelY = 4;
> -               *BytePerPixelC = 1;
> -       } else if (SourcePixelFormat == dm_420_8) {
> -               *BytePerPixelDETY = 1;
> -               *BytePerPixelDETC = 2;
> -               *BytePerPixelY = 1;
> -               *BytePerPixelC = 2;
> -       } else if (SourcePixelFormat == dm_420_12) {
> -               *BytePerPixelDETY = 2;
> -               *BytePerPixelDETC = 4;
> -               *BytePerPixelY = 2;
> -               *BytePerPixelC = 4;
> -       } else {
> -               *BytePerPixelDETY = 4.0 / 3;
> -               *BytePerPixelDETC = 8.0 / 3;
> -               *BytePerPixelY = 2;
> -               *BytePerPixelC = 4;
> -       }
> -
> -       if ((SourcePixelFormat == dm_444_64 || SourcePixelFormat == dm_444_32 || SourcePixelFormat == dm_444_16 || SourcePixelFormat == dm_444_8 || SourcePixelFormat == dm_mono_16
> -                       || SourcePixelFormat == dm_mono_8 || SourcePixelFormat == dm_rgbe)) {
> -               if (SurfaceTiling == dm_sw_linear) {
> -                       *BlockHeight256BytesY = 1;
> -               } else if (SourcePixelFormat == dm_444_64) {
> -                       *BlockHeight256BytesY = 4;
> -               } else if (SourcePixelFormat == dm_444_8) {
> -                       *BlockHeight256BytesY = 16;
> -               } else {
> -                       *BlockHeight256BytesY = 8;
> -               }
> -               *BlockWidth256BytesY = 256U / *BytePerPixelY / *BlockHeight256BytesY;
> -               *BlockHeight256BytesC = 0;
> -               *BlockWidth256BytesC = 0;
> -       } else {
> -               if (SurfaceTiling == dm_sw_linear) {
> -                       *BlockHeight256BytesY = 1;
> -                       *BlockHeight256BytesC = 1;
> -               } else if (SourcePixelFormat == dm_rgbe_alpha) {
> -                       *BlockHeight256BytesY = 8;
> -                       *BlockHeight256BytesC = 16;
> -               } else if (SourcePixelFormat == dm_420_8) {
> -                       *BlockHeight256BytesY = 16;
> -                       *BlockHeight256BytesC = 8;
> -               } else {
> -                       *BlockHeight256BytesY = 8;
> -                       *BlockHeight256BytesC = 8;
> -               }
> -               *BlockWidth256BytesY = 256U / *BytePerPixelY / *BlockHeight256BytesY;
> -               *BlockWidth256BytesC = 256U / *BytePerPixelC / *BlockHeight256BytesC;
> -       }
> -       return true;
> -}
> +#include "dml/dcn30/display_mode_vba_30.h"
>
>  static bool is_dual_plane(enum source_format_class source_format)
>  {
> @@ -467,7 +380,7 @@ static void get_meta_and_pte_attr(
>         double byte_per_pixel_det_y;
>         double byte_per_pixel_det_c;
>
> -       CalculateBytePerPixelAnd256BBlockSizes(
> +       dml30_CalculateBytePerPixelAnd256BBlockSizes(
>                         (enum source_format_class) (source_format),
>                         (enum dm_swizzle_mode) (tiling),
>                         &bytes_per_element_y,
> --
> 2.36.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ