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