1b8e80941Smrg/* 2b8e80941Smrg * Copyright (c) 2012-2013 Etnaviv Project 3b8e80941Smrg * 4b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5b8e80941Smrg * copy of this software and associated documentation files (the "Software"), 6b8e80941Smrg * to deal in the Software without restriction, including without limitation 7b8e80941Smrg * the rights to use, copy, modify, merge, publish, distribute, sub license, 8b8e80941Smrg * and/or sell copies of the Software, and to permit persons to whom the 9b8e80941Smrg * Software is furnished to do so, subject to the following conditions: 10b8e80941Smrg * 11b8e80941Smrg * The above copyright notice and this permission notice (including the 12b8e80941Smrg * next paragraph) shall be included in all copies or substantial portions 13b8e80941Smrg * of the Software. 14b8e80941Smrg * 15b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16b8e80941Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17b8e80941Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18b8e80941Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19b8e80941Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20b8e80941Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21b8e80941Smrg * DEALINGS IN THE SOFTWARE. 22b8e80941Smrg * 23b8e80941Smrg * Authors: 24b8e80941Smrg * Wladimir J. van der Laan <laanwj@gmail.com> 25b8e80941Smrg */ 26b8e80941Smrg 27b8e80941Smrg#ifndef H_ETNAVIV_RS 28b8e80941Smrg#define H_ETNAVIV_RS 29b8e80941Smrg 30b8e80941Smrg#include "etnaviv_context.h" 31b8e80941Smrg#include <stdint.h> 32b8e80941Smrg 33b8e80941Smrgstruct rs_state { 34b8e80941Smrg uint8_t downsample_x : 1; /* Downsample in x direction */ 35b8e80941Smrg uint8_t downsample_y : 1; /* Downsample in y direction */ 36b8e80941Smrg uint8_t source_ts_valid : 1; 37b8e80941Smrg 38b8e80941Smrg uint8_t source_format; /* RS_FORMAT_XXX */ 39b8e80941Smrg uint8_t source_tiling; /* ETNA_LAYOUT_XXX */ 40b8e80941Smrg uint8_t dest_tiling; /* ETNA_LAYOUT_XXX */ 41b8e80941Smrg uint8_t dest_format; /* RS_FORMAT_XXX */ 42b8e80941Smrg uint8_t swap_rb; 43b8e80941Smrg uint8_t flip; 44b8e80941Smrg struct etna_bo *source; 45b8e80941Smrg uint32_t source_offset; 46b8e80941Smrg uint32_t source_stride; 47b8e80941Smrg uint32_t source_padded_width; /* total padded width (only needed for source) */ 48b8e80941Smrg uint32_t source_padded_height; /* total padded height */ 49b8e80941Smrg struct etna_bo *dest; 50b8e80941Smrg uint32_t dest_offset; 51b8e80941Smrg uint32_t dest_stride; 52b8e80941Smrg uint32_t dest_padded_height; /* total padded height */ 53b8e80941Smrg uint16_t width; /* source width */ 54b8e80941Smrg uint16_t height; /* source height */ 55b8e80941Smrg uint32_t dither[2]; 56b8e80941Smrg uint32_t clear_bits; 57b8e80941Smrg uint32_t clear_mode; /* VIVS_RS_CLEAR_CONTROL_MODE_XXX */ 58b8e80941Smrg uint32_t clear_value[4]; 59b8e80941Smrg uint32_t tile_count; 60b8e80941Smrg uint8_t aa; 61b8e80941Smrg uint8_t endian_mode; /* ENDIAN_MODE_XXX */ 62b8e80941Smrg}; 63b8e80941Smrg 64b8e80941Smrg/* treat this as opaque structure */ 65b8e80941Smrgstruct compiled_rs_state { 66b8e80941Smrg uint8_t source_ts_valid : 1; 67b8e80941Smrg uint32_t RS_CONFIG; 68b8e80941Smrg uint32_t RS_SOURCE_STRIDE; 69b8e80941Smrg uint32_t RS_DEST_STRIDE; 70b8e80941Smrg uint32_t RS_WINDOW_SIZE; 71b8e80941Smrg uint32_t RS_DITHER[2]; 72b8e80941Smrg uint32_t RS_CLEAR_CONTROL; 73b8e80941Smrg uint32_t RS_FILL_VALUE[4]; 74b8e80941Smrg uint32_t RS_EXTRA_CONFIG; 75b8e80941Smrg uint32_t RS_PIPE_OFFSET[2]; 76b8e80941Smrg uint32_t RS_KICKER_INPLACE; /* Set if source is destination */ 77b8e80941Smrg 78b8e80941Smrg struct etna_reloc source[2]; 79b8e80941Smrg struct etna_reloc dest[2]; 80b8e80941Smrg}; 81b8e80941Smrg 82b8e80941Smrg/* compile RS state struct */ 83b8e80941Smrgvoid 84b8e80941Smrgetna_compile_rs_state(struct etna_context *ctx, struct compiled_rs_state *cs, 85b8e80941Smrg const struct rs_state *rs); 86b8e80941Smrg 87b8e80941Smrg/* Context initialization for RS clear_blit functions. */ 88b8e80941Smrgvoid 89b8e80941Smrgetna_clear_blit_rs_init(struct pipe_context *pctx); 90b8e80941Smrg 91b8e80941Smrg#endif 92