Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libnvidia-egl-x11 for openSUSE:Factory checked in at 2024-12-08 11:37:13 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libnvidia-egl-x11 (Old) and /work/SRC/openSUSE:Factory/.libnvidia-egl-x11.new.21547 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libnvidia-egl-x11" Sun Dec 8 11:37:13 2024 rev:3 rq:1228783 version:1.0.1 Changes: -------- --- /work/SRC/openSUSE:Factory/libnvidia-egl-x11/libnvidia-egl-x11.changes 2024-10-25 19:20:24.996563961 +0200 +++ /work/SRC/openSUSE:Factory/.libnvidia-egl-x11.new.21547/libnvidia-egl-x11.changes 2024-12-08 11:38:15.188420050 +0100 @@ -1,0 +2,11 @@ +Fri Dec 6 13:32:30 UTC 2024 - Stefan Dirsch <sndir...@suse.com> + +- update to self-tagged version 1.0.1 + * Fix the HAVE_TYPEOF macro in glvnd_list.h. + * Fix a couple typos. + * Use the correct Present event mask in eplX11CreateWindowSurface. + * Add a warning to glvnd_list.h if typeof() isn't supported. + * X11: Factor out native handle to XID conversion + * X11: Check for duplicate native drawables + +------------------------------------------------------------------- Old: ---- egl-x11-1.0.tar.gz New: ---- egl-x11-1.0.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libnvidia-egl-x11.spec ++++++ --- /var/tmp/diff_new_pack.3G7Ejk/_old 2024-12-08 11:38:15.608437498 +0100 +++ /var/tmp/diff_new_pack.3G7Ejk/_new 2024-12-08 11:38:15.608437498 +0100 @@ -20,7 +20,7 @@ %define lname libnvidia-egl-x11%{so_ver} %define rname egl-x11 Name: libnvidia-egl-x11 -Version: 1.0 +Version: 1.0.1 Release: 0 Summary: NVIDIA XLib and XCB EGL Platform Library # src/x11/dma-buf.h:/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ ++++++ egl-x11-1.0.tar.gz -> egl-x11-1.0.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/egl-x11-1.0/meson.build new/egl-x11-1.0.1/meson.build --- old/egl-x11-1.0/meson.build 2024-09-23 17:21:40.000000000 +0200 +++ new/egl-x11-1.0.1/meson.build 2024-11-20 20:04:18.000000000 +0100 @@ -23,6 +23,11 @@ dep_eglexternal = dependency('eglexternalplatform', version : ['>=1.2', '<2']) inc_base = include_directories('src/base') +cc = meson.get_compiler('c') +if cc.compiles('typeof(int *);', name : 'typeof') + add_project_arguments('-DHAVE_TYPEOF', language : ['c']) +endif + subdir('src/base') subdir('src/x11') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/egl-x11-1.0/src/base/glvnd_list.h new/egl-x11-1.0.1/src/base/glvnd_list.h --- old/egl-x11-1.0/src/base/glvnd_list.h 2024-09-23 17:21:40.000000000 +0200 +++ new/egl-x11-1.0.1/src/base/glvnd_list.h 2024-11-20 20:04:18.000000000 +0100 @@ -282,6 +282,7 @@ * support typeof() and fails with this implementation, please try a newer * compiler. */ +#warning "typeof() is not supported. The fallback for this is undefined behavior." #define __glvnd_container_of(ptr, sample, member) \ (void *)((char *)(ptr) \ - ((char *)&(sample)->member - (char *)(sample))) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/egl-x11-1.0/src/x11/x11-pixmap.c new/egl-x11-1.0.1/src/x11/x11-pixmap.c --- old/egl-x11-1.0/src/x11/x11-pixmap.c 2024-09-23 17:21:40.000000000 +0200 +++ new/egl-x11-1.0.1/src/x11/x11-pixmap.c 2024-11-20 20:04:18.000000000 +0100 @@ -401,11 +401,32 @@ } } +static EGLBoolean CheckExistingPixmap(EplDisplay *pdpy, xcb_pixmap_t xpix) +{ + EplSurface *psurf; + + glvnd_list_for_each_entry(psurf, &pdpy->surface_list, entry) + { + if (psurf->type == EPL_SURFACE_TYPE_PIXMAP) + { + X11Pixmap *ppix = (X11Pixmap *) psurf->priv; + if (ppix->xpix == xpix) + { + eplSetError(pdpy->platform, EGL_BAD_ALLOC, + "An EGLSurface already exists for pixmap 0x%x\n", xpix); + return EGL_FALSE; + } + } + } + + return EGL_TRUE; +} + EGLSurface eplX11CreatePixmapSurface(EplPlatformData *plat, EplDisplay *pdpy, EplSurface *surf, EGLConfig config, void *native_surface, const EGLAttrib *attribs, EGLBoolean create_platform) { X11DisplayInstance *inst = pdpy->priv->inst; - xcb_pixmap_t xpix = 0; + xcb_pixmap_t xpix = eplX11GetNativeXID(pdpy, native_surface, create_platform); X11Pixmap *ppix = NULL; const EplConfig *configInfo; const EplFormatInfo *fmt; @@ -423,20 +444,14 @@ }; EGLAttrib *internalAttribs = NULL; - if (create_platform) + if (xpix == 0) { - if (pdpy->platform_enum == EGL_PLATFORM_X11_KHR) - { - xpix = (uint32_t) *((unsigned long *) native_surface); - } - else - { - xpix = *((uint32_t *) native_surface); - } + eplSetError(plat, EGL_BAD_NATIVE_PIXMAP, "Invalid native pixmap %p\n", native_surface); + return EGL_NO_SURFACE; } - else + if (!CheckExistingPixmap(pdpy, xpix)) { - xpix = (xcb_pixmap_t) ((uintptr_t) native_surface); + return EGL_NO_SURFACE; } configInfo = eplConfigListFind(inst->configs, config); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/egl-x11-1.0/src/x11/x11-platform.c new/egl-x11-1.0.1/src/x11/x11-platform.c --- old/egl-x11-1.0/src/x11/x11-platform.c 2024-09-23 17:21:40.000000000 +0200 +++ new/egl-x11-1.0.1/src/x11/x11-platform.c 2024-11-20 20:04:18.000000000 +0100 @@ -508,7 +508,7 @@ { return NULL; } - for (i=0; screen; i++) + for (i=0; i<screen; i++) { xcb_screen_next(&iter); } @@ -1286,11 +1286,10 @@ { EGLAttrib *internalAttribs = NULL; int count = 0; - int i; if (attribs != NULL) { - for (count = 0; attribs[count] != EGL_NONE; i += 2) + for (count = 0; attribs[count] != EGL_NONE; count += 2) { if (attribs[count] == EGL_SURFACE_Y_INVERTED_NVX) { @@ -1402,3 +1401,34 @@ } } +uint32_t eplX11GetNativeXID(EplDisplay *pdpy, void *native_surface, EGLBoolean create_platform) +{ + unsigned long xid = 0; + + if (create_platform) + { + if (native_surface != NULL) + { + if (pdpy->platform_enum == EGL_PLATFORM_X11_KHR) + { + xid = *((unsigned long *) native_surface); + } + else + { + xid = *((uint32_t *) native_surface); + } + } + } + else + { + xid = (unsigned long) ((uintptr_t) native_surface); + } + + // Make sure the value that we get actually fits in a 32-bit integer. + if (((uint32_t) xid) != xid) + { + return 0; + } + + return xid; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/egl-x11-1.0/src/x11/x11-platform.h new/egl-x11-1.0.1/src/x11/x11-platform.h --- old/egl-x11-1.0/src/x11/x11-platform.h 2024-09-23 17:21:40.000000000 +0200 +++ new/egl-x11-1.0.1/src/x11/x11-platform.h 2024-11-20 20:04:18.000000000 +0100 @@ -355,6 +355,18 @@ X11XlibDisplayClosedData *eplX11AddXlibDisplayClosedCallback(void *xlib_native_display); /** + * Returns the XID for the native surface handle in one of the + * eglCreate*Surface functions. + * + * \param pdpy The EplDisplay struct + * \param native_surface The native surface handle + * \param create_platform True if this is for one of the + * eglCreatePlatform*Surface functions. + * \return The XID value, or 0 if the native handle is invalid. + */ +uint32_t eplX11GetNativeXID(EplDisplay *pdpy, void *native_surface, EGLBoolean create_platform); + +/** * Returns true if a native display has been closed. * * Note that this only works for an Xlib Display, because XCB doesn't have any diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/egl-x11-1.0/src/x11/x11-window.c new/egl-x11-1.0.1/src/x11/x11-window.c --- old/egl-x11-1.0/src/x11/x11-window.c 2024-09-23 17:21:40.000000000 +0200 +++ new/egl-x11-1.0.1/src/x11/x11-window.c 2024-11-20 20:04:18.000000000 +0100 @@ -1241,11 +1241,32 @@ pthread_mutex_unlock(&pwin->mutex); } +static EGLBoolean CheckExistingWindow(EplDisplay *pdpy, xcb_window_t xwin) +{ + EplSurface *psurf; + + glvnd_list_for_each_entry(psurf, &pdpy->surface_list, entry) + { + if (psurf->type == EPL_SURFACE_TYPE_WINDOW) + { + X11Window *pwin = (X11Window *) psurf->priv; + if (pwin->xwin == xwin) + { + eplSetError(pdpy->platform, EGL_BAD_ALLOC, + "An EGLSurface already exists for window 0x%x\n", xwin); + return EGL_FALSE; + } + } + } + + return EGL_TRUE; +} + EGLSurface eplX11CreateWindowSurface(EplPlatformData *plat, EplDisplay *pdpy, EplSurface *surf, EGLConfig config, void *native_surface, const EGLAttrib *attribs, EGLBoolean create_platform) { X11DisplayInstance *inst = pdpy->priv->inst; - xcb_window_t xwin = 0; + xcb_window_t xwin = eplX11GetNativeXID(pdpy, native_surface, create_platform); xcb_void_cookie_t presentSelectCookie; xcb_get_window_attributes_cookie_t winodwAttribCookie; xcb_get_window_attributes_reply_t *windowAttribReply = NULL; @@ -1265,20 +1286,14 @@ EGLAttrib *internalAttribs = NULL; uint32_t eventMask; - if (create_platform) + if (xwin == 0) { - if (pdpy->platform_enum == EGL_PLATFORM_X11_KHR) - { - xwin = (uint32_t) *((unsigned long *) native_surface); - } - else - { - xwin = *((uint32_t *) native_surface); - } + eplSetError(plat, EGL_BAD_NATIVE_WINDOW, "Invalid native window %p\n", native_surface); + return EGL_NO_SURFACE; } - else + if (!CheckExistingWindow(pdpy, xwin)) { - xwin = (xcb_window_t) ((uintptr_t) native_surface); + return EGL_NO_SURFACE; } configInfo = eplConfigListFind(inst->configs, config); @@ -1361,10 +1376,8 @@ pwin->present_event_id = xcb_generate_id(inst->conn); pwin->present_event = xcb_register_for_special_xge(inst->conn, &xcb_present_id, pwin->present_event_id, &pwin->present_event_stamp); - presentSelectCookie = xcb_present_select_input_checked(inst->conn, pwin->present_event_id, xwin, - XCB_PRESENT_EVENT_MASK_CONFIGURE_NOTIFY - | XCB_PRESENT_EVENT_MASK_COMPLETE_NOTIFY - | XCB_PRESENT_EVENT_MASK_IDLE_NOTIFY); + presentSelectCookie = xcb_present_select_input_checked(inst->conn, + pwin->present_event_id, xwin, eventMask); error = xcb_request_check(inst->conn, presentSelectCookie); if (error != NULL) {