summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/etnaviv/etnaviv_blt.h
blob: 868440828ac0bb8219b28b15941f4a10d6601c20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
 * Copyright (c) 2017 Etnaviv Project
 * Copyright (C) 2017 Zodiac Inflight Innovations
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sub license,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 *
 * Authors:
 *    Wladimir J. van der Laan <laanwj@gmail.com>
 */
#ifndef H_ETNAVIV_BLT
#define H_ETNAVIV_BLT

#include "etnaviv_tiling.h"

#include <stdbool.h>
#include "drm/etnaviv_drmif.h"

struct pipe_context;

/* src/dest info for image operations */
struct blt_imginfo
{
   unsigned compressed:1;
   unsigned use_ts:1;
   struct etna_reloc addr;
   struct etna_reloc ts_addr;
   uint32_t format; /* BLT_FORMAT_* */
   uint32_t stride;
   uint32_t compress_fmt; /* COLOR_COMPRESSION_FORMAT_* */
   enum etna_surface_layout tiling; /* ETNA_LAYOUT_* */
   uint32_t ts_clear_value[2];
   uint8_t swizzle[4]; /* TEXTURE_SWIZZLE_* */
   uint8_t cache_mode; /* TS_CACHE_MODE_* */
   uint8_t endian_mode; /* ENDIAN_MODE_* */
   uint8_t bpp; /* # bytes per pixel 1/2/4/8 - only used for CLEAR_IMAGE */
};

/** (Partial) image clear operation.
 */
struct blt_clear_op
{
   struct blt_imginfo dest;
   uint32_t clear_value[2];
   uint32_t clear_bits[2]; /* bit mask of bits to clear */
   uint16_t rect_x;
   uint16_t rect_y;
   uint16_t rect_w;
   uint16_t rect_h;
};

/** Copy image operation.
 */
struct blt_imgcopy_op
{
   unsigned flip_y:1;
   struct blt_imginfo src;
   struct blt_imginfo dest;
   uint16_t src_x;
   uint16_t src_y;
   uint16_t dest_x;
   uint16_t dest_y;
   uint16_t rect_w;
   uint16_t rect_h;
};

/** Resolve-in-place operation.
 * Fills unfilled tiles.
 */
struct blt_inplace_op
{
   struct etna_reloc addr;
   struct etna_reloc ts_addr;
   uint32_t ts_clear_value[2];
   uint32_t num_tiles;
   uint8_t cache_mode; /* TS_CACHE_MODE_* */
   uint8_t bpp;
};

/* Context initialization for BLT clear_blit functions. */
void
etna_clear_blit_blt_init(struct pipe_context *pctx);

#endif