[Mesa-dev] [PATCH] xa: don't leak fences

Thomas Hellstrom thellstrom at vmware.com
Wed Aug 5 03:01:50 PDT 2015


Hi!

On 07/10/2015 01:12 PM, Marek Olšák wrote:
> I wonder... do we still need XA considering that everybody can just
> use glamor instead?
>
> Marek

Just back from vacation so I late reply.

In the case of VMware/vmwgfx, the rendering setup latency is huge.
Glamor tries to accelerate everything.
saa+xa tries to accelerate as little as possible following the
(admittedly questionable) statement I read somewhere that
Xrender-like acceleration is always faster if it can be done in pure
software. The vmware saa implementation tries to be reasonably smart and
do xrender operation in software and final presents and composition in
hardware with the nice effect that some Xrender benchmarks actually run
faster in the virtual Machine than on its host. As screens grow larger,
however, this approach may well tend to be a dead end.

Not long ago I tried using Xwayland with glamor on vmwgfx and I was
surprised and encouraged by how snappy it looked. I haven't tried
modesetting+glamor+vmwgfx in a while but last time I tried it had all
sorts of rendering artefacts.

But anyway, at some point and after careful benchmarking we can probably
move vmwgfx over to glamor and ditch XA, But XA needs to stay around for
now.

Thanks,
Thomas

>
> On Wed, Jul 8, 2015 at 7:39 PM, Rob Clark <robdclark at gmail.com> wrote:
>> From: Rob Clark <robclark at freedesktop.org>
>>
>> XA was never unref'ing last_fence in the various call paths to
>> pipe->flush().  Add this to xa_context_flush() and update the other
>> open-coded calls to pipe->flush() to use xa_context_flush() instead.
>>
>> This fixes a memory leak reported with xf86-video-freedreno.
>>
>> Reported-by: Nicolas Dechesne <nicolas.dechesne at linaro.org>
>> Cc: "10.5 10.6" <mesa-stable at lists.freedesktop.org>
>> Signed-off-by: Rob Clark <robclark at freedesktop.org>
>> ---
>>  src/gallium/state_trackers/xa/xa_context.c | 6 +++++-
>>  src/gallium/state_trackers/xa/xa_tracker.c | 2 +-
>>  src/gallium/state_trackers/xa/xa_yuv.c     | 2 +-
>>  3 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c
>> index fd49c82..ebfb290 100644
>> --- a/src/gallium/state_trackers/xa/xa_context.c
>> +++ b/src/gallium/state_trackers/xa/xa_context.c
>> @@ -37,7 +37,11 @@
>>  XA_EXPORT void
>>  xa_context_flush(struct xa_context *ctx)
>>  {
>> -       ctx->pipe->flush(ctx->pipe, &ctx->last_fence, 0);
>> +    if (ctx->last_fence) {
>> +        struct pipe_screen *screen = ctx->xa->screen;
>> +        screen->fence_reference(screen, &ctx->last_fence, NULL);
>> +    }
>> +    ctx->pipe->flush(ctx->pipe, &ctx->last_fence, 0);
>>  }
>>
>>  XA_EXPORT struct xa_context *
>> diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
>> index a384c1c..1df1da7 100644
>> --- a/src/gallium/state_trackers/xa/xa_tracker.c
>> +++ b/src/gallium/state_trackers/xa/xa_tracker.c
>> @@ -464,7 +464,7 @@ xa_surface_redefine(struct xa_surface *srf,
>>                         xa_min(save_height, template->height0), &src_box);
>>         pipe->resource_copy_region(pipe, texture,
>>                                    0, 0, 0, 0, srf->tex, 0, &src_box);
>> -       pipe->flush(pipe, &xa->default_ctx->last_fence, 0);
>> +       xa_context_flush(xa->default_ctx);
>>      }
>>
>>      pipe_resource_reference(&srf->tex, texture);
>> diff --git a/src/gallium/state_trackers/xa/xa_yuv.c b/src/gallium/state_trackers/xa/xa_yuv.c
>> index 1519639..97a1833 100644
>> --- a/src/gallium/state_trackers/xa/xa_yuv.c
>> +++ b/src/gallium/state_trackers/xa/xa_yuv.c
>> @@ -154,7 +154,7 @@ xa_yuv_planar_blit(struct xa_context *r,
>>         box++;
>>      }
>>
>> -    r->pipe->flush(r->pipe, &r->last_fence, 0);
>> +    xa_context_flush(r);
>>
>>      xa_ctx_sampler_views_destroy(r);
>>      xa_ctx_srf_destroy(r);
>> --
>> 2.4.3
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=vpukPkBtpoNQp2IUKuFviOmPNYWVKmen3Jeeu55zmEA&m=Te7648QdywS9RDPz53hgZS3QRABaJXfScb_lMEYP9Kw&s=rMOrpIBCc9Q9J9i5caDyFx5KBTLy6sIv5nb3cfKlMS8&e= 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=BQIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=vpukPkBtpoNQp2IUKuFviOmPNYWVKmen3Jeeu55zmEA&m=Te7648QdywS9RDPz53hgZS3QRABaJXfScb_lMEYP9Kw&s=rMOrpIBCc9Q9J9i5caDyFx5KBTLy6sIv5nb3cfKlMS8&e= 



More information about the mesa-dev mailing list