Re: [Mesa-dev] [PATCH] [rfc] dri3: allow building against older xcb

2018-03-13 Thread Michel Dänzer
On 2018-03-12 08:05 PM, Dave Airlie wrote:
> On 13 March 2018 at 03:59, Marek Olšák  wrote:
>> This is good, though some older distros only have libxcb 1.11.
> 
> On those distros you likely just want to --disable-dri3 anyways.

Why would you? DRI3 has been working fine with XCB >= 1.11.1.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] [rfc] dri3: allow building against older xcb

2018-03-13 Thread Marek Olšák
On Mon, Mar 12, 2018 at 4:20 PM, Dave Airlie  wrote:
> On 13 March 2018 at 05:58, Marek Olšák  wrote:
>> On Mon, Mar 12, 2018 at 3:05 PM, Dave Airlie  wrote:
>>> On 13 March 2018 at 03:59, Marek Olšák  wrote:
 This is good, though some older distros only have libxcb 1.11.
>>>
>>> On those distros you likely just want to --disable-dri3 anyways.
>>>
>>> Dave.
>>
>> Good one. I know you don't care, but we are talking about the latest
>> long-term stable version of a major distro.
>
> Does that distro have dri3 support in it's X server?
>
> If so, then a follow up patch to lower this to 1.11 would be fine (actually
> I've posted a cleaner patch), but if you don't need dri3 support, then
> the follow up could just enable libxcb 1.11 support by dropping dri3

Yes, it has DRI3 support in the X server.

Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] [rfc] dri3: allow building against older xcb

2018-03-12 Thread Dave Airlie
On 13 March 2018 at 05:58, Marek Olšák  wrote:
> On Mon, Mar 12, 2018 at 3:05 PM, Dave Airlie  wrote:
>> On 13 March 2018 at 03:59, Marek Olšák  wrote:
>>> This is good, though some older distros only have libxcb 1.11.
>>
>> On those distros you likely just want to --disable-dri3 anyways.
>>
>> Dave.
>
> Good one. I know you don't care, but we are talking about the latest
> long-term stable version of a major distro.

Does that distro have dri3 support in it's X server?

If so, then a follow up patch to lower this to 1.11 would be fine (actually
I've posted a cleaner patch), but if you don't need dri3 support, then
the follow up could just enable libxcb 1.11 support by dropping dri3

Dave.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] [rfc] dri3: allow building against older xcb

2018-03-12 Thread Marek Olšák
On Mon, Mar 12, 2018 at 3:05 PM, Dave Airlie  wrote:
> On 13 March 2018 at 03:59, Marek Olšák  wrote:
>> This is good, though some older distros only have libxcb 1.11.
>
> On those distros you likely just want to --disable-dri3 anyways.
>
> Dave.

Good one. I know you don't care, but we are talking about the latest
long-term stable version of a major distro.

I know you don't care about the following either, but if Mesa can't
use older libxcb, the PRO driver will have to ship its own libxcb for
older distros. It's a terrible idea IMO.

Marek
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] [rfc] dri3: allow building against older xcb

2018-03-12 Thread Emil Velikov
On 12 March 2018 at 18:48, Dave Airlie  wrote:
> On 13 March 2018 at 03:24, Emil Velikov  wrote:
>> Hi Dave,
>>
>> On 11 March 2018 at 23:26, Dave Airlie  wrote:
>>> From: Dave Airlie 
>>>
>>> I'm not sure everyone wants to be updating their dri3 in a forced
>>> march setting, this allows a nicer approach, esp when you want
>>> to build on distro that aren't brand new.
>>>
>>> I'm sure there are plenty of ways this patch could be cleaner,
>>> and I've also not built it against an updated dri3.
>>
>> Have you considered cases where the build server is using 1.12, while
>> at run-time we have 1.13?
>> Are you explicitly forbidding that, say via the packaging? It tends to
>> be allowed on most(all?) distributions.
>
> Yes I am because really who does that, and why do I care.
>
Sounds like I stepped on your toes here. Pardon, did not mean to.

All I've seen is distribution packaging ensuring the runtime version
is at least equal to the build-time one.
I have not seen the opposite, hence the question.

> If you build against a newer libxcb it won't run against the older one either,
> why do you expect building against the older one will magically work against
> a newer one with all the features?
>
Very often an updated version is of dependency is shipped, yet the
package (say mesa) is not rebuilt.
AFAICT there's no clear way to annotate this kind of 'hidden'
dependency, thus package maintainers don't know about it.

Hence, causing fair amount of time lost in user frustration and
developers debugging.

>> That said, if updating XCB is a serious no-go, may I suggest something
>> like the following:
>>  - add local fallback definitions/declarations
>>  - add local functions (annotated as weak) which return 'the correct'
>> value so that the fallback paths kick in
>
> I can sorta see the first part being useful, the second is definitely
> over engineering
> the solution.
>
> The thing is most of the features in dri3.1 are gated on the X server
> having support,
> Most people are not updating their X servers, I'm guessing apart from
> the modifiers
> devs there'll be at most 10 people who update their X server for this
> feature in advance
> of a distro moving them to it. I know I won't personally be going
> around all 10 boxes I
> keep running updating their X server for a feature that doesn't add
> anything on those
> hw configurations yet. When distros move to the 1.20 X server they'll
> also move to newer
> xcb, this is for distros that won't move at all.
>
Hey, I'm just sharing an idea of what sounds like the more robust
solution. It should work "for everyone" even though it seem like an
overkill.
I dare not think of the xcb/xserver/mesa combinations that people use.

As long as people are on board with the fun experience mentioned
above, don't mind me ;-)

HTH
Emil
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] [rfc] dri3: allow building against older xcb

2018-03-12 Thread Dave Airlie
On 13 March 2018 at 03:59, Marek Olšák  wrote:
> This is good, though some older distros only have libxcb 1.11.

On those distros you likely just want to --disable-dri3 anyways.

Dave.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] [rfc] dri3: allow building against older xcb

2018-03-12 Thread Dave Airlie
On 13 March 2018 at 03:24, Emil Velikov  wrote:
> Hi Dave,
>
> On 11 March 2018 at 23:26, Dave Airlie  wrote:
>> From: Dave Airlie 
>>
>> I'm not sure everyone wants to be updating their dri3 in a forced
>> march setting, this allows a nicer approach, esp when you want
>> to build on distro that aren't brand new.
>>
>> I'm sure there are plenty of ways this patch could be cleaner,
>> and I've also not built it against an updated dri3.
>
> Have you considered cases where the build server is using 1.12, while
> at run-time we have 1.13?
> Are you explicitly forbidding that, say via the packaging? It tends to
> be allowed on most(all?) distributions.

Yes I am because really who does that, and why do I care.

If you build against a newer libxcb it won't run against the older one either,
why do you expect building against the older one will magically work against
a newer one with all the features?

> That said, if updating XCB is a serious no-go, may I suggest something
> like the following:
>  - add local fallback definitions/declarations
>  - add local functions (annotated as weak) which return 'the correct'
> value so that the fallback paths kick in

I can sorta see the first part being useful, the second is definitely
over engineering
the solution.

The thing is most of the features in dri3.1 are gated on the X server
having support,
Most people are not updating their X servers, I'm guessing apart from
the modifiers
devs there'll be at most 10 people who update their X server for this
feature in advance
of a distro moving them to it. I know I won't personally be going
around all 10 boxes I
keep running updating their X server for a feature that doesn't add
anything on those
hw configurations yet. When distros move to the 1.20 X server they'll
also move to newer
xcb, this is for distros that won't move at all.

Dave.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] [rfc] dri3: allow building against older xcb

2018-03-12 Thread Marek Olšák
This is good, though some older distros only have libxcb 1.11.

Marek

On Sun, Mar 11, 2018 at 7:26 PM, Dave Airlie  wrote:
> From: Dave Airlie 
>
> I'm not sure everyone wants to be updating their dri3 in a forced
> march setting, this allows a nicer approach, esp when you want
> to build on distro that aren't brand new.
>
> I'm sure there are plenty of ways this patch could be cleaner,
> and I've also not built it against an updated dri3.
> ---
>  configure.ac |  4 ++--
>  src/egl/drivers/dri2/platform_x11_dri3.c |  4 
>  src/loader/loader_dri3_helper.c  | 22 --
>  src/loader/loader_dri3_helper.h  |  3 ++-
>  4 files changed, 24 insertions(+), 9 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 1553ce9..6a1f139 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -92,9 +92,9 @@ WAYLAND_REQUIRED=1.11
>  WAYLAND_PROTOCOLS_REQUIRED=1.8
>  XCB_REQUIRED=1.9.3
>  XCBDRI2_REQUIRED=1.8
> -XCBDRI3_REQUIRED=1.13
> +XCBDRI3_REQUIRED=1.12
>  XCBGLX_REQUIRED=1.8.1
> -XCBPRESENT_REQUIRED=1.13
> +XCBPRESENT_REQUIRED=1.12
>  XDAMAGE_REQUIRED=1.1
>  XSHMFENCE_REQUIRED=1.1
>  XVMC_REQUIRED=1.0.6
> diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c 
> b/src/egl/drivers/dri2/platform_x11_dri3.c
> index dce3356..efe030a 100644
> --- a/src/egl/drivers/dri2/platform_x11_dri3.c
> +++ b/src/egl/drivers/dri2/platform_x11_dri3.c
> @@ -327,6 +327,7 @@ dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay 
> *disp, _EGLContext *ctx,
>EGLClientBuffer buffer,
>const EGLint *attr_list)
>  {
> +#if XCB_DRI3_MAJOR_VERSION == 1 && XCB_DRI3_MINOR_VERSION > 0
> struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
> struct dri2_egl_image *dri2_img;
> xcb_dri3_buffers_from_pixmap_cookie_t bp_cookie;
> @@ -376,6 +377,9 @@ dri3_create_image_khr_pixmap_from_buffers(_EGLDisplay 
> *disp, _EGLContext *ctx,
> }
>
> return _img->base;
> +#else
> +   return NULL;
> +#endif
>  }
>
>  static _EGLImage *
> diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
> index 585f7ce..624ef1b 100644
> --- a/src/loader/loader_dri3_helper.c
> +++ b/src/loader/loader_dri3_helper.c
> @@ -389,6 +389,7 @@ dri3_handle_present_event(struct loader_dri3_drawable 
> *draw,
>  /* If the server tells us that our allocation is suboptimal, we
>* reallocate once.
>*/
> +#ifdef XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY
>   if (ce->mode == XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY &&
>   draw->last_present_mode != ce->mode) {
>  for (int b = 0; b < ARRAY_SIZE(draw->buffers); b++) {
> @@ -396,7 +397,7 @@ dri3_handle_present_event(struct loader_dri3_drawable 
> *draw,
>draw->buffers[b]->reallocate = true;
>  }
>   }
> -
> +#endif
>   draw->last_present_mode = ce->mode;
>
>   if (draw->vtable->show_fps)
> @@ -903,10 +904,10 @@ loader_dri3_swap_buffers_msc(struct 
> loader_dri3_drawable *draw,
> */
>if (!loader_dri3_have_image_blit(draw) && draw->cur_blit_source != -1)
>   options |= XCB_PRESENT_OPTION_COPY;
> -
> +#ifdef XCB_PRESENT_OPTION_SUBOPTIMAL
>if (draw->multiplanes_available)
>   options |= XCB_PRESENT_OPTION_SUBOPTIMAL;
> -
> +#endif
>back->busy = 1;
>back->last_swap = draw->send_sbc;
>xcb_present_pixmap(draw->conn,
> @@ -1053,6 +1054,7 @@ image_format_to_fourcc(int format)
> return 0;
>  }
>
> +#if XCB_DRI3_MAJOR_VERSION == 1 && XCB_DRI3_MINOR_VERSION > 0
>  static bool
>  has_supported_modifier(struct loader_dri3_drawable *draw, unsigned int 
> format,
> uint64_t *modifiers, uint32_t count)
> @@ -1087,6 +1089,7 @@ has_supported_modifier(struct loader_dri3_drawable 
> *draw, unsigned int format,
> free(supported_modifiers);
> return found;
>  }
> +#endif
>
>  /** loader_dri3_alloc_render_buffer
>   *
> @@ -1132,6 +1135,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable 
> *draw, unsigned int format,
>goto no_image;
>
> if (!draw->is_different_gpu) {
> +#if XCB_DRI3_MAJOR_VERSION == 1 && XCB_DRI3_MINOR_VERSION > 0
>if (draw->multiplanes_available &&
>draw->ext->image->base.version >= 15 &&
>draw->ext->image->queryDmaBufModifiers &&
> @@ -1195,7 +1199,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable 
> *draw, unsigned int format,
>  buffer);
>   free(modifiers);
>}
> -
> +#endif
>if (!buffer->image)
>   buffer->image = draw->ext->image->createImage(draw->dri_screen,
> width, height,
> @@ -1272,6 +1276,7 @@ dri3_alloc_render_buffer(struct loader_dri3_drawable 
> *draw, unsigned int 

Re: [Mesa-dev] [PATCH] [rfc] dri3: allow building against older xcb

2018-03-12 Thread Emil Velikov
Hi Dave,

On 11 March 2018 at 23:26, Dave Airlie  wrote:
> From: Dave Airlie 
>
> I'm not sure everyone wants to be updating their dri3 in a forced
> march setting, this allows a nicer approach, esp when you want
> to build on distro that aren't brand new.
>
> I'm sure there are plenty of ways this patch could be cleaner,
> and I've also not built it against an updated dri3.

Have you considered cases where the build server is using 1.12, while
at run-time we have 1.13?
Are you explicitly forbidding that, say via the packaging? It tends to
be allowed on most(all?) distributions.

FWIW I'd recommend updating XCB since apart from the features, it
addresses some nasty issues in the Vulkan drivers [1].

That said, if updating XCB is a serious no-go, may I suggest something
like the following:
 - add local fallback definitions/declarations
 - add local functions (annotated as weak) which return 'the correct'
value so that the fallback paths kick in

HTH
Emil

[1] 
https://cgit.freedesktop.org/xcb/libxcb/commit/?id=fad81b63422105f9345215ab2716c4b804ec7986
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev