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 33struct rs_state { 34 uint8_t downsample_x : 1; /* Downsample in x direction */ 35 uint8_t downsample_y : 1; /* Downsample in y direction */ 36 37 uint8_t source_format; /* RS_FORMAT_XXX */ 38 uint8_t source_tiling; /* ETNA_LAYOUT_XXX */ 39 uint8_t dest_tiling; /* ETNA_LAYOUT_XXX */ 40 uint8_t dest_format; /* RS_FORMAT_XXX */ 41 uint8_t swap_rb; 42 uint8_t flip; 43 struct etna_bo *source; 44 uint32_t source_offset; 45 uint32_t source_stride; 46 uint32_t source_padded_height; /* total padded height */ 47 struct etna_bo *dest; 48 uint32_t dest_offset; 49 uint32_t dest_stride; 50 uint32_t dest_padded_height; /* total padded height */ 51 uint16_t width; /* source width */ 52 uint16_t height; /* source height */ 53 uint32_t dither[2]; 54 uint32_t clear_bits; 55 uint32_t clear_mode; /* VIVS_RS_CLEAR_CONTROL_MODE_XXX */ 56 uint32_t clear_value[4]; 57 uint8_t aa; 58 uint8_t endian_mode; /* ENDIAN_MODE_XXX */ 59}; 60 61/* treat this as opaque structure */ 62struct compiled_rs_state { 63 uint32_t RS_CONFIG; 64 uint32_t RS_SOURCE_STRIDE; 65 uint32_t RS_DEST_STRIDE; 66 uint32_t RS_WINDOW_SIZE; 67 uint32_t RS_DITHER[2]; 68 uint32_t RS_CLEAR_CONTROL; 69 uint32_t RS_FILL_VALUE[4]; 70 uint32_t RS_EXTRA_CONFIG; 71 uint32_t RS_PIPE_OFFSET[2]; 72 73 struct etna_reloc source[2]; 74 struct etna_reloc dest[2]; 75}; 76 77/* compile RS state struct */ 78void 79etna_compile_rs_state(struct etna_context *ctx, struct compiled_rs_state *cs, 80 const struct rs_state *rs); 81 82/* modify the clear bits value in the compiled RS state */ 83void 84etna_modify_rs_clearbits(struct compiled_rs_state *cs, uint32_t clear_bits); 85 86#endif 87