~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/drivers/r600/r600_pipe_common.c

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "r600_pipe_common.h"
28
28
#include "r600_cs.h"
29
29
#include "evergreen_compute.h"
30
 
#include "tgsi/tgsi_parse.h"
31
30
#include "util/list.h"
32
31
#include "util/u_draw_quad.h"
33
32
#include "util/u_memory.h"
34
33
#include "util/format/u_format_s3tc.h"
35
34
#include "util/u_upload_mgr.h"
36
35
#include "util/os_time.h"
 
36
#include "util/hex.h"
37
37
#include "vl/vl_decoder.h"
38
38
#include "vl/vl_video_buffer.h"
39
39
#include "radeon_video.h"
488
488
{
489
489
        struct r600_common_context *rctx = (struct r600_common_context *)ctx;
490
490
 
491
 
        return rctx->ws->ctx_query_reset_status(rctx->ctx, false, NULL);
 
491
        return rctx->ws->ctx_query_reset_status(rctx->ctx, false, NULL, NULL);
492
492
}
493
493
 
494
494
static void r600_set_debug_callback(struct pipe_context *ctx,
692
692
        { "tes", DBG_TES, "Print tessellation evaluation shaders" },
693
693
        { "preoptir", DBG_PREOPT_IR, "Print the LLVM IR before initial optimizations" },
694
694
        { "checkir", DBG_CHECK_IR, "Enable additional sanity checks on shader IR" },
695
 
        { "use_tgsi", DBG_USE_TGSI, "Take TGSI directly instead of using NIR-to-TGSI"},
696
695
 
697
696
        { "testdma", DBG_TEST_DMA, "Invoke SDMA tests and exit." },
698
697
        { "testvmfaultcp", DBG_TEST_VMFAULT_CP, "Invoke a CP VM fault test and exit." },
772
771
                return;
773
772
 
774
773
        _mesa_sha1_final(&ctx, sha1);
775
 
        disk_cache_format_hex_id(cache_id, sha1, 20 * 2);
 
774
        mesa_bytes_to_hex(cache_id, sha1, 20);
776
775
 
777
776
        /* These flags affect shader compilation. */
778
 
        uint64_t shader_debug_flags =
779
 
                rscreen->debug_flags & DBG_USE_TGSI;
780
 
 
781
777
        rscreen->disk_shader_cache =
782
778
                disk_cache_create(r600_get_family_name(rscreen),
783
 
                                  cache_id,
784
 
                                  shader_debug_flags);
 
779
                                  cache_id, 0);
785
780
}
786
781
 
787
782
static struct disk_cache *r600_get_disk_shader_cache(struct pipe_screen *pscreen)
1038
1033
                }
1039
1034
                return sizeof(uint32_t);
1040
1035
        case PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE:
 
1036
        case PIPE_COMPUTE_CAP_MAX_SUBGROUPS:
1041
1037
                break; /* unused */
1042
 
        case PIPE_COMPUTE_CAP_SUBGROUP_SIZE:
 
1038
        case PIPE_COMPUTE_CAP_SUBGROUP_SIZES:
1043
1039
                if (ret) {
1044
1040
                        uint32_t *subgroup_size = ret;
1045
1041
                        *subgroup_size = r600_wavefront_size(rscreen->family);
1099
1095
                        return false;
1100
1096
 
1101
1097
                /* Recompute the timeout after waiting. */
1102
 
                if (timeout && timeout != PIPE_TIMEOUT_INFINITE) {
 
1098
                if (timeout && timeout != OS_TIMEOUT_INFINITE) {
1103
1099
                        int64_t time = os_time_get_nano();
1104
1100
                        timeout = abs_timeout > time ? abs_timeout - time : 0;
1105
1101
                }
1119
1115
                        return false;
1120
1116
 
1121
1117
                /* Recompute the timeout after all that. */
1122
 
                if (timeout && timeout != PIPE_TIMEOUT_INFINITE) {
 
1118
                if (timeout && timeout != OS_TIMEOUT_INFINITE) {
1123
1119
                        int64_t time = os_time_get_nano();
1124
1120
                        timeout = abs_timeout > time ? abs_timeout - time : 0;
1125
1121
                }
1376
1372
                .lower_cs_local_index_to_id = true,
1377
1373
                .lower_uniforms_to_ubo = true,
1378
1374
                .lower_image_offset_to_range_base = 1,
1379
 
                .vectorize_tess_levels = 1
 
1375
                .vectorize_tess_levels = 1,
1380
1376
        };
1381
1377
 
1382
1378
        rscreen->nir_options = nir_options;
1384
1380
        if (rscreen->info.family < CHIP_CEDAR)
1385
1381
                rscreen->nir_options.force_indirect_unrolling_sampler = true;
1386
1382
 
1387
 
   if (rscreen->info.gfx_level >= EVERGREEN) {
1388
 
      rscreen->nir_options.lower_bitfield_extract = true;
 
1383
        if (rscreen->info.gfx_level >= EVERGREEN) {
 
1384
                rscreen->nir_options.lower_bitfield_extract = true;
1389
1385
                rscreen->nir_options.lower_bitfield_insert_to_bitfield_select = true;
1390
 
   }
 
1386
        }
1391
1387
 
1392
1388
        if (rscreen->info.gfx_level < EVERGREEN) {
1393
1389
                /* Pre-EG doesn't have these ALU ops */
1394
1390
                rscreen->nir_options.lower_bit_count = true;
1395
1391
                rscreen->nir_options.lower_bitfield_reverse = true;
1396
 
      rscreen->nir_options.lower_bitfield_insert_to_shifts = true;
1397
 
      rscreen->nir_options.lower_bitfield_extract_to_shifts = true;
 
1392
                rscreen->nir_options.lower_bitfield_insert_to_shifts = true;
 
1393
                rscreen->nir_options.lower_bitfield_extract_to_shifts = true;
1398
1394
        }
1399
1395
 
1400
1396
        if (rscreen->info.gfx_level < CAYMAN) {
1410
1406
                        nir_lower_dtrunc;
1411
1407
        }
1412
1408
 
1413
 
        if (rscreen->debug_flags & DBG_USE_TGSI) {
1414
 
 
1415
 
                rscreen->nir_options.lower_fpow = false;
1416
 
                /* TGSI is vector, and NIR-to-TGSI doesn't like it when the
1417
 
                 * input vars have been scalarized.
1418
 
                 */
1419
 
                rscreen->nir_options.lower_to_scalar = false;
1420
 
 
1421
 
                /* NIR-to-TGSI can't do fused integer csel, and it can't just
1422
 
                 * override the flag and get the code lowered back when we ask
1423
 
                 * it to handle it.
1424
 
                 */
1425
 
                rscreen->nir_options.has_fused_comp_and_csel = false;
1426
 
 
1427
 
                /* r600 has a bitfield_select and bitfield_extract opcode
1428
 
                 * (called bfi/bfe), but TGSI's BFI/BFE isn't that.
1429
 
                 */
1430
 
                rscreen->nir_options.lower_bitfield_extract = false;
1431
 
                rscreen->nir_options.lower_bitfield_insert_to_bitfield_select = false;
1432
 
 
1433
 
                /* TGSI's ifind is reversed from ours, keep it the TGSI way. */
1434
 
                rscreen->nir_options.lower_find_msb_to_reverse = false;
1435
 
        } else {
1436
 
      rscreen->nir_options.has_fmulz = true;
1437
 
   }
1438
 
 
1439
 
        rscreen->nir_options_fs = rscreen->nir_options;
 
1409
        rscreen->nir_options_fs = rscreen->nir_options;
1440
1410
        rscreen->nir_options_fs.lower_all_io_to_temps = true;
1441
1411
 
1442
1412
        return true;