Hi, Gallium Hackers, We are working on Gallium3D on android-x86, APU. We want to run general compute programs on r600 GPU, specifically, "Radeon HD6310(Evergreen family)".
The first thing drawn our eyes are gallium/tests/trivial/compute.c because it calls general compute APIs and attempts to execute tgsi programs on a back-end. unfortunately, we failed to execute it even we have pipe_r600.so on android-x86. now we have a healthy android-x86 and it supports opengl well. further, we can run tri.c under tests/trivial/ directory as well. let's take a simple example. can a kind person give us pointers? static void test_resource_access(struct context *ctx) { const char *src = "COMP\n" "DCL RES[0], BUFFER, RAW, WR\n" "DCL RES[1], 2D, RAW, WR\n" "DCL SV[0], BLOCK_ID[0]\n" "DCL TEMP[0], LOCAL\n" "DCL TEMP[1], LOCAL\n" "IMM UINT32 { 15, 0, 0, 0 }\n" "IMM UINT32 { 16, 1, 0, 0 }\n" "\n" " BGNSUB\n" " UADD TEMP[0].x, SV[0].xxxx, SV[0].yyyy\n" " AND TEMP[0].x, TEMP[0], IMM[0]\n" " UMUL TEMP[0].x, TEMP[0], IMM[1]\n" " LOAD TEMP[0].xyzw, RES[0], TEMP[0]\n" " UMUL TEMP[1], SV[0], IMM[1]\n" " STORE RES[1].xyzw, TEMP[1], TEMP[0]\n" " RET\n" " ENDSUB\n"; void init0(void *p, int s, int x, int y) { *(float *)p = 8.0 - (float)x; } void init1(void *p, int s, int x, int y) { *(uint32_t *)p = 0xdeadbeef; } void expect(void *p, int s, int x, int y) { *(float *)p = 8.0 - (float)((x + 4*y) & 0x3f); } printf("- %s\n", __func__); init_prog(ctx, 0, 0, 0, src, NULL); init_tex(ctx, 0, PIPE_BUFFER, true, PIPE_FORMAT_R32_FLOAT, 256, 0, init0); init_tex(ctx, 1, PIPE_TEXTURE_2D, true, PIPE_FORMAT_R32_FLOAT, 60, 12, init1); init_compute_resources(ctx, (int []) { 0, 1, -1 }); launch_grid(ctx, (uint []){1, 1, 1}, (uint []){15, 12, 1}, 0, NULL); check_tex(ctx, 1, expect, NULL); destroy_compute_resources(ctx); destroy_tex(ctx); destroy_prog(ctx); } for init_prog, here is the key functions: *tgsi_text_translate(psrc, prog, Elements(prog)); what's the meaning for this API? the input is tgsi program, what's the output? in a nutshell, how can gallium translate tgsi to evergreen's ISA. *ctx->hwcs = pipe->create_compute_state(pipe, &cs); *pipe->bind_compute_state(pipe, ctx->hwcs); in evergreen_compute.c, it doesn't calloc kernels array and process cso->prog if HAVE_OPENCL is not set. should we set HAVE_OPENCL for general compute? thanks, --lx
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev