[PATCH i-g-t 08/14] lib/igt_draw: Add 64bpp support for the non-XY_FAST_COLOR_BLT path

Juha-Pekka Heikkilä juhapekka.heikkila at gmail.com
Mon Nov 18 14:42:59 UTC 2024


Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>

On Fri, Oct 4, 2024 at 1:41 PM Ville Syrjala
<ville.syrjala at linux.intel.com> wrote:
>
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> XY_COLOR_BLT can't do 64bpp since we have nowhere to store
> the other half of the color. In order to support 64bpp
> pixel formats we have to get a little bit creative and
> use XY_PAT_BLT_IMMEDIATE instead. We simply treat the
> buffer as 32bpp, double the horizontal dimensions to
> compensate, and alternate between the lower and upper
> dwords of the color value when filling the 8x8 pattern.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
>  lib/igt_draw.c  | 24 ++++++++++++++++++++++++
>  lib/intel_reg.h |  2 ++
>  2 files changed, 26 insertions(+)
>
> diff --git a/lib/igt_draw.c b/lib/igt_draw.c
> index 2312a0c71030..81da01a6c5ad 100644
> --- a/lib/igt_draw.c
> +++ b/lib/igt_draw.c
> @@ -833,6 +833,30 @@ static void draw_rect_blt(int fd, struct cmd_data *cmd_data,
>                 intel_bb_out(ibb, (1 << 29) | ((pitch-1) << 14) | (buf_height-1));
>                 intel_bb_out(ibb, 0);   /* mipmap levels / qpitch */
>                 intel_bb_out(ibb, 0);   /* mipmap index / alignment */
> +       } else if (buf->bpp == 64) {
> +               int x = rect->x * 2;
> +               int w = rect->w * 2;
> +
> +               blt_cmd_depth = 3 << 24; /* 32bpp */
> +               blt_cmd_len = ((ver >= 8) ?  0x4 : 0x3) + 8*8;
> +               blt_cmd_tiling = (tiling) ? XY_COLOR_BLT_TILED : 0;
> +               pitch = (ver >= 4 && tiling) ? buf->stride / 4 : buf->stride;
> +
> +               switch_blt_tiling(ibb, tiling, true);
> +
> +               intel_bb_out(ibb, XY_PAT_BLT_IMMEDIATE_CMD_NOLEN | XY_COLOR_BLT_WRITE_ALPHA |
> +                            XY_COLOR_BLT_WRITE_RGB | blt_cmd_tiling | blt_cmd_len);
> +               intel_bb_out(ibb, blt_cmd_depth | (0xF0 << 16) | pitch);
> +               intel_bb_out(ibb, (rect->y << 16) | x);
> +               intel_bb_out(ibb, ((rect->y + rect->h) << 16) | (x + w));
> +               intel_bb_emit_reloc_fenced(ibb, dst->handle, 0, I915_GEM_DOMAIN_RENDER,
> +                                          0, dst->addr.offset);
> +               for (int i = 0; i < 8*8; i += 2) {
> +                       intel_bb_out(ibb, color);
> +                       intel_bb_out(ibb, color >> 32);
> +               }
> +
> +               switch_blt_tiling(ibb, tiling, false);
>         } else {
>                 switch (buf->bpp) {
>                 case 8:
> diff --git a/lib/intel_reg.h b/lib/intel_reg.h
> index 26833c66f8e7..903b44b59fc3 100644
> --- a/lib/intel_reg.h
> +++ b/lib/intel_reg.h
> @@ -2545,6 +2545,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
>  #define XY_COLOR_BLT_WRITE_RGB         (1<<20)
>  #define XY_COLOR_BLT_TILED             (1<<11)
>
> +#define XY_PAT_BLT_IMMEDIATE_CMD_NOLEN ((2<<29)|(0x72<<22))
> +
>  #define XY_SETUP_CLIP_BLT_CMD          ((2<<29)|(3<<22)|1)
>
>  #define XY_SRC_COPY_BLT_WRITE_ALPHA    (1<<21)
> --
> 2.45.2
>


More information about the igt-dev mailing list