Re: [PATCH xserver 2/4] dri3: Robustly clamp to 1.0 if not all screens support 1.2

2018-05-01 Thread Emil Velikov
On 30 April 2018 at 08:06, Mario Kleiner  wrote:
> Checking for dri3_screen_info_rec.version >= 2 is insufficient,
> as some shipping drivers, e.g., intel-ddx, nouveau-ddx, set the
> version to DRI3_SCREEN_INFO_VERSION, ie. to whatever version the
> installed servers headers define.

Hey, at least ati/amdgpu does it properly ;-)

Although in practise there are enough cases/bugs where drivers set the
version they're build against.
Instead of the one they support/implement.

Just grep for VERSION - anythings that's not a preprocessor guard
should be fixed.
Guess we should fix those one of these days.

FWIW series looks spot-on, though I can see it's already merged.
Emil
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver 2/4] dri3: Robustly clamp to 1.0 if not all screens support 1.2

2018-04-30 Thread Mario Kleiner
Checking for dri3_screen_info_rec.version >= 2 is insufficient,
as some shipping drivers, e.g., intel-ddx, nouveau-ddx, set the
version to DRI3_SCREEN_INFO_VERSION, ie. to whatever version the
installed servers headers define. On server 1.20 that would
be version 2, but the drivers still don't support the v1.2
hooks. Make sure all hooks are defined before reporting v1.2.

Also make clamping of reported version to minimum of client
or server robust against possible future clients with possible
majorVersion >= 2.0.

Signed-off-by: Mario Kleiner 
Cc: Adam Jackson 
Cc: Daniel Stone 
---
 dri3/dri3_request.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/dri3/dri3_request.c b/dri3/dri3_request.c
index 61d3f9d..e34bebe 100644
--- a/dri3/dri3_request.c
+++ b/dri3/dri3_request.c
@@ -37,7 +37,10 @@ dri3_screen_can_one_point_two(ScreenPtr screen)
 {
 dri3_screen_priv_ptr dri3 = dri3_screen_priv(screen);
 
-if (dri3 && dri3->info && dri3->info->version >= 2)
+if (dri3 && dri3->info && dri3->info->version >= 2 &&
+dri3->info->pixmap_from_fds && dri3->info->fds_from_pixmap &&
+dri3->info->get_formats && dri3->info->get_modifiers &&
+dri3->info->get_drawable_modifiers)
 return TRUE;
 
 return FALSE;
@@ -79,7 +82,8 @@ proc_dri3_query_version(ClientPtr client)
  */
 
 if (rep.majorVersion > stuff->majorVersion ||
-rep.minorVersion > stuff->minorVersion) {
+(rep.majorVersion == stuff->majorVersion &&
+ rep.minorVersion > stuff->minorVersion)) {
 rep.majorVersion = stuff->majorVersion;
 rep.minorVersion = stuff->minorVersion;
 }
-- 
2.7.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel