etnaviv_rs.h revision 7ec681f3
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   uint8_t source_ts_valid : 1;
37   uint8_t source_ts_compressed : 1;
38
39   uint8_t source_format; /* RS_FORMAT_XXX */
40   uint8_t source_tiling; /* ETNA_LAYOUT_XXX */
41   uint8_t dest_tiling; /* ETNA_LAYOUT_XXX */
42   uint8_t dest_format; /* RS_FORMAT_XXX */
43   uint8_t swap_rb;
44   uint8_t flip;
45   struct etna_bo *source;
46   uint32_t source_offset;
47   uint32_t source_stride;
48   uint32_t source_padded_width; /* total padded width (only needed for source) */
49   uint32_t source_padded_height; /* total padded height */
50   struct etna_bo *dest;
51   uint32_t dest_offset;
52   uint32_t dest_stride;
53   uint32_t dest_padded_height; /* total padded height */
54   uint16_t width; /* source width */
55   uint16_t height; /* source height */
56   uint32_t dither[2];
57   uint32_t clear_bits;
58   uint32_t clear_mode; /* VIVS_RS_CLEAR_CONTROL_MODE_XXX */
59   uint32_t clear_value[4];
60   uint32_t tile_count;
61   uint8_t aa;
62   uint8_t endian_mode; /* ENDIAN_MODE_XXX */
63};
64
65/* treat this as opaque structure */
66struct compiled_rs_state {
67   uint8_t source_ts_valid : 1;
68   uint32_t RS_CONFIG;
69   uint32_t RS_SOURCE_STRIDE;
70   uint32_t RS_DEST_STRIDE;
71   uint32_t RS_WINDOW_SIZE;
72   uint32_t RS_DITHER[2];
73   uint32_t RS_CLEAR_CONTROL;
74   uint32_t RS_FILL_VALUE[4];
75   uint32_t RS_EXTRA_CONFIG;
76   uint32_t RS_PIPE_OFFSET[2];
77   uint32_t RS_KICKER_INPLACE; /* Set if source is destination */
78
79   struct etna_reloc source[2];
80   struct etna_reloc dest[2];
81};
82
83/* compile RS state struct */
84void
85etna_compile_rs_state(struct etna_context *ctx, struct compiled_rs_state *cs,
86                      const struct rs_state *rs);
87
88/* Context initialization for RS clear_blit functions. */
89void
90etna_clear_blit_rs_init(struct pipe_context *pctx);
91
92#endif
93