summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/lima/lima_job.h
blob: f9691236db52cca8357ad826b518c7dd0e387bed (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
/*
 * Copyright (C) 2018-2019 Lima Project
 *
 * 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, sublicense,
 * 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 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 NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
 *
 */

#ifndef H_LIMA_JOB
#define H_LIMA_JOB

#include <stdbool.h>
#include <stdint.h>

#include <util/u_dynarray.h>

#include <pipe/p_state.h>

struct lima_context;
struct lima_bo;
struct lima_dump;
struct pipe_surface;

struct lima_job_key {
   struct pipe_surface *cbuf;
   struct pipe_surface *zsbuf;
};

struct lima_job_clear {
   unsigned buffers;
   uint32_t color_8pc;
   uint32_t depth;
   uint32_t stencil;
   uint64_t color_16pc;
};

struct lima_job_fb_info {
   int width, height;
   int tiled_w, tiled_h;
   int shift_w, shift_h;
   int block_w, block_h;
   int shift_min;
};

struct lima_job {
   int fd;
   struct lima_context *ctx;

   struct util_dynarray gem_bos[2];
   struct util_dynarray bos[2];

   struct lima_job_key key;

   struct util_dynarray vs_cmd_array;
   struct util_dynarray plbu_cmd_array;
   struct util_dynarray plbu_cmd_head;

   unsigned resolve;

   int pp_max_stack_size;

   struct pipe_scissor_state damage_rect;

   struct lima_job_clear clear;

   struct lima_job_fb_info fb;

   /* for dump command stream */
   struct lima_dump *dump;
};

static inline bool
lima_job_has_draw_pending(struct lima_job *job)
{
   return !!job->plbu_cmd_array.size;
}

struct lima_job *lima_job_get(struct lima_context *ctx);

bool lima_job_add_bo(struct lima_job *job, int pipe,
                     struct lima_bo *bo, uint32_t flags);
void *lima_job_create_stream_bo(struct lima_job *job, int pipe,
                                unsigned size, uint32_t *va);

void lima_do_job(struct lima_job *job);

bool lima_job_init(struct lima_context *ctx);
void lima_job_fini(struct lima_context *ctx);

#endif