diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2015-07-02 13:42:47 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2015-07-02 13:42:47 +0100 |
commit | de350c3610e49270a0f422663a42deb4b94b5bb0 (patch) | |
tree | 41dfe9b56fa96c2b95fe64fb3901ebbc208161df | |
parent | 7c61592022ea519edf92e86d721d707580eacbdb (diff) | |
parent | 2123f7682d522619f101b05fb75efa75dabbe371 (diff) |
Merge tag 'xorg-server-1.17.2' into cygwin-release-1.17
xorg-server-1.17.2
Conflicts:
hw/xwin/glx/gen_gl_wrappers.py
hw/xwin/winprocarg.c
53 files changed, 432 insertions, 140 deletions
diff --git a/Xext/shm.c b/Xext/shm.c index db9d47450..b359a9035 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -260,7 +260,7 @@ ShmDestroyPixmap(PixmapPtr pPixmap) pScreen->DestroyPixmap = ShmDestroyPixmap; if (shmdesc) - ShmDetachSegment(shmdesc, pPixmap->drawable.id); + ShmDetachSegment(shmdesc, 0); return ret; } @@ -427,7 +427,7 @@ ProcShmAttach(ClientPtr client) /*ARGSUSED*/ static int ShmDetachSegment(void *value, /* must conform to DeleteType */ - XID shmseg) + XID unused) { ShmDescPtr shmdesc = (ShmDescPtr) value; ShmDescPtr *prev; @@ -971,6 +971,12 @@ ProcPanoramiXShmCreatePixmap(ClientPtr client) stuff->offset); if (pMap) { + result = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, + RT_PIXMAP, pMap, RT_NONE, NULL, DixCreateAccess); + if (result != Success) { + pDraw->pScreen->DestroyPixmap(pMap); + return result; + } dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc); shmdesc->refcnt++; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; diff --git a/configure.ac b/configure.ac index 62a0b4793..37241aa6a 100644 --- a/configure.ac +++ b/configure.ac @@ -26,8 +26,8 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.60) -AC_INIT([xorg-server], 1.17.1, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) -RELEASE_DATE="2015-02-10" +AC_INIT([xorg-server], 1.17.2, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) +RELEASE_DATE="2015-06-16" RELEASE_NAME="lambic" AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_MACRO_DIR([m4]) @@ -1987,7 +1987,7 @@ if test "x$XORG" = xyes; then sparc*) SOLARIS_INOUT_ARCH="sparcv8plus" ;; - i*86) + i*86|x86_64*) if test x$SOLARIS_64 = xyes ; then SOLARIS_INOUT_ARCH="amd64" else @@ -2439,7 +2439,8 @@ if test "$KDRIVE" = yes; then fi ;; esac - KDRIVE_LOCAL_LIBS="$MAIN_LIB $DIX_LIB $KDRIVE_LIB" + KDRIVE_MAIN_LIB="$MAIN_LIB" + KDRIVE_LOCAL_LIBS="$DIX_LIB $KDRIVE_LIB" KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $FB_LIB $MI_LIB $KDRIVE_PURE_LIBS" KDRIVE_LOCAL_LIBS="$KDRIVE_LOCAL_LIBS $KDRIVE_OS_LIB" KDRIVE_LIBS="$KDRIVE_LOCAL_LIBS $XSERVER_SYS_LIBS $GLX_SYS_LIBS $DLOPEN_LIBS $TSLIB_LIBS" @@ -2451,6 +2452,7 @@ AC_SUBST([KDRIVE_INCS]) AC_SUBST([KDRIVE_PURE_INCS]) AC_SUBST([KDRIVE_CFLAGS]) AC_SUBST([KDRIVE_PURE_LIBS]) +AC_SUBST([KDRIVE_MAIN_LIB]) AC_SUBST([KDRIVE_LOCAL_LIBS]) AC_SUBST([KDRIVE_LIBS]) AM_CONDITIONAL(KDRIVELINUX, [test "x$KDRIVELINUX" = xyes]) diff --git a/dix/devices.c b/dix/devices.c index c4fdbe169..03290e486 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -177,6 +177,9 @@ DeviceSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, if (!isfinite(f[i])) return BadValue; + if (!dev->valuator) + return BadMatch; + if (!checkonly) DeviceSetTransform(dev, f); } diff --git a/dix/events.c b/dix/events.c index b8c67fdfc..250061568 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1063,6 +1063,7 @@ MonthChangedOrBadTime(CARD32 *ms) void NoticeTime(const DeviceIntPtr dev, TimeStamp time) { + currentTime = time; lastDeviceEventTime[XIAllDevices].time = currentTime; lastDeviceEventTime[dev->id].time = currentTime; diff --git a/glamor/glamor.c b/glamor/glamor.c index 017266a85..a8cc810d1 100644 --- a/glamor/glamor.c +++ b/glamor/glamor.c @@ -305,6 +305,35 @@ glamor_create_screen_resources(ScreenPtr screen) return ret; } +static Bool +glamor_check_instruction_count(int gl_version) +{ + GLint max_native_alu_instructions; + + /* Avoid using glamor if the reported instructions limit is too low, + * as this would cause glamor to fallback on sw due to large shaders + * which ends up being unbearably slow. + */ + if (gl_version < 30) { + if (!epoxy_has_gl_extension("GL_ARB_fragment_program")) { + ErrorF("GL_ARB_fragment_program required\n"); + return FALSE; + } + + glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, + GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB, + &max_native_alu_instructions); + if (max_native_alu_instructions < GLAMOR_MIN_ALU_INSTRUCTIONS) { + LogMessage(X_WARNING, + "glamor requires at least %d instructions (%d reported)\n", + GLAMOR_MIN_ALU_INSTRUCTIONS, max_native_alu_instructions); + return FALSE; + } + } + + return TRUE; +} + /** Set up glamor for an already-configured GL context. */ Bool glamor_init(ScreenPtr screen, unsigned int flags) @@ -384,6 +413,9 @@ glamor_init(ScreenPtr screen, unsigned int flags) ErrorF("Require OpenGL version 2.1 or later.\n"); goto fail; } + + if (!glamor_check_instruction_count(gl_version)) + goto fail; } else { if (gl_version < 20) { ErrorF("Require Open GLES2.0 or later.\n"); @@ -411,6 +443,14 @@ glamor_init(ScreenPtr screen, unsigned int flags) epoxy_has_gl_extension("GL_ARB_buffer_storage"); glamor_priv->has_nv_texture_barrier = epoxy_has_gl_extension("GL_NV_texture_barrier"); + glamor_priv->has_unpack_subimage = + glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP || + epoxy_gl_version() >= 30 || + epoxy_has_gl_extension("GL_EXT_unpack_subimage"); + glamor_priv->has_pack_subimage = + glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP || + epoxy_gl_version() >= 30 || + epoxy_has_gl_extension("GL_NV_pack_subimage"); glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size); glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size); diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c index 737b2744b..235a4baed 100644 --- a/glamor/glamor_core.c +++ b/glamor/glamor_core.c @@ -35,7 +35,7 @@ #include "glamor_priv.h" -const Bool +Bool glamor_get_drawable_location(const DrawablePtr drawable) { PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 113450c8d..3bed1920b 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -597,6 +597,7 @@ glamor_egl_close_screen(ScreenPtr screen) return screen->CloseScreen(screen); } +#ifdef DRI3 static int glamor_dri3_open_client(ClientPtr client, ScreenPtr screen, @@ -653,12 +654,12 @@ static dri3_screen_info_rec glamor_dri3_info = { .pixmap_from_fd = glamor_pixmap_from_fd, .fd_from_pixmap = glamor_fd_from_pixmap, }; +#endif /* DRI3 */ void glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) { ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); struct glamor_egl_screen_private *glamor_egl = glamor_egl_get_screen_private(scrn); @@ -670,7 +671,9 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) glamor_ctx->make_current = glamor_egl_make_current; +#ifdef DRI3 if (glamor_egl->dri3_capable) { + glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); /* Tell the core that we have the interfaces for import/export * of pixmaps. */ @@ -693,6 +696,7 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx) } } } +#endif } static void diff --git a/glamor/glamor_fbo.c b/glamor/glamor_fbo.c index 8d73e4765..ad4dfe656 100644 --- a/glamor/glamor_fbo.c +++ b/glamor/glamor_fbo.c @@ -348,7 +348,6 @@ _glamor_create_tex(glamor_screen_private *glamor_priv, glamor_make_current(glamor_priv); glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_2D, tex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0, diff --git a/glamor/glamor_font.c b/glamor/glamor_font.c index 0ca91fa2e..cc0fecf7a 100644 --- a/glamor/glamor_font.c +++ b/glamor/glamor_font.c @@ -97,7 +97,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font) glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); diff --git a/glamor/glamor_largepixmap.c b/glamor/glamor_largepixmap.c index 9b2458453..b9c3b9af1 100644 --- a/glamor/glamor_largepixmap.c +++ b/glamor/glamor_largepixmap.c @@ -1046,6 +1046,15 @@ glamor_composite_largepixmap_region(CARD8 op, int source_repeat_type = 0, mask_repeat_type = 0; int ok = TRUE; + if (source_pixmap_priv == dest_pixmap_priv) { + glamor_fallback("source and dest pixmaps are the same\n"); + return FALSE; + } + if (mask_pixmap_priv == dest_pixmap_priv) { + glamor_fallback("mask and dest pixmaps are the same\n"); + return FALSE; + } + if (source->repeat) source_repeat_type = source->repeatType; else diff --git a/glamor/glamor_pixmap.c b/glamor/glamor_pixmap.c index 947113ee9..0d92710cf 100644 --- a/glamor/glamor_pixmap.c +++ b/glamor/glamor_pixmap.c @@ -717,7 +717,6 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex, } glBindTexture(GL_TEXTURE_2D, *tex); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index ed6e2d192..612701a19 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -236,6 +236,8 @@ typedef struct glamor_screen_private { int has_buffer_storage; int has_khr_debug; int has_nv_texture_barrier; + int has_pack_subimage; + int has_unpack_subimage; int max_fbo_size; int has_rw_pbo; @@ -669,7 +671,7 @@ glamor_pixmap_fbo *glamor_create_fbo_array(glamor_screen_private *glamor_priv, void glamor_init_finish_access_shaders(ScreenPtr screen); void glamor_fini_finish_access_shaders(ScreenPtr screen); -const Bool glamor_get_drawable_location(const DrawablePtr drawable); +Bool glamor_get_drawable_location(const DrawablePtr drawable); void glamor_get_drawable_deltas(DrawablePtr drawable, PixmapPtr pixmap, int *x, int *y); GLint glamor_compile_glsl_prog(GLenum type, const char *source); @@ -1095,4 +1097,6 @@ void glamor_xv_render(glamor_port_private *port_priv); #include "glamor_font.h" +#define GLAMOR_MIN_ALU_INSTRUCTIONS 128 /* Minimum required number of native ALU instructions */ + #endif /* GLAMOR_PRIV_H */ diff --git a/glamor/glamor_program.c b/glamor/glamor_program.c index 1d0328f2b..3207aaf15 100644 --- a/glamor/glamor_program.c +++ b/glamor/glamor_program.c @@ -343,9 +343,6 @@ glamor_build_program(ScreenPtr screen, prog->dash_uniform = glamor_get_uniform(prog, glamor_program_location_dash, "dash"); prog->dash_length_uniform = glamor_get_uniform(prog, glamor_program_location_dash, "dash_length"); - if (glGetError() != GL_NO_ERROR) - goto fail; - free(version_string); free(fs_vars); free(vs_vars); diff --git a/glamor/glamor_render.c b/glamor/glamor_render.c index 2386f2e2e..d9b16ea05 100644 --- a/glamor/glamor_render.c +++ b/glamor/glamor_render.c @@ -1400,6 +1400,7 @@ glamor_composite_clipped_region(CARD8 op, { ScreenPtr screen = dest->pDrawable->pScreen; PixmapPtr source_pixmap = NULL, mask_pixmap = NULL; + PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable); PicturePtr temp_src = source, temp_mask = mask; glamor_pixmap_private *temp_src_priv = source_pixmap_priv; glamor_pixmap_private *temp_mask_priv = mask_pixmap_priv; @@ -1502,7 +1503,14 @@ glamor_composite_clipped_region(CARD8 op, } } - /*XXXXX, self copy? */ + if (source_pixmap == dest_pixmap) { + glamor_fallback("source and dest pixmaps are the same\n"); + goto out; + } + if (mask_pixmap == dest_pixmap) { + glamor_fallback("mask and dest pixmaps are the same\n"); + goto out; + } x_dest += dest->pDrawable->x; y_dest += dest->pDrawable->y; diff --git a/glamor/glamor_spans.c b/glamor/glamor_spans.c index 582d11df3..6ebb12e18 100644 --- a/glamor/glamor_spans.c +++ b/glamor/glamor_spans.c @@ -226,7 +226,7 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax, BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y); glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y); - glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb); + glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); glPixelStorei(GL_PACK_ALIGNMENT, 4); d = dst; diff --git a/glamor/glamor_sync.c b/glamor/glamor_sync.c index 5e158c33a..fbc47d4b3 100644 --- a/glamor/glamor_sync.c +++ b/glamor/glamor_sync.c @@ -94,8 +94,10 @@ glamor_sync_init(ScreenPtr screen) return FALSE; } +#ifdef HAVE_XSHMFENCE if (!miSyncShmScreenInit(screen)) return FALSE; +#endif screen_funcs = miSyncGetScreenFuncs(screen); glamor->saved_procs.sync_screen_funcs.CreateFence = screen_funcs->CreateFence; diff --git a/glamor/glamor_transfer.c b/glamor/glamor_transfer.c index 891415565..aa5e8616e 100644 --- a/glamor/glamor_transfer.c +++ b/glamor/glamor_transfer.c @@ -73,7 +73,9 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, glamor_make_current(glamor_priv); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel); + + if (glamor_priv->has_unpack_subimage) + glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel); glamor_pixmap_loop(priv, box_x, box_y) { BoxPtr box = glamor_pixmap_box_at(priv, box_x, box_y); @@ -92,25 +94,34 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, int y1 = MAX(boxes->y1 + dy_dst, box->y1); int y2 = MIN(boxes->y2 + dy_dst, box->y2); + size_t ofs = (y1 - dy_dst + dy_src) * byte_stride; + ofs += (x1 - dx_dst + dx_src) * bytes_per_pixel; + boxes++; if (x2 <= x1 || y2 <= y1) continue; - glPixelStorei(GL_UNPACK_SKIP_ROWS, y1 - dy_dst + dy_src); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1 - dx_dst + dx_src); - - glTexSubImage2D(GL_TEXTURE_2D, 0, - x1 - box->x1, y1 - box->y1, - x2 - x1, y2 - y1, - format, type, - bits); + if (glamor_priv->has_unpack_subimage || + x2 - x1 == byte_stride / bytes_per_pixel) { + glTexSubImage2D(GL_TEXTURE_2D, 0, + x1 - box->x1, y1 - box->y1, + x2 - x1, y2 - y1, + format, type, + bits + ofs); + } else { + for (; y1 < y2; y1++, ofs += byte_stride) + glTexSubImage2D(GL_TEXTURE_2D, 0, + x1 - box->x1, y1 - box->y1, + x2 - x1, 1, + format, type, + bits + ofs); + } } } - glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); + if (glamor_priv->has_unpack_subimage) + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); } /* @@ -166,7 +177,8 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, glamor_make_current(glamor_priv); glPixelStorei(GL_PACK_ALIGNMENT, 4); - glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel); + if (glamor_priv->has_pack_subimage) + glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel); glamor_pixmap_loop(priv, box_x, box_y) { BoxPtr box = glamor_pixmap_box_at(priv, box_x, box_y); @@ -174,7 +186,7 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, BoxPtr boxes = in_boxes; int nbox = in_nbox; - glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb); + glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb); while (nbox--) { @@ -183,20 +195,25 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox, int x2 = MIN(boxes->x2 + dx_src, box->x2); int y1 = MAX(boxes->y1 + dy_src, box->y1); int y2 = MIN(boxes->y2 + dy_src, box->y2); + size_t ofs = (y1 - dy_src + dy_dst) * byte_stride; + ofs += (x1 - dx_src + dx_dst) * bytes_per_pixel; boxes++; if (x2 <= x1 || y2 <= y1) continue; - glPixelStorei(GL_PACK_SKIP_PIXELS, x1 - dx_src + dx_dst); - glPixelStorei(GL_PACK_SKIP_ROWS, y1 - dy_src + dy_dst); - glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits); + if (glamor_priv->has_pack_subimage || + x2 - x1 == byte_stride / bytes_per_pixel) { + glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits + ofs); + } else { + for (; y1 < y2; y1++, ofs += byte_stride) + glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, 1, format, type, bits + ofs); + } } } - glPixelStorei(GL_PACK_ROW_LENGTH, 0); - glPixelStorei(GL_PACK_SKIP_ROWS, 0); - glPixelStorei(GL_PACK_SKIP_PIXELS, 0); + if (glamor_priv->has_pack_subimage) + glPixelStorei(GL_PACK_ROW_LENGTH, 0); } /* diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c index 897aa1955..8fbaf1d44 100644 --- a/hw/kdrive/ephyr/ephyrinit.c +++ b/hw/kdrive/ephyr/ephyrinit.c @@ -52,6 +52,13 @@ void processScreenOrOutputArg(const char *screen_size, const char *output, char void processOutputArg(const char *output, char *parent_id); void processScreenArg(const char *screen_size, char *parent_id); +int +main(int argc, char *argv[], char *envp[]) +{ + hostx_use_resname(basename(argv[0]), 0); + return dix_main(argc, argv, envp); +} + void InitCard(char *name) { @@ -209,10 +216,6 @@ ddxProcessArgument(int argc, char **argv, int i) EPHYR_DBG("mark argv[%d]='%s'", i, argv[i]); - if (i == 1) { - hostx_use_resname(basename(argv[0]), 0); - } - if (!strcmp(argv[i], "-parent")) { if (i + 1 < argc) { int j; diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index f64861b50..71c1691c4 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -177,7 +177,7 @@ hostx_set_win_title(KdScreenInfo *screen, const char *extra_text) memset(buf, 0, BUF_LEN + 1); snprintf(buf, BUF_LEN, "Xephyr on %s.%d %s", - HostX.server_dpy_name, + HostX.server_dpy_name ? HostX.server_dpy_name : ":0", scrpriv->mynum, (extra_text != NULL) ? extra_text : ""); xcb_icccm_set_wm_name(HostX.conn, @@ -443,7 +443,7 @@ hostx_init(void) else #endif HostX.conn = xcb_connect(NULL, &HostX.screen); - if (xcb_connection_has_error(HostX.conn)) { + if (!HostX.conn || xcb_connection_has_error(HostX.conn)) { fprintf(stderr, "\nXephyr cannot open host display. Is DISPLAY set?\n"); exit(1); } @@ -798,7 +798,7 @@ hostx_screen_init(KdScreenInfo *screen, } EPHYR_DBG("host_screen=%p x=%d, y=%d, wxh=%dx%d, buffer_height=%d", - host_screen, x, y, width, height, buffer_height); + screen, x, y, width, height, buffer_height); if (scrpriv->ximg != NULL) { /* Free up the image data if previously used @@ -866,6 +866,11 @@ hostx_screen_init(KdScreenInfo *screen, ~0, NULL); + /* Match server byte order so that the image can be converted to + * the native byte order by xcb_image_put() before drawing */ + if (host_depth_matches_server(scrpriv)) + scrpriv->ximg->byte_order = IMAGE_BYTE_ORDER; + scrpriv->ximg->data = malloc(scrpriv->ximg->stride * buffer_height); } @@ -1034,8 +1039,11 @@ hostx_paint_rect(KdScreenInfo *screen, sx, sy, dx, dy, width, height, FALSE); } else { - xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, scrpriv->ximg, - dx, dy, 0); + /* This is slow and could be done better */ + xcb_image_t *img = xcb_image_native (HostX.conn, scrpriv->ximg, 1); + xcb_image_put(HostX.conn, scrpriv->win, HostX.gc, img, 0, 0, 0); + if (scrpriv->ximg != img) + xcb_image_destroy(img); } xcb_aux_sync(HostX.conn); @@ -1407,9 +1415,12 @@ ephyr_glamor_init(ScreenPtr screen) ephyr_glamor_set_window_size(scrpriv->glamor, scrpriv->win_width, scrpriv->win_height); - glamor_init(screen, - GLAMOR_USE_SCREEN | - GLAMOR_USE_PICTURE_SCREEN); + if (!glamor_init(screen, + GLAMOR_USE_SCREEN | + GLAMOR_USE_PICTURE_SCREEN)) { + FatalError("Failed to initialize glamor\n"); + return FALSE; + } return TRUE; } diff --git a/hw/kdrive/fake/Makefile.am b/hw/kdrive/fake/Makefile.am index 14c99c3cc..d28bd2752 100644 --- a/hw/kdrive/fake/Makefile.am +++ b/hw/kdrive/fake/Makefile.am @@ -18,6 +18,7 @@ Xfake_SOURCES = \ Xfake_LDADD = \ libfake.la \ + @KDRIVE_MAIN_LIB@ \ @KDRIVE_LIBS@ Xfake_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) diff --git a/hw/kdrive/fbdev/Makefile.am b/hw/kdrive/fbdev/Makefile.am index 7e8ba024c..d550c1391 100644 --- a/hw/kdrive/fbdev/Makefile.am +++ b/hw/kdrive/fbdev/Makefile.am @@ -16,6 +16,7 @@ Xfbdev_SOURCES = \ Xfbdev_LDADD = \ libfbdev.la \ + @KDRIVE_MAIN_LIB@ \ @KDRIVE_LIBS@ Xfbdev_DEPENDENCIES = \ diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index 16b3e2821..2b84d8669 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -583,10 +583,11 @@ xf86VTEnter(void) /* Turn screen saver off when switching back */ dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); - /* If we use systemd-logind it will enable input devices for us */ - if (!systemd_logind_controls_session()) - for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) + for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) { + /* Devices with server managed fds get enabled on logind resume */ + if (!(pInfo->flags & XI86_SERVER_FD)) xf86EnableInputDeviceForVTSwitch(pInfo); + } for (ih = InputHandlers; ih; ih = ih->next) { if (ih->is_input) diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c index 15988b8b1..c1aaba41a 100644 --- a/hw/xfree86/common/xf86platformBus.c +++ b/hw/xfree86/common/xf86platformBus.c @@ -153,8 +153,10 @@ xf86_check_platform_slot(const struct xf86_platform_device *pd) for (i = 0; i < xf86NumEntities; i++) { const EntityPtr u = xf86Entities[i]; - if (pd->pdev && u->bus.type == BUS_PCI) - return !MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci); + if (pd->pdev && u->bus.type == BUS_PCI && + MATCH_PCI_DEVICES(pd->pdev, u->bus.id.pci)) { + return FALSE; + } if ((u->bus.type == BUS_PLATFORM) && (pd == u->bus.id.plat)) { return FALSE; } @@ -426,6 +428,10 @@ xf86platformProbeDev(DriverPtr drvp) /* find the main device or any device specificed in xorg.conf */ for (i = 0; i < numDevs; i++) { + /* skip inactive devices */ + if (!devList[i]->active) + continue; + for (j = 0; j < xf86_num_platform_devices; j++) { if (devList[i]->busID && *devList[i]->busID) { if (xf86PlatformDeviceCheckBusID(&xf86_platform_devices[j], devList[i]->busID)) @@ -449,10 +455,14 @@ xf86platformProbeDev(DriverPtr drvp) continue; } - /* if autoaddgpu devices is enabled then go find a few more and add them as GPU screens */ - if (xf86Info.autoAddGPU && numDevs) { + /* if autoaddgpu devices is enabled then go find any unclaimed platform + * devices and add them as GPU screens */ + if (xf86Info.autoAddGPU) { for (j = 0; j < xf86_num_platform_devices; j++) { - probeSingleDevice(&xf86_platform_devices[j], drvp, devList[0], PLATFORM_PROBE_GPU_SCREEN); + if (probeSingleDevice(&xf86_platform_devices[j], drvp, + devList ? devList[0] : NULL, + PLATFORM_PROBE_GPU_SCREEN)) + foundScreen = TRUE; } } diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index 1ea799b3a..a8de5f9e7 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -427,10 +427,10 @@ drmmode_set_cursor(xf86CrtcPtr crtc) drmModeSetCursor2(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, ms->cursor_width, ms->cursor_height, cursor->bits->xhot, cursor->bits->yhot); + if (!ret) + return; if (ret == -EINVAL) use_set_cursor2 = FALSE; - else - return; } ret = drmModeSetCursor(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id, handle, diff --git a/hw/xfree86/drivers/modesetting/dumb_bo.c b/hw/xfree86/drivers/modesetting/dumb_bo.c index 58d420e07..cf13f0a9c 100644 --- a/hw/xfree86/drivers/modesetting/dumb_bo.c +++ b/hw/xfree86/drivers/modesetting/dumb_bo.c @@ -25,6 +25,10 @@ * */ +#ifdef HAVE_DIX_CONFIG_H +#include "dix-config.h" +#endif + #include "dumb_bo.h" #include <errno.h> diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c index 012d1941a..8d5c4daf3 100644 --- a/hw/xfree86/int10/generic.c +++ b/hw/xfree86/int10/generic.c @@ -104,7 +104,7 @@ readIntVec(struct pci_device *dev, unsigned char *buf, int len) { void *map; - if (!pci_device_map_legacy(dev, 0, len, 0, &map)) + if (pci_device_map_legacy(dev, 0, len, 0, &map)) return FALSE; memcpy(buf, map, len); diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index 692bf40b9..54b6e5cd7 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -732,6 +732,8 @@ xf86CompatOutput(ScrnInfoPtr pScrn) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + if (config->compat_output < 0) + return NULL; return config->output[config->compat_output]; } diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c index 79b9a8858..6ca118f25 100644 --- a/hw/xfree86/os-support/linux/int10/linux.c +++ b/hw/xfree86/os-support/linux/int10/linux.c @@ -75,7 +75,7 @@ readLegacy(struct pci_device *dev, unsigned char *buf, int base, int len) { void *map; - if (!pci_device_map_legacy(dev, base, len, 0, &map)) + if (pci_device_map_legacy(dev, base, len, 0, &map)) return FALSE; memcpy(buf, map, len); diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c index 49758f465..4ad41a374 100644 --- a/hw/xfree86/os-support/linux/systemd-logind.c +++ b/hw/xfree86/os-support/linux/systemd-logind.c @@ -40,8 +40,6 @@ #include "systemd-logind.h" -#define DBUS_TIMEOUT 500 /* Wait max 0.5 seconds */ - struct systemd_logind_info { DBusConnection *conn; char *session; @@ -130,7 +128,7 @@ systemd_logind_take_fd(int _major, int _minor, const char *path, } reply = dbus_connection_send_with_reply_and_block(info->conn, msg, - DBUS_TIMEOUT, &error); + DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) { LogMessage(X_ERROR, "systemd-logind: failed to take device %s: %s\n", path, error.message); @@ -207,7 +205,7 @@ systemd_logind_release_fd(int _major, int _minor, int fd) } reply = dbus_connection_send_with_reply_and_block(info->conn, msg, - DBUS_TIMEOUT, &error); + DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) LogMessage(X_ERROR, "systemd-logind: failed to release device: %s\n", error.message); @@ -289,7 +287,7 @@ systemd_logind_ack_pause(struct systemd_logind_info *info, } reply = dbus_connection_send_with_reply_and_block(info->conn, msg, - DBUS_TIMEOUT, &error); + DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) LogMessage(X_ERROR, "systemd-logind: failed to ack pause: %s\n", error.message); @@ -313,6 +311,9 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data) dbus_int32_t major, minor; char *pause_str; + if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL) + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + dbus_error_init(&error); if (dbus_message_is_signal(message, @@ -454,7 +455,7 @@ connect_hook(DBusConnection *connection, void *data) } reply = dbus_connection_send_with_reply_and_block(connection, msg, - DBUS_TIMEOUT, &error); + DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) { LogMessage(X_ERROR, "systemd-logind: failed to get session: %s\n", error.message); @@ -489,7 +490,7 @@ connect_hook(DBusConnection *connection, void *data) } reply = dbus_connection_send_with_reply_and_block(connection, msg, - DBUS_TIMEOUT, &error); + DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) { LogMessage(X_ERROR, "systemd-logind: TakeControl failed: %s\n", error.message); @@ -561,7 +562,7 @@ systemd_logind_release_control(struct systemd_logind_info *info) } reply = dbus_connection_send_with_reply_and_block(info->conn, msg, - DBUS_TIMEOUT, &error); + DBUS_TIMEOUT_USE_DEFAULT, &error); if (!reply) { LogMessage(X_ERROR, "systemd-logind: ReleaseControl failed: %s\n", error.message); diff --git a/hw/xfree86/sdksyms.sh b/hw/xfree86/sdksyms.sh index fb60dff9f..530d6f548 100755 --- a/hw/xfree86/sdksyms.sh +++ b/hw/xfree86/sdksyms.sh @@ -350,13 +350,25 @@ BEGIN { if (sdk) { n = 3; + # skip line numbers GCC 5 adds before __attribute__ + while ($n == "" || $0 ~ /^# [0-9]+ "/) { + getline; + n = 1; + } + # skip attribute, if any while ($n ~ /^(__attribute__|__global)/ || # skip modifiers, if any $n ~ /^\*?(unsigned|const|volatile|struct|_X_EXPORT)$/ || # skip pointer - $n ~ /^[a-zA-Z0-9_]*\*$/) + $n ~ /^[a-zA-Z0-9_]*\*$/) { n++; + # skip line numbers GCC 5 adds after __attribute__ + while ($n == "" || $0 ~ /^# [0-9]+ "/) { + getline; + n = 1; + } + } # type specifier may not be set, as in # extern _X_EXPORT unsigned name(...) diff --git a/hw/xnest/Keyboard.c b/hw/xnest/Keyboard.c index ee3f68e3f..ae8375ee3 100644 --- a/hw/xnest/Keyboard.c +++ b/hw/xnest/Keyboard.c @@ -16,6 +16,10 @@ is" without express or implied warranty. #include <xnest-config.h> #endif +#ifdef WIN32 +#include <X11/Xwindows.h> +#endif + #include <X11/X.h> #include <X11/Xproto.h> #include <xcb/xcb_keysyms.h> diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am index 994554088..ab1bbb6a5 100644 --- a/hw/xwayland/Makefile.am +++ b/hw/xwayland/Makefile.am @@ -43,6 +43,7 @@ xwayland-glamor.c : $(nodist_Xwayland_SOURCES) glamor_lib = $(top_builddir)/glamor/libglamor.la Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL +Xwayland_DEPENDENCIES = $(glamor_lib) endif EXTRA_DIST = drm.xml diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c index 5a9d1fe70..c137e1ec0 100644 --- a/hw/xwayland/xwayland-cursor.c +++ b/hw/xwayland/xwayland-cursor.c @@ -82,6 +82,23 @@ xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor) return xwl_shm_destroy_pixmap(pixmap); } +static void +frame_callback(void *data, + struct wl_callback *callback, + uint32_t time) +{ + struct xwl_seat *xwl_seat = data; + xwl_seat->cursor_frame_cb = NULL; + if (xwl_seat->cursor_needs_update) { + xwl_seat->cursor_needs_update = FALSE; + xwl_seat_set_cursor(xwl_seat); + } +} + +static const struct wl_callback_listener frame_listener = { + frame_callback +}; + void xwl_seat_set_cursor(struct xwl_seat *xwl_seat) { @@ -98,6 +115,11 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat) return; } + if (xwl_seat->cursor_frame_cb) { + xwl_seat->cursor_needs_update = TRUE; + return; + } + cursor = xwl_seat->x_cursor; pixmap = dixGetPrivate(&cursor->devPrivates, &xwl_cursor_private_key); stride = cursor->bits->width * 4; @@ -117,6 +139,10 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat) wl_surface_damage(xwl_seat->cursor, 0, 0, xwl_seat->x_cursor->bits->width, xwl_seat->x_cursor->bits->height); + + xwl_seat->cursor_frame_cb = wl_surface_frame(xwl_seat->cursor); + wl_callback_add_listener(xwl_seat->cursor_frame_cb, &frame_listener, xwl_seat); + wl_surface_commit(xwl_seat->cursor); } diff --git a/hw/xwayland/xwayland-glamor.c b/hw/xwayland/xwayland-glamor.c index dd8551840..d574d9407 100644 --- a/hw/xwayland/xwayland-glamor.c +++ b/hw/xwayland/xwayland-glamor.c @@ -310,7 +310,7 @@ xwl_drm_init_egl(struct xwl_screen *xwl_screen) } if (!epoxy_has_gl_extension("GL_OES_EGL_image")) { - ErrorF("GL_OES_EGL_image no available"); + ErrorF("GL_OES_EGL_image not available\n"); return; } @@ -329,7 +329,7 @@ xwl_drm_handle_device(void *data, struct wl_drm *drm, const char *device) xwl_screen->drm_fd = open(xwl_screen->device_name, O_RDWR | O_CLOEXEC); if (xwl_screen->drm_fd == -1) { - ErrorF("wayland-egl: could not open %s (%s)", + ErrorF("wayland-egl: could not open %s (%s)\n", xwl_screen->device_name, strerror(errno)); return; } diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index 5e204189f..4639048d9 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -43,7 +43,7 @@ static int xwl_pointer_proc(DeviceIntPtr device, int what) { #define NBUTTONS 10 -#define NAXES 2 +#define NAXES 4 BYTE map[NBUTTONS + 1]; int i = 0; Atom btn_labels[NBUTTONS] = { 0 }; @@ -67,8 +67,10 @@ xwl_pointer_proc(DeviceIntPtr device, int what) axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y); + axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_HWHEEL); + axes_labels[3] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_WHEEL); - if (!InitValuatorClassDeviceStruct(device, 2, btn_labels, + if (!InitValuatorClassDeviceStruct(device, NAXES, btn_labels, GetMotionHistorySize(), Absolute)) return BadValue; @@ -77,6 +79,13 @@ xwl_pointer_proc(DeviceIntPtr device, int what) 0, 0xFFFF, 10000, 0, 10000, Absolute); InitValuatorAxisStruct(device, 1, axes_labels[1], 0, 0xFFFF, 10000, 0, 10000, Absolute); + InitValuatorAxisStruct(device, 2, axes_labels[2], + NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative); + InitValuatorAxisStruct(device, 3, axes_labels[3], + NO_AXIS_LIMITS, NO_AXIS_LIMITS, 0, 0, 0, Relative); + + SetScrollValuator(device, 2, SCROLL_TYPE_HORIZONTAL, 1.0, SCROLL_FLAG_NONE); + SetScrollValuator(device, 3, SCROLL_TYPE_VERTICAL, 1.0, SCROLL_FLAG_PREFERRED); if (!InitPtrFeedbackClassDeviceStruct(device, xwl_pointer_control)) return BadValue; @@ -259,54 +268,24 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer, uint32_t time, uint32_t axis, wl_fixed_t value) { struct xwl_seat *xwl_seat = data; - int index, count; - int i, val; + int index; const int divisor = 10; ValuatorMask mask; - if (time - xwl_seat->scroll_time > 2000) { - xwl_seat->vertical_scroll = 0; - xwl_seat->horizontal_scroll = 0; - } - xwl_seat->scroll_time = time; - - /* FIXME: Need to do proper smooth scrolling here! */ switch (axis) { case WL_POINTER_AXIS_VERTICAL_SCROLL: - xwl_seat->vertical_scroll += value / divisor; - val = wl_fixed_to_int(xwl_seat->vertical_scroll); - xwl_seat->vertical_scroll -= wl_fixed_from_int(val); - - if (val <= -1) - index = 4; - else if (val >= 1) - index = 5; - else - return; + index = 3; break; case WL_POINTER_AXIS_HORIZONTAL_SCROLL: - xwl_seat->horizontal_scroll += value / divisor; - val = wl_fixed_to_int(xwl_seat->horizontal_scroll); - xwl_seat->horizontal_scroll -= wl_fixed_from_int(val); - - if (val <= -1) - index = 6; - else if (val >= 1) - index = 7; - else - return; + index = 2; break; default: return; } valuator_mask_zero(&mask); - - count = abs(val); - for (i = 0; i < count; i++) { - QueuePointerEvents(xwl_seat->pointer, ButtonPress, index, 0, &mask); - QueuePointerEvents(xwl_seat->pointer, ButtonRelease, index, 0, &mask); - } + valuator_mask_set_double(&mask, index, wl_fixed_to_double(value) / divisor); + QueuePointerEvents(xwl_seat->pointer, MotionNotify, 0, POINTER_RELATIVE, &mask); } static const struct wl_pointer_listener pointer_listener = { @@ -567,7 +546,7 @@ create_input_device(struct xwl_screen *xwl_screen, uint32_t id) xwl_seat = calloc(sizeof *xwl_seat, 1); if (xwl_seat == NULL) { - ErrorF("create_input ENOMEM"); + ErrorF("create_input ENOMEM\n"); return; } @@ -590,6 +569,8 @@ xwl_seat_destroy(struct xwl_seat *xwl_seat) RemoveDevice(xwl_seat->keyboard, FALSE); wl_seat_destroy(xwl_seat->seat); wl_surface_destroy(xwl_seat->cursor); + if (xwl_seat->cursor_frame_cb) + wl_callback_destroy(xwl_seat->cursor_frame_cb); wl_array_release(&xwl_seat->keys); free(xwl_seat); } diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c index 778914c61..155cbc109 100644 --- a/hw/xwayland/xwayland-output.c +++ b/hw/xwayland/xwayland-output.c @@ -159,7 +159,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id) xwl_output = calloc(sizeof *xwl_output, 1); if (xwl_output == NULL) { - ErrorF("create_output ENOMEM"); + ErrorF("create_output ENOMEM\n"); return NULL; } @@ -168,7 +168,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id) wl_output_add_listener(xwl_output->output, &output_listener, xwl_output); if (snprintf(name, sizeof name, "XWAYLAND%d", serial++) < 0) { - ErrorF("create_output ENOMEM"); + ErrorF("create_output ENOMEM\n"); free(xwl_output); return NULL; } diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index 7e8d667d6..bc92beb38 100644 --- a/hw/xwayland/xwayland.c +++ b/hw/xwayland/xwayland.c @@ -483,7 +483,7 @@ listen_on_fds(struct xwl_screen *xwl_screen) int i; for (i = 0; i < xwl_screen->listen_fd_count; i++) - ListenOnOpenFD(xwl_screen->listen_fds[i], TRUE); + ListenOnOpenFD(xwl_screen->listen_fds[i], FALSE); } static void @@ -702,4 +702,6 @@ InitOutput(ScreenInfo * screen_info, int argc, char **argv) if (AddScreen(xwl_screen_init, argc, argv) == -1) { FatalError("Couldn't add screen\n"); } + + LocalAccessScopeUser(); } diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h index bfffa712f..28b0c995e 100644 --- a/hw/xwayland/xwayland.h +++ b/hw/xwayland/xwayland.h @@ -115,16 +115,14 @@ struct xwl_seat { struct wl_pointer *wl_pointer; struct wl_keyboard *wl_keyboard; struct wl_array keys; - struct wl_surface *cursor; struct xwl_window *focus_window; uint32_t id; uint32_t pointer_enter_serial; struct xorg_list link; CursorPtr x_cursor; - - wl_fixed_t horizontal_scroll; - wl_fixed_t vertical_scroll; - uint32_t scroll_time; + struct wl_surface *cursor; + struct wl_callback *cursor_frame_cb; + Bool cursor_needs_update; size_t keymap_size; char *keymap; diff --git a/hw/xwin/winclipboard/Makefile.am b/hw/xwin/winclipboard/Makefile.am index b1c95f4ef..a1079aec6 100644 --- a/hw/xwin/winclipboard/Makefile.am +++ b/hw/xwin/winclipboard/Makefile.am @@ -19,7 +19,7 @@ xwinclip_SOURCES = xwinclip.c debug.c xwinclip_CFLAGS = $(XWINMODULES_CFLAGS) -xwinclip_LDADD = libXWinclipboard.la $(XWINMODULES_LIBS) -lgdi32 +xwinclip_LDADD = libXWinclipboard.la $(XWINMODULES_LIBS) -lgdi32 -lpthread include $(top_srcdir)/manpages.am appman_PRE = xwinclip.man diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 1aa77a5eb..b0eb696f8 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -388,9 +388,15 @@ /* Vendor name */ #undef XVENDORNAME +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + /* Enable GNU and other extensions to the C environment for GLIBC */ #undef _GNU_SOURCE +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/include/input.h b/include/input.h index bf22dc7ee..7212cc176 100644 --- a/include/input.h +++ b/include/input.h @@ -505,7 +505,7 @@ extern int AttachDevice(ClientPtr client, DeviceIntPtr slave, DeviceIntPtr master); extern _X_EXPORT DeviceIntPtr GetPairedDevice(DeviceIntPtr kbd); -extern DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); +extern _X_EXPORT DeviceIntPtr GetMaster(DeviceIntPtr dev, int type); extern _X_EXPORT int AllocDevicePair(ClientPtr client, const char *name, diff --git a/include/os.h b/include/os.h index 8c09955b2..da20427fd 100644 --- a/include/os.h +++ b/include/os.h @@ -418,11 +418,28 @@ extern _X_EXPORT void ResetHosts(const char *display); extern _X_EXPORT void +EnableLocalAccess(void); + +extern _X_EXPORT void +DisableLocalAccess(void); + +extern _X_EXPORT void EnableLocalHost(void); extern _X_EXPORT void DisableLocalHost(void); +#ifndef NO_LOCAL_CLIENT_CRED +extern _X_EXPORT void +EnableLocalUser(void); + +extern _X_EXPORT void +DisableLocalUser(void); + +extern _X_EXPORT void +LocalAccessScopeUser(void); +#endif + extern _X_EXPORT void AccessUsingXdmcp(void); diff --git a/include/servermd.h b/include/servermd.h index a3b5c3af3..087826f48 100644 --- a/include/servermd.h +++ b/include/servermd.h @@ -52,6 +52,8 @@ SOFTWARE. #error xserver code must include dix-config.h before any other headers #endif +#include <X11/Xarch.h> /* for X_LITTLE_ENDIAN/X_BIG_ENDIAN */ + #if X_BYTE_ORDER == X_LITTLE_ENDIAN #define IMAGE_BYTE_ORDER LSBFirst #define BITMAP_BIT_ORDER LSBFirst diff --git a/mi/mifillarc.c b/mi/mifillarc.c index 246d70ff4..888519edf 100644 --- a/mi/mifillarc.c +++ b/mi/mifillarc.c @@ -660,6 +660,11 @@ miPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs_all, xArc * parcs) if (narcs && nspans + arc->height > MAX_SPANS_PER_LOOP) break; nspans += arc->height; + + /* A pie-slice arc may add another pile of spans */ + if (pGC->arcMode == ArcPieSlice && + (-FULLCIRCLE < arc->angle2 && arc->angle2 < FULLCIRCLE)) + nspans += (arc->height + 1) >> 1; } pts = points = malloc (sizeof (DDXPointRec) * nspans + diff --git a/os/access.c b/os/access.c index 28f2d3213..75e7a6983 100644 --- a/os/access.c +++ b/os/access.c @@ -102,6 +102,10 @@ SOFTWARE. #include <sys/ioctl.h> #include <ctype.h> +#ifndef NO_LOCAL_CLIENT_CRED +#include <pwd.h> +#endif + #if defined(TCPCONN) || defined(STREAMSCONN) #include <netinet/in.h> #endif /* TCPCONN || STREAMSCONN */ @@ -225,6 +229,13 @@ static int LocalHostEnabled = FALSE; static int LocalHostRequested = FALSE; static int UsingXdmcp = FALSE; +static enum { + LOCAL_ACCESS_SCOPE_HOST = 0, +#ifndef NO_LOCAL_CLIENT_CRED + LOCAL_ACCESS_SCOPE_USER, +#endif +} LocalAccessScope; + /* FamilyServerInterpreted implementation */ static Bool siAddrMatch(int family, void *addr, int len, HOST * host, ClientPtr client); @@ -237,6 +248,21 @@ static void siTypesInitialize(void); */ void +EnableLocalAccess(void) +{ + switch (LocalAccessScope) { + case LOCAL_ACCESS_SCOPE_HOST: + EnableLocalHost(); + break; +#ifndef NO_LOCAL_CLIENT_CRED + case LOCAL_ACCESS_SCOPE_USER: + EnableLocalUser(); + break; +#endif + } +} + +void EnableLocalHost(void) { if (!UsingXdmcp) { @@ -249,6 +275,21 @@ EnableLocalHost(void) * called when authorization is enabled to keep us secure */ void +DisableLocalAccess(void) +{ + switch (LocalAccessScope) { + case LOCAL_ACCESS_SCOPE_HOST: + DisableLocalHost(); + break; +#ifndef NO_LOCAL_CLIENT_CRED + case LOCAL_ACCESS_SCOPE_USER: + DisableLocalUser(); + break; +#endif + } +} + +void DisableLocalHost(void) { HOST *self; @@ -262,6 +303,74 @@ DisableLocalHost(void) } } +#ifndef NO_LOCAL_CLIENT_CRED +static int GetLocalUserAddr(char **addr) +{ + static const char *type = "localuser"; + static const char delimiter = '\0'; + static const char *value; + struct passwd *pw; + int length = -1; + + pw = getpwuid(getuid()); + + if (pw == NULL || pw->pw_name == NULL) + goto out; + + value = pw->pw_name; + + length = asprintf(addr, "%s%c%s", type, delimiter, value); + + if (length == -1) { + goto out; + } + + /* Trailing NUL */ + length++; + +out: + return length; +} + +void +EnableLocalUser(void) +{ + char *addr = NULL; + int length = -1; + + length = GetLocalUserAddr(&addr); + + if (length == -1) + return; + + NewHost(FamilyServerInterpreted, addr, length, TRUE); + + free(addr); +} + +void +DisableLocalUser(void) +{ + char *addr = NULL; + int length = -1; + + length = GetLocalUserAddr(&addr); + + if (length == -1) + return; + + RemoveHost(NULL, FamilyServerInterpreted, length, addr); + + free(addr); +} + +void +LocalAccessScopeUser(void) +{ + LocalAccessScope = LOCAL_ACCESS_SCOPE_USER; +} +#endif + /* * called at init time when XDMCP will be used; xdmcp always * adds local hosts manually when needed @@ -1392,7 +1501,7 @@ InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client) } for (host = validhosts; host; host = host->next) { if (host->family == FamilyServerInterpreted) { - if (addr && siAddrMatch(family, addr, len, host, client)) { + if (siAddrMatch(family, addr, len, host, client)) { return 0; } } @@ -181,11 +181,11 @@ CheckAuthorization(unsigned int name_length, /* * If the authorization file has at least one entry for this server, - * disable local host access. (loadauth > 0) + * disable local access. (loadauth > 0) * * If there are zero entries (either initially or when the * authorization file is later reloaded), or if a valid - * authorization file was never loaded, enable local host access. + * authorization file was never loaded, enable local access. * (loadauth == 0 || !loaded) * * If the authorization file was loaded initially (with valid @@ -194,11 +194,11 @@ CheckAuthorization(unsigned int name_length, */ if (loadauth > 0) { - DisableLocalHost(); /* got at least one */ + DisableLocalAccess(); /* got at least one */ loaded = TRUE; } else if (loadauth == 0 || !loaded) - EnableLocalHost(); + EnableLocalAccess(); } if (name_length) { for (i = 0; i < NUM_AUTHORIZATION; i++) { diff --git a/os/backtrace.c b/os/backtrace.c index 9f32b5687..a9c797795 100644 --- a/os/backtrace.c +++ b/os/backtrace.c @@ -87,7 +87,7 @@ xorg_backtrace(void) procname[1] = 0; } - if (dladdr((void *)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname && + if (dladdr((void *)(uintptr_t)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname && *dlinfo.dli_fname) filename = dlinfo.dli_fname; else @@ -95,7 +95,7 @@ xorg_backtrace(void) ErrorFSigSafe("%u: %s (%s%s+0x%x) [%p]\n", i++, filename, procname, ret == -UNW_ENOMEM ? "..." : "", (int)off, - (void *)(pip.start_ip + off)); + (void *)(uintptr_t)(pip.start_ip + off)); ret = unw_step(&cursor); if (ret < 0) diff --git a/os/connection.c b/os/connection.c index c2fb22dd4..6b0aa6d20 100644 --- a/os/connection.c +++ b/os/connection.c @@ -521,8 +521,13 @@ CloseWellKnownConnections(void) { int i; - for (i = 0; i < ListenTransCount; i++) - _XSERVTransClose(ListenTransConns[i]); + for (i = 0; i < ListenTransCount; i++) { + if (ListenTransConns[i] != NULL) { + _XSERVTransClose(ListenTransConns[i]); + ListenTransConns[i] = NULL; + } + } + ListenTransCount = 0; } static void diff --git a/os/utils.c b/os/utils.c index 57f934e07..9bb39eb11 100644 --- a/os/utils.c +++ b/os/utils.c @@ -2134,6 +2134,7 @@ FormatUInt64Hex(uint64_t num, char *string) string[len] = '\0'; } +#if !defined(WIN32) || defined(__CYGWIN__) /* Move a file descriptor out of the way of our select mask; this * is useful for file descriptors which will never appear in the * select mask to avoid reducing the number of clients that can @@ -2157,3 +2158,4 @@ os_move_fd(int fd) close(fd); return newfd; } +#endif diff --git a/os/xdmcp.c b/os/xdmcp.c index bc5a70706..b265db338 100644 --- a/os/xdmcp.c +++ b/os/xdmcp.c @@ -19,6 +19,10 @@ #ifdef WIN32 #include <X11/Xwinsock.h> +#define XSERV_t +#define TRANS_SERVER +#define TRANS_REOPEN +#include <X11/Xtrans/Xtrans.h> #endif #include <X11/Xos.h> diff --git a/present/present.c b/present/present.c index 2a705a968..a6346015e 100644 --- a/present/present.c +++ b/present/present.c @@ -409,20 +409,20 @@ static void present_unflip(ScreenPtr screen) { present_screen_priv_ptr screen_priv = present_screen_priv(screen); + PixmapPtr pixmap = (*screen->GetScreenPixmap)(screen); assert (!screen_priv->unflip_event_id); assert (!screen_priv->flip_pending); if (screen_priv->flip_window) - present_set_tree_pixmap(screen_priv->flip_window, - (*screen->GetScreenPixmap)(screen)); + present_set_tree_pixmap(screen_priv->flip_window, pixmap); - present_set_tree_pixmap(screen->root, (*screen->GetScreenPixmap)(screen)); + present_set_tree_pixmap(screen->root, pixmap); /* Update the screen pixmap with the current flip pixmap contents */ if (screen_priv->flip_pixmap && screen_priv->flip_window) { - present_copy_region(&screen_priv->flip_window->drawable, + present_copy_region(&pixmap->drawable, screen_priv->flip_pixmap, NULL, 0, 0); } diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 69b3ecf0f..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; } @@ -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, |