101e04c3fSmrg/*
201e04c3fSmrg * Copyright (c) 2012-2013 Etnaviv Project
301e04c3fSmrg *
401e04c3fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
501e04c3fSmrg * copy of this software and associated documentation files (the "Software"),
601e04c3fSmrg * to deal in the Software without restriction, including without limitation
701e04c3fSmrg * the rights to use, copy, modify, merge, publish, distribute, sub license,
801e04c3fSmrg * and/or sell copies of the Software, and to permit persons to whom the
901e04c3fSmrg * Software is furnished to do so, subject to the following conditions:
1001e04c3fSmrg *
1101e04c3fSmrg * The above copyright notice and this permission notice (including the
1201e04c3fSmrg * next paragraph) shall be included in all copies or substantial portions
1301e04c3fSmrg * of the Software.
1401e04c3fSmrg *
1501e04c3fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1601e04c3fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1701e04c3fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
1801e04c3fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1901e04c3fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2001e04c3fSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2101e04c3fSmrg * DEALINGS IN THE SOFTWARE.
2201e04c3fSmrg *
2301e04c3fSmrg * Authors:
2401e04c3fSmrg *    Wladimir J. van der Laan <laanwj@gmail.com>
2501e04c3fSmrg */
2601e04c3fSmrg
2701e04c3fSmrg#ifndef H_ETNAVIV_RS
2801e04c3fSmrg#define H_ETNAVIV_RS
2901e04c3fSmrg
3001e04c3fSmrg#include "etnaviv_context.h"
3101e04c3fSmrg#include <stdint.h>
3201e04c3fSmrg
3301e04c3fSmrgstruct rs_state {
3401e04c3fSmrg   uint8_t downsample_x : 1; /* Downsample in x direction */
3501e04c3fSmrg   uint8_t downsample_y : 1; /* Downsample in y direction */
3601e04c3fSmrg   uint8_t source_ts_valid : 1;
377ec681f3Smrg   uint8_t source_ts_compressed : 1;
3801e04c3fSmrg
3901e04c3fSmrg   uint8_t source_format; /* RS_FORMAT_XXX */
4001e04c3fSmrg   uint8_t source_tiling; /* ETNA_LAYOUT_XXX */
4101e04c3fSmrg   uint8_t dest_tiling; /* ETNA_LAYOUT_XXX */
4201e04c3fSmrg   uint8_t dest_format; /* RS_FORMAT_XXX */
4301e04c3fSmrg   uint8_t swap_rb;
4401e04c3fSmrg   uint8_t flip;
4501e04c3fSmrg   struct etna_bo *source;
4601e04c3fSmrg   uint32_t source_offset;
4701e04c3fSmrg   uint32_t source_stride;
4801e04c3fSmrg   uint32_t source_padded_width; /* total padded width (only needed for source) */
4901e04c3fSmrg   uint32_t source_padded_height; /* total padded height */
5001e04c3fSmrg   struct etna_bo *dest;
5101e04c3fSmrg   uint32_t dest_offset;
5201e04c3fSmrg   uint32_t dest_stride;
5301e04c3fSmrg   uint32_t dest_padded_height; /* total padded height */
5401e04c3fSmrg   uint16_t width; /* source width */
5501e04c3fSmrg   uint16_t height; /* source height */
5601e04c3fSmrg   uint32_t dither[2];
5701e04c3fSmrg   uint32_t clear_bits;
5801e04c3fSmrg   uint32_t clear_mode; /* VIVS_RS_CLEAR_CONTROL_MODE_XXX */
5901e04c3fSmrg   uint32_t clear_value[4];
6001e04c3fSmrg   uint32_t tile_count;
6101e04c3fSmrg   uint8_t aa;
6201e04c3fSmrg   uint8_t endian_mode; /* ENDIAN_MODE_XXX */
6301e04c3fSmrg};
6401e04c3fSmrg
6501e04c3fSmrg/* treat this as opaque structure */
6601e04c3fSmrgstruct compiled_rs_state {
6701e04c3fSmrg   uint8_t source_ts_valid : 1;
6801e04c3fSmrg   uint32_t RS_CONFIG;
6901e04c3fSmrg   uint32_t RS_SOURCE_STRIDE;
7001e04c3fSmrg   uint32_t RS_DEST_STRIDE;
7101e04c3fSmrg   uint32_t RS_WINDOW_SIZE;
7201e04c3fSmrg   uint32_t RS_DITHER[2];
7301e04c3fSmrg   uint32_t RS_CLEAR_CONTROL;
7401e04c3fSmrg   uint32_t RS_FILL_VALUE[4];
7501e04c3fSmrg   uint32_t RS_EXTRA_CONFIG;
7601e04c3fSmrg   uint32_t RS_PIPE_OFFSET[2];
7701e04c3fSmrg   uint32_t RS_KICKER_INPLACE; /* Set if source is destination */
7801e04c3fSmrg
7901e04c3fSmrg   struct etna_reloc source[2];
8001e04c3fSmrg   struct etna_reloc dest[2];
8101e04c3fSmrg};
8201e04c3fSmrg
8301e04c3fSmrg/* compile RS state struct */
8401e04c3fSmrgvoid
8501e04c3fSmrgetna_compile_rs_state(struct etna_context *ctx, struct compiled_rs_state *cs,
8601e04c3fSmrg                      const struct rs_state *rs);
8701e04c3fSmrg
8801e04c3fSmrg/* Context initialization for RS clear_blit functions. */
8901e04c3fSmrgvoid
9001e04c3fSmrgetna_clear_blit_rs_init(struct pipe_context *pctx);
9101e04c3fSmrg
9201e04c3fSmrg#endif
93