[PATCH xserver] glamor/xwayland: Add depth 30 format mapping for DRI 3.2 as well.
Signed-off-by: Mario Kleiner--- glamor/glamor_egl.c | 2 ++ hw/xwayland/xwayland-glamor.c | 4 2 files changed, 6 insertions(+) diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 8389d5f..eccc795 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -464,6 +464,8 @@ gbm_format_for_depth(CARD8 depth) return GBM_FORMAT_RGB565; case 24: return GBM_FORMAT_XRGB; +case 30: +return GBM_FORMAT_ARGB2101010; default: ErrorF("unexpected depth: %d\n", depth); case 32: diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index b961695..4de3beb 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -69,6 +69,8 @@ wl_drm_format_for_depth(int depth) return WL_DRM_FORMAT_RGB565; case 24: return WL_DRM_FORMAT_XRGB; +case 30: +return WL_DRM_FORMAT_ARGB2101010; default: ErrorF("unexpected depth: %d\n", depth); case 32: @@ -84,6 +86,8 @@ gbm_format_for_depth(int depth) return GBM_FORMAT_RGB565; case 24: return GBM_FORMAT_XRGB; +case 30: +return GBM_FORMAT_ARGB2101010; default: ErrorF("unexpected depth: %d\n", depth); case 32: -- 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
Re: [xserver,1/4] os: move xf86PrivsElevated here
Sent that a little too soon; please consider "Reviewed-by: Ben Crocker < bcroc...@redhat.com>" to be added after each of the "Signed-off-by: Nicolai Haehnle < nicolai.haeh...@amd.com>" lines. Also please note that I rebased Nicolai's original patch, https://patchwork.freedesktop.org/series/18684/, against a very recent copy of master. Thanks, Ben On Thu, Mar 8, 2018 at 4:53 PM, Ben Crockerwrote: > From: Nicolai Hähnle > > From: Nicolai Hähnle > > Having different types of code all trying to check for elevated privileges > is a bad idea. This implementation is the most thorough one. > > Signed-off-by: Nicolai Hähnle > --- > hw/xfree86/common/xf86Init.c | 59 +- > --- > include/os.h | 3 +++ > os/utils.c | 63 ++ > ++ > 3 files changed, 67 insertions(+), 58 deletions(-) > > diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c > index e61fe66..758b926 100644 > --- a/hw/xfree86/common/xf86Init.c > +++ b/hw/xfree86/common/xf86Init.c > @@ -230,78 +230,21 @@ xf86PrintBanner(void) > xf86ErrorFVerb(0, "Current version of pixman: %s\n", > pixman_version_string()); > xf86ErrorFVerb(0, "\tBefore reporting problems, check " > "" __VENDORDWEBSUPPORT__ "\n" > "\tto make sure that you have the latest version.\n"); > } > > Bool > xf86PrivsElevated(void) > { > -static Bool privsTested = FALSE; > -static Bool privsElevated = TRUE; > - > -if (!privsTested) { > -#if defined(WIN32) > -privsElevated = FALSE; > -#else > -if ((getuid() != geteuid()) || (getgid() != getegid())) { > -privsElevated = TRUE; > -} > -else { > -#if defined(HAVE_ISSETUGID) > -privsElevated = issetugid(); > -#elif defined(HAVE_GETRESUID) > -uid_t ruid, euid, suid; > -gid_t rgid, egid, sgid; > - > -if ((getresuid(, , ) == 0) && > -(getresgid(, , ) == 0)) { > -privsElevated = (euid != suid) || (egid != sgid); > -} > -else { > -printf("Failed getresuid or getresgid"); > -/* Something went wrong, make defensive assumption */ > -privsElevated = TRUE; > -} > -#else > -if (getuid() == 0) { > -/* running as root: uid==euid==0 */ > -privsElevated = FALSE; > -} > -else { > -/* > - * If there are saved ID's the process might still be > privileged > - * even though the above test succeeded. If issetugid() > and > - * getresgid() aren't available, test this by trying to > set > - * euid to 0. > - */ > -unsigned int oldeuid; > - > -oldeuid = geteuid(); > - > -if (seteuid(0) != 0) { > -privsElevated = FALSE; > -} > -else { > -if (seteuid(oldeuid) != 0) { > -FatalError("Failed to drop privileges. > Exiting\n"); > -} > -privsElevated = TRUE; > -} > -} > -#endif > -} > -#endif > -privsTested = TRUE; > -} > -return privsElevated; > +return PrivsElevated(); > } > > static void > TrapSignals(void) > { > if (xf86Info.notrapSignals) { > OsSignal(SIGSEGV, SIG_DFL); > OsSignal(SIGABRT, SIG_DFL); > OsSignal(SIGILL, SIG_DFL); > #ifdef SIGEMT > diff --git a/include/os.h b/include/os.h > index d2c41b4..686f6d6 100644 > --- a/include/os.h > +++ b/include/os.h > @@ -355,20 +355,23 @@ Fclose(void *); > extern const char * > Win32TempDir(void); > > extern int > System(const char *cmdline); > > #define Fopen(a,b) fopen(a,b) > #define Fclose(a) fclose(a) > #endif > > +extern _X_EXPORT Bool > +PrivsElevated(void); > + > extern _X_EXPORT void > CheckUserParameters(int argc, char **argv, char **envp); > extern _X_EXPORT void > CheckUserAuthorization(void); > > extern _X_EXPORT int > AddHost(ClientPtr /*client */ , > int /*family */ , > unsigned /*length */ , > const void * /*pAddr */ ); > diff --git a/os/utils.c b/os/utils.c > index ac55cd7..024989e 100644 > --- a/os/utils.c > +++ b/os/utils.c > @@ -1717,20 +1717,83 @@ System(const char *cmdline) > > /* Close process and thread handles. */ > CloseHandle(pi.hProcess); > CloseHandle(pi.hThread); > free(cmd); > > return dwExitCode; > } > #endif > > +Bool > +PrivsElevated(void) > +{ > +static Bool privsTested = FALSE; > +static Bool privsElevated = TRUE; > + > +if (!privsTested) { > +#if defined(WIN32) > +
[xserver,1/4] os: move xf86PrivsElevated here
From: Nicolai HähnleFrom: Nicolai Hähnle Having different types of code all trying to check for elevated privileges is a bad idea. This implementation is the most thorough one. Signed-off-by: Nicolai Hähnle --- hw/xfree86/common/xf86Init.c | 59 + include/os.h | 3 +++ os/utils.c | 63 3 files changed, 67 insertions(+), 58 deletions(-) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index e61fe66..758b926 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -230,78 +230,21 @@ xf86PrintBanner(void) xf86ErrorFVerb(0, "Current version of pixman: %s\n", pixman_version_string()); xf86ErrorFVerb(0, "\tBefore reporting problems, check " "" __VENDORDWEBSUPPORT__ "\n" "\tto make sure that you have the latest version.\n"); } Bool xf86PrivsElevated(void) { -static Bool privsTested = FALSE; -static Bool privsElevated = TRUE; - -if (!privsTested) { -#if defined(WIN32) -privsElevated = FALSE; -#else -if ((getuid() != geteuid()) || (getgid() != getegid())) { -privsElevated = TRUE; -} -else { -#if defined(HAVE_ISSETUGID) -privsElevated = issetugid(); -#elif defined(HAVE_GETRESUID) -uid_t ruid, euid, suid; -gid_t rgid, egid, sgid; - -if ((getresuid(, , ) == 0) && -(getresgid(, , ) == 0)) { -privsElevated = (euid != suid) || (egid != sgid); -} -else { -printf("Failed getresuid or getresgid"); -/* Something went wrong, make defensive assumption */ -privsElevated = TRUE; -} -#else -if (getuid() == 0) { -/* running as root: uid==euid==0 */ -privsElevated = FALSE; -} -else { -/* - * If there are saved ID's the process might still be privileged - * even though the above test succeeded. If issetugid() and - * getresgid() aren't available, test this by trying to set - * euid to 0. - */ -unsigned int oldeuid; - -oldeuid = geteuid(); - -if (seteuid(0) != 0) { -privsElevated = FALSE; -} -else { -if (seteuid(oldeuid) != 0) { -FatalError("Failed to drop privileges. Exiting\n"); -} -privsElevated = TRUE; -} -} -#endif -} -#endif -privsTested = TRUE; -} -return privsElevated; +return PrivsElevated(); } static void TrapSignals(void) { if (xf86Info.notrapSignals) { OsSignal(SIGSEGV, SIG_DFL); OsSignal(SIGABRT, SIG_DFL); OsSignal(SIGILL, SIG_DFL); #ifdef SIGEMT diff --git a/include/os.h b/include/os.h index d2c41b4..686f6d6 100644 --- a/include/os.h +++ b/include/os.h @@ -355,20 +355,23 @@ Fclose(void *); extern const char * Win32TempDir(void); extern int System(const char *cmdline); #define Fopen(a,b) fopen(a,b) #define Fclose(a) fclose(a) #endif +extern _X_EXPORT Bool +PrivsElevated(void); + extern _X_EXPORT void CheckUserParameters(int argc, char **argv, char **envp); extern _X_EXPORT void CheckUserAuthorization(void); extern _X_EXPORT int AddHost(ClientPtr /*client */ , int /*family */ , unsigned /*length */ , const void * /*pAddr */ ); diff --git a/os/utils.c b/os/utils.c index ac55cd7..024989e 100644 --- a/os/utils.c +++ b/os/utils.c @@ -1717,20 +1717,83 @@ System(const char *cmdline) /* Close process and thread handles. */ CloseHandle(pi.hProcess); CloseHandle(pi.hThread); free(cmd); return dwExitCode; } #endif +Bool +PrivsElevated(void) +{ +static Bool privsTested = FALSE; +static Bool privsElevated = TRUE; + +if (!privsTested) { +#if defined(WIN32) +privsElevated = FALSE; +#else +if ((getuid() != geteuid()) || (getgid() != getegid())) { +privsElevated = TRUE; +} +else { +#if defined(HAVE_ISSETUGID) +privsElevated = issetugid(); +#elif defined(HAVE_GETRESUID) +uid_t ruid, euid, suid; +gid_t rgid, egid, sgid; + +if ((getresuid(, , ) == 0) && +(getresgid(, , ) == 0)) { +privsElevated = (euid != suid) || (egid != sgid); +} +else { +printf("Failed getresuid or getresgid"); +/* Something went wrong, make defensive assumption */ +privsElevated = TRUE; +} +#else +
Re: [PATCH xserver] meson: Require libdrm for dri1/2/3 when configured 'auto' as well as 'true'
On 8 March 2018 at 12:34, Jon Turneywrote: > If dri1/2/3 are configured for auto-detection, libdrm is required, as well > as the corresponding proto. (Practically we will always have the > corresponding protos now, as they are part of xorgproto). > > Signed-off-by: Jon Turney Reviewed-by: Emil Velikov -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] meson: Require libdrm for dri1/2/3 when configured 'auto' as well as 'true'
If dri1/2/3 are configured for auto-detection, libdrm is required, as well as the corresponding proto. (Practically we will always have the corresponding protos now, as they are part of xorgproto). Signed-off-by: Jon Turney--- meson.build | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 3579d078a..32d72045b 100644 --- a/meson.build +++ b/meson.build @@ -279,20 +279,22 @@ endif build_glx = get_option('glx') +libdrm_dep = dependency('libdrm', version: '>= 2.4.89', required: false) + if get_option('dri1') == 'auto' -build_dri1 = xf86driproto_dep.found() +build_dri1 = xf86driproto_dep.found() and libdrm_dep.found() else build_dri1 = get_option('dri1') == 'true' endif if get_option('dri2') == 'auto' -build_dri2 = dri2proto_dep.found() +build_dri2 = dri2proto_dep.found() and libdrm_dep.found() else build_dri2 = get_option('dri2') == 'true' endif if get_option('dri3') == 'auto' -build_dri3 = dri3proto_dep.found() and xshmfence_dep.found() +build_dri3 = dri3proto_dep.found() and xshmfence_dep.found() and libdrm_dep.found() else build_dri3 = get_option('dri3') == 'true' if build_dri3 @@ -302,8 +304,11 @@ else endif endif -libdrm_required = (get_option('dri1') == 'true') or (get_option('dri2') == 'true') or (get_option('dri3') == 'true') -libdrm_dep = dependency('libdrm', version: '>= 2.4.89', required: libdrm_required) +libdrm_required = build_dri1 or build_dri2 or build_dri3 +if not libdrm_dep.found() and libdrm_required +error('DRI requested, but LIBDRM not found') +endif + build_modesetting = libdrm_dep.found() build_vbe = false -- 2.16.2 ___ 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