• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018-2019 Lima 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, sublicense,
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 shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  */
23 
24 #ifndef H_LIMA_JOB
25 #define H_LIMA_JOB
26 
27 #include <stdbool.h>
28 #include <stdint.h>
29 
30 #include <util/u_dynarray.h>
31 
32 #include <pipe/p_state.h>
33 
34 struct lima_context;
35 struct lima_bo;
36 struct lima_dump;
37 struct pipe_surface;
38 
39 struct lima_job_key {
40    struct pipe_surface *cbuf;
41    struct pipe_surface *zsbuf;
42 };
43 
44 struct lima_job_clear {
45    unsigned buffers;
46    uint32_t color_8pc;
47    uint32_t depth;
48    uint32_t stencil;
49    uint64_t color_16pc;
50 };
51 
52 struct lima_job_fb_info {
53    int width, height;
54    int tiled_w, tiled_h;
55    int shift_w, shift_h;
56    int block_w, block_h;
57    int shift_min;
58 };
59 
60 struct lima_job {
61    int fd;
62    struct lima_context *ctx;
63 
64    struct util_dynarray gem_bos[2];
65    struct util_dynarray bos[2];
66 
67    struct lima_job_key key;
68 
69    struct util_dynarray vs_cmd_array;
70    struct util_dynarray plbu_cmd_array;
71    struct util_dynarray plbu_cmd_head;
72 
73    unsigned resolve;
74 
75    int pp_max_stack_size;
76 
77    struct pipe_scissor_state damage_rect;
78 
79    struct lima_job_clear clear;
80 
81    struct lima_job_fb_info fb;
82 
83    /* for dump command stream */
84    struct lima_dump *dump;
85 };
86 
87 static inline bool
lima_job_has_draw_pending(struct lima_job * job)88 lima_job_has_draw_pending(struct lima_job *job)
89 {
90    return !!job->plbu_cmd_array.size;
91 }
92 
93 struct lima_job *lima_job_get(struct lima_context *ctx);
94 
95 bool lima_job_add_bo(struct lima_job *job, int pipe,
96                      struct lima_bo *bo, uint32_t flags);
97 void *lima_job_create_stream_bo(struct lima_job *job, int pipe,
98                                 unsigned size, uint32_t *va);
99 
100 void lima_do_job(struct lima_job *job);
101 
102 bool lima_job_init(struct lima_context *ctx);
103 void lima_job_fini(struct lima_context *ctx);
104 
105 #endif
106