[Mesa-dev] Fwd: GPU-CPU sync during radeonQueryGetResult

Vyacheslav Gonakhchyan ytriffy at gmail.com
Mon Jul 6 10:05:05 PDT 2015


Ilia, thanks for the gallium link.
Do you know any links to high level info with broad strokes about how this
sync works? Frankly I do not know driver terminology and wanted to know
more about how this sync is performed for my research. I'm using mesa as a
reference because it has open implementation code. Occlusion query
functionality probably waits for z-buffer to become ready. Problem is that
usual synchronization techniques do not apply here. I'm thinking that
driver code gets notifications about state change. I want to know what kind
of notifications are available? Can query be performed in parallel with
another frame being processed or does it need complete GPU pipeline flush?

Thanks,
Vyacheslav

On Mon, Jul 6, 2015 at 8:32 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:

> On Mon, Jul 6, 2015 at 11:29 AM, Vyacheslav Gonakhchyan
> <ytriffy at gmail.com> wrote:
> > Hi, everyone.
> >
> > Trying to understand method radeonQueryGetResult (more broadly GPU-CPU
> > sync).
> >
> > static void radeonQueryGetResult(struct gl_context *ctx, struct
> > gl_query_object *q)
> > {
> >     struct radeon_query_object *query = (struct radeon_query_object *)q;
> >         uint32_t *result;
> >     int i;
> >
> >     radeon_print(RADEON_STATE, RADEON_VERBOSE,
> >             "%s: query id %d, result %d\n",
> >             __func__, query->Base.Id, (int) query->Base.Result);
> >
> >     radeon_bo_map(query->bo, GL_FALSE);
> >         result = query->bo->ptr;
> >
> >     query->Base.Result = 0;
> >     for (i = 0; i < query->curr_offset/sizeof(uint32_t); ++i) {
> >         query->Base.Result += LE32_TO_CPU(result[i]);
> >         radeon_print(RADEON_STATE, RADEON_TRACE, "result[%d] = %d\n", i,
> > LE32_TO_CPU(result[i]));
> >     }
> >
> >     radeon_bo_unmap(query->bo);
> > }
> >
> > I don't know which part is responsible for blocking behavior (waiting for
> > response from GPU). I suspect that radeon_bo_map does this magic.
> > Can someone point in the right direction?
>
> The radeon_bo_map defined in
> src/gallium/winsys/radeon/drm/radeon_drm_bo.c indeed has this magic.
> However the code in src/mesa/drivers/dri/radeon/radeon_queryobj.c
> references the radeon_bo_map in libdrm, which does not appear to wait.
>
> FWIW for nouveau, nouveau_bo_map will also implicitly do a
> nouveau_bo_wait, but that does not appear to be the case for radeon.
>
> Cheers,
>
>   -ilia
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150706/a59358c2/attachment.html>


More information about the mesa-dev mailing list