| 1 |
/* |
| 2 |
* Copyright © 2022 Imagination Technologies Ltd. |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 |
* of this software and associated documentation files (the "Software"), to deal |
| 6 |
* in the Software without restriction, including without limitation the rights |
| 7 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 |
* copies of the Software, and to permit persons to whom the Software is |
| 9 |
* furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice (including the next |
| 12 |
* paragraph) shall be included in all copies or substantial portions of the |
| 13 |
* 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 NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 18 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 19 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 |
* SOFTWARE. |
| 22 |
*/ |
| 23 |
|
| 24 |
#include <assert.h> |
| 25 |
#include <errno.h> |
| 26 |
#include <fcntl.h> |
| 27 |
#include <limits.h> |
| 28 |
#include <stdbool.h> |
| 29 |
#include <stddef.h> |
| 30 |
#include <stdint.h> |
| 31 |
#include <string.h> |
| 32 |
#include <unistd.h> |
| 33 |
#include <vulkan/vulkan.h> |
| 34 |
|
| 35 |
#include "fw-api/pvr_rogue_fwif.h" |
| 36 |
#include "fw-api/pvr_rogue_fwif_rf.h" |
| 37 |
#include "pvr_csb.h" |
| 38 |
#include "pvr_job_render.h" |
| 39 |
#include "pvr_srv.h" |
| 40 |
#include "pvr_srv_bo.h" |
| 41 |
#include "pvr_srv_bridge.h" |
| 42 |
#include "pvr_srv_job_common.h" |
| 43 |
#include "pvr_srv_job_render.h" |
| 44 |
#include "pvr_srv_sync.h" |
| 45 |
#include "pvr_srv_sync_prim.h" |
| 46 |
#include "pvr_types.h" |
| 47 |
#include "pvr_winsys.h" |
| 48 |
#include "util/compiler.h" |
| 49 |
#include "util/log.h" |
| 50 |
#include "util/macros.h" |
| 51 |
#include "util/os_file.h" |
| 52 |
#include "util/u_math.h" |
| 53 |
#include "vk_alloc.h" |
| 54 |
#include "vk_log.h" |
| 55 |
#include "vk_util.h" |
| 56 |
|
| 57 |
struct pvr_srv_winsys_free_list { |
| 58 |
struct pvr_winsys_free_list base; |
| 59 |
|
| 60 |
void *handle; |
| 61 |
|
| 62 |
struct pvr_srv_winsys_free_list *parent; |
| 63 |
}; |
| 64 |
|
| 65 |
#define to_pvr_srv_winsys_free_list(free_list) \ |
| 66 |
container_of(free_list, struct pvr_srv_winsys_free_list, base) |
| 67 |
|
| 68 |
struct pvr_srv_winsys_rt_dataset { |
| 69 |
struct pvr_winsys_rt_dataset base; |
| 70 |
|
| 71 |
struct { |
| 72 |
void *handle; |
| 73 |
struct pvr_srv_sync_prim *sync_prim; |
| 74 |
} rt_datas[ROGUE_FWIF_NUM_RTDATAS]; |
| 75 |
}; |
| 76 |
|
| 77 |
#define to_pvr_srv_winsys_rt_dataset(rt_dataset) \ |
| 78 |
container_of(rt_dataset, struct pvr_srv_winsys_rt_dataset, base) |
| 79 |
|
| 80 |
struct pvr_srv_winsys_render_ctx { |
| 81 |
struct pvr_winsys_render_ctx base; |
| 82 |
|
| 83 |
/* Handle to kernel context. */ |
| 84 |
void *handle; |
| 85 |
|
| 86 |
int timeline_geom; |
| 87 |
int timeline_frag; |
| 88 |
}; |
| 89 |
|
| 90 |
#define to_pvr_srv_winsys_render_ctx(ctx) \ |
| 91 |
container_of(ctx, struct pvr_srv_winsys_render_ctx, base) |
| 92 |
|
| 93 |
static uint64_t pvr_rogue_get_cr_multisamplectl_val(uint32_t samples, |
| 94 |
bool y_flip) |
| 95 |
{ |
| 96 |
static const struct { |
| 97 |
uint8_t x[8]; |
| 98 |
uint8_t y[8]; |
| 99 |
} sample_positions[4] = { |
| 100 |
/* 1 sample */ |
| 101 |
{ |
| 102 |
.x = { 8 }, |
| 103 |
.y = { 8 }, |
| 104 |
}, |
| 105 |
/* 2 samples */ |
| 106 |
{ |
| 107 |
.x = { 12, 4 }, |
| 108 |
.y = { 12, 4 }, |
| 109 |
}, |
| 110 |
/* 4 samples */ |
| 111 |
{ |
| 112 |
.x = { 6, 14, 2, 10 }, |
| 113 |
.y = { 2, 6, 10, 14 }, |
| 114 |
}, |
| 115 |
/* 8 samples */ |
| 116 |
{ |
| 117 |
.x = { 9, 7, 13, 5, 3, 1, 11, 15 }, |
| 118 |
.y = { 5, 11, 9, 3, 13, 7, 15, 1 }, |
| 119 |
}, |
| 120 |
}; |
| 121 |
uint64_t multisamplectl; |
| 122 |
uint8_t idx; |
| 123 |
|
| 124 |
idx = util_fast_log2(samples); |
| 125 |
assert(idx < ARRAY_SIZE(sample_positions)); |
| 126 |
|
| 127 |
pvr_csb_pack (&multisamplectl, CR_PPP_MULTISAMPLECTL, value) { |
| 128 |
switch (samples) { |
| 129 |
case 8: |
| 130 |
value.msaa_x7 = sample_positions[idx].x[7]; |
| 131 |
value.msaa_x6 = sample_positions[idx].x[6]; |
| 132 |
value.msaa_x5 = sample_positions[idx].x[5]; |
| 133 |
value.msaa_x4 = sample_positions[idx].x[4]; |
| 134 |
|
| 135 |
if (y_flip) { |
| 136 |
value.msaa_y7 = 16U - sample_positions[idx].y[7]; |
| 137 |
value.msaa_y6 = 16U - sample_positions[idx].y[6]; |
| 138 |
value.msaa_y5 = 16U - sample_positions[idx].y[5]; |
| 139 |
value.msaa_y4 = 16U - sample_positions[idx].y[4]; |
| 140 |
} else { |
| 141 |
value.msaa_y7 = sample_positions[idx].y[7]; |
| 142 |
value.msaa_y6 = sample_positions[idx].y[6]; |
| 143 |
value.msaa_y5 = sample_positions[idx].y[5]; |
| 144 |
value.msaa_y4 = sample_positions[idx].y[4]; |
| 145 |
} |
| 146 |
|
| 147 |
FALLTHROUGH; |
| 148 |
case 4: |
| 149 |
value.msaa_x3 = sample_positions[idx].x[3]; |
| 150 |
value.msaa_x2 = sample_positions[idx].x[2]; |
| 151 |
|
| 152 |
if (y_flip) { |
| 153 |
value.msaa_y3 = 16U - sample_positions[idx].y[3]; |
| 154 |
value.msaa_y2 = 16U - sample_positions[idx].y[2]; |
| 155 |
} else { |
| 156 |
value.msaa_y3 = sample_positions[idx].y[3]; |
| 157 |
value.msaa_y2 = sample_positions[idx].y[2]; |
| 158 |
} |
| 159 |
|
| 160 |
FALLTHROUGH; |
| 161 |
case 2: |
| 162 |
value.msaa_x1 = sample_positions[idx].x[1]; |
| 163 |
|
| 164 |
if (y_flip) { |
| 165 |
value.msaa_y1 = 16U - sample_positions[idx].y[1]; |
| 166 |
} else { |
| 167 |
value.msaa_y1 = sample_positions[idx].y[1]; |
| 168 |
} |
| 169 |
|
| 170 |
FALLTHROUGH; |
| 171 |
case 1: |
| 172 |
value.msaa_x0 = sample_positions[idx].x[0]; |
| 173 |
|
| 174 |
if (y_flip) { |
| 175 |
value.msaa_y0 = 16U - sample_positions[idx].y[0]; |
| 176 |
} else { |
| 177 |
value.msaa_y0 = sample_positions[idx].y[0]; |
| 178 |
} |
| 179 |
|
| 180 |
break; |
| 181 |
default: |
| 182 |
UNREACHABLE("Unsupported number of samples"); |
| 183 |
} |
| 184 |
} |
| 185 |
|
| 186 |
return multisamplectl; |
| 187 |
} |
| 188 |
|
| 189 |
static uint32_t |
| 190 |
pvr_rogue_get_cr_isp_mtile_size_val(const struct pvr_device_info *dev_info, |
| 191 |
const struct pvr_rt_mtile_info *mtile_info, |
| 192 |
uint32_t samples) |
| 193 |
{ |
| 194 |
uint32_t samples_per_pixel = |
| 195 |
PVR_GET_FEATURE_VALUE(dev_info, isp_samples_per_pixel, 0); |
| 196 |
uint32_t isp_mtile_size; |
| 197 |
|
| 198 |
pvr_csb_pack (&isp_mtile_size, CR_ISP_MTILE_SIZE, value) { |
| 199 |
value.x = mtile_info->mtile_x1; |
| 200 |
value.y = mtile_info->mtile_y1; |
| 201 |
|
| 202 |
if (samples_per_pixel == 1) { |
| 203 |
if (samples >= 4) |
| 204 |
value.x <<= 1; |
| 205 |
|
| 206 |
if (samples >= 2) |
| 207 |
value.y <<= 1; |
| 208 |
} else if (samples_per_pixel == 2) { |
| 209 |
if (samples >= 8) |
| 210 |
value.x <<= 1; |
| 211 |
|
| 212 |
if (samples >= 4) |
| 213 |
value.y <<= 1; |
| 214 |
} else if (samples_per_pixel == 4) { |
| 215 |
if (samples >= 8) |
| 216 |
value.y <<= 1; |
| 217 |
} else { |
| 218 |
assert(!"Unsupported ISP samples per pixel value"); |
| 219 |
} |
| 220 |
} |
| 221 |
|
| 222 |
return isp_mtile_size; |
| 223 |
} |
| 224 |
|
| 225 |
static uint32_t pvr_rogue_get_ppp_screen_val(uint32_t width, uint32_t height) |
| 226 |
{ |
| 227 |
uint32_t val; |
| 228 |
|
| 229 |
pvr_csb_pack (&val, CR_PPP_SCREEN, state) { |
| 230 |
state.pixxmax = width - 1; |
| 231 |
state.pixymax = height - 1; |
| 232 |
} |
| 233 |
|
| 234 |
return val; |
| 235 |
} |
| 236 |
|
| 237 |
struct pvr_rogue_cr_te { |
| 238 |
uint32_t aa; |
| 239 |
uint32_t mtile1; |
| 240 |
uint32_t mtile2; |
| 241 |
uint32_t screen; |
| 242 |
uint32_t mtile_stride; |
| 243 |
}; |
| 244 |
|
| 245 |
static void pvr_rogue_ct_te_init(const struct pvr_device_info *dev_info, |
| 246 |
const struct pvr_rt_mtile_info *mtile_info, |
| 247 |
uint32_t samples, |
| 248 |
struct pvr_rogue_cr_te *const te_regs) |
| 249 |
{ |
| 250 |
uint32_t samples_per_pixel = |
| 251 |
PVR_GET_FEATURE_VALUE(dev_info, isp_samples_per_pixel, 0); |
| 252 |
|
| 253 |
pvr_csb_pack (&te_regs->aa, CR_TE_AA, value) { |
| 254 |
if (samples_per_pixel == 1) { |
| 255 |
if (samples >= 2) |
| 256 |
value.y = true; |
| 257 |
if (samples >= 4) |
| 258 |
value.x = true; |
| 259 |
} else if (samples_per_pixel == 2) { |
| 260 |
if (samples >= 2) |
| 261 |
value.x2 = true; |
| 262 |
if (samples >= 4) |
| 263 |
value.y = true; |
| 264 |
if (samples >= 8) |
| 265 |
value.x = true; |
| 266 |
} else if (samples_per_pixel == 4) { |
| 267 |
if (samples >= 2) |
| 268 |
value.x2 = true; |
| 269 |
if (samples >= 4) |
| 270 |
value.y2 = true; |
| 271 |
if (samples >= 8) |
| 272 |
value.y = true; |
| 273 |
} else { |
| 274 |
assert(!"Unsupported ISP samples per pixel value"); |
| 275 |
} |
| 276 |
} |
| 277 |
|
| 278 |
pvr_csb_pack (&te_regs->mtile1, CR_TE_MTILE1, value) { |
| 279 |
value.x1 = mtile_info->mtile_x1; |
| 280 |
if (!PVR_HAS_FEATURE(dev_info, simple_internal_parameter_format)) { |
| 281 |
value.x2 = mtile_info->mtile_x2; |
| 282 |
value.x3 = mtile_info->mtile_x3; |
| 283 |
} |
| 284 |
} |
| 285 |
|
| 286 |
pvr_csb_pack (&te_regs->mtile2, CR_TE_MTILE2, value) { |
| 287 |
value.y1 = mtile_info->mtile_y1; |
| 288 |
if (!PVR_HAS_FEATURE(dev_info, simple_internal_parameter_format)) { |
| 289 |
value.y2 = mtile_info->mtile_y2; |
| 290 |
value.y3 = mtile_info->mtile_y3; |
| 291 |
} |
| 292 |
} |
| 293 |
|
| 294 |
pvr_csb_pack (&te_regs->screen, CR_TE_SCREEN, value) { |
| 295 |
value.xmax = mtile_info->x_tile_max; |
| 296 |
value.ymax = mtile_info->y_tile_max; |
| 297 |
} |
| 298 |
|
| 299 |
te_regs->mtile_stride = mtile_info->mtile_x1 * mtile_info->mtile_y1; |
| 300 |
} |
| 301 |
|
| 302 |
VkResult PVR_PER_ARCH(srv_render_target_dataset_create)( |
| 303 |
struct pvr_winsys *ws, |
| 304 |
const struct pvr_winsys_rt_dataset_create_info *create_info, |
| 305 |
const struct pvr_device_info *dev_info, |
| 306 |
struct pvr_winsys_rt_dataset **const rt_dataset_out) |
| 307 |
{ |
| 308 |
const pvr_dev_addr_t macrotile_addrs[ROGUE_FWIF_NUM_RTDATAS] = { |
| 309 |
[0] = create_info->rt_datas[0].macrotile_array_dev_addr, |
| 310 |
[1] = create_info->rt_datas[1].macrotile_array_dev_addr, |
| 311 |
}; |
| 312 |
const pvr_dev_addr_t pm_mlist_addrs[ROGUE_FWIF_NUM_RTDATAS] = { |
| 313 |
[0] = create_info->rt_datas[0].pm_mlist_dev_addr, |
| 314 |
[1] = create_info->rt_datas[1].pm_mlist_dev_addr, |
| 315 |
}; |
| 316 |
const pvr_dev_addr_t rgn_header_addrs[ROGUE_FWIF_NUM_RTDATAS] = { |
| 317 |
[0] = create_info->rt_datas[0].rgn_header_dev_addr, |
| 318 |
[1] = create_info->rt_datas[1].rgn_header_dev_addr, |
| 319 |
}; |
| 320 |
|
| 321 |
struct pvr_srv_winsys *srv_ws = to_pvr_srv_winsys(ws); |
| 322 |
struct pvr_srv_winsys_free_list *srv_local_free_list = |
| 323 |
to_pvr_srv_winsys_free_list(create_info->local_free_list); |
| 324 |
void *free_lists[ROGUE_FW_MAX_FREELISTS] = { NULL }; |
| 325 |
struct pvr_srv_winsys_rt_dataset *srv_rt_dataset; |
| 326 |
void *handles[ROGUE_FWIF_NUM_RTDATAS]; |
| 327 |
struct pvr_rogue_cr_te rogue_te_regs; |
| 328 |
struct pvr_rt_mtile_info mtile_info; |
| 329 |
uint32_t isp_mtile_size; |
| 330 |
VkResult result; |
| 331 |
|
| 332 |
free_lists[ROGUE_FW_LOCAL_FREELIST] = srv_local_free_list->handle; |
| 333 |
|
| 334 |
if (srv_local_free_list->parent) { |
| 335 |
free_lists[ROGUE_FW_GLOBAL_FREELIST] = |
| 336 |
srv_local_free_list->parent->handle; |
| 337 |
} |
| 338 |
|
| 339 |
srv_rt_dataset = vk_zalloc(ws->alloc, |
| 340 |
sizeof(*srv_rt_dataset), |
| 341 |
8, |
| 342 |
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE); |
| 343 |
if (!srv_rt_dataset) |
| 344 |
return vk_error(NULL, VK_ERROR_OUT_OF_HOST_MEMORY); |
| 345 |
|
| 346 |
/* If greater than 1 we'll have to pass in an array. For now just passing in |
| 347 |
* the reference. |
| 348 |
*/ |
| 349 |
STATIC_ASSERT(ROGUE_FWIF_NUM_GEOMDATAS == 1); |
| 350 |
/* If not 2 the arrays used in the bridge call will require updating. */ |
| 351 |
STATIC_ASSERT(ROGUE_FWIF_NUM_RTDATAS == 2); |
| 352 |
|
| 353 |
pvr_arch_rt_mtile_info_init(dev_info, |
| 354 |
&mtile_info, |
| 355 |
create_info->width, |
| 356 |
create_info->height, |
| 357 |
create_info->samples); |
| 358 |
|
| 359 |
isp_mtile_size = pvr_rogue_get_cr_isp_mtile_size_val(dev_info, |
| 360 |
&mtile_info, |
| 361 |
create_info->samples); |
| 362 |
|
| 363 |
pvr_rogue_ct_te_init(dev_info, |
| 364 |
&mtile_info, |
| 365 |
create_info->samples, |
| 366 |
&rogue_te_regs); |
| 367 |
|
| 368 |
result = pvr_srv_rgx_create_hwrt_dataset( |
| 369 |
ws->render_fd, |
| 370 |
pvr_rogue_get_cr_multisamplectl_val(create_info->samples, true), |
| 371 |
pvr_rogue_get_cr_multisamplectl_val(create_info->samples, false), |
| 372 |
macrotile_addrs, |
| 373 |
pm_mlist_addrs, |
| 374 |
&create_info->rtc_dev_addr, |
| 375 |
rgn_header_addrs, |
| 376 |
&create_info->tpc_dev_addr, |
| 377 |
&create_info->vheap_table_dev_addr, |
| 378 |
free_lists, |
| 379 |
create_info->isp_merge_lower_x, |
| 380 |
create_info->isp_merge_lower_y, |
| 381 |
create_info->isp_merge_scale_x, |
| 382 |
create_info->isp_merge_scale_y, |
| 383 |
create_info->isp_merge_upper_x, |
| 384 |
create_info->isp_merge_upper_y, |
| 385 |
isp_mtile_size, |
| 386 |
rogue_te_regs.mtile_stride, |
| 387 |
pvr_rogue_get_ppp_screen_val(create_info->width, create_info->height), |
| 388 |
create_info->rgn_header_size, |
| 389 |
rogue_te_regs.aa, |
| 390 |
rogue_te_regs.mtile1, |
| 391 |
rogue_te_regs.mtile2, |
| 392 |
rogue_te_regs.screen, |
| 393 |
create_info->tpc_size, |
| 394 |
create_info->tpc_stride, |
| 395 |
create_info->layers, |
| 396 |
handles); |
| 397 |
if (result != VK_SUCCESS) |
| 398 |
goto err_vk_free_srv_rt_dataset; |
| 399 |
|
| 400 |
srv_rt_dataset->rt_datas[0].handle = handles[0]; |
| 401 |
srv_rt_dataset->rt_datas[1].handle = handles[1]; |
| 402 |
|
| 403 |
for (uint32_t i = 0; i < ARRAY_SIZE(srv_rt_dataset->rt_datas); i++) { |
| 404 |
srv_rt_dataset->rt_datas[i].sync_prim = pvr_srv_sync_prim_alloc(srv_ws); |
| 405 |
if (!srv_rt_dataset->rt_datas[i].sync_prim) |
| 406 |
goto err_srv_sync_prim_free; |
| 407 |
} |
| 408 |
|
| 409 |
srv_rt_dataset->base.ws = ws; |
| 410 |
|
| 411 |
*rt_dataset_out = &srv_rt_dataset->base; |
| 412 |
|
| 413 |
return VK_SUCCESS; |
| 414 |
|
| 415 |
err_srv_sync_prim_free: |
| 416 |
for (uint32_t i = 0; i < ARRAY_SIZE(srv_rt_dataset->rt_datas); i++) { |
| 417 |
pvr_srv_sync_prim_free(srv_ws, srv_rt_dataset->rt_datas[i].sync_prim); |
| 418 |
|
| 419 |
if (srv_rt_dataset->rt_datas[i].handle) { |
| 420 |
pvr_srv_rgx_destroy_hwrt_dataset(ws->render_fd, |
| 421 |
srv_rt_dataset->rt_datas[i].handle); |
| 422 |
} |
| 423 |
} |
| 424 |
|
| 425 |
err_vk_free_srv_rt_dataset: |
| 426 |
vk_free(ws->alloc, srv_rt_dataset); |
| 427 |
|
| 428 |
return result; |
| 429 |
} |
| 430 |
|
| 431 |
static void pvr_srv_render_ctx_fw_static_state_init( |
| 432 |
struct pvr_winsys_render_ctx_create_info *create_info, |
| 433 |
struct rogue_fwif_static_rendercontext_state *static_state) |
| 434 |
{ |
| 435 |
#if defined(PVR_BUILD_ARCH_ROGUE) |
| 436 |
struct pvr_rogue_winsys_render_ctx_static_state *ws_static_state = |
| 437 |
&create_info->static_state.rogue; |
| 438 |
#else |
| 439 |
# error "Missing arch" |
| 440 |
#endif |
| 441 |
|
| 442 |
struct rogue_fwif_ta_regs_cswitch *regs = |
| 443 |
&static_state->ctx_switch_geom_regs[0]; |
| 444 |
|
| 445 |
memset(static_state, 0, sizeof(*static_state)); |
| 446 |
|
| 447 |
regs->vdm_context_state_base_addr = ws_static_state->vdm_ctx_state_base_addr; |
| 448 |
regs->ta_context_state_base_addr = ws_static_state->geom_ctx_state_base_addr; |
| 449 |
|
| 450 |
STATIC_ASSERT(ARRAY_SIZE(regs->ta_state) == |
| 451 |
ARRAY_SIZE(ws_static_state->geom_state)); |
| 452 |
for (uint32_t i = 0; i < ARRAY_SIZE(ws_static_state->geom_state); i++) { |
| 453 |
regs->ta_state[i].vdm_context_store_task0 = |
| 454 |
ws_static_state->geom_state[i].vdm_ctx_store_task0; |
| 455 |
regs->ta_state[i].vdm_context_store_task1 = |
| 456 |
ws_static_state->geom_state[i].vdm_ctx_store_task1; |
| 457 |
regs->ta_state[i].vdm_context_store_task2 = |
| 458 |
ws_static_state->geom_state[i].vdm_ctx_store_task2; |
| 459 |
|
| 460 |
regs->ta_state[i].vdm_context_resume_task0 = |
| 461 |
ws_static_state->geom_state[i].vdm_ctx_resume_task0; |
| 462 |
regs->ta_state[i].vdm_context_resume_task1 = |
| 463 |
ws_static_state->geom_state[i].vdm_ctx_resume_task1; |
| 464 |
regs->ta_state[i].vdm_context_resume_task2 = |
| 465 |
ws_static_state->geom_state[i].vdm_ctx_resume_task2; |
| 466 |
} |
| 467 |
} |
| 468 |
|
| 469 |
static uint32_t |
| 470 |
pvr_srv_geometry_cmd_stream_load(struct rogue_fwif_cmd_ta *const cmd, |
| 471 |
const uint8_t *const stream, |
| 472 |
const uint32_t stream_len, |
| 473 |
const struct pvr_device_info *const dev_info) |
| 474 |
{ |
| 475 |
const uint32_t *stream_ptr = (const uint32_t *)stream; |
| 476 |
struct rogue_fwif_ta_regs *const regs = &cmd->regs; |
| 477 |
uint32_t main_stream_len = |
| 478 |
pvr_csb_unpack((const uint64_t *)stream_ptr, KMD_STREAM_HDR).length; |
| 479 |
|
| 480 |
stream_ptr += pvr_cmd_length(KMD_STREAM_HDR); |
| 481 |
|
| 482 |
regs->vdm_ctrl_stream_base = *(const uint64_t *)stream_ptr; |
| 483 |
stream_ptr += pvr_cmd_length(CR_VDM_CTRL_STREAM_BASE); |
| 484 |
|
| 485 |
regs->tpu_border_colour_table = *(const uint64_t *)stream_ptr; |
| 486 |
stream_ptr += pvr_cmd_length(CR_TPU_BORDER_COLOUR_TABLE_VDM); |
| 487 |
|
| 488 |
regs->ppp_ctrl = *stream_ptr; |
| 489 |
stream_ptr += pvr_cmd_length(CR_PPP_CTRL); |
| 490 |
|
| 491 |
regs->te_psg = *stream_ptr; |
| 492 |
stream_ptr += pvr_cmd_length(CR_TE_PSG); |
| 493 |
|
| 494 |
regs->vdm_context_resume_task0_size = *stream_ptr; |
| 495 |
stream_ptr += pvr_cmd_length(VDMCTRL_PDS_STATE0); |
| 496 |
|
| 497 |
regs->view_idx = *stream_ptr; |
| 498 |
stream_ptr++; |
| 499 |
|
| 500 |
assert((const uint8_t *)stream_ptr - stream <= stream_len); |
| 501 |
assert((const uint8_t *)stream_ptr - stream == main_stream_len); |
| 502 |
|
| 503 |
return main_stream_len; |
| 504 |
} |
| 505 |
|
| 506 |
static void pvr_srv_geometry_cmd_ext_stream_load( |
| 507 |
struct rogue_fwif_cmd_ta *const cmd, |
| 508 |
const uint8_t *const stream, |
| 509 |
const uint32_t stream_len, |
| 510 |
const uint32_t ext_stream_offset, |
| 511 |
const struct pvr_device_info *const dev_info) |
| 512 |
{ |
| 513 |
const uint32_t *ext_stream_ptr = |
| 514 |
(const uint32_t *)((uint8_t *)stream + ext_stream_offset); |
| 515 |
struct rogue_fwif_ta_regs *const regs = &cmd->regs; |
| 516 |
|
| 517 |
struct ROGUE_KMD_STREAM_EXTHDR_GEOM0 header0; |
| 518 |
|
| 519 |
header0 = pvr_csb_unpack(ext_stream_ptr, KMD_STREAM_EXTHDR_GEOM0); |
| 520 |
ext_stream_ptr += pvr_cmd_length(KMD_STREAM_EXTHDR_GEOM0); |
| 521 |
|
| 522 |
assert(PVR_HAS_QUIRK(dev_info, 49927) == header0.has_brn49927); |
| 523 |
if (header0.has_brn49927) { |
| 524 |
regs->tpu = *ext_stream_ptr; |
| 525 |
ext_stream_ptr += pvr_cmd_length(CR_TPU); |
| 526 |
} |
| 527 |
|
| 528 |
assert((const uint8_t *)ext_stream_ptr - stream == stream_len); |
| 529 |
} |
| 530 |
|
| 531 |
static void |
| 532 |
srv_geometry_cmd_init(const struct pvr_winsys_render_submit_info *submit_info, |
| 533 |
const struct pvr_srv_sync_prim *sync_prim, |
| 534 |
struct rogue_fwif_cmd_ta *cmd, |
| 535 |
const struct pvr_device_info *const dev_info) |
| 536 |
{ |
| 537 |
const struct pvr_winsys_geometry_state *state = &submit_info->geometry; |
| 538 |
uint32_t ext_stream_offset; |
| 539 |
|
| 540 |
memset(cmd, 0, sizeof(*cmd)); |
| 541 |
|
| 542 |
cmd->cmd_shared.cmn.frame_num = submit_info->frame_num; |
| 543 |
|
| 544 |
ext_stream_offset = pvr_srv_geometry_cmd_stream_load(cmd, |
| 545 |
state->fw_stream, |
| 546 |
state->fw_stream_len, |
| 547 |
dev_info); |
| 548 |
|
| 549 |
if (ext_stream_offset < state->fw_stream_len) { |
| 550 |
pvr_srv_geometry_cmd_ext_stream_load(cmd, |
| 551 |
state->fw_stream, |
| 552 |
state->fw_stream_len, |
| 553 |
ext_stream_offset, |
| 554 |
dev_info); |
| 555 |
} |
| 556 |
|
| 557 |
if (state->flags.is_first_geometry) |
| 558 |
cmd->flags |= ROGUE_FWIF_TAFLAGS_FIRSTKICK; |
| 559 |
|
| 560 |
if (state->flags.is_last_geometry) |
| 561 |
cmd->flags |= ROGUE_FWIF_TAFLAGS_LASTKICK; |
| 562 |
|
| 563 |
if (state->flags.use_single_core) |
| 564 |
cmd->flags |= ROGUE_FWIF_TAFLAGS_SINGLE_CORE; |
| 565 |
|
| 566 |
cmd->partial_render_ta_3d_fence.ufo_addr.addr = |
| 567 |
pvr_srv_sync_prim_get_fw_addr(sync_prim); |
| 568 |
cmd->partial_render_ta_3d_fence.value = sync_prim->value; |
| 569 |
} |
| 570 |
|
| 571 |
static uint32_t |
| 572 |
pvr_srv_fragment_cmd_stream_load(struct rogue_fwif_cmd_3d *const cmd, |
| 573 |
const uint8_t *const stream, |
| 574 |
const uint32_t stream_len, |
| 575 |
const struct pvr_device_info *const dev_info) |
| 576 |
{ |
| 577 |
const uint32_t *stream_ptr = (const uint32_t *)stream; |
| 578 |
struct rogue_fwif_3d_regs *const regs = &cmd->regs; |
| 579 |
uint32_t main_stream_len = |
| 580 |
pvr_csb_unpack((const uint64_t *)stream_ptr, KMD_STREAM_HDR).length; |
| 581 |
|
| 582 |
stream_ptr += pvr_cmd_length(KMD_STREAM_HDR); |
| 583 |
|
| 584 |
regs->isp_scissor_base = *(const uint64_t *)stream_ptr; |
| 585 |
stream_ptr += pvr_cmd_length(CR_ISP_SCISSOR_BASE); |
| 586 |
|
| 587 |
regs->isp_dbias_base = *(const uint64_t *)stream_ptr; |
| 588 |
stream_ptr += pvr_cmd_length(CR_ISP_DBIAS_BASE); |
| 589 |
|
| 590 |
regs->isp_oclqry_base = *(const uint64_t *)stream_ptr; |
| 591 |
stream_ptr += pvr_cmd_length(CR_ISP_OCLQRY_BASE); |
| 592 |
|
| 593 |
regs->isp_zlsctl = *(const uint64_t *)stream_ptr; |
| 594 |
stream_ptr += pvr_cmd_length(CR_ISP_ZLSCTL); |
| 595 |
|
| 596 |
regs->isp_zload_store_base = *(const uint64_t *)stream_ptr; |
| 597 |
stream_ptr += pvr_cmd_length(CR_ISP_ZLOAD_BASE); |
| 598 |
|
| 599 |
regs->isp_stencil_load_store_base = *(const uint64_t *)stream_ptr; |
| 600 |
stream_ptr += pvr_cmd_length(CR_ISP_STENCIL_LOAD_BASE); |
| 601 |
|
| 602 |
if (PVR_HAS_FEATURE(dev_info, requires_fb_cdc_zls_setup)) { |
| 603 |
regs->fb_cdc_zls = *(const uint64_t *)stream_ptr; |
| 604 |
stream_ptr += 2U; |
| 605 |
} |
| 606 |
|
| 607 |
STATIC_ASSERT(ARRAY_SIZE(regs->pbe_word) == 8U); |
| 608 |
STATIC_ASSERT(ARRAY_SIZE(regs->pbe_word[0]) == 3U); |
| 609 |
STATIC_ASSERT(sizeof(regs->pbe_word[0][0]) == sizeof(uint64_t)); |
| 610 |
memcpy(regs->pbe_word, stream_ptr, sizeof(regs->pbe_word)); |
| 611 |
stream_ptr += 8U * 3U * 2U; |
| 612 |
|
| 613 |
regs->tpu_border_colour_table = *(const uint64_t *)stream_ptr; |
| 614 |
stream_ptr += pvr_cmd_length(CR_TPU_BORDER_COLOUR_TABLE_PDM); |
| 615 |
|
| 616 |
STATIC_ASSERT(ARRAY_SIZE(regs->pds_bgnd) == 3U); |
| 617 |
STATIC_ASSERT(sizeof(regs->pds_bgnd[0]) == sizeof(uint64_t)); |
| 618 |
memcpy(regs->pds_bgnd, stream_ptr, sizeof(regs->pds_bgnd)); |
| 619 |
stream_ptr += 3U * 2U; |
| 620 |
|
| 621 |
STATIC_ASSERT(ARRAY_SIZE(regs->pds_pr_bgnd) == 3U); |
| 622 |
STATIC_ASSERT(sizeof(regs->pds_pr_bgnd[0]) == sizeof(uint64_t)); |
| 623 |
memcpy(regs->pds_pr_bgnd, stream_ptr, sizeof(regs->pds_pr_bgnd)); |
| 624 |
stream_ptr += 3U * 2U; |
| 625 |
|
| 626 |
STATIC_ASSERT(ARRAY_SIZE(regs->usc_clear_register) == 8U); |
| 627 |
STATIC_ASSERT(sizeof(regs->usc_clear_register[0]) == sizeof(uint32_t)); |
| 628 |
memcpy(regs->usc_clear_register, |
| 629 |
stream_ptr, |
| 630 |
sizeof(regs->usc_clear_register)); |
| 631 |
stream_ptr += 8U; |
| 632 |
|
| 633 |
regs->usc_pixel_output_ctrl = *stream_ptr; |
| 634 |
stream_ptr += pvr_cmd_length(CR_USC_PIXEL_OUTPUT_CTRL); |
| 635 |
|
| 636 |
regs->isp_bgobjdepth = *stream_ptr; |
| 637 |
stream_ptr += pvr_cmd_length(CR_ISP_BGOBJDEPTH); |
| 638 |
|
| 639 |
regs->isp_bgobjvals = *stream_ptr; |
| 640 |
stream_ptr += pvr_cmd_length(CR_ISP_BGOBJVALS); |
| 641 |
|
| 642 |
regs->isp_aa = *stream_ptr; |
| 643 |
stream_ptr += pvr_cmd_length(CR_ISP_AA); |
| 644 |
|
| 645 |
regs->isp_ctl = *stream_ptr; |
| 646 |
stream_ptr += pvr_cmd_length(CR_ISP_CTL); |
| 647 |
|
| 648 |
regs->event_pixel_pds_info = *stream_ptr; |
| 649 |
stream_ptr += pvr_cmd_length(CR_EVENT_PIXEL_PDS_INFO); |
| 650 |
|
| 651 |
if (PVR_HAS_FEATURE(dev_info, cluster_grouping)) { |
| 652 |
regs->pixel_phantom = *stream_ptr; |
| 653 |
stream_ptr++; |
| 654 |
} |
| 655 |
|
| 656 |
regs->view_idx = *stream_ptr; |
| 657 |
stream_ptr++; |
| 658 |
|
| 659 |
regs->event_pixel_pds_data = *stream_ptr; |
| 660 |
stream_ptr += pvr_cmd_length(CR_EVENT_PIXEL_PDS_DATA); |
| 661 |
|
| 662 |
if (PVR_HAS_FEATURE(dev_info, gpu_multicore_support)) { |
| 663 |
regs->isp_oclqry_stride = *stream_ptr; |
| 664 |
stream_ptr++; |
| 665 |
} |
| 666 |
|
| 667 |
if (PVR_HAS_FEATURE(dev_info, zls_subtile)) { |
| 668 |
regs->isp_zls_pixels = *stream_ptr; |
| 669 |
stream_ptr += pvr_cmd_length(CR_ISP_ZLS_PIXELS); |
| 670 |
} |
| 671 |
|
| 672 |
cmd->zls_stride = *stream_ptr; |
| 673 |
stream_ptr++; |
| 674 |
|
| 675 |
cmd->sls_stride = *stream_ptr; |
| 676 |
stream_ptr++; |
| 677 |
|
| 678 |
if (PVR_HAS_FEATURE(dev_info, gpu_multicore_support)) { |
| 679 |
cmd->execute_count = *stream_ptr; |
| 680 |
stream_ptr++; |
| 681 |
} |
| 682 |
|
| 683 |
assert((const uint8_t *)stream_ptr - stream <= stream_len); |
| 684 |
assert((const uint8_t *)stream_ptr - stream == main_stream_len); |
| 685 |
|
| 686 |
return main_stream_len; |
| 687 |
} |
| 688 |
|
| 689 |
static void pvr_srv_fragment_cmd_ext_stream_load( |
| 690 |
struct rogue_fwif_cmd_3d *const cmd, |
| 691 |
const uint8_t *const stream, |
| 692 |
const uint32_t stream_len, |
| 693 |
const uint32_t ext_stream_offset, |
| 694 |
const struct pvr_device_info *const dev_info) |
| 695 |
{ |
| 696 |
const uint32_t *ext_stream_ptr = |
| 697 |
(const uint32_t *)((uint8_t *)stream + ext_stream_offset); |
| 698 |
struct rogue_fwif_3d_regs *const regs = &cmd->regs; |
| 699 |
|
| 700 |
struct ROGUE_KMD_STREAM_EXTHDR_FRAG0 header0; |
| 701 |
|
| 702 |
header0 = pvr_csb_unpack(ext_stream_ptr, KMD_STREAM_EXTHDR_FRAG0); |
| 703 |
ext_stream_ptr += pvr_cmd_length(KMD_STREAM_EXTHDR_FRAG0); |
| 704 |
|
| 705 |
assert(PVR_HAS_QUIRK(dev_info, 49927) == header0.has_brn49927); |
| 706 |
if (header0.has_brn49927) { |
| 707 |
regs->tpu = *ext_stream_ptr; |
| 708 |
ext_stream_ptr += pvr_cmd_length(CR_TPU); |
| 709 |
} |
| 710 |
|
| 711 |
assert((const uint8_t *)ext_stream_ptr - stream == stream_len); |
| 712 |
} |
| 713 |
|
| 714 |
static void srv_fragment_cmd_init(struct rogue_fwif_cmd_3d *cmd, |
| 715 |
const struct pvr_winsys_fragment_state *state, |
| 716 |
const struct pvr_device_info *dev_info, |
| 717 |
uint32_t frame_num) |
| 718 |
{ |
| 719 |
uint32_t ext_stream_offset; |
| 720 |
|
| 721 |
memset(cmd, 0, sizeof(*cmd)); |
| 722 |
|
| 723 |
cmd->cmd_shared.cmn.frame_num = frame_num; |
| 724 |
|
| 725 |
ext_stream_offset = pvr_srv_fragment_cmd_stream_load(cmd, |
| 726 |
state->fw_stream, |
| 727 |
state->fw_stream_len, |
| 728 |
dev_info); |
| 729 |
|
| 730 |
if (ext_stream_offset < state->fw_stream_len) { |
| 731 |
pvr_srv_fragment_cmd_ext_stream_load(cmd, |
| 732 |
state->fw_stream, |
| 733 |
state->fw_stream_len, |
| 734 |
ext_stream_offset, |
| 735 |
dev_info); |
| 736 |
} |
| 737 |
|
| 738 |
if (state->flags.has_depth_buffer) |
| 739 |
cmd->flags |= ROGUE_FWIF_RENDERFLAGS_DEPTHBUFFER; |
| 740 |
|
| 741 |
if (state->flags.has_stencil_buffer) |
| 742 |
cmd->flags |= ROGUE_FWIF_RENDERFLAGS_STENCILBUFFER; |
| 743 |
|
| 744 |
if (state->flags.prevent_cdm_overlap) |
| 745 |
cmd->flags |= ROGUE_FWIF_RENDERFLAGS_PREVENT_CDM_OVERLAP; |
| 746 |
|
| 747 |
if (state->flags.use_single_core) |
| 748 |
cmd->flags |= ROGUE_FWIF_RENDERFLAGS_SINGLE_CORE; |
| 749 |
|
| 750 |
if (state->flags.get_vis_results) |
| 751 |
cmd->flags |= ROGUE_FWIF_RENDERFLAGS_GETVISRESULTS; |
| 752 |
|
| 753 |
if (state->flags.has_spm_scratch_buffer) |
| 754 |
cmd->flags |= ROGUE_FWIF_RENDERFLAGS_SPMSCRATCHBUFFER; |
| 755 |
|
| 756 |
if (state->flags.disable_pixel_merging) |
| 757 |
cmd->flags |= ROGUE_FWIF_RENDERFLAGS_DISABLE_PIXELMERGE; |
| 758 |
} |
| 759 |
|
| 760 |
VkResult PVR_PER_ARCH(srv_winsys_render_submit)( |
| 761 |
const struct pvr_winsys_render_ctx *ctx, |
| 762 |
const struct pvr_winsys_render_submit_info *submit_info, |
| 763 |
const struct pvr_device_info *dev_info, |
| 764 |
struct vk_sync *signal_sync_geom, |
| 765 |
struct vk_sync *signal_sync_frag) |
| 766 |
{ |
| 767 |
const struct pvr_srv_winsys_rt_dataset *srv_rt_dataset = |
| 768 |
to_pvr_srv_winsys_rt_dataset(submit_info->rt_dataset); |
| 769 |
struct pvr_srv_sync_prim *sync_prim = |
| 770 |
srv_rt_dataset->rt_datas[submit_info->rt_data_idx].sync_prim; |
| 771 |
void *rt_data_handle = |
| 772 |
srv_rt_dataset->rt_datas[submit_info->rt_data_idx].handle; |
| 773 |
const struct pvr_srv_winsys_render_ctx *srv_ctx = |
| 774 |
to_pvr_srv_winsys_render_ctx(ctx); |
| 775 |
const struct pvr_srv_winsys *srv_ws = to_pvr_srv_winsys(ctx->ws); |
| 776 |
|
| 777 |
struct pvr_srv_sync *srv_signal_sync_geom; |
| 778 |
struct pvr_srv_sync *srv_signal_sync_frag; |
| 779 |
|
| 780 |
struct rogue_fwif_cmd_ta geom_cmd; |
| 781 |
struct rogue_fwif_cmd_3d frag_cmd = { 0 }; |
| 782 |
struct rogue_fwif_cmd_3d pr_cmd = { 0 }; |
| 783 |
|
| 784 |
uint8_t *frag_cmd_ptr = NULL; |
| 785 |
uint32_t frag_cmd_size = 0; |
| 786 |
|
| 787 |
uint32_t current_sync_value = sync_prim->value; |
| 788 |
uint32_t geom_sync_update_value; |
| 789 |
uint32_t frag_to_geom_fence_count = 0; |
| 790 |
uint32_t frag_to_geom_fence_value; |
| 791 |
uint32_t frag_sync_update_count = 0; |
| 792 |
uint32_t frag_sync_update_value; |
| 793 |
|
| 794 |
int in_frag_fd = -1; |
| 795 |
int in_geom_fd = -1; |
| 796 |
int fence_frag; |
| 797 |
int fence_geom; |
| 798 |
|
| 799 |
VkResult result; |
| 800 |
srv_geometry_cmd_init(submit_info, sync_prim, &geom_cmd, dev_info); |
| 801 |
|
| 802 |
srv_fragment_cmd_init(&pr_cmd, |
| 803 |
&submit_info->fragment_pr, |
| 804 |
dev_info, |
| 805 |
submit_info->frame_num); |
| 806 |
|
| 807 |
if (submit_info->has_fragment_job) { |
| 808 |
srv_fragment_cmd_init(&frag_cmd, |
| 809 |
&submit_info->fragment, |
| 810 |
dev_info, |
| 811 |
submit_info->frame_num); |
| 812 |
|
| 813 |
frag_cmd_ptr = (uint8_t *)&frag_cmd; |
| 814 |
frag_cmd_size = sizeof(frag_cmd); |
| 815 |
} |
| 816 |
|
| 817 |
if (submit_info->geometry.wait) { |
| 818 |
struct pvr_srv_sync *srv_wait_sync = |
| 819 |
to_srv_sync(submit_info->geometry.wait); |
| 820 |
|
| 821 |
if (srv_wait_sync->fd >= 0) { |
| 822 |
in_geom_fd = os_dupfd_cloexec(srv_wait_sync->fd); |
| 823 |
if (in_geom_fd == -1) { |
| 824 |
return vk_errorf(NULL, |
| 825 |
VK_ERROR_OUT_OF_HOST_MEMORY, |
| 826 |
"dup called on wait sync failed, Errno: %s", |
| 827 |
strerror(errno)); |
| 828 |
} |
| 829 |
} |
| 830 |
} |
| 831 |
|
| 832 |
if (submit_info->fragment.wait) { |
| 833 |
struct pvr_srv_sync *srv_wait_sync = |
| 834 |
to_srv_sync(submit_info->fragment.wait); |
| 835 |
|
| 836 |
if (srv_wait_sync->fd >= 0) { |
| 837 |
in_frag_fd = os_dupfd_cloexec(srv_wait_sync->fd); |
| 838 |
if (in_frag_fd == -1) { |
| 839 |
return vk_errorf(NULL, |
| 840 |
VK_ERROR_OUT_OF_HOST_MEMORY, |
| 841 |
"dup called on wait sync failed, Errno: %s", |
| 842 |
strerror(errno)); |
| 843 |
} |
| 844 |
} |
| 845 |
} |
| 846 |
|
| 847 |
if (submit_info->geometry.flags.is_first_geometry) { |
| 848 |
frag_to_geom_fence_count = 1; |
| 849 |
frag_to_geom_fence_value = current_sync_value; |
| 850 |
} |
| 851 |
|
| 852 |
/* Geometery is always kicked */ |
| 853 |
geom_sync_update_value = ++current_sync_value; |
| 854 |
|
| 855 |
if (submit_info->has_fragment_job) { |
| 856 |
frag_sync_update_count = 1; |
| 857 |
frag_sync_update_value = ++current_sync_value; |
| 858 |
} |
| 859 |
|
| 860 |
do { |
| 861 |
/* The fw allows the ZS and MSAA scratch buffers to be lazily allocated in |
| 862 |
* which case we need to provide a status update (i.e. if they are |
| 863 |
* physically backed or not) to the fw. In our case they will always be |
| 864 |
* physically backed so no need to inform the fw about their status and |
| 865 |
* pass in anything. We'll just pass in NULL. |
| 866 |
*/ |
| 867 |
result = pvr_srv_rgx_kick_render2(srv_ws->base.render_fd, |
| 868 |
srv_ctx->handle, |
| 869 |
frag_to_geom_fence_count, |
| 870 |
&sync_prim->ctx->block_handle, |
| 871 |
&sync_prim->offset, |
| 872 |
&frag_to_geom_fence_value, |
| 873 |
1, |
| 874 |
&sync_prim->ctx->block_handle, |
| 875 |
&sync_prim->offset, |
| 876 |
&geom_sync_update_value, |
| 877 |
frag_sync_update_count, |
| 878 |
&sync_prim->ctx->block_handle, |
| 879 |
&sync_prim->offset, |
| 880 |
&frag_sync_update_value, |
| 881 |
sync_prim->ctx->block_handle, |
| 882 |
sync_prim->offset, |
| 883 |
geom_sync_update_value, |
| 884 |
in_geom_fd, |
| 885 |
srv_ctx->timeline_geom, |
| 886 |
&fence_geom, |
| 887 |
"GEOM", |
| 888 |
in_frag_fd, |
| 889 |
srv_ctx->timeline_frag, |
| 890 |
&fence_frag, |
| 891 |
"FRAG", |
| 892 |
sizeof(geom_cmd), |
| 893 |
(uint8_t *)&geom_cmd, |
| 894 |
sizeof(pr_cmd), |
| 895 |
(uint8_t *)&pr_cmd, |
| 896 |
frag_cmd_size, |
| 897 |
frag_cmd_ptr, |
| 898 |
submit_info->job_num, |
| 899 |
/* Always kick the TA. */ |
| 900 |
true, |
| 901 |
/* Always kick a PR. */ |
| 902 |
true, |
| 903 |
submit_info->has_fragment_job, |
| 904 |
false, |
| 905 |
0, |
| 906 |
rt_data_handle, |
| 907 |
NULL, |
| 908 |
NULL, |
| 909 |
0, |
| 910 |
NULL, |
| 911 |
NULL, |
| 912 |
0, |
| 913 |
0, |
| 914 |
0, |
| 915 |
0, |
| 916 |
0); |
| 917 |
} while (result == VK_NOT_READY); |
| 918 |
|
| 919 |
if (result != VK_SUCCESS) |
| 920 |
goto end_close_in_fds; |
| 921 |
|
| 922 |
/* The job submission was succesful, update the sync prim value. */ |
| 923 |
sync_prim->value = current_sync_value; |
| 924 |
|
| 925 |
if (signal_sync_geom) { |
| 926 |
srv_signal_sync_geom = to_srv_sync(signal_sync_geom); |
| 927 |
pvr_srv_set_sync_payload(srv_signal_sync_geom, fence_geom); |
| 928 |
} else if (fence_geom != -1) { |
| 929 |
close(fence_geom); |
| 930 |
} |
| 931 |
|
| 932 |
if (signal_sync_frag) { |
| 933 |
srv_signal_sync_frag = to_srv_sync(signal_sync_frag); |
| 934 |
pvr_srv_set_sync_payload(srv_signal_sync_frag, fence_frag); |
| 935 |
} else if (fence_frag != -1) { |
| 936 |
close(fence_frag); |
| 937 |
} |
| 938 |
|
| 939 |
end_close_in_fds: |
| 940 |
if (in_geom_fd >= 0) |
| 941 |
close(in_geom_fd); |
| 942 |
|
| 943 |
if (in_frag_fd >= 0) |
| 944 |
close(in_frag_fd); |
| 945 |
|
| 946 |
return result; |
| 947 |
} |