101e04c3fSmrg/*
201e04c3fSmrg * Copyright (c) 2017 Etnaviv Project
301e04c3fSmrg * Copyright (C) 2017 Zodiac Inflight Innovations
401e04c3fSmrg *
501e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
601e04c3fSmrg * copy of this software and associated documentation files (the "Software"),
701e04c3fSmrg * to deal in the Software without restriction, including without limitation
801e04c3fSmrg * the rights to use, copy, modify, merge, publish, distribute, sub license,
901e04c3fSmrg * and/or sell copies of the Software, and to permit persons to whom the
1001e04c3fSmrg * Software is furnished to do so, subject to the following conditions:
1101e04c3fSmrg *
1201e04c3fSmrg * The above copyright notice and this permission notice (including the
1301e04c3fSmrg * next paragraph) shall be included in all copies or substantial portions
1401e04c3fSmrg * of the Software.
1501e04c3fSmrg *
1601e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1701e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1801e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
1901e04c3fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2001e04c3fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2101e04c3fSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2201e04c3fSmrg * DEALINGS IN THE SOFTWARE.
2301e04c3fSmrg *
2401e04c3fSmrg * Authors:
2501e04c3fSmrg *    Wladimir J. van der Laan <laanwj@gmail.com>
2601e04c3fSmrg */
2701e04c3fSmrg#ifndef H_ETNAVIV_BLT
2801e04c3fSmrg#define H_ETNAVIV_BLT
2901e04c3fSmrg
3001e04c3fSmrg#include "etnaviv_tiling.h"
3101e04c3fSmrg
3201e04c3fSmrg#include <stdbool.h>
337ec681f3Smrg#include "drm/etnaviv_drmif.h"
3401e04c3fSmrg
3501e04c3fSmrgstruct pipe_context;
3601e04c3fSmrg
3701e04c3fSmrg/* src/dest info for image operations */
3801e04c3fSmrgstruct blt_imginfo
3901e04c3fSmrg{
4001e04c3fSmrg   unsigned use_ts:1;
4101e04c3fSmrg   struct etna_reloc addr;
4201e04c3fSmrg   struct etna_reloc ts_addr;
4301e04c3fSmrg   uint32_t format; /* BLT_FORMAT_* */
4401e04c3fSmrg   uint32_t stride;
4501e04c3fSmrg   enum etna_surface_layout tiling; /* ETNA_LAYOUT_* */
4601e04c3fSmrg   uint32_t ts_clear_value[2];
4701e04c3fSmrg   uint8_t swizzle[4]; /* TEXTURE_SWIZZLE_* */
487ec681f3Smrg   uint8_t ts_mode; /* TS_MODE_* */
497ec681f3Smrg   int8_t ts_compress_fmt; /* COLOR_COMPRESSION_FORMAT_* */
5001e04c3fSmrg   uint8_t endian_mode; /* ENDIAN_MODE_* */
5101e04c3fSmrg   uint8_t bpp; /* # bytes per pixel 1/2/4/8 - only used for CLEAR_IMAGE */
5201e04c3fSmrg};
5301e04c3fSmrg
5401e04c3fSmrg/** (Partial) image clear operation.
5501e04c3fSmrg */
5601e04c3fSmrgstruct blt_clear_op
5701e04c3fSmrg{
5801e04c3fSmrg   struct blt_imginfo dest;
5901e04c3fSmrg   uint32_t clear_value[2];
6001e04c3fSmrg   uint32_t clear_bits[2]; /* bit mask of bits to clear */
6101e04c3fSmrg   uint16_t rect_x;
6201e04c3fSmrg   uint16_t rect_y;
6301e04c3fSmrg   uint16_t rect_w;
6401e04c3fSmrg   uint16_t rect_h;
6501e04c3fSmrg};
6601e04c3fSmrg
6701e04c3fSmrg/** Copy image operation.
6801e04c3fSmrg */
6901e04c3fSmrgstruct blt_imgcopy_op
7001e04c3fSmrg{
7101e04c3fSmrg   unsigned flip_y:1;
7201e04c3fSmrg   struct blt_imginfo src;
7301e04c3fSmrg   struct blt_imginfo dest;
7401e04c3fSmrg   uint16_t src_x;
7501e04c3fSmrg   uint16_t src_y;
7601e04c3fSmrg   uint16_t dest_x;
7701e04c3fSmrg   uint16_t dest_y;
7801e04c3fSmrg   uint16_t rect_w;
7901e04c3fSmrg   uint16_t rect_h;
8001e04c3fSmrg};
8101e04c3fSmrg
8201e04c3fSmrg/** Resolve-in-place operation.
8301e04c3fSmrg * Fills unfilled tiles.
8401e04c3fSmrg */
8501e04c3fSmrgstruct blt_inplace_op
8601e04c3fSmrg{
8701e04c3fSmrg   struct etna_reloc addr;
8801e04c3fSmrg   struct etna_reloc ts_addr;
8901e04c3fSmrg   uint32_t ts_clear_value[2];
9001e04c3fSmrg   uint32_t num_tiles;
917ec681f3Smrg   uint8_t ts_mode; /* TS_MODE_* */
9201e04c3fSmrg   uint8_t bpp;
9301e04c3fSmrg};
9401e04c3fSmrg
9501e04c3fSmrg/* Context initialization for BLT clear_blit functions. */
9601e04c3fSmrgvoid
9701e04c3fSmrgetna_clear_blit_blt_init(struct pipe_context *pctx);
9801e04c3fSmrg
9901e04c3fSmrg#endif
100