summaryrefslogtreecommitdiff
path: root/r6xx.h
blob: 7465717779d70b169187bbbe029d2bf252025e86 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
 * Copyright 2009 Advanced Micro Devices, Inc.
 * Copyright 2012 Red Hat Inc.
 *
 * 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
 * on 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 AUTHOR(S) AND/OR THEIR SUPPLIERS 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:
 *     Alex Deucher <alexander.deucher@amd.com>
 *     Jerome Glisse
 */
#ifndef R6XX_H
#define R6XX_H

#include "rati_file.h"

struct r6xx_sq_conf {
    unsigned                        ps_prio;
    unsigned                        vs_prio;
    unsigned                        gs_prio;
    unsigned                        es_prio;
    unsigned                        num_ps_gprs;
    unsigned                        num_vs_gprs;
    unsigned                        num_gs_gprs;
    unsigned                        num_es_gprs;
    unsigned                        num_temp_gprs;
    unsigned                        num_ps_threads;
    unsigned                        num_vs_threads;
    unsigned                        num_gs_threads;
    unsigned                        num_es_threads;
    unsigned                        num_ps_stack_entries;
    unsigned                        num_vs_stack_entries;
    unsigned                        num_gs_stack_entries;
    unsigned                        num_es_stack_entries;
    unsigned                        sq_config;
};

struct r6xx_vbo {
    unsigned                        offset;
    unsigned                        ndw;
    unsigned                        stride;
    unsigned                        data_format;
    unsigned                        num_format_all;
    unsigned                        format_comp_all;
    unsigned                        srf_mode_all;
    unsigned                        endian_swap;
    unsigned                        mem_request_size;
    struct ctx_bo                   *bo;
};

struct r6xx_draw {
    unsigned                        primitive_type;
    unsigned                        num_instances;
    unsigned                        index_type;
    unsigned                        num_indices;
    unsigned                        vgt_draw_initiator;
};

struct r6xx_blit;

void r6xx_emit_reloc(struct r6xx_blit *blit, struct ctx_bo *bo);
int r6xx_sq_conf(struct r6xx_blit *blit);
int r6xx_set_vport_scissor(struct r6xx_blit *blit, unsigned id, int x1, int y1, int x2, int y2);
int r6xx_set_generic_scissor(struct r6xx_blit *blit, int x1, int y1, int x2, int y2);
int r6xx_set_window_scissor(struct r6xx_blit *blit, int x1, int y1, int x2, int y2);
int r6xx_set_screen_scissor(struct r6xx_blit *blit, int x1, int y1, int x2, int y2);
int r6xx_set_clip_rect(struct r6xx_blit *blit, unsigned id, int x1, int y1, int x2, int y2);
int r6xx_set_render_target(struct r6xx_blit *blit, struct ctx_bo *bo);
int r6xx_fs_setup(struct r6xx_blit *blit, struct ctx_bo *bo,
                  unsigned offset, unsigned ngprs, unsigned stack_size);
int r6xx_vs_setup(struct r6xx_blit *blit, struct ctx_bo *bo,
                  unsigned offset, unsigned ngprs, unsigned stack_size,
                  unsigned cs_export_count);
void r6xx_ps_setup(struct r6xx_blit *blit, struct ctx_bo *bo,
                   unsigned offset, unsigned ngprs, unsigned stack_size,
                   unsigned export_mode, unsigned num_interp);
int r6xx_set_alu_consts(struct r6xx_blit *blit, unsigned id,
                        unsigned count, float *cst);
void r6xx_set_default_sampler(struct r6xx_blit *blit, unsigned id);
void r6xx_set_tex_resource(struct r6xx_blit *blit, unsigned id, struct ctx_bo *bo);
int r6xx_set_vtx_resource(struct r6xx_blit *blit, unsigned id,
                          struct r6xx_vbo *vbo);
int r6xx_draw_auto(struct r6xx_blit *blit, struct r6xx_draw *draw);
int r6xx_disable_depth(struct r6xx_blit *blit);
int r6xx_surface_sync(struct r6xx_blit *blit,
                      struct ctx_bo *bo,
                      unsigned sync_type);
int r6xx_event(struct r6xx_blit *blit, unsigned event_iniator);
int r6xx_set_default_state(struct r6xx_blit *blit);
unsigned r6xx_solid_vs(uint32_t *shader);
unsigned r6xx_copy_vs(uint32_t *shader);
unsigned r6xx_solid_ps(uint32_t* shader);
unsigned r6xx_copy_ps(uint32_t *shader);

/*
 * rfile helper
 */
int r6xx_rfile_legalize(struct rati_file *rfile);
int r6xx_rfile_clear_offset(struct rati_file *rfile);

/*
 * tati helpers
 */
int r6xx_tati_cmd_buffer_write(struct rati_file *rfile,
                               unsigned idx, FILE *file);

#endif