[Mesa-dev] [PATCH 09/11] intel: Add support for blitting 6 byte-per-pixel formats.

Kenneth Graunke kenneth at whitecape.org
Fri May 10 15:00:59 PDT 2013


On 04/16/2013 05:21 PM, Eric Anholt wrote:
> The next commit introduces what is apparently our first one, which tripped
> over this in glReadPixels.
> ---
>   src/mesa/drivers/dri/intel/intel_blit.c |   21 ++++++++++++++-------
>   1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
> index 1f3fad5..cc2fa70 100644
> --- a/src/mesa/drivers/dri/intel/intel_blit.c
> +++ b/src/mesa/drivers/dri/intel/intel_blit.c
> @@ -150,15 +150,22 @@ intelEmitCopyBlit(struct intel_context *intel,
>      if (src_pitch % 4 != 0 || dst_pitch % 4 != 0)
>         return false;
>
> -   /* For big formats (such as floating point), do the copy using 32bpp and
> -    * multiply the coordinates.
> +   /* For big formats (such as floating point), do the copy using 16 or 32bpp
> +    * and multiply the coordinates.
>       */
>      if (cpp > 4) {
> -      assert(cpp % 4 == 0);
> -      dst_x *= cpp / 4;
> -      dst_x2 *= cpp / 4;
> -      src_x *= cpp / 4;
> -      cpp = 4;
> +      if (cpp % 4 == 2) {
> +         dst_x *= cpp / 2;
> +         dst_x2 *= cpp / 2;
> +         src_x *= cpp / 2;
> +         cpp = 2;
> +      } else {
> +         assert(cpp % 4 == 0);
> +         dst_x *= cpp / 4;
> +         dst_x2 *= cpp / 4;
> +         src_x *= cpp / 4;
> +         cpp = 4;
> +      }
>      }
>
>      BR13 = br13_for_cpp(cpp) | translate_raster_op(logic_op) << 16;
>

Ah, right, RGB_FLOAT16 would be our first 3-component 16-bit = 48-bit = 
6 byte format.  So yeah, this is definitely necessary, and looks fine.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the mesa-dev mailing list