Hi, Gallium Hackers,<div><br></div><div>We are working on Gallium3D on android-x86, APU. We want to run general compute programs on r600 GPU, specifically, "<span style="background-color:rgb(255,255,255);color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;font-size:14px;line-height:22px">Radeon HD6310(Evergreen family)".</span></div>
<div><font color="#333333" face="Helvetica, arial, freesans, clean, sans-serif"><span style="line-height:22px"><br></span></font></div><div><font color="#333333" face="Helvetica, arial, freesans, clean, sans-serif"><span style="line-height:22px">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. </span></font><span style="color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif;line-height:22px">now we have a healthy android-x86 and it supports opengl well. further, we can run tri.c under tests/trivial/ directory as well. </span></div>
<div><font color="#333333" face="Helvetica, arial, freesans, clean, sans-serif"><span style="line-height:22px"><br></span></font></div><div><font color="#333333" face="Helvetica, arial, freesans, clean, sans-serif"><span style="line-height:22px">let's take a simple example. can a kind person give us pointers?</span></font></div>
<div><span style="line-height:22px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif">static void test_resource_access(struct context *ctx)</span></div><div><font color="#333333" face="Helvetica, arial, freesans, clean, sans-serif"><div style="line-height:22px">
{</div><div style="line-height:22px">        const char *src = "COMP\n"</div><div style="line-height:22px">                "DCL RES[0], BUFFER, RAW, WR\n"</div><div style="line-height:22px">                "DCL RES[1], 2D, RAW, WR\n"</div>
<div style="line-height:22px">                "DCL SV[0], BLOCK_ID[0]\n"</div><div style="line-height:22px">                "DCL TEMP[0], LOCAL\n"</div><div style="line-height:22px">                "DCL TEMP[1], LOCAL\n"</div>
<div style="line-height:22px">                "IMM UINT32 { 15, 0, 0, 0 }\n"</div><div style="line-height:22px">                "IMM UINT32 { 16, 1, 0, 0 }\n"</div><div style="line-height:22px">                "\n"</div>
<div style="line-height:22px">                "    BGNSUB\n"</div><div style="line-height:22px">                "       UADD TEMP[0].x, SV[0].xxxx, SV[0].yyyy\n"</div><div style="line-height:22px">                "       AND TEMP[0].x, TEMP[0], IMM[0]\n"</div>
<div style="line-height:22px">                "       UMUL TEMP[0].x, TEMP[0], IMM[1]\n"</div><div style="line-height:22px">                "       LOAD TEMP[0].xyzw, RES[0], TEMP[0]\n"</div><div style="line-height:22px">
                "       UMUL TEMP[1], SV[0], IMM[1]\n"</div><div style="line-height:22px">                "       STORE RES[1].xyzw, TEMP[1], TEMP[0]\n"</div><div style="line-height:22px">                "       RET\n"</div>
<div style="line-height:22px">                "    ENDSUB\n";</div><div style="line-height:22px">        void init0(void *p, int s, int x, int y) {</div><div style="line-height:22px">                *(float *)p = 8.0 - (float)x;</div>
<div style="line-height:22px">        }</div><div style="line-height:22px">        void init1(void *p, int s, int x, int y) {</div><div style="line-height:22px">                *(uint32_t *)p = 0xdeadbeef;</div><div style="line-height:22px">
        }</div><div style="line-height:22px">        void expect(void *p, int s, int x, int y) {</div><div style="line-height:22px">                *(float *)p = 8.0 - (float)((x + 4*y) & 0x3f);</div><div style="line-height:22px">
        }</div><div style="line-height:22px"><br></div><div style="line-height:22px">        printf("- %s\n", __func__);</div><div style="line-height:22px"><br></div><div style="line-height:22px">        init_prog(ctx, 0, 0, 0, src, NULL); </div>
<div style="line-height:22px">        init_tex(ctx, 0, PIPE_BUFFER, true, PIPE_FORMAT_R32_FLOAT,</div><div style="line-height:22px">                 256, 0, init0);</div><div style="line-height:22px">        init_tex(ctx, 1, PIPE_TEXTURE_2D, true, PIPE_FORMAT_R32_FLOAT,</div>
<div style="line-height:22px">                 60, 12, init1);</div><div style="line-height:22px">        init_compute_resources(ctx, (int []) { 0, 1, -1 });</div><div style="line-height:22px">        launch_grid(ctx, (uint []){1, 1, 1}, (uint []){15, 12, 1}, 0, NULL);</div>
<div style="line-height:22px">        check_tex(ctx, 1, expect, NULL);</div><div style="line-height:22px">        destroy_compute_resources(ctx);</div><div style="line-height:22px">        destroy_tex(ctx);</div><div style="line-height:22px">
        destroy_prog(ctx);</div><div style="line-height:22px">}</div><div style="line-height:22px"><br></div><div><div><span style="line-height:22px">for init_prog, here is the key functions:</span></div><div><span style="line-height:22px">        *tgsi_text_translate(psrc, prog, Elements(prog));</span></div>
<div><span style="line-height:22px">what's the meaning for this API?  the input is tgsi program, what's the output?</span></div><div><span style="line-height:22px">in a nutshell, how can gallium translate tgsi to evergreen's ISA.</span></div>
<div><span style="line-height:22px"><br></span></div><div><span style="line-height:22px">        *ctx->hwcs = pipe->create_compute_state(pipe, &cs);</span></div><div><span style="line-height:22px">        *pipe->bind_compute_state(pipe, ctx->hwcs);</span></div>
</div><div style="line-height:22px">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? </div><div style="line-height:22px">
<br></div><div style="line-height:22px">thanks,</div><div style="line-height:22px">--lx</div><div style="line-height:22px"><br></div><div style="line-height:22px"><br></div></font></div>