[Pixman] [PATCH] MIPS: DSPr2: Added over_n_8_8888 and over_n_8_0565 fast paths.

Siarhei Siamashka siarhei.siamashka at gmail.com
Wed Apr 4 01:25:46 PDT 2012


On Tue, Apr 3, 2012 at 8:30 PM, Nemanja Lukic <nlukic at mips.com> wrote:
> From: Nemanja Lukic <nemanja.lukic at rt-rk.com>

> +LEAF_MIPS_DSPR2(pixman_composite_over_n_8_0565_asm_mips)
> +/*
> + * a0 - dst  (r5g6b5)
> + * a1 - src  (32bit constant)
> + * a2 - mask (a8)
> + * a3 - w
> + */
> +
> +    beqz     a3, 3f
> +     nop
> +    li       t4, 0x00ff00ff
> +    li       t5, 0xff
> +    srl      t6, a1, 24     /* t6 = srca */
> +    beq      t6, t5, 2f     /* if (srca == 0xff) */
> +     nop
> +1:
> +                            /* a1 = src */
> +    lbu      t0, 0(a2)      /* t0 = mask */
> +    beqz     t0, 111f       /* if (t0 == 0) */
> +     addiu   a2, a2, 1
> +    lhu     t1, 0(a0)       /* t1 = dst */
> +    CONVERT_1x0565_TO_1x8888 t1, t2, t3, t7
> +    beq      t0, t5, 11f    /* if (t0 == 0xff) */
> +     move    t3, a1
> +
> +    MIPS_UN8x4_MUL_UN8       a1, t0, t3, t4, t7, t8, t9
> +11:
> +    not      t6, t3
> +    srl      t6, t6, 24
> +    MIPS_UN8x4_MUL_UN8       t2, t6, t2, t4, t7, t8, t9
> +    addu_s.qb                t1, t2, t3
> +    CONVERT_1x8888_TO_1x0565 t1, t2, t3, t7
> +    sh       t2, 0(a0)
> +111:
> +    addiu    a3, a3, -1
> +    bgtz     a3, 1b
> +     addiu   a0, a0, 2
> +    b        3f
> +     nop
> +2:
> +                            /* a1 = src */
> +    lbu      t0, 0(a2)      /* t0 = mask */
> +    beqz     t0, 222f       /* if (t0 == 0) */
> +     addiu   a2, a2, 1
> +    beq      t0, t5, 22f    /* if (t0 == 0xff) */
> +     move    t1, a1
> +    lhu      t1, 0(a0)      /* t1 = dst */
> +
> +    CONVERT_1x0565_TO_1x8888 t1, t2, t3, t7
> +    OVER_8888_8_8888         a1, t0, t2, t1, t4, t3, t7, t8, t9
> +22:
> +    CONVERT_1x8888_TO_1x0565 t1, t9, t3, t7

I think this can be improved a bit. When (srca == 0xff && mask ==
0xff) there is no need to do 8888 to 0565 conversion on each
iteration, it can be done once.

> +    sh       t9, 0(a0)
> +222:
> +    addiu    a3, a3, -1
> +    bgtz     a3, 2b
> +     addiu   a0, a0, 2
> +3:
> +    j        ra
> +     nop
> +
> +END(pixman_composite_over_n_8_0565_asm_mips)

-- 
Best regards,
Siarhei Siamashka


More information about the Pixman mailing list