[Mesa-dev] [Bug 96408] [PERF] SSO: dirty all stages when only one is updated. Trigger extra validations.

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jun 6 16:56:02 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=96408

            Bug ID: 96408
           Summary: [PERF] SSO: dirty all stages when only one is updated.
                    Trigger extra validations.
           Product: Mesa
           Version: git
          Hardware: Other
                OS: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Mesa core
          Assignee: mesa-dev at lists.freedesktop.org
          Reporter: gregory.hainaut at gmail.com
        QA Contact: mesa-dev at lists.freedesktop.org

Hello,

Profile my app (PCSX2), I found that NEW_VERTEX_PROGRAM validation is often
called whereas my program barely switch the vertex shader.

It was detected on Gallium Nouveau but it could impact others (gallium) drivers


Potential issue 1:
_mesa_UseProgramStages (aka glUseProgramStages) will always call
_mesa_use_shader_program which call in turn ctx->Driver.UseProgram

If I'm correct it is allowed to attach a stage to any pipeline (i.e. not bound
pipeline). In this case, it doesn't make sense to call UseProgram.

Potential issue 2:
ctx->Driver.UseProgram (aka st_use_program in gallium word) will dirty all
stages (see code below). I'm not sure it is mandatory. It feels like the API
need to be extended with an st_use_program_stage.

static void
st_use_program(struct gl_context *ctx, struct gl_shader_program *shProg)
{
   struct st_context *st = st_context(ctx);

   st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM;
   st->dirty.st |= ST_NEW_VERTEX_PROGRAM;
   st->dirty.st |= ST_NEW_GEOMETRY_PROGRAM;
   st->dirty.st |= ST_NEW_TESSCTRL_PROGRAM;
   st->dirty.st |= ST_NEW_TESSEVAL_PROGRAM;
   st->dirty_cp.st |= ST_NEW_COMPUTE_PROGRAM;
}

Potential issue 3:
I don't know if we need to revalidate everything when the pipeline is switched. 

In order to reduce pipeline validate one could create severals pipeline that
contains same programs.

Example:
pipe0 contains VS and FS0
pipe1 contains VS and FS1

Do we need to revalidate all the VS resources, if pipe1 is bound after pipe0?

Any opinions ?

Gregory

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160606/43cea268/attachment.html>


More information about the mesa-dev mailing list