From a34d29c2edd786f0baa0e7c334f4174eeecb71d2 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 8 Mar 2015 17:56:58 +0000 Subject: [PATCH 1/6] configure.ac: remove remaining TLS references No longer used with the removal of the GL dispatch (glapi) from libglx a few releases ago. Signed-off-by: Emil Velikov Reviewed-by: Adam Jackson Reviewed-by: Eric Anholt --- configure.ac | 16 +----------- include/dix-config.h.in | 3 --- m4/xorg-tls.m4 | 55 ----------------------------------------- 3 files changed, 1 insertion(+), 73 deletions(-) delete mode 100644 m4/xorg-tls.m4 diff --git a/configure.ac b/configure.ac index 280c3692a..7fa503081 100644 --- a/configure.ac +++ b/configure.ac @@ -560,17 +560,7 @@ dnl GLX build options AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerated indirect GLX (default: enabled)]), [AIGLX=$enableval], [AIGLX=yes]) -XORG_TLS -AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: auto)]), - [GLX_USE_TLS=$enableval - if test "x$GLX_USE_TLS" = "xyes" && test "${ac_cv_tls}" = "none" ; then - AC_MSG_ERROR([GLX with TLS support requested, but the compiler does not support it.]) - fi], - [GLX_USE_TLS=no - if test "${ac_cv_tls}" != "none" ; then - GLX_USE_TLS=yes - fi]) -AC_SUBST(GLX_TLS, ${GLX_USE_TLS}) + AC_ARG_WITH(khronos-spec-dir, AS_HELP_STRING([--with-khronos-spec-dir=PATH], [Path to Khronos OpenGL registry database files (default: auto)]), [KHRONOS_SPEC_DIR="${withval}"], [KHRONOS_SPEC_DIR=auto]) @@ -1324,10 +1314,6 @@ if test "x$AIGLX" = xyes -a \( "x$DRI2" = xyes \); then fi AM_CONDITIONAL(AIGLX_DRI_LOADER, { test "x$DRI2" = xyes; } && test "x$AIGLX" = xyes) -if test "x$GLX_USE_TLS" = xyes ; then - GLX_DEFINES="-DGLX_USE_TLS -DPTHREADS" - GLX_SYS_LIBS="$GLX_SYS_LIBS -lpthread" -fi AC_SUBST([GLX_DEFINES]) AC_SUBST([GLX_SYS_LIBS]) diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 1aa77a5eb..bd479cfcd 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -454,9 +454,6 @@ /* Define to __typeof__ if your compiler spells it that way. */ #undef typeof -/* The compiler supported TLS storage class, prefering initial-exec if tls_model is supported */ -#undef TLS - /* Correctly set _XSERVER64 for OSX fat binaries */ #ifdef __APPLE__ #include "dix-config-apple-verbatim.h" diff --git a/m4/xorg-tls.m4 b/m4/xorg-tls.m4 deleted file mode 100644 index 57687758f..000000000 --- a/m4/xorg-tls.m4 +++ /dev/null @@ -1,55 +0,0 @@ -dnl Copyright © 2011 Apple Inc. -dnl -dnl Permission is hereby granted, free of charge, to any person obtaining a -dnl copy of this software and associated documentation files (the "Software"), -dnl to deal in the Software without restriction, including without limitation -dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, -dnl and/or sell copies of the Software, and to permit persons to whom the -dnl Software is furnished to do so, subject to the following conditions: -dnl -dnl The above copyright notice and this permission notice (including the next -dnl paragraph) shall be included in all copies or substantial portions of the -dnl Software. -dnl -dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -dnl DEALINGS IN THE SOFTWARE. -dnl -dnl Authors: Jeremy Huddleston - -AC_DEFUN([XORG_TLS], [ - AC_REQUIRE([XORG_STRICT_OPTION]) - AC_MSG_CHECKING(for thread local storage (TLS) support) - AC_CACHE_VAL(ac_cv_tls, [ - ac_cv_tls=none - keywords="__thread __declspec(thread)" - for kw in $keywords ; do - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int $kw test;]], [])], ac_cv_tls=$kw ; break ;) - done - ]) - AC_MSG_RESULT($ac_cv_tls) - - if test "$ac_cv_tls" != "none"; then - AC_MSG_CHECKING(for tls_model attribute support) - AC_CACHE_VAL(ac_cv_tls_model, [ - save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $STRICT_CFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int $ac_cv_tls __attribute__((tls_model("initial-exec"))) test;]], [])], - ac_cv_tls_model=yes, ac_cv_tls_model=no) - CFLAGS="$save_CFLAGS" - ]) - AC_MSG_RESULT($ac_cv_tls_model) - - if test "x$ac_cv_tls_model" = "xyes" ; then - xorg_tls=$ac_cv_tls' __attribute__((tls_model("initial-exec")))' - else - xorg_tls=$ac_cv_tls - fi - - AC_DEFINE_UNQUOTED([TLS], $xorg_tls, [The compiler supported TLS storage class, prefering initial-exec if tls_model is supported]) - fi -]) From a08ee773983c44ebb893f10a1dcfa443f2734277 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 19 Mar 2015 12:36:50 +0000 Subject: [PATCH 2/6] randr: remove chatty error messages All of these seem like left over from developments stage. Remove them as they can cause excessive flood in the logs. Cc: Dave Airlie Signed-off-by: Emil Velikov Reviewed-by: Alex Deucher --- randr/rrcrtc.c | 4 ---- randr/rrscreen.c | 2 -- 2 files changed, 6 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 69b3ecf0f..6d297aad3 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -502,7 +502,6 @@ rrCheckPixmapBounding(ScreenPtr pScreen, if (new_width == screen_pixmap->drawable.width && new_height == screen_pixmap->drawable.height) { - ErrorF("adjust shatters %d %d\n", newsize->x1, newsize->x2); } else { pScrPriv->rrScreenSetSize(pScreen, new_width, new_height, 0, 0); } @@ -557,7 +556,6 @@ RRCrtcSet(RRCrtcPtr crtc, width = mode->mode.width; height = mode->mode.height; } - ErrorF("have a master to look out for\n"); ret = rrCheckPixmapBounding(master, crtc, x, y, width, height); if (!ret) @@ -565,8 +563,6 @@ RRCrtcSet(RRCrtcPtr crtc, if (pScreen->current_master) { ret = rrCreateSharedPixmap(crtc, width, height, x, y); - ErrorF("need to create shared pixmap %d", ret); - } } #if RANDR_12_INTERFACE diff --git a/randr/rrscreen.c b/randr/rrscreen.c index e7ea49ddf..c2a7798e1 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -400,8 +400,6 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) update_totals(iter, pScrPriv); } - ErrorF("reporting %d %d %d %d\n", total_crtcs, total_outputs, total_modes, total_name_len); - pScrPriv = rrGetScrPriv(pScreen); rep = (xRRGetScreenResourcesReply) { .type = X_Reply, From 93ef0e580e9cdbe739046a0873971d402525ef00 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 19 Mar 2015 12:40:06 +0000 Subject: [PATCH 3/6] randr: use randr: prefix in ErrorF() To provide some information about the origin of the message. Cc: Dave Airlie Signed-off-by: Emil Velikov Reviewed-by: Alex Deucher --- randr/rrcrtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 6d297aad3..dca0691ac 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -428,7 +428,7 @@ rrCreateSharedPixmap(RRCrtcPtr crtc, int width, int height, ret = pScrPriv->rrCrtcSetScanoutPixmap(crtc, spix); if (ret == FALSE) { - ErrorF("failed to set shadow slave pixmap\n"); + ErrorF("randr: failed to set shadow slave pixmap\n"); return FALSE; } From 363cd0e0b499ea8c32b2aa5cf7ea0f0a56b4c3ef Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 19 Mar 2015 12:19:23 +0000 Subject: [PATCH 4/6] randr: use local variables where possible This will allow us to make the code more readable, and the lines will fit within 80 columns. Signed-off-by: Emil Velikov Reviewed-by: Alex Deucher --- randr/rrcrtc.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index dca0691ac..0df96a4be 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -394,7 +394,7 @@ rrCreateSharedPixmap(RRCrtcPtr crtc, int width, int height, Bool ret; int depth; PixmapPtr mscreenpix; - PixmapPtr protopix = crtc->pScreen->current_master->GetScreenPixmap(crtc->pScreen->current_master); + PixmapPtr protopix = master->GetScreenPixmap(master); rrScrPriv(crtc->pScreen); /* create a pixmap on the master screen, @@ -457,18 +457,20 @@ rrCheckPixmapBounding(ScreenPtr pScreen, /* have to iterate all the crtcs of the attached gpu masters and all their output slaves */ for (c = 0; c < pScrPriv->numCrtcs; c++) { - if (pScrPriv->crtcs[c] == rr_crtc) { + RRCrtcPtr crtc = pScrPriv->crtcs[c]; + + if (crtc == rr_crtc) { newbox.x1 = x; newbox.x2 = x + w; newbox.y1 = y; newbox.y2 = y + h; } else { - if (!pScrPriv->crtcs[c]->mode) + if (!crtc->mode) continue; - newbox.x1 = pScrPriv->crtcs[c]->x; - newbox.x2 = pScrPriv->crtcs[c]->x + pScrPriv->crtcs[c]->mode->mode.width; - newbox.y1 = pScrPriv->crtcs[c]->y; - newbox.y2 = pScrPriv->crtcs[c]->y + pScrPriv->crtcs[c]->mode->mode.height; + newbox.x1 = crtc->x; + newbox.x2 = crtc->x + crtc->mode->mode.width; + newbox.y1 = crtc->y; + newbox.y2 = crtc->y + crtc->mode->mode.height; } RegionInit(&new_crtc_region, &newbox, 1); RegionUnion(&total_region, &total_region, &new_crtc_region); @@ -477,19 +479,21 @@ rrCheckPixmapBounding(ScreenPtr pScreen, xorg_list_for_each_entry(slave, &pScreen->output_slave_list, output_head) { rrScrPrivPtr slave_priv = rrGetScrPriv(slave); for (c = 0; c < slave_priv->numCrtcs; c++) { - if (slave_priv->crtcs[c] == rr_crtc) { + RRCrtcPtr slave_crtc = slave_priv->crtcs[c]; + + if (slave_crtc == rr_crtc) { newbox.x1 = x; newbox.x2 = x + w; newbox.y1 = y; newbox.y2 = y + h; } else { - if (!slave_priv->crtcs[c]->mode) + if (!slave_crtc->mode) continue; - newbox.x1 = slave_priv->crtcs[c]->x; - newbox.x2 = slave_priv->crtcs[c]->x + slave_priv->crtcs[c]->mode->mode.width; - newbox.y1 = slave_priv->crtcs[c]->y; - newbox.y2 = slave_priv->crtcs[c]->y + slave_priv->crtcs[c]->mode->mode.height; + newbox.x1 = slave_crtc->x; + newbox.x2 = slave_crtc->x + slave_crtc->mode->mode.width; + newbox.y1 = slave_crtc->y; + newbox.y2 = slave_crtc->y + slave_crtc->mode->mode.height; } RegionInit(&new_crtc_region, &newbox, 1); RegionUnion(&total_region, &total_region, &new_crtc_region); From 739e8fac0e9d8d4c1653e53a8f3ce2d38b3de320 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 19 Mar 2015 12:22:18 +0000 Subject: [PATCH 5/6] randr: wrap long line Also make use of total_name_len variable for consistency. Signed-off-by: Emil Velikov Reviewed-by: Alex Deucher --- randr/rrscreen.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/randr/rrscreen.c b/randr/rrscreen.c index c2a7798e1..d0ca91e0e 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -413,8 +413,9 @@ rrGetMultiScreenResources(ClientPtr client, Bool query, ScreenPtr pScreen) .nbytesNames = total_name_len }; - rep.length = (total_crtcs + total_outputs + total_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) + - bytes_to_int32(rep.nbytesNames)); + rep.length = (total_crtcs + total_outputs + + total_modes * bytes_to_int32(SIZEOF(xRRModeInfo)) + + bytes_to_int32(total_name_len)); extraLen = rep.length << 2; if (extraLen) { From 23702dd2689e2e1e65be5767ac0303a985bb04a0 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Thu, 19 Mar 2015 12:26:29 +0000 Subject: [PATCH 6/6] randr: coding style fixes In most of xserver code-base we define new functions at column 0, with their return type provided on the previous line. Two functions did not follow this rule so update them, and get them wrapped up to 80 as an added bonus. Signed-off-by: Emil Velikov Reviewed-by: Alex Deucher --- randr/rrcrtc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 0df96a4be..e235c5ff8 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -1575,7 +1575,8 @@ ProcRRGetCrtcTransform(ClientPtr client) return Success; } -static Bool check_all_screen_crtcs(ScreenPtr pScreen, int *x, int *y) +static Bool +check_all_screen_crtcs(ScreenPtr pScreen, int *x, int *y) { rrScrPriv(pScreen); int i; @@ -1595,7 +1596,8 @@ static Bool check_all_screen_crtcs(ScreenPtr pScreen, int *x, int *y) return FALSE; } -static Bool constrain_all_screen_crtcs(DeviceIntPtr pDev, ScreenPtr pScreen, int *x, int *y) +static Bool +constrain_all_screen_crtcs(DeviceIntPtr pDev, ScreenPtr pScreen, int *x, int *y) { rrScrPriv(pScreen); int i;