All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Romanick <idr@freedesktop.org>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	xorg-devel@lists.x.org, dri-devel@lists.freedesktop.org,
	mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] [xorg 1/3] dri2: Allow GetBuffers to match any format
Date: Tue, 20 Jan 2015 12:49:41 -0800	[thread overview]
Message-ID: <54BEBF65.2080408@freedesktop.org> (raw)
In-Reply-To: <1421665245-5994-3-git-send-email-chris@chris-wilson.co.uk>

On 01/19/2015 03:00 AM, Chris Wilson wrote:
> Since the introduction of DRI2GetBuffersWithFormat, the old
> DRI2GetBuffers interface would always recreate all buffers all the time
> as it was no longer agnostic to the format value being set by the DDXes.
> This causes an issue with clients intermixing the two requests,
> rendering any sharing or caching of buffers (e.g. for triple buffering)
> void.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  hw/xfree86/dri2/dri2.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
> index 43a1899..f9f594d 100644
> --- a/hw/xfree86/dri2/dri2.c
> +++ b/hw/xfree86/dri2/dri2.c
> @@ -464,14 +464,16 @@ find_attachment(DRI2DrawablePtr pPriv, unsigned attachment)
>  static Bool
>  allocate_or_reuse_buffer(DrawablePtr pDraw, DRI2ScreenPtr ds,
>                           DRI2DrawablePtr pPriv,
> -                         unsigned int attachment, unsigned int format,
> +                         unsigned int attachment,
> +                         int has_format, unsigned int format,
>                           int dimensions_match, DRI2BufferPtr * buffer)
>  {
>      int old_buf = find_attachment(pPriv, attachment);
>  
>      if ((old_buf < 0)
>          || attachment == DRI2BufferFrontLeft
> -        || !dimensions_match || (pPriv->buffers[old_buf]->format != format)) {
> +        || !dimensions_match
> +        || (has_format && pPriv->buffers[old_buf]->format != format)) {
>          *buffer = create_buffer(ds, pDraw, attachment, format);

Shouldn't the create_buffer change if !has_format?  If !has_format and,
say, !dimensions_match, create_buffer will get format = 0 when it should
get format = pPriv->buffers[old_buf]->format.  Right?

Another alternative would be to have the caller always pass a format:
either the format supplied in the protocol or the format of the old
buffer.  That might be more messy.  Dunno.

>          return TRUE;
>  
> @@ -549,7 +551,8 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
>          const unsigned format = (has_format) ? *(attachments++) : 0;
>  
>          if (allocate_or_reuse_buffer(pDraw, ds, pPriv, attachment,
> -                                     format, dimensions_match, &buffers[i]))
> +                                     has_format, format, dimensions_match,
> +                                     &buffers[i]))
>              buffers_changed = 1;
>  
>          if (buffers[i] == NULL)
> @@ -584,7 +587,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
>  
>      if (need_real_front > 0) {
>          if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFrontLeft,
> -                                     front_format, dimensions_match,
> +                                     has_format, front_format, dimensions_match,
>                                       &buffers[i]))
>              buffers_changed = 1;
>  
> @@ -595,7 +598,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
>  
>      if (need_fake_front > 0) {
>          if (allocate_or_reuse_buffer(pDraw, ds, pPriv, DRI2BufferFakeFrontLeft,
> -                                     front_format, dimensions_match,
> +                                     has_format, front_format, dimensions_match,
>                                       &buffers[i]))
>              buffers_changed = 1;
>  
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-01-20 20:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-19 11:00 Implement GLX_EXT_buffer_age for DRI2 Chris Wilson
     [not found] ` <1421665245-5994-1-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
2015-01-19 11:00   ` [dri2proto] Declare DRI2ParamXHasBufferAge Chris Wilson
     [not found]     ` <1421665245-5994-2-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
2015-01-20 20:53       ` [Mesa-dev] " Ian Romanick
2015-06-16 12:25         ` Martin Peres
2015-01-19 11:00   ` [xorg 1/3] dri2: Allow GetBuffers to match any format Chris Wilson
2015-01-20 20:49     ` Ian Romanick [this message]
2015-06-16 13:11       ` Martin Peres
2015-01-19 11:00   ` [xorg 2/3] dri2: Pass swap-interval=0 ScheduleSwap requests to the ddx Chris Wilson
2015-02-18 19:57     ` Fredrik Höglund
2015-01-19 11:00   ` [xorg 3/3] dri2: Reuse unused flags in GetBuffers protocol to pass last SBC Chris Wilson
2015-01-19 14:14     ` Chris Wilson
2015-01-19 14:29       ` [PATCH v2] " Chris Wilson
2015-01-20 21:55         ` Ian Romanick
2015-01-19 11:00   ` [xf86-video-ati] dri2: Enable BufferAge support Chris Wilson
2015-01-20 16:47     ` Alex Deucher
2015-01-19 11:00   ` [xf86-video-nouveau] " Chris Wilson
     [not found]     ` <1421665245-5994-7-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
2015-05-09  4:41       ` Mario Kleiner
2015-01-19 11:00   ` [mesa 7/9] glx/dri2: Add DRI2GetParam() Chris Wilson
     [not found]     ` <1421665245-5994-8-git-send-email-chris-Y6uKTt2uX1cEflXRtASbqLVCufUGDwFn@public.gmane.org>
2015-01-20 19:11       ` [Mesa-dev] " Ian Romanick
2015-01-19 11:00   ` [mesa 8/9] glx/dri2: Move the wait after SwapBuffers into the next GetBuffers Chris Wilson
2015-01-20 20:03     ` Ian Romanick
2015-01-19 11:00   ` [mesa 9/9] glx/dri2: Implement getBufferAge Chris Wilson
2015-01-20 20:35     ` Ian Romanick
     [not found]       ` <54BEBBF9.8010104-CC+yJ3UmIYqDUpFQwHEjaQ@public.gmane.org>
2015-01-20 20:49         ` [Mesa-dev] " Ian Romanick
2015-01-20 21:49 ` Implement GLX_EXT_buffer_age for DRI2 Dave Airlie
2015-02-18 18:40   ` [Mesa-dev] " Daniel Stone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54BEBF65.2080408@freedesktop.org \
    --to=idr@freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mesa-dev@lists.freedesktop.org \
    --cc=xorg-devel@lists.x.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.