Re: [Mesa-dev] [PATCH 4/4] drisw/glx: use XShm if possible
On Wed, 2015-06-10 at 18:08 +0200, Marc-André Lureau wrote: > + if (!xshm_error && shmid >= 0) { > + pdp->shminfo.shmid = shmid; > + pdp->ximage = XShmCreateImage(dpy, > +pdp->visinfo->visual, > +pdp->visinfo->depth, > +ZPixmap, /* format */ > +NULL, /* data */ > +&pdp->shminfo,/* shminfo */ > +0, 0);/* width, height */ > + if (pdp->ximage == NULL) { > + int (*old_handler)(Display *, XErrorEvent *); > + > + /* dispatch pending errors */ > + XSync(dpy, False); > + > + old_handler = XSetErrorHandler(handle_xerror); > + /* This may trigger the X protocol error we're ready to catch: */ > + XShmAttach(dpy, &pdp->shminfo); > + XSync(dpy, False); > Telling the server to attach the image only if creating it failed ain't gonna work too great: X Error of failed request: BadShmSeg (invalid shared segment parameter) Major opcode of failed request: 130 (MIT-SHM) Minor opcode of failed request: 3 (X_ShmPutImage) Segment id in failed request: 0x1a5 Serial number of failed request: 31 Current serial number in output stream: 32 But with the == changed to !=, this does seem to work! Under (accelerated) gnome-shell, llvmpipe gears gets around 1280fps at its default window size and 110 fullscreen, compared to about 1110 and 40 with PutImage, respectively. Nice one. PutImage's semantics are that when it returns the app owns the image data again: the image has been either copied into xlib's request buffer or written to the socket. Not so ShmPutImage, which just enqueues the request and lets the server pick the data up whenever. So it's possible, if we dirty the front buffer before xserver finishes the ShmPutImage, that we'd see an inconsistent screen state for a moment. So I think this wants an XSync after XShmPutImage (which dings windowed fps by ~50 but doesn't seem to bother fullscreen at all). With those two things fixed, the series is: Reviewed-by: Adam Jackson Any chance you feel like trying the same trick with ShmGetImage and EXT_texture_from_pixmap? - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glx: Fix image size computation for EXT_texture_integer (v2)
Without this this extension basically can't work in indirect contexts, TexImage2D will compute the image size as 0 and we'll send no image data to the server. v2: Add EXT_texture_integer to the client extension list too (Ian) Signed-off-by: Adam Jackson --- src/glx/compsize.c | 10 ++ src/glx/glxextensions.c | 1 + 2 files changed, 11 insertions(+) diff --git a/src/glx/compsize.c b/src/glx/compsize.c index 99c7763..8055919 100644 --- a/src/glx/compsize.c +++ b/src/glx/compsize.c @@ -65,6 +65,8 @@ __glElementsPerGroup(GLenum format, GLenum type) switch (format) { case GL_RGB: case GL_BGR: + case GL_RGB_INTEGER_EXT: + case GL_BGR_INTEGER_EXT: return 3; case GL_RG: case GL_422_EXT: @@ -74,10 +76,13 @@ __glElementsPerGroup(GLenum format, GLenum type) case GL_DEPTH_STENCIL_NV: case GL_YCBCR_422_APPLE: case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE_ALPHA_INTEGER_EXT: return 2; case GL_RGBA: case GL_BGRA: case GL_ABGR_EXT: + case GL_RGBA_INTEGER_EXT: + case GL_BGRA_INTEGER_EXT: return 4; case GL_COLOR_INDEX: case GL_STENCIL_INDEX: @@ -88,6 +93,11 @@ __glElementsPerGroup(GLenum format, GLenum type) case GL_ALPHA: case GL_LUMINANCE: case GL_INTENSITY: + case GL_RED_INTEGER_EXT: + case GL_GREEN_INTEGER_EXT: + case GL_BLUE_INTEGER_EXT: + case GL_ALPHA_INTEGER_EXT: + case GL_LUMINANCE_INTEGER_EXT: return 1; default: return 0; diff --git a/src/glx/glxextensions.c b/src/glx/glxextensions.c index cb8cd66..3b29aef 100644 --- a/src/glx/glxextensions.c +++ b/src/glx/glxextensions.c @@ -241,6 +241,7 @@ static const struct extension_info known_gl_extensions[] = { { GL(EXT_texture_env_combine),VER(1,3), Y, N, N, N }, { GL(EXT_texture_env_dot3), VER(0,0), Y, N, N, N }, { GL(EXT_texture_filter_anisotropic), VER(0,0), Y, N, N, N }, + { GL(EXT_texture_integer),VER(0,0), Y, N, N, N }, { GL(EXT_texture_lod),VER(1,2), Y, N, N, N }, { GL(EXT_texture_lod_bias), VER(1,4), Y, N, N, N }, { GL(EXT_texture_mirror_clamp), VER(0,0), Y, N, N, N }, -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] r600/sb: Fix an &/&& mistake
gcc says: sb/sb_sched.cpp: In member function 'bool r600_sb::alu_group_tracker::try_reserve(r600_sb::alu_node*)': sb/sb_sched.cpp:492:7: warning: suggest parentheses around operand of '!' or change '&' to '&&' or '!' to '~' [-Wparentheses] if (!trans & fbs) It happens to be harmless; if fbs is ever non-zero, it will be VEC_210, which is 5, so (!trans & 5) == 1 and the branch works as expected. But logical AND is clearly what was meant. Signed-off-by: Adam Jackson --- src/gallium/drivers/r600/sb/sb_sched.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/drivers/r600/sb/sb_sched.cpp b/src/gallium/drivers/r600/sb/sb_sched.cpp index 2e38a62..6268078 100644 --- a/src/gallium/drivers/r600/sb/sb_sched.cpp +++ b/src/gallium/drivers/r600/sb/sb_sched.cpp @@ -489,7 +489,7 @@ bool alu_group_tracker::try_reserve(alu_node* n) { n->bc.bank_swizzle = 0; - if (!trans & fbs) + if (!trans && fbs) n->bc.bank_swizzle = VEC_210; if (gpr.try_reserve(n)) { -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] llvmpipe broken on Skylake Pentium (LP_NATIVE_VECTOR_WIDTH=128)
I'm having some difficulty getting llvmpipe working on a Skylake Pentium, which has the charming property of not having AVX support at all (Skylake Cores have AVX2, and Xeons have AVX512, but Pentium seems to be the new way of spelling Celeron). Currently I'm trying this with llvm 3.6.2 and Mesa 10.6.5, but llvm 3.7 doesn't seem to be any better. The error I'm getting is: $ DISPLAY=:2 LIBGL_DRIVERS_PATH=`pwd`/lib64/gallium LP_NATIVE_VECTOR_WIDTH=128 /usr/lib64/mesa/gloss LLVM ERROR: Cannot select: intrinsic %llvm.x86.sse41.pblendvb (Setting LP_NATIVE_VECTOR_WIDTH like that seems to be effective at triggering this on Skylake Core, but in the name of paranoia I'm emulating a Pentium by patching kvm to mask off the AVX bits of cpuflags: https://ajax.fedorapeople.org/qemu-pseudoskl.patch ) That does indeed seem to be the pblendvb intrinsic from lp_build_select(), from lp_build_depth_stencil_test(), and at that point I get (against Xvfb, giving me a z32 depth format): (gdb) p bld->type $1 = {floating = 0, fixed = 0, sign = 0, norm = 0, width = 32, length = 4} There are several other paths through lp_build_select() that look like they could work, but don't. If I turn on the if (0)'d vector select path, I get something like: LLVM ERROR: Cannot select: 0xc23df0: v4i32 = X86ISD::SMAX 0xc1caf0, 0xc25020 [ORD=103] [ID=189] 0xc1caf0: v4i32 = X86ISD::VSRL 0xc3a810, 0xc269e0 [ORD=102] [ID=179] 0xc3a810: v4i32 = bitcast 0xc096b0 [ORD=95] [ID=150] 0xc096b0: v2i64,ch = X86ISD::VZEXT_LOAD 0xc28160, 0xc1f750 [ORD=95] [ID=140] 0xc1f750: i64 = add 0xc22560, 0xc21220 [ORD=83] [ID=102] 0xc22560: i64,ch = CopyFromReg 0xbca1c0, 0xc21880 [ORD=82] [ID=76] 0xc21880: i64 = Register %vreg26 [ID=28] 0xc21220: i64 = Constant<232> [ID=29] 0xc269e0: v4i32 = X86ISD::VZEXT_MOVL 0xc09c00 [ORD=102] [ID=169] 0xc09c00: v4i32 = scalar_to_vector 0xc24be0 [ORD=102] [ID=160] 0xc24be0: i32 = truncate 0xc22de0 [ORD=99] [ID=151] 0xc22de0: i64,ch = load 0xc28160, 0xc22450, 0xc0a9f0 [ORD=104] [ID=141] 0xc22450: i64 = add 0xc22560, 0xc09f30 [ORD=97] [ID=100] 0xc22560: i64,ch = CopyFromReg 0xbca1c0, 0xc21880 [ORD=82] [ID=76] 0xc21880: i64 = Register %vreg26 [ID=28] 0xc09f30: i64 = Constant<244> [ID=31] 0xc0a9f0: i64 = undef [ID=4] 0xc25020: v4i32 = bitcast 0xc06ec0 [ORD=9] [ID=119] 0xc06ec0: v2i64,ch = load 0xbca1c0, 0xc05fc0, 0xc0a9f0 [ORD=9] [ID=104] 0xc05fc0: i64 = X86ISD::Wrapper 0xc21550 [ID=78] 0xc21550: i64 = TargetConstantPool<<4 x i32> > 0 [ID=47] 0xc0a9f0: i64 = undef [ID=4] In function: fs57_variant0_partial I get the same result for either the BuildTrunc or BuildICmp paths through the if (0) at the top, and I also get the same result if I just fall through to lp_build_select_bitwise(). This doesn't seem to be the only breakage. lp_test_format dies with: LLVM ERROR: Cannot select: 0x231e090: v4i32 = X86ISD::UMIN 0x2346b70, 0x231bf80 [ORD=5] [ID=30] 0x2346b70: v4i32 = bitcast 0x2346840 [ORD=3] [ID=29] 0x2346840: v2i64 = scalar_to_vector 0x2346c80 [ORD=3] [ID=27] 0x2346c80: i64,ch = load 0x236abd0, 0x231b3d0, 0x231ba30 [ORD=3] [ID=24] 0x231b3d0: i64,ch = CopyFromReg 0x236abd0, 0x231b2c0 [ORD=1] [ID=20] 0x231b2c0: i64 = Register %vreg1 [ID=2] 0x231ba30: i64 = undef [ID=4] 0x231bf80: v4i32 = bitcast 0x231be70 [ORD=5] [ID=28] 0x231be70: v2i64,ch = load 0x236abd0, 0x231d920, 0x231ba30 [ORD=5] [ID=25] 0x231d920: i64 = X86ISD::Wrapper 0x231e3c0 [ID=22] 0x231e3c0: i64 = TargetConstantPool<<4 x i32> > 0 [ID=14] 0x231ba30: i64 = undef [ID=4] In function: fetch_r32g32_uscaled_unorm8 lp_test_arit dies with: LLVM ERROR: Cannot select: intrinsic %llvm.x86.sse41.round.ps lp_test_conv dies with: LLVM ERROR: Cannot select: 0xd79a20: v4i32 = X86ISD::SMIN 0xd796f0, 0xd794d0 [ORD=8] [ID=25] 0xd796f0: v4i32 = X86ISD::SMAX 0xd79f70, 0xd696b0 [ORD=6] [ID=23] 0xd79f70: v4i32 = bitcast 0xd698d0 [ORD=4] [ID=21] 0xd698d0: v2i64,ch = load 0xd43920, 0xd69380, 0xd69050 [ORD=4] [ID=17] 0xd69380: i64 = add 0xd68c10, 0xd69270 [ORD=3] [ID=13] 0xd68c10: i64,ch = CopyFromReg 0xd43920, 0xd68b00 [ORD=1] [ID=8] 0xd68b00: i64 = Register %vreg0 [ID=1] 0xd69270: i64 = Constant<16> [ID=4] 0xd69050: i64 = undef [ID=3] 0xd696b0: v4i32 = bitcast 0xd695a0 [ORD=5] [ID=18] 0xd695a0: v2i64,ch = load 0xd43920, 0xd793c0, 0xd69050 [ORD=5] [ID=14] 0xd793c0: i64 = X86ISD::Wrapper 0xd7a2a0 [ID=10] 0xd7a2a0: i64 = TargetConstantPool<<4 x i32> > 0 [ID=6] 0xd69050: i64 = undef [ID=3] 0xd794d0: v4i32 = bitcast 0xd795e0 [ORD=7] [ID=19] 0xd795e0: v2i64,ch = load 0xd43920, 0xd79910, 0xd69050 [ORD=7] [ID=15] 0xd79910: i64 = X86ISD::Wrapper 0xd7a190 [ID=11] 0xd7a190: i64 = TargetConstantPool<<4 x i32> > 0 [ID=7] 0xd69050: i64 =
Re: [Mesa-dev] llvmpipe broken on Skylake Pentium (LP_NATIVE_VECTOR_WIDTH=128)
On Mon, 2015-10-12 at 21:57 +0200, Roland Scheidegger wrote: > Note that the vector width doesn't really control if avx is used or not, > since that's a decision which llvm does on its own (we do set it > manually if we detect avx on our own, but llvm will use avx anyway even > if we don't if it thinks the cpu supports it with newer llvm versions), > albeit it would be possible to override this (but this changed > significantly between llvm versions). I don't care about AVX working, really. It might be nice to have but the performance benefit isn't all that impressive for gnome-shell-like workloads, and a non-functional desktop is a framerate of 0 so literally anything would be an improvement. I patched X86.td in llvm to clamp Skylake at SSE4.2 [1], but it doesn't help. More to the point the instructions I'm dying on here aren't AVX to begin with, the intrinsics we're emitting are SSE4.1 and I would have hoped llvm could break v4i32 apart on its own. > You could give lp_build_create_jit_compiler_for_module() a look, in > particular builder.setMCPU(MCPU) and related stuff. I believe if you've > got a core i5 haswell there or something similar (by > llvm::sys::getHostCPUName()), it will then try to use avx, regardless if > the avx flag is present or not. This means that theoretically we should > probably mask off the not supported bits manually somehow, so they > aren't automatically derived from the cpu type set there (or set a > different cpu name, but we'd need to bend over backwards to derive the > correct type). The mechanism to do so seems kind of "meh" for jit code... I don't think getHostCPUName is the droid I'm looking for: Breakpoint 1, llvm::sys::getHostCPUName () at Host.cpp:218 218 StringRef sys::getHostCPUName() { (gdb) finish Run till exit from #0 llvm::sys::getHostCPUName () at Host.cpp:218 0x7260e193 in lp_build_create_jit_compiler_for_module (OutJIT=OutJIT@entry=0x8defe8, OutCode=OutCode@entry=0x8df018, M=, CMM=0x8d52c0, OptLevel=, useMCJIT=useMCJIT@entry=1, OutError=OutError@entry=0x7fffd300) at gallivm/lp_bld_misc.cpp:480 480StringRef MCPU = llvm::sys::getHostCPUName(); Value returned is $1 = {static npos = 18446744073709551615, Data = 0x716ab9f8 "x86-64", Length = 6} [1] - https://ajax.fedorapeople.org/llvm-3.6.2-nerf-skylake.patch - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] llvmpipe broken on Skylake Pentium (LP_NATIVE_VECTOR_WIDTH=128)
On Mon, 2015-10-12 at 22:55 +0200, Roland Scheidegger wrote: > I don't know that looks like a generic string you're getting back. > x86-64 IIRC implies sse2 in llvm, but not the other sseX flags (and if > we detected sse41 we're going to use intrinsics for these, which then > may not be available in llvm _potentially_ (I'm really not sure here as > this code changed, and mesa generally is only adapted to such changes > once it breaks..., but the string here will be something less generic > like "ivybridge" usually on real hw). This was the clue I needed, SSE4.1 intrinsics die because llvm doesn't think they're legal for the target, because llvm 3.6 doesn't know about broadwell or skylake so they just appear as generic. Adding their model numbers to the Haswell path seems to do the trick (since apparently Haswell Pentium has the same property re AVX). - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i915: For the love all that is holy, stop saying "IGD"
a001 and a011 are pineview chips. Say so. Signed-off-by: Adam Jackson --- include/pci_ids/i915_pci_ids.h| 4 ++-- src/mesa/drivers/dri/i915/intel_chipset.h | 14 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/pci_ids/i915_pci_ids.h b/include/pci_ids/i915_pci_ids.h index 7d51975..1c43c8e 100644 --- a/include/pci_ids/i915_pci_ids.h +++ b/include/pci_ids/i915_pci_ids.h @@ -11,5 +11,5 @@ CHIPSET(0x27AE, I945_GME, "Intel(R) 945GME") CHIPSET(0x29B2, Q35_G,"Intel(R) Q35") CHIPSET(0x29C2, G33_G,"Intel(R) G33") CHIPSET(0x29D2, Q33_G,"Intel(R) Q33") -CHIPSET(0xA011, IGD_GM, "Intel(R) IGD") -CHIPSET(0xA001, IGD_G,"Intel(R) IGD") +CHIPSET(0xA011, PNV_GM, "Intel(R) Pineview M") +CHIPSET(0xA001, PNV_G,"Intel(R) Pineview") diff --git a/src/mesa/drivers/dri/i915/intel_chipset.h b/src/mesa/drivers/dri/i915/intel_chipset.h index 8375a4b..3828085 100644 --- a/src/mesa/drivers/dri/i915/intel_chipset.h +++ b/src/mesa/drivers/dri/i915/intel_chipset.h @@ -46,12 +46,12 @@ #define PCI_CHIP_G33_G 0x29C2 #define PCI_CHIP_Q33_G 0x29D2 -#define PCI_CHIP_IGD_GM0xA011 -#define PCI_CHIP_IGD_G 0xA001 +#define PCI_CHIP_PNV_GM0xA011 +#define PCI_CHIP_PNV_G 0xA001 -#define IS_IGDGM(devid)(devid == PCI_CHIP_IGD_GM) -#define IS_IGDG(devid) (devid == PCI_CHIP_IGD_G) -#define IS_IGD(devid) (IS_IGDG(devid) || IS_IGDGM(devid)) +#define IS_PNVGM(devid)(devid == PCI_CHIP_PNV_GM) +#define IS_PNVG(devid) (devid == PCI_CHIP_PNV_G) +#define IS_PNV(devid) (IS_PNVG(devid) || IS_PNVGM(devid)) #define IS_MOBILE(devid) (devid == PCI_CHIP_I855_GM || \ devid == PCI_CHIP_I915_GM || \ @@ -60,7 +60,7 @@ devid == PCI_CHIP_I965_GM || \ devid == PCI_CHIP_I965_GME || \ devid == PCI_CHIP_GM45_GM || \ -IS_IGD(devid) || \ +IS_PNV(devid) || \ devid == PCI_CHIP_ILM_G) #define IS_915(devid) (devid == PCI_CHIP_I915_G || \ @@ -72,7 +72,7 @@ devid == PCI_CHIP_I945_GME || \ devid == PCI_CHIP_G33_G || \ devid == PCI_CHIP_Q33_G || \ -devid == PCI_CHIP_Q35_G || IS_IGD(devid)) +devid == PCI_CHIP_Q35_G || IS_PNV(devid)) #define IS_9XX(devid) (IS_915(devid) || \ IS_945(devid)) -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] X test suite regression due to gallivm change
Starting from: > commit 320d1191c61a0a82444605c12e5c4b2ee0b241eb > Author: Jose Fonseca > Date: Mon Apr 4 00:05:33 2016 +0100 > > gallivm: Use llvm.fmuladd.*. > > Reviewed-by: Roland Scheidegger 'make check' in xserver no longer passes on Xephyr+glamor+llvmpipe. At least, not on my Skylake. Setting LP_NATIVE_VECTOR_WIDTH=128 fixes it, so I assume this is a difference in generated code between AVX2 and non-AVX. I haven't dug much further into it yet, just wondering if there's any obvious reason AVX would generate noticably different rendering after this change, or if this change had been seen to cause trouble on other AVX machines. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] X test suite regression due to gallivm change
On Thu, 2017-02-23 at 21:59 +0100, Roland Scheidegger wrote: > So, what does the failing test do? Not much, curiously. There are five that fail and they're all fairly trivial, although the xts harness makes that hard to see. XClearArea/6 and XClearWindow/4 set the window background pixmap to None and calls XClearArea. This should not change any pixels; apparently it does. XClearArea/7 and XClearWindow/5 create a parent window, then a child, sets the parent bg to None, the child to ParentRelative, and clears the child. Again, this should not change anything, but does. XCopyArea/1 creates two windows, tiles the background of the first one (equivalent to ClearWindow), copies from one window to the other, and verifies that the second one has the right content. The first four there are a little strange because, in principle, the thing they're testing is that no rendering happens. Presumably what's being measured is that some _other_ rendering prior to the action under test is being done incorrectly. The CopyArea test is probably closest to the root cause. I'll drill down a bit on exactly what that turns into in terms of GL draws. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glx: Fix __glXWireToEvent for BufferSwapComplete
In the DRI2 path this event is magically synthesized from the corresponding DRI2 event, but with Present, the server sends us the event itself. The DRI2 path fills in the serial number, send_event, and display fields of the XEvent struct that the app sees, but the Present path did not. This is likely related to a class of crashes seen in gtk/clutter apps: https://bugzilla.redhat.com/attachment.cgi?id=1032631 Note that the crashing instruction is looking up the lock_fns slot in the Display *, and %rdi (holding the Display *) is 0x1. Cc: mesa-sta...@lists.freedesktop.org Signed-off-by: Adam Jackson --- src/glx/glxext.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/glx/glxext.c b/src/glx/glxext.c index fdc24d4..dc87fb9 100644 --- a/src/glx/glxext.c +++ b/src/glx/glxext.c @@ -138,6 +138,9 @@ __glXWireToEvent(Display *dpy, XEvent *event, xEvent *wire) if (!glxDraw) return False; + aevent->serial = _XSetLastRequestRead(dpy, (xGenericReply *) wire); + aevent->send_event = (awire->type & 0x80) != 0; + aevent->display = dpy; aevent->event_type = awire->event_type; aevent->drawable = glxDraw->xDrawable; aevent->ust = ((CARD64)awire->ust_hi << 32) | awire->ust_lo; -- 2.4.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glx: Fix __glXWireToEvent for BufferSwapComplete
On Tue, 2015-08-04 at 19:38 -0700, Eric Anholt wrote: > In the Pbuffer path, we get serial from awire. Why's this one > different? Because I copied it from the dri2 path not the pbuffer path. This idiom is more correct, _XSetLastRequestRead is how you notify xlib of the advance in serials so it can emit XSync when it approaches wraparound. > > + aevent->send_event = (awire->type & 0x80) != 0; > > + aevent->display = dpy; > > These look good. Related: pbuffers don't seem to be setting the > display, either. Doesn't have to be fixed in this patch. The pbuffer case is so deeply idiotic as to be unusable. Consider: typedef struct { int type; unsigned long serial; Bool send_event; Display *display; Window window; } XAnyEvent; vs. typedef struct { int event_type; int draw_type; unsigned long serial; Bool send_event; Display *display; GLXDrawable drawable; unsigned int buffer_mask; unsigned int aux_buffer; int x, y; int width, height; int count; } GLXPbufferClobberEvent; And worse, event_type for pbuffers is one of: #define GLX_DAMAGED 0x8020 #define GLX_SAVED 0x8021 So if you expect to ever get a pbuffer clobber event, you need to edit your event dispatch to know that event_type might be wildly out-of-band from the X event namespace, and that any time you want one of the fields from XAnyEvent you need a function call that's aware of the different struct layouts. Good work SGI. Fortunately neither Xorg nor nvidia will ever emit clobber events (and I seriously doubt catalyst will either), so this is all academic unless someone really wants interop with an Indigo, or we want to defend against XSendEvent from a meddlesome client. I can fix the pbuffer path, but the above is why I hadn't even thought to bother. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 13/14] egl: Track EGL_KHR_debug state when going through EGL API calls
On Tue, 2016-09-13 at 16:54 +0100, Emil Velikov wrote: > Going through table 13.2 and the below there are some discrepancies. > > AFAICT some of those can be seen as spec bugs (B), while others seem > to be missing (M) > - thread - eglBindAPI (M) Not really missing, but tricky. _EGL_FUNC_START calls _eglSetFuncName which initializes thr->CurrentObjectLabel, so if there _is_ a non-dummy thread then the callback will get the correct label for the thread object. However, if we're on the dummy thread, then we'll hit the call to _eglDebugReportFull(objectLabel=NULL), which will correctly call the callback with both labels NULL. Arguably _eglSetFuncName should also clear ->CurrentObjectLabel in this case. > - display - eglGetCurrentDisplay (B) It's somewhat irrelevant since our implementation never throws an error on this path (and it's not clear that any implementation ever would), but: what do you mean by "spec bug" here? > - context - eglQueryAPI (M), eglQueryAPI is _defined_ as never throwing an error, so I'm not sure this is really "missing". However, the dummy thread's ->CurrentAPI is initialized to 0, but "no API" is EGL_NONE which is not zero but 0x3038, so that really is a bug; I'll fix that up. > eglGetCurrentContext (B) Again, this is defined as not throwing an error, so as long as we never trigger the debug callback there's no problem here. > - surface - eglSwapInterval (B) Again, not sure what you mean by "spec bug" here. But there is an implementation bug, we should pass ctx->DrawSurface as the active object to _EGL_FUNC_START since we're already locked; if it's NULL and we have a live thread then _eglSetFuncName will clear the current object label correctly. I'll fix that up. > eglGetCurrentSurface(B) The weird part about this one is that we might need to throw an error before we've found a valid surface to operate with. The spec allows the object label to be NULL in this case, but _eglSetFuncName isn't clearing the current object label when initialized with a NULL object. I'll fix that too. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 14/14] egl: Implement EGL_KHR_debug
On Tue, 2016-09-13 at 17:17 +0100, Emil Velikov wrote: > > + } else { > > + _eglDebugReportFull(EGL_BAD_ALLOC, __func__, __func__, > > + EGL_DEBUG_MSG_CRITICAL_KHR, NULL, NULL); > > + return EGL_BAD_ALLOC; > > + } > > Nit: Please use the same style as the "objectType == > EGL_OBJECT_DISPLAY_KHR" case. AFAICT the reason this code doesn't use RETURN_EGL_ERROR like everything else is because it doesn't lock the display. Which is extremely wrong, since we definitely depend on it not going away from under us later! Fixed in v2. > Nit: You can also drop the "else" and flatten (indent one level less) > all of the following code. Done in v2. > Missing EGLAPIENTRY Fixed in v2. > > +eglDebugMessageControlKHR(EGLDEBUGPROCKHR callback, > > + const EGLAttrib *attrib_list) > > +{ > > + unsigned int newEnabled; > > + > > + _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_BAD_ALLOC); > > + > > + mtx_lock(_eglGlobal.Mutex); > > + > > + newEnabled = _eglGlobal.debugTypesEnabled; > > + if (attrib_list != NULL) { > > + int i; > > + > > + for (i = 0; attrib_list[i] != EGL_NONE; i += 2) { > > Don't think we check it elsewhere (and/or if we should care too much) but > still: > Check if i overflows or use unsigned type ? There's a bunch of places where we don't check that... > > + if (attrib_list[i] >= EGL_DEBUG_MSG_CRITICAL_KHR && > > + attrib_list[i] <= EGL_DEBUG_MSG_INFO_KHR) { > > +if (attrib_list[i + 1]) { > > + newEnabled |= DebugBitFromType(attrib_list[i]); > > +} else { > > + newEnabled &= ~DebugBitFromType(attrib_list[i]); > > +} > > Nit: break; ? Nope. You're allowed to set the disposition for multiple error levels in a single call to DebugMessageControl, so you need to validate them all. > > +eglQueryDebugKHR(EGLint attribute, EGLAttrib *value) > > +{ > > + _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_BAD_ALLOC); > > + > > + mtx_lock(_eglGlobal.Mutex); > > + if (attribute >= EGL_DEBUG_MSG_CRITICAL_KHR && > > + attribute <= EGL_DEBUG_MSG_INFO_KHR) { > > + if (_eglGlobal.debugTypesEnabled & DebugBitFromType(attribute)) { > > + *value = EGL_TRUE; > > + } else { > > + *value = EGL_FALSE; > > + } > > + } else if (attribute == EGL_DEBUG_CALLBACK_KHR) { > > + *value = (EGLAttrib) _eglGlobal.debugCallback; > > + } else { > > + mtx_unlock(_eglGlobal.Mutex); > > + _eglReportError(EGL_BAD_ATTRIBUTE, NULL, > > + "Invalid attribute 0x%04lx", (unsigned long) attribute); > > + return EGL_FALSE; > > + } > > Nit: Switch statement will be a lot easier to read. Meh. I factored out the valid-debug-level check to a helper, at which point you can't really use a switch. Redone as a do-while so I could use break to bail out of the success conditions. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/14] egl: Track EGL_KHR_debug state when going through EGL API calls (v2)
From: Kyle Brenneman This decorates every EGL entrypoint with _EGL_FUNC_START, which records the function name and primary dispatch object label in the current thread state. It also adds debug report functions and calls them when appropriate. This would be useful enough for debugging on its own, if the user set a breakpoint when the report function was called. We will also need this state tracked in order to expose EGL_KHR_debug. v2: - Clear the object label in more cases in _eglSetFuncName - Set dummy thread's CurrentAPI to EGL_NONE not zero - Pass draw surface (if any) to _EGL_FUNC_START in eglSwapInterval --- src/egl/main/eglapi.c | 155 ++ src/egl/main/eglcurrent.c | 91 ++- src/egl/main/eglcurrent.h | 22 +++ src/egl/main/eglglobals.h | 5 ++ 4 files changed, 259 insertions(+), 14 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 0477ad9..216b289 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -250,6 +250,37 @@ _eglUnlockDisplay(_EGLDisplay *dpy) mtx_unlock(&dpy->Mutex); } +static EGLBoolean +_eglSetFuncName(const char *funcName, _EGLDisplay *disp, EGLenum objectType, _EGLResource *object) +{ + _EGLThreadInfo *thr = _eglGetCurrentThread(); + if (!_eglIsCurrentThreadDummy()) { + thr->CurrentFuncName = funcName; + thr->CurrentObjectLabel = NULL; + + if (objectType == EGL_OBJECT_THREAD_KHR) + thr->CurrentObjectLabel = thr->Label; + else if (objectType == EGL_OBJECT_DISPLAY_KHR) + thr->CurrentObjectLabel = disp ? disp->Label : NULL; + else + thr->CurrentObjectLabel = object ? object->Label : NULL; + + return EGL_TRUE; + } + + _eglDebugReportFull(EGL_BAD_ALLOC, funcName, funcName, + EGL_DEBUG_MSG_CRITICAL_KHR, NULL, NULL); + return EGL_FALSE; +} + +#define _EGL_FUNC_START(disp, objectType, object, ret) \ + do { \ + if (!_eglSetFuncName(__func__, disp, objectType, (_EGLResource *) object)) { \ + if (disp) \ +_eglUnlockDisplay(disp); \ + return ret; \ + } \ + } while(0) static EGLint * _eglConvertAttribsToInt(const EGLAttrib *attr_list) @@ -287,6 +318,8 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay) _EGLDisplay *dpy; void *native_display_ptr; + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); + STATIC_ASSERT(sizeof(void*) == sizeof(nativeDisplay)); native_display_ptr = (void*) nativeDisplay; @@ -330,6 +363,7 @@ static EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list) { + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); return _eglGetPlatformDisplayCommon(platform, native_display, attrib_list); } @@ -340,6 +374,8 @@ eglGetPlatformDisplay(EGLenum platform, void *native_display, EGLDisplay display; EGLint *int_attribs; + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); + int_attribs = _eglConvertAttribsToInt(attrib_list); if (attrib_list && !int_attribs) RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, NULL); @@ -483,6 +519,8 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + if (!disp) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); @@ -533,6 +571,8 @@ eglTerminate(EGLDisplay dpy) { _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + if (!disp) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); @@ -560,6 +600,7 @@ eglQueryString(EGLDisplay dpy, EGLint name) } disp = _eglLockDisplay(dpy); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL); _EGL_CHECK_DISPLAY(disp, NULL, drv); switch (name) { @@ -585,6 +626,8 @@ eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config); @@ -600,6 +643,8 @@ eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs, config_size, num_config); @@ -617,6 +662,8 @@ eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + _EGL_CHECK_CONFIG(disp, conf, EGL_FALSE, drv); ret = drv->API.GetConfigAttrib(drv, di
[Mesa-dev] [PATCH 14/14] egl: Implement EGL_KHR_debug (v2)
From: Kyle Brenneman Wire up the debug entrypoints to EGL dispatch, and add the extension string to the client extension list. v2: - Lots of style fixes - Fix missing EGLAPIENTRYs - Factor out valid attribute check - Lock display in eglLabelObjectKHR as needed, and use RETURN_EGL_* - Move "EGL_KHR_debug" into asciibetical order in client extension string --- src/egl/main/eglapi.c | 145 ++ src/egl/main/eglglobals.c | 1 + 2 files changed, 146 insertions(+) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 216b289..7162039 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1977,6 +1977,148 @@ eglExportDMABUFImageMESA(EGLDisplay dpy, EGLImage image, RETURN_EGL_EVAL(disp, ret); } +static EGLint EGLAPIENTRY +eglLabelObjectKHR(EGLDisplay dpy, EGLenum objectType, EGLObjectKHR object, + EGLLabelKHR label) +{ + _EGLDisplay *disp = NULL; + _EGLResourceType type; + + _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_BAD_ALLOC); + + if (objectType == EGL_OBJECT_THREAD_KHR) { + _EGLThreadInfo *t = _eglGetCurrentThread(); + + if (!_eglIsCurrentThreadDummy()) { + t->Label = label; + return EGL_SUCCESS; + } + + RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_BAD_ALLOC); + } + + disp = _eglLockDisplay(dpy); + if (disp == NULL) + RETURN_EGL_ERROR(disp, EGL_BAD_DISPLAY, EGL_BAD_DISPLAY); + + if (objectType == EGL_OBJECT_DISPLAY_KHR) { + if (dpy != (EGLDisplay) object) + RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_BAD_PARAMETER); + + disp->Label = label; + RETURN_EGL_EVAL(disp, EGL_SUCCESS); + } + + switch (objectType) { + case EGL_OBJECT_CONTEXT_KHR: + type = _EGL_RESOURCE_CONTEXT; + break; + case EGL_OBJECT_SURFACE_KHR: + type = _EGL_RESOURCE_SURFACE; + break; + case EGL_OBJECT_IMAGE_KHR: + type = _EGL_RESOURCE_IMAGE; + break; + case EGL_OBJECT_SYNC_KHR: + type = _EGL_RESOURCE_SYNC; + break; + case EGL_OBJECT_STREAM_KHR: + default: + RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_BAD_PARAMETER); + } + + if (_eglCheckResource(object, type, disp)) { + _EGLResource *res = (_EGLResource *) object; + + res->Label = label; + RETURN_EGL_EVAL(disp, EGL_SUCCESS); + } + + RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_BAD_PARAMETER); +} + +static EGLBoolean +validDebugMessageLevel(EGLAttrib level) +{ + return (level >= EGL_DEBUG_MSG_CRITICAL_KHR && + level <= EGL_DEBUG_MSG_INFO_KHR); +} + +static EGLint EGLAPIENTRY +eglDebugMessageControlKHR(EGLDEBUGPROCKHR callback, + const EGLAttrib *attrib_list) +{ + unsigned int newEnabled; + + _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_BAD_ALLOC); + + mtx_lock(_eglGlobal.Mutex); + + newEnabled = _eglGlobal.debugTypesEnabled; + if (attrib_list != NULL) { + int i; + + for (i = 0; attrib_list[i] != EGL_NONE; i += 2) { + if (validDebugMessageLevel(attrib_list[i])) { +if (attrib_list[i + 1]) + newEnabled |= DebugBitFromType(attrib_list[i]); +else + newEnabled &= ~DebugBitFromType(attrib_list[i]); +continue; + } + + // On error, set the last error code, call the current + // debug callback, and return the error code. + mtx_unlock(_eglGlobal.Mutex); + _eglReportError(EGL_BAD_ATTRIBUTE, NULL, + "Invalid attribute 0x%04lx", (unsigned long) attrib_list[i]); + return EGL_BAD_ATTRIBUTE; + } + } + + if (callback != NULL) { + _eglGlobal.debugCallback = callback; + _eglGlobal.debugTypesEnabled = newEnabled; + } else { + _eglGlobal.debugCallback = NULL; + _eglGlobal.debugTypesEnabled = _EGL_DEBUG_BIT_CRITICAL | _EGL_DEBUG_BIT_ERROR; + } + + mtx_unlock(_eglGlobal.Mutex); + return EGL_SUCCESS; +} + +static EGLBoolean EGLAPIENTRY +eglQueryDebugKHR(EGLint attribute, EGLAttrib *value) +{ + _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_BAD_ALLOC); + + mtx_lock(_eglGlobal.Mutex); + + do { + if (validDebugMessageLevel(attribute)) { + if (_eglGlobal.debugTypesEnabled & DebugBitFromType(attribute)) +*value = EGL_TRUE; + else +*value = EGL_FALSE; + break; + } + + if (attribute == EGL_DEBUG_CALLBACK_KHR) { + *value = (EGLAttrib) _eglGlobal.debugCallback; + break; + } + + mtx_unlock(_eglGlobal.Mutex); + _eglReportError(EGL_BAD_ATTRIBUTE, NULL, + "Invalid attribute 0x%04lx", (unsigned long) attribute); + return EGL_FALSE; + } while (0); + + mtx_unlock(_eglGlobal.Mutex); + return EGL_TRUE; +} + __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname) { @@ -2056,6 +2198,9 @@ eglGetProcAddress(const char *procname) { "eglGetSyncValuesCHROMIU
[Mesa-dev] [PATCH 08/14] egl: Factor out _eglCreateImageCommon (v2)
From: Kyle Brenneman v2: - Pass disp to RETURN_EGL_ERROR so we unlock the display --- src/egl/main/eglapi.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index a74e5e4..ba4826a 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1309,11 +1309,10 @@ eglReleaseThread(void) } -static EGLImage EGLAPIENTRY -eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, +static EGLImage +_eglCreateImageCommon(_EGLDisplay *disp, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list) { - _EGLDisplay *disp = _eglLockDisplay(dpy); _EGLContext *context = _eglLookupContext(ctx, disp); _EGLDriver *drv; _EGLImage *img; @@ -1337,18 +1336,27 @@ eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, RETURN_EGL_EVAL(disp, ret); } +static EGLImage EGLAPIENTRY +eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, + EGLClientBuffer buffer, const EGLint *attr_list) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + return _eglCreateImageCommon(disp, ctx, target, buffer, attr_list); +} + EGLImage EGLAPIENTRY eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attr_list) { + _EGLDisplay *disp = _eglLockDisplay(dpy); EGLImage image; EGLint *int_attribs = _eglConvertAttribsToInt(attr_list); if (attr_list && !int_attribs) - RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_IMAGE); + RETURN_EGL_ERROR(disp, EGL_BAD_ALLOC, EGL_NO_IMAGE); - image = eglCreateImageKHR(dpy, ctx, target, buffer, int_attribs); + image = _eglCreateImageCommon(disp, ctx, target, buffer, int_attribs); free(int_attribs); return image; } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 09/14] egl: Lock the display in _eglCreateSync's callers
On Tue, 2016-09-13 at 17:22 +0100, Emil Velikov wrote: > Actually, current code has a bunch of such bugs which this series addresses. > Considering there's only a couple of those and they are pretty hard to > hit I won't bother with respinning the patches. > > That is unless we want them for stable ? I mean, I'm going to want this in "stable" because I want to switch to libglvnd sooner than later. I'm perfectly capable of applying the series to Fedora's Mesa build on my own though. I guess my question is why applying the whole series to stable wouldn't be acceptable. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 09/14] egl: Lock the display in _eglCreateSync's callers
On Tue, 2016-09-13 at 19:18 +0100, Emil Velikov wrote: > For the series as a whole ? > Two words which contradict any software's stable scheme - new feature. Disagree, but I'm not the one running Mesa's stable branch, so my opinion doesn't count here. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 13/14] egl: Track EGL_KHR_debug state when going through EGL API calls (v2)
On Tue, 2016-09-13 at 14:14 -0600, Kyle Brenneman wrote: > On 09/13/2016 11:57 AM, Adam Jackson wrote: > > @@ -37,7 +39,7 @@ > > > > /* This should be kept in sync with _eglInitThreadInfo() */ > > #define _EGL_THREAD_INFO_INITIALIZER \ > > - { EGL_SUCCESS, NULL, 0, NULL, NULL, NULL } > > + { EGL_SUCCESS, NULL, EGL_NONE, NULL, NULL, NULL } > > The API here should be EGL_OPENGL_ES_API, not EGL_NONE. Otherwise, the > current API would effectively change when the _EGLThreadInfo struct is > allocated. Or I guess more generally, _EGL_THREAD_INFO_INITIALIZER > should produce the same data as _eglInitThreadInfo. Mmm, okay. That's a very close reading of the spec. QueryAPI allows the result to be EGL_NONE, which does make sense for the dummy thread since you sure won't be doing much with it. But BindAPI says the default is EGL_OPENGL_ES_API, so presumably that should apply even to the dummy context. One does wonder then how you could ever get EGL_NONE out of QueryAPI. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 09/14] egl: Lock the display in _eglCreateSync's callers
On Wed, 2016-09-14 at 11:15 +0100, Emil Velikov wrote: > Nice one... I wonder if your view will be the same if you were never > involved in distribution packaging? Guess we'll never know :-\ > In case you've forgotten things have been like that for a long time - > long before I jumped in. I wasn't accusing you of anything. I said _I_ am not the one making the decision, that's all. Obviously I can't make definite assertions about counterfactuals about my work history, but I think considering all "new features" equally destabilizing is wrong. Why have an extension model if you're not going to use it to make assertions about the orthogonality of feature sets? Why refuse to reason about the code, unless you don't have any confidence that it's something that can be reasoned about? Yes, we do backport features, it works pretty well. If one does so enough times, a sense develops of how "big" of a feature it's possible to backport reasonably. I have my own opinion about this one, and I was asking what the rule was for mesa stable. Since the rule seems to be "no", fine, not for stable. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/14] egl: Track EGL_KHR_debug state when going through EGL API calls (v3)
From: Kyle Brenneman This decorates every EGL entrypoint with _EGL_FUNC_START, which records the function name and primary dispatch object label in the current thread state. It also adds debug report functions and calls them when appropriate. This would be useful enough for debugging on its own, if the user set a breakpoint when the report function was called. We will also need this state tracked in order to expose EGL_KHR_debug. v2: - Clear the object label in more cases in _eglSetFuncName - Pass draw surface (if any) to _EGL_FUNC_START in eglSwapInterval v3: - Set dummy thread's CurrentAPI to EGL_OPENGL_ES_API not zero - Less ?: in _eglSetFuncName --- src/egl/main/eglapi.c | 153 +++--- src/egl/main/eglcurrent.c | 91 ++- src/egl/main/eglcurrent.h | 22 +++ src/egl/main/eglglobals.h | 5 ++ 4 files changed, 258 insertions(+), 13 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 1c62a80..cbc3841 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -250,6 +250,37 @@ _eglUnlockDisplay(_EGLDisplay *dpy) mtx_unlock(&dpy->Mutex); } +static EGLBoolean +_eglSetFuncName(const char *funcName, _EGLDisplay *disp, EGLenum objectType, _EGLResource *object) +{ + _EGLThreadInfo *thr = _eglGetCurrentThread(); + if (!_eglIsCurrentThreadDummy()) { + thr->CurrentFuncName = funcName; + thr->CurrentObjectLabel = NULL; + + if (objectType == EGL_OBJECT_THREAD_KHR) + thr->CurrentObjectLabel = thr->Label; + else if (objectType == EGL_OBJECT_DISPLAY_KHR && disp) + thr->CurrentObjectLabel = disp->Label; + else if (object) + thr->CurrentObjectLabel = object->Label; + + return EGL_TRUE; + } + + _eglDebugReportFull(EGL_BAD_ALLOC, funcName, funcName, + EGL_DEBUG_MSG_CRITICAL_KHR, NULL, NULL); + return EGL_FALSE; +} + +#define _EGL_FUNC_START(disp, objectType, object, ret) \ + do { \ + if (!_eglSetFuncName(__func__, disp, objectType, (_EGLResource *) object)) { \ + if (disp) \ +_eglUnlockDisplay(disp); \ + return ret; \ + } \ + } while(0) static EGLint * _eglConvertAttribsToInt(const EGLAttrib *attr_list) @@ -287,6 +318,8 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay) _EGLDisplay *dpy; void *native_display_ptr; + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); + STATIC_ASSERT(sizeof(void*) == sizeof(nativeDisplay)); native_display_ptr = (void*) nativeDisplay; @@ -330,6 +363,7 @@ static EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list) { + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); return _eglGetPlatformDisplayCommon(platform, native_display, attrib_list); } @@ -340,6 +374,8 @@ eglGetPlatformDisplay(EGLenum platform, void *native_display, EGLDisplay display; EGLint *int_attribs; + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); + int_attribs = _eglConvertAttribsToInt(attrib_list); if (attrib_list && !int_attribs) RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, NULL); @@ -483,6 +519,8 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + if (!disp) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); @@ -533,6 +571,8 @@ eglTerminate(EGLDisplay dpy) { _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + if (!disp) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); @@ -560,6 +600,7 @@ eglQueryString(EGLDisplay dpy, EGLint name) } disp = _eglLockDisplay(dpy); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL); _EGL_CHECK_DISPLAY(disp, NULL, drv); switch (name) { @@ -585,6 +626,8 @@ eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config); @@ -600,6 +643,8 @@ eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs, config_size, num_config); @@ -617,6 +662,8 @@ eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + _EGL_CHECK_CONFIG(disp, conf, EGL_FALSE, drv); ret =
Re: [Mesa-dev] [PATCH 13/14] egl: Track EGL_KHR_debug state when going through EGL API calls
On Wed, 2016-09-14 at 12:08 +0100, Emil Velikov wrote: > Thanks for reminding me - eglQueryAPI should never throw an error, > indeed. Since EGL_KHR_debug is applicable for functions_do_ throw an > error, one should leave the API out of the spec text shouldn't they ? I mean, sure, but this patch is against Mesa, not the spec. > This is precisely what I'm talking about - one cannot relate the error > label to a {surface,context,display} object that is yet to be found. > As such the object label (and friends) should be related to the > current thread. I see your point, I'm just not sure what you want done about it. My reading of the spec is that there are two ways an implementation can handle this: a) "The primary object should be the object the function operates on, see table 13.2 which provides the recommended mapping between functions and their primary object." Note "recommended", which suggests the primary object could be something else. b) " will contain the label attached to the primary object of the message; Labels will be NULL if not set by the application. [...] This may be NULL even though the application labeled the object. This is because it is possible an error was raised while executing the command before the primary object was validated, therefore its label can not be included in the callback." This suggests that if the primary object can't be validated, then a NULL label will be used. Now to me, option b seems more conservative. Debug callbacks need to be prepared for null object labels due to mandatory spec language. They need to be prepared for unexpected primary objects only due to optional spec language. And option b is the approach this patch takes, entrypoints that error before the primary object is validated will invoke the callback with a null object label. If we want to amend the spec language, great, that's a fine idea, and Khronos bugzilla is → that way. But even if we did, I think the implementation in this patch (well, v3 of it) can be said to conform to the spec as it currently exists, and that such amendment should not invalidate existing implementations. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 09/14] egl: Lock the display in _eglCreateSync's callers
On Wed, 2016-09-14 at 14:29 +0100, Emil Velikov wrote: > It's surprising that you haven't heard about this, considering it's > been in use for more than three years. Guess you simply forgot ? Most of my own patches to Mesa have been so far from being "features" that I've never had to care. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 00/14] EGL_KHR_debug v3
On Tue, 2016-09-13 at 17:30 +0100, Emil Velikov wrote: > Everything else (1-12 incl.) is > Reviewed-by: Emil Velikov Merged these, thanks. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] glx/glvnd: Don't modify the dummy slot in the dispatch table
Signed-off-by: Adam Jackson --- src/glx/glxglvnd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/glx/glxglvnd.c b/src/glx/glxglvnd.c index 098304d..2fc9b00 100644 --- a/src/glx/glxglvnd.c +++ b/src/glx/glxglvnd.c @@ -50,6 +50,9 @@ static void __glXGLVNDSetDispatchIndex(const GLubyte *procName, int index) { unsigned internalIndex = FindGLXFunction(procName); +if (internalIndex == DI_FUNCTION_COUNT) +return; /* unknown or static dispatch */ + __glXDispatchTableIndices[internalIndex] = index; } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glvnd: Fix dynamic GLX entrypoint lookup
On Mon, 2016-09-05 at 11:23 +0100, Eric Engestrom wrote: > > +static int > > +compare(const void *l, const void *r) > > +{ > > +const char *s = *(const char **)r; > > Shouldn't we do the same with `l`? No. 'l' is the key we're looking for (the function name), r is the current element of the array of char* we're searching. We want to dereference r once to get the string we're comparing to, but *l is just 'g'. Split series sent. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] glx/glvnd: Fix dispatch function names and indices
As this array was not actually sorted, FindGLXFunction's binary search would only sometimes work. Signed-off-by: Adam Jackson --- src/glx/g_glxglvnddispatchfuncs.c | 254 ++-- src/glx/g_glxglvnddispatchindices.h | 36 ++--- 2 files changed, 144 insertions(+), 146 deletions(-) diff --git a/src/glx/g_glxglvnddispatchfuncs.c b/src/glx/g_glxglvnddispatchfuncs.c index e6b9c0b..b5e3398 100644 --- a/src/glx/g_glxglvnddispatchfuncs.c +++ b/src/glx/g_glxglvnddispatchfuncs.c @@ -17,16 +17,19 @@ const char * const __glXDispatchTableStrings[DI_LAST_INDEX] = { #define __ATTRIB(field) \ [DI_##field] = "glX"#field +__ATTRIB(BindSwapBarrierSGIX), __ATTRIB(BindTexImageEXT), // glXChooseFBConfig implemented by libglvnd __ATTRIB(ChooseFBConfigSGIX), // glXChooseVisual implemented by libglvnd // glXCopyContext implemented by libglvnd +__ATTRIB(CopySubBufferMESA), // glXCreateContext implemented by libglvnd __ATTRIB(CreateContextAttribsARB), __ATTRIB(CreateContextWithConfigSGIX), __ATTRIB(CreateGLXPbufferSGIX), // glXCreateGLXPixmap implemented by libglvnd +__ATTRIB(CreateGLXPixmapMESA), __ATTRIB(CreateGLXPixmapWithConfigSGIX), // glXCreateNewContext implemented by libglvnd // glXCreatePbuffer implemented by libglvnd @@ -51,54 +54,50 @@ const char * const __glXDispatchTableStrings[DI_LAST_INDEX] = { __ATTRIB(GetFBConfigAttribSGIX), __ATTRIB(GetFBConfigFromVisualSGIX), // glXGetFBConfigs implemented by libglvnd +__ATTRIB(GetMscRateOML), // glXGetProcAddress implemented by libglvnd // glXGetProcAddressARB implemented by libglvnd +__ATTRIB(GetScreenDriver), // glXGetSelectedEvent implemented by libglvnd __ATTRIB(GetSelectedEventSGIX), +__ATTRIB(GetSwapIntervalMESA), +__ATTRIB(GetSyncValuesOML), __ATTRIB(GetVideoSyncSGI), // glXGetVisualFromFBConfig implemented by libglvnd __ATTRIB(GetVisualFromFBConfigSGIX), // glXImportContextEXT implemented by libglvnd // glXIsDirect implemented by libglvnd +__ATTRIB(JoinSwapGroupSGIX), // glXMakeContextCurrent implemented by libglvnd // glXMakeCurrent implemented by libglvnd // glXQueryContext implemented by libglvnd __ATTRIB(QueryContextInfoEXT), +__ATTRIB(QueryCurrentRendererIntegerMESA), +__ATTRIB(QueryCurrentRendererStringMESA), // glXQueryDrawable implemented by libglvnd // glXQueryExtension implemented by libglvnd // glXQueryExtensionsString implemented by libglvnd __ATTRIB(QueryGLXPbufferSGIX), +__ATTRIB(QueryMaxSwapBarriersSGIX), +__ATTRIB(QueryRendererIntegerMESA), +__ATTRIB(QueryRendererStringMESA), // glXQueryServerString implemented by libglvnd // glXQueryVersion implemented by libglvnd +__ATTRIB(ReleaseBuffersMESA), __ATTRIB(ReleaseTexImageEXT), // glXSelectEvent implemented by libglvnd __ATTRIB(SelectEventSGIX), // glXSwapBuffers implemented by libglvnd +__ATTRIB(SwapBuffersMscOML), +__ATTRIB(SwapIntervalMESA), __ATTRIB(SwapIntervalSGI), // glXUseXFont implemented by libglvnd +__ATTRIB(WaitForMscOML), +__ATTRIB(WaitForSbcOML), // glXWaitGL implemented by libglvnd __ATTRIB(WaitVideoSyncSGI), // glXWaitX implemented by libglvnd -__ATTRIB(glXBindSwapBarrierSGIX), -__ATTRIB(glXCopySubBufferMESA), -__ATTRIB(glXCreateGLXPixmapMESA), -__ATTRIB(glXGetMscRateOML), -__ATTRIB(glXGetScreenDriver), -__ATTRIB(glXGetSwapIntervalMESA), -__ATTRIB(glXGetSyncValuesOML), -__ATTRIB(glXJoinSwapGroupSGIX), -__ATTRIB(glXQueryCurrentRendererIntegerMESA), -__ATTRIB(glXQueryCurrentRendererStringMESA), -__ATTRIB(glXQueryMaxSwapBarriersSGIX), -__ATTRIB(glXQueryRendererIntegerMESA), -__ATTRIB(glXQueryRendererStringMESA), -__ATTRIB(glXReleaseBuffersMESA), -__ATTRIB(glXSwapBuffersMscOML), -__ATTRIB(glXSwapIntervalMESA), -__ATTRIB(glXWaitForMscOML), -__ATTRIB(glXWaitForSbcOML), - #undef __ATTRIB }; @@ -557,49 +556,49 @@ static int dispatch_WaitVideoSyncSGI(int divisor, int remainder, -static void dispatch_glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, +static void dispatch_BindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier) { -PFNGLXBINDSWAPBARRIERSGIXPROC pglXBindSwapBarrierSGIX; +PFNGLXBINDSWAPBARRIERSGIXPROC pBindSwapBarrierSGIX; __GLXvendorInfo *dd; dd = GetDispatchFromDrawable(dpy, drawable); if (dd == NULL) return; -__FETCH_FUNCTION_PTR(glXBindSwapBarrierSGIX); -if (pglXBindSwapBarrierSGIX == NULL) +__FETCH_FUNCTION_PTR(BindSwapBarrierSGIX); +if (pBindSwapBarrierSGIX == NULL) return; -(*pglXBindSwapBarrierSGIX)(dpy, drawable, barrier); +(*pBindSwapBarrierSGIX)(dpy, drawable, barrier); } -static void dispatch_glXCopySubBuf
[Mesa-dev] [PATCH 3/3] glx/glvnd: Use bsearch() in FindGLXFunction instead of open-coding it
Signed-off-by: Adam Jackson --- src/glx/glxglvnd.c | 30 ++ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/glx/glxglvnd.c b/src/glx/glxglvnd.c index 2fc9b00..b6b4151 100644 --- a/src/glx/glxglvnd.c +++ b/src/glx/glxglvnd.c @@ -1,11 +1,11 @@ #include +#include #include #include "glvnd/libglxabi.h" #include "glxglvnd.h" - static Bool __glXGLVNDIsScreenSupported(Display *dpy, int screen) { /* TODO: Think of a better heuristic... */ @@ -17,26 +17,24 @@ static void *__glXGLVNDGetProcAddress(const GLubyte *procName) return glXGetProcAddressARB(procName); } +static int +compare(const void *l, const void *r) +{ +const char *s = *(const char **)r; +return strcmp(l, s); +} + static unsigned FindGLXFunction(const GLubyte *name) { -int first = 0; -int last = DI_FUNCTION_COUNT - 1; +const char **match; -while (first <= last) { -int middle = (first + last) / 2; -int comp = strcmp(__glXDispatchTableStrings[middle], - (const char *) name); +match = bsearch(name, __glXDispatchTableStrings, DI_FUNCTION_COUNT, +sizeof(const char *), compare); -if (comp < 0) -first = middle + 1; -else if (comp > 0) -last = middle - 1; -else -return middle; -} +if (match == NULL) +return DI_FUNCTION_COUNT; -/* Just point to the dummy entry at the end of the respective table */ -return DI_FUNCTION_COUNT; +return match - __glXDispatchTableStrings; } static void *__glXGLVNDGetDispatchAddress(const GLubyte *procName) -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/2] intel: Enable EGL_KHR_gl_texture_3D_image
This extension is a prerequisite for EGL 1.5, but the Intel drivers don't report support for it, and I'm not really sure why, the driver code certainly looks prepared for it. That said, I haven't tested either of these patches, and I'm not aware of any apps using the feature (certainly nothing in piglit). - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] i965: Enable EGL_KHR_gl_texture_3D_image
Signed-off-by: Adam Jackson --- src/mesa/drivers/dri/i965/intel_screen.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c index 82d4203..63b02530 100644 --- a/src/mesa/drivers/dri/i965/intel_screen.c +++ b/src/mesa/drivers/dri/i965/intel_screen.c @@ -916,6 +916,9 @@ brw_query_renderer_integer(__DRIscreen *dri_screen, case __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE: value[0] = 1; return 0; + case __DRI2_RENDERER_HAS_TEXTURE_3D: + value[0] = 1; + return 0; default: return driQueryRendererIntegerCommon(dri_screen, param, value); } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] i915: Enable EGL_KHR_gl_texture_3D_image
Signed-off-by: Adam Jackson --- src/mesa/drivers/dri/i915/intel_screen.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c index 19f7a6a..a78e250 100644 --- a/src/mesa/drivers/dri/i915/intel_screen.c +++ b/src/mesa/drivers/dri/i915/intel_screen.c @@ -748,6 +748,9 @@ i915_query_renderer_integer(__DRIscreen *psp, int param, unsigned int *value) case __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE: value[0] = 1; return 0; + case __DRI2_RENDERER_HAS_TEXTURE_3D: + value[0] = 1; + return 0; default: return driQueryRendererIntegerCommon(psp, param, value); } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 13/14] egl: Track EGL_KHR_debug state when going through EGL API calls (v3)
On Fri, 2016-09-16 at 18:33 +0100, Emil Velikov wrote: > But regardless, this and v2 14/14 look a lot better and are > > Reviewed-by: Emil Velikov Merged, thanks. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] reviewers: Throw myself on the GLX grenade
Signed-off-by: Adam Jackson --- REVIEWERS | 4 1 file changed, 4 insertions(+) diff --git a/REVIEWERS b/REVIEWERS index f7574b3..f822421 100644 --- a/REVIEWERS +++ b/REVIEWERS @@ -104,3 +104,7 @@ F: src/egl/drivers/dri2/platform_wayland.c FREEDRENO R: Rob Clark F: src/gallium/drivers/freedreno/ + +GLX +R: Adam Jackson +F: src/glx/ -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dri2: Insert a synchronisation point for glXWaitX
On Tue, 2016-08-16 at 15:55 +0100, Chris Wilson wrote: > On Mon, Aug 17, 2015 at 03:17:30PM -0700, Eric Anholt wrote: > > > > I think XSync makes more sense. It's cheaper, and it does exactly what > > you're supposed to do at this point -- make sure that all your X > > requests have been processed, so that any GL batchbuffer flushes happen > > after that. > > Quoting Adam Jackson: > > This is a bit incorrect. For direct contexts, DRI2's WaitX becomes > DRI2CopyRegion from real-front to fake-front. That _does_ generate a > reply, but whether it flushes the X rendering queue appears to be up to > the driver's CopyRegion{,2} hook Just to be screechingly precise: WaitX is not "wait for a reply so you know your requests have been heard", it's "guarantee that X rendering has flushed through enough that GL can see it". The only core X request that comes close to the same semantics is GetImage [1]. If you only have MMIO hardware, like an Indy or a Voodoo, then XSync would be as strong as WaitX. If you have a single command queue, then XSync is as strong as WaitX if the server flushes its rendering at FlushCallback. But even single-queue hardware might implement WaitX as "acquire breadcrumb for X's rendering queue, insert pipeline bubble for that breadcrumb into requesting client's GL queue in kernel", which is what the "does not require a round-trip" language in the WaitX man page is about. [1] - Even then, it would arguably be legal for the server to cheat. ClearWindow followed by a 1x1 GetImage could just return the bg pixel and leave the fill enqueued to the hardware. Whether that's a server you want to run is merely a quality-of-implementation issue. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dri2: Insert a synchronisation point for glXWaitX
On Wed, 2016-08-17 at 08:17 -0700, Eric Anholt wrote: > All I'm saying is that it's the thing that was intentionally used for > this purpose in DRI1 and early DRI2, and maybe if it works we shouldn't > just accidentally drop it in a refactor. I don't see how the patch in this thread does that. I confess I've been looped in on this somewhat late, so if there's another thread I should be looking at for context... > I wholeheartedly endorse fixing glXWaitX to DTRT and using it. Having > written about how it's the right way a bunch, are you planning on > writing a piglit test and the patch? Or should it go somewhere on my > list (it's not near the top)? It's somewhat difficult to write a test for it that fails reliably for even one driver lets alone multiple, but I'm sure I can provoke DRI2 into doing something stupid. I'll see what I can come up with. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] dri2: Insert a synchronisation point for glXWaitX
On Wed, 2016-08-17 at 17:50 +0100, Chris Wilson wrote: > On Wed, Aug 17, 2016 at 12:13:23PM -0400, Adam Jackson wrote: > > > > On Wed, 2016-08-17 at 08:17 -0700, Eric Anholt wrote: > > > > > > > > All I'm saying is that it's the thing that was intentionally used for > > > this purpose in DRI1 and early DRI2, and maybe if it works we shouldn't > > > just accidentally drop it in a refactor. > > > > I don't see how the patch in this thread does that. I confess I've been > > looped in on this somewhat late, so if there's another thread I should be > > looking at for context... > > By calling invalidate on the drawable, before the backend will use the > surface (either as a texture or as a renderable) it will do a > DRI2GetBuffers() round trip. (It is also likely that the buffer will > have been invalidated in the meantime and alreadly pending the round > trip.) That provides the server with a definite point at which it can > insert a synchronisation barrier. I understand that. I don't understand how that counts as "dropping" any round trips with the server. If anything it's adding one. The patch does not remove the copy from real to fake front, which request is already a round trip. In fact I'd think the ddx ought to treat that copy as a cue to flush X rendering in any case, since that would also cover the equivalent path for indirect contexts. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glx/glvnd: list the strcmp arguments in correct order
On Thu, 2016-09-01 at 10:36 +0100, Emil Velikov wrote: > > From: Emil Velikov > > Currently, due to the inverse order, strcmp will produce negative result > when the needle is towards the start of the haystack. Thus on the next > iteration(s) we'll end up further towards the end and eventually fail to > locate the entry. > > > Cc: "12.0" > Signed-off-by: Emil Velikov This still sucks because the dispatch table contains doubled "glX" prefixes in a couple of places, so the table isn't actually sorted. Also, open-coding a binary search is a sin. Better patch sent. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glvnd: Fix dynamic GLX entrypoint lookup
The dynamic dispatch table needs to be sorted properly, the entrypoints shouldn't duplicate the 'glX' prefix, and please just use bsearch() instead of open-coding it. Signed-off-by: Adam Jackson --- src/glx/g_glxglvnddispatchfuncs.c | 254 ++-- src/glx/g_glxglvnddispatchindices.h | 36 ++--- src/glx/glxglvnd.c | 32 ++--- 3 files changed, 161 insertions(+), 161 deletions(-) diff --git a/src/glx/g_glxglvnddispatchfuncs.c b/src/glx/g_glxglvnddispatchfuncs.c index e6b9c0b..b5e3398 100644 --- a/src/glx/g_glxglvnddispatchfuncs.c +++ b/src/glx/g_glxglvnddispatchfuncs.c @@ -17,16 +17,19 @@ const char * const __glXDispatchTableStrings[DI_LAST_INDEX] = { #define __ATTRIB(field) \ [DI_##field] = "glX"#field +__ATTRIB(BindSwapBarrierSGIX), __ATTRIB(BindTexImageEXT), // glXChooseFBConfig implemented by libglvnd __ATTRIB(ChooseFBConfigSGIX), // glXChooseVisual implemented by libglvnd // glXCopyContext implemented by libglvnd +__ATTRIB(CopySubBufferMESA), // glXCreateContext implemented by libglvnd __ATTRIB(CreateContextAttribsARB), __ATTRIB(CreateContextWithConfigSGIX), __ATTRIB(CreateGLXPbufferSGIX), // glXCreateGLXPixmap implemented by libglvnd +__ATTRIB(CreateGLXPixmapMESA), __ATTRIB(CreateGLXPixmapWithConfigSGIX), // glXCreateNewContext implemented by libglvnd // glXCreatePbuffer implemented by libglvnd @@ -51,54 +54,50 @@ const char * const __glXDispatchTableStrings[DI_LAST_INDEX] = { __ATTRIB(GetFBConfigAttribSGIX), __ATTRIB(GetFBConfigFromVisualSGIX), // glXGetFBConfigs implemented by libglvnd +__ATTRIB(GetMscRateOML), // glXGetProcAddress implemented by libglvnd // glXGetProcAddressARB implemented by libglvnd +__ATTRIB(GetScreenDriver), // glXGetSelectedEvent implemented by libglvnd __ATTRIB(GetSelectedEventSGIX), +__ATTRIB(GetSwapIntervalMESA), +__ATTRIB(GetSyncValuesOML), __ATTRIB(GetVideoSyncSGI), // glXGetVisualFromFBConfig implemented by libglvnd __ATTRIB(GetVisualFromFBConfigSGIX), // glXImportContextEXT implemented by libglvnd // glXIsDirect implemented by libglvnd +__ATTRIB(JoinSwapGroupSGIX), // glXMakeContextCurrent implemented by libglvnd // glXMakeCurrent implemented by libglvnd // glXQueryContext implemented by libglvnd __ATTRIB(QueryContextInfoEXT), +__ATTRIB(QueryCurrentRendererIntegerMESA), +__ATTRIB(QueryCurrentRendererStringMESA), // glXQueryDrawable implemented by libglvnd // glXQueryExtension implemented by libglvnd // glXQueryExtensionsString implemented by libglvnd __ATTRIB(QueryGLXPbufferSGIX), +__ATTRIB(QueryMaxSwapBarriersSGIX), +__ATTRIB(QueryRendererIntegerMESA), +__ATTRIB(QueryRendererStringMESA), // glXQueryServerString implemented by libglvnd // glXQueryVersion implemented by libglvnd +__ATTRIB(ReleaseBuffersMESA), __ATTRIB(ReleaseTexImageEXT), // glXSelectEvent implemented by libglvnd __ATTRIB(SelectEventSGIX), // glXSwapBuffers implemented by libglvnd +__ATTRIB(SwapBuffersMscOML), +__ATTRIB(SwapIntervalMESA), __ATTRIB(SwapIntervalSGI), // glXUseXFont implemented by libglvnd +__ATTRIB(WaitForMscOML), +__ATTRIB(WaitForSbcOML), // glXWaitGL implemented by libglvnd __ATTRIB(WaitVideoSyncSGI), // glXWaitX implemented by libglvnd -__ATTRIB(glXBindSwapBarrierSGIX), -__ATTRIB(glXCopySubBufferMESA), -__ATTRIB(glXCreateGLXPixmapMESA), -__ATTRIB(glXGetMscRateOML), -__ATTRIB(glXGetScreenDriver), -__ATTRIB(glXGetSwapIntervalMESA), -__ATTRIB(glXGetSyncValuesOML), -__ATTRIB(glXJoinSwapGroupSGIX), -__ATTRIB(glXQueryCurrentRendererIntegerMESA), -__ATTRIB(glXQueryCurrentRendererStringMESA), -__ATTRIB(glXQueryMaxSwapBarriersSGIX), -__ATTRIB(glXQueryRendererIntegerMESA), -__ATTRIB(glXQueryRendererStringMESA), -__ATTRIB(glXReleaseBuffersMESA), -__ATTRIB(glXSwapBuffersMscOML), -__ATTRIB(glXSwapIntervalMESA), -__ATTRIB(glXWaitForMscOML), -__ATTRIB(glXWaitForSbcOML), - #undef __ATTRIB }; @@ -557,49 +556,49 @@ static int dispatch_WaitVideoSyncSGI(int divisor, int remainder, -static void dispatch_glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, +static void dispatch_BindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier) { -PFNGLXBINDSWAPBARRIERSGIXPROC pglXBindSwapBarrierSGIX; +PFNGLXBINDSWAPBARRIERSGIXPROC pBindSwapBarrierSGIX; __GLXvendorInfo *dd; dd = GetDispatchFromDrawable(dpy, drawable); if (dd == NULL) return; -__FETCH_FUNCTION_PTR(glXBindSwapBarrierSGIX); -if (pglXBindSwapBarrierSGIX == NULL) +__FETCH_FUNCTION_PTR(BindSwapBarrierSGIX); +if (pBindSwapBarrierSGIX == NULL) return; -(*pglXBindSwapB
Re: [Mesa-dev] [PATCH 4/6] EGL: Call the EGL_KHR_debug callback on errors.
On Wed, 2016-07-06 at 10:33 -0600, Kyle Brenneman wrote: > @@ -292,6 +292,24 @@ _eglError(EGLint errCode, const char *msg) > return EGL_FALSE; > } > > +EGLBoolean > +_eglError(EGLint errCode, const char *msg) > +{ > + if (errCode != EGL_SUCCESS) { > + EGLint type; > + if (errCode == EGL_BAD_ALLOC) { > + type = EGL_DEBUG_MSG_CRITICAL_KHR; > + } else { > + type = EGL_DEBUG_MSG_ERROR_KHR; > + } > + > + _eglDebugReport(errCode, NULL, msg, type, NULL, NULL); > + } else { > + _eglInternalError(errCode, msg); > + } > + return EGL_FALSE; > +} I don't think this can be right? _eglDebugReport ends with: if (type == EGL_DEBUG_MSG_CRITICAL_KHR || type == EGL_DEBUG_MSG_ERROR_KHR) { _eglError(error, command); } So this looks like it could mutually recurse until you run out of stack space and crash. I'll try to write a test to prove the point but maybe I'm missing something about how this is meant to work. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] EGL: Combine the GL and GLES current contexts (v2)
From: Kyle Brenneman Only keep track of a single current context, instead of separate contexts for GL and GLES. In EGL 1.4 (and 1.5), EGL_OPENGL_API and EGL_OPENGL_ES_API are supposed to be interchangeable for all purposes except for eglCreateContext. The _EGLThreadInfo::CurrentContexts array is now a single pointer to the current context, which may be a GL or GLES context. In addition, it now keeps track of the current API as an enum instead of an index. eglMakeCurrent will now replace the current context, regardless of which client API is used for for the current and new contexts. It no longer checks for a conflicting context. In addition, calling eglMakeCurrent with EGL_NO_CONTEXT will now release the current context regardless of the current API. v2: Rebased against master (Adam Jackson) Reviewed-by: Adam Jackson --- src/egl/main/eglapi.c | 42 -- src/egl/main/eglcontext.c | 31 --- src/egl/main/eglcurrent.c | 15 ++- src/egl/main/eglcurrent.h | 41 - 4 files changed, 22 insertions(+), 107 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 4700dbe..df2dcd6 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1088,18 +1088,8 @@ eglWaitClient(void) EGLBoolean EGLAPIENTRY eglWaitGL(void) { - _EGLThreadInfo *t = _eglGetCurrentThread(); - EGLint api_index = t->CurrentAPIIndex; - EGLint es_index = _eglConvertApiToIndex(EGL_OPENGL_ES_API); - EGLBoolean ret; - - if (api_index != es_index && _eglIsCurrentThreadDummy()) - RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_FALSE); - - t->CurrentAPIIndex = es_index; - ret = eglWaitClient(); - t->CurrentAPIIndex = api_index; - return ret; + /* Since we only support OpenGL and GLES, eglWaitGL is equivalent to eglWaitClient. */ + return eglWaitClient(); } @@ -1222,7 +1212,7 @@ eglBindAPI(EGLenum api) if (!_eglIsApiValid(api)) RETURN_EGL_ERROR(NULL, EGL_BAD_PARAMETER, EGL_FALSE); - t->CurrentAPIIndex = _eglConvertApiToIndex(api); + t->CurrentAPI = api; RETURN_EGL_SUCCESS(NULL, EGL_TRUE); } @@ -1238,7 +1228,7 @@ eglQueryAPI(void) EGLenum ret; /* returns one of EGL_OPENGL_API, EGL_OPENGL_ES_API or EGL_OPENVG_API */ - ret = _eglConvertApiFromIndex(t->CurrentAPIIndex); + ret = t->CurrentAPI; RETURN_EGL_SUCCESS(NULL, ret); } @@ -1271,25 +1261,17 @@ eglReleaseThread(void) /* unbind current contexts */ if (!_eglIsCurrentThreadDummy()) { _EGLThreadInfo *t = _eglGetCurrentThread(); - EGLint api_index = t->CurrentAPIIndex; - EGLint i; - for (i = 0; i < _EGL_API_NUM_APIS; i++) { - _EGLContext *ctx = t->CurrentContexts[i]; - if (ctx) { -_EGLDisplay *disp = ctx->Resource.Display; -_EGLDriver *drv; + _EGLContext *ctx = t->CurrentContext; + if (ctx) { + _EGLDisplay *disp = ctx->Resource.Display; + _EGLDriver *drv; -t->CurrentAPIIndex = i; - -mtx_lock(&disp->Mutex); -drv = disp->Driver; -(void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL); -mtx_unlock(&disp->Mutex); - } + mtx_lock(&disp->Mutex); + drv = disp->Driver; + (void) drv->API.MakeCurrent(drv, disp, NULL, NULL, NULL); + mtx_unlock(&disp->Mutex); } - - t->CurrentAPIIndex = api_index; } _eglDestroyCurrentThread(); diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index ae19862..ebc004d 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -557,20 +557,16 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c, static _EGLContext * _eglBindContextToThread(_EGLContext *ctx, _EGLThreadInfo *t) { - EGLint apiIndex; _EGLContext *oldCtx; - apiIndex = (ctx) ? - _eglConvertApiToIndex(ctx->ClientAPI) : t->CurrentAPIIndex; - - oldCtx = t->CurrentContexts[apiIndex]; + oldCtx = t->CurrentContext; if (ctx != oldCtx) { if (oldCtx) oldCtx->Binding = NULL; if (ctx) ctx->Binding = t; - t->CurrentContexts[apiIndex] = ctx; + t->CurrentContext = ctx; } return oldCtx; @@ -585,7 +581,6 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read) { _EGLThreadInfo *t = _eglGetCurrentThread(); _EGLDisplay *dpy; - EGLint conflict_api; if (_eglIsCurrentThreadDummy()) return _eglError(EGL_BAD_ALLOC, "eglMakeCurrent"); @@ -617,13 +612,11 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read) if (ctx->Binding && ctx->Binding != t) return _eglError(EGL_BAD_ACCESS, "eglMakeCurrent"); if (draw && draw->CurrentContex
Re: [Mesa-dev] [PATCH] EGL: Combine the GL and GLES current contexts (v2)
On Wed, 2016-09-07 at 11:15 -0400, Adam Jackson wrote: > From: Kyle Brenneman > > Only keep track of a single current context, instead of separate > contexts for GL and GLES. In addition to fixing 1.4+ compliance, this fixes the "eglterminate then unbind context" piglit. Merged. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] EGL: Combine the GL and GLES current contexts (v2)
On Wed, 2016-09-07 at 22:07 +0100, Emil Velikov wrote: > Was going to mention this but it slipped through. Can we get a proper > spec quote in the code ? I guess the logic through eglCreateContext (the only place where the API difference matters) is a little contorted, certainly took me more than one read to figure it out. Patch sent. > If it was a separate bugfix w/o the cleanup I would have suggested > adding it to -stable. If ... Me, I'd take it for stable anyway. It's not like _egl_thread_info is ABI. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] egl: Document why EGL_OPENGL{, _ES}_API are mostly identical
Signed-off-by: Adam Jackson --- src/egl/main/eglcontext.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index ebc004d..057b60f 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -457,6 +457,16 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy, /** * Initialize the given _EGLContext object to defaults and/or the values * in the attrib_list. + * + * According to EGL 1.5 Section 3.7: + * + * "EGL_OPENGL_API and EGL_OPENGL_ES_API are interchangeable for all + * purposes except eglCreateContext." + * + * And since we only support GL and GLES, this is the only place where the + * bound API matters at all. We look up the current API from the current + * thread, and stash that in the context we're initializing. Our caller is + * responsible for determining whether that's an API it supports. */ EGLBoolean _eglInitContext(_EGLContext *ctx, _EGLDisplay *dpy, _EGLConfig *conf, -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/7] Implement EGL_KHR_debug (v2)
This rebases Kyle's series atop master (the change to treat GL and GLES identically created some merge conflicts), and ports a fix from glvnd's handling of DebugMessageControl. I'm working on piglits to cover this, and a very basic first test is on the list now. As glvnd's EGL interface essentially requires EGL_KHR_debug support from the vendor library, this should really be merged soon. Patches 4-6 have the most interesting changes to the common _EGL macros to actually wire up the debug functionality, and could use another set of eyes on them. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/7] EGL: Update eglext.h
From: Kyle Brenneman Updated eglext.h to revision 32074 from the Khronos repository. Added two #includes to egltypedefs.h. Both were in the previous version of eglext.h but not in the new one. Reviewed-by: Adam Jackson --- include/EGL/eglext.h | 36 ++-- src/egl/main/egltypedefs.h | 2 ++ 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h index 6043b37..40a2233 100644 --- a/include/EGL/eglext.h +++ b/include/EGL/eglext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2013-2014 The Khronos Group Inc. +** Copyright (c) 2013-2015 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -33,12 +33,12 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.opengl.org/registry/ ** -** Khronos $Revision$ on $Date$ +** Khronos $Revision: 32074 $ on $Date: 2015-09-30 10:36:02 -0700 (Wed, 30 Sep 2015) $ */ #include -#define EGL_EGLEXT_VERSION 20150508 +#define EGL_EGLEXT_VERSION 20150930 /* Generated C header for: * API: egl @@ -99,6 +99,33 @@ EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, #define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3 #endif /* EGL_KHR_create_context_no_error */ +#ifndef EGL_KHR_debug +#define EGL_KHR_debug 1 +typedef void *EGLLabelKHR; +typedef void *EGLObjectKHR; +typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message); +#define EGL_OBJECT_THREAD_KHR 0x33B0 +#define EGL_OBJECT_DISPLAY_KHR0x33B1 +#define EGL_OBJECT_CONTEXT_KHR0x33B2 +#define EGL_OBJECT_SURFACE_KHR0x33B3 +#define EGL_OBJECT_IMAGE_KHR 0x33B4 +#define EGL_OBJECT_SYNC_KHR 0x33B5 +#define EGL_OBJECT_STREAM_KHR 0x33B6 +#define EGL_DEBUG_MSG_CRITICAL_KHR0x33B9 +#define EGL_DEBUG_MSG_ERROR_KHR 0x33BA +#define EGL_DEBUG_MSG_WARN_KHR0x33BB +#define EGL_DEBUG_MSG_INFO_KHR0x33BC +#define EGL_DEBUG_CALLBACK_KHR0x33B8 +typedef EGLint (EGLAPIENTRYP PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib *value); +typedef EGLint (EGLAPIENTRYP PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDebugKHR (EGLint attribute, EGLAttrib *value); +EGLAPI EGLint EGLAPIENTRY eglLabelObjectKHR (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); +#endif +#endif /* EGL_KHR_debug */ + #ifndef EGL_KHR_fence_sync #define EGL_KHR_fence_sync 1 typedef khronos_utime_nanoseconds_t EGLTimeKHR; @@ -879,9 +906,6 @@ EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); #define EGL_NATIVE_SURFACE_TIZEN 0x32A1 #endif /* EGL_TIZEN_image_native_surface */ -#include -#include - #ifdef __cplusplus } #endif diff --git a/src/egl/main/egltypedefs.h b/src/egl/main/egltypedefs.h index 7facdb4..f20af44 100644 --- a/src/egl/main/egltypedefs.h +++ b/src/egl/main/egltypedefs.h @@ -33,6 +33,8 @@ #include #include +#include +#include #include "eglcompiler.h" -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/7] EGL: Record the debug object label in _EGLThreadInfo
From: Kyle Brenneman Added a field to _EGLThreadInfo to hold the object label for the current EGL function call. Changed the _EGL_FUNC_START macro and _eglSetFuncName function to take an object type enum and an _EGLResource pointer, which it uses to fill in the object label. Removed the command name and object label parameters from _eglDebugReport, and made it look them up from the current _EGLThreadInfo. Added a separate _eglDebugReportFull function to allow the caller to specify the command and label. Reviewed-by: Adam Jackson --- src/egl/main/eglapi.c | 183 ++ src/egl/main/eglcurrent.c | 47 src/egl/main/eglcurrent.h | 23 +++--- 3 files changed, 149 insertions(+), 104 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 087077d..a684b43 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -250,9 +250,9 @@ _eglUnlockDisplay(_EGLDisplay *dpy) mtx_unlock(&dpy->Mutex); } -#define _EGL_FUNC_START(disp, ret) \ +#define _EGL_FUNC_START(disp, objectType, object, ret) \ do { \ - if (!_eglSetFuncName(__func__)) { \ + if (!_eglSetFuncName(__func__, disp, objectType, (_EGLResource *) object)) { \ if (disp) \ _eglUnlockDisplay(disp); \ return ret; \ @@ -260,14 +260,32 @@ _eglUnlockDisplay(_EGLDisplay *dpy) } while(0) static EGLBoolean -_eglSetFuncName(const char *funcName) +_eglSetFuncName(const char *funcName, _EGLDisplay *disp, EGLenum objectType, _EGLResource *object) { _EGLThreadInfo *thr = _eglGetCurrentThread(); if (!_eglIsCurrentThreadDummy()) { thr->CurrentFuncName = funcName; + thr->CurrentObjectLabel = NULL; + + if (objectType == EGL_OBJECT_THREAD_KHR) { + thr->CurrentObjectLabel = thr->Label; + } else if (objectType == EGL_OBJECT_DISPLAY_KHR) { + if (disp != NULL) { +thr->CurrentObjectLabel = disp->Label; + } + } else { + /* + * Everything else will either be NULL or a valid _EGLResource + * pointer. + */ + if (object != NULL) { +thr->CurrentObjectLabel = object->Label; + } + } + return EGL_TRUE; } else { - _eglDebugReport(EGL_BAD_ALLOC, funcName, funcName, EGL_DEBUG_MSG_CRITICAL_KHR, NULL, NULL); + _eglDebugReportFull(EGL_BAD_ALLOC, funcName, funcName, EGL_DEBUG_MSG_CRITICAL_KHR, NULL, NULL); return EGL_FALSE; } } @@ -308,7 +326,7 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay) _EGLDisplay *dpy; void *native_display_ptr; - _EGL_FUNC_START(NULL, EGL_NO_DISPLAY); + _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_NO_DISPLAY); STATIC_ASSERT(sizeof(void*) == sizeof(nativeDisplay)); native_display_ptr = (void*) nativeDisplay; @@ -324,7 +342,7 @@ eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, { _EGLDisplay *dpy; - _EGL_FUNC_START(NULL, EGL_NO_DISPLAY); + _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_NO_DISPLAY); switch (platform) { #ifdef HAVE_X11_PLATFORM @@ -358,7 +376,7 @@ eglGetPlatformDisplay(EGLenum platform, void *native_display, EGLDisplay display; EGLint *int_attribs; - _EGL_FUNC_START(NULL, EGL_NO_DISPLAY); + _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_NO_DISPLAY); int_attribs = _eglConvertAttribsToInt(attrib_list); if (attrib_list && !int_attribs) @@ -501,7 +519,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { _EGLDisplay *disp = _eglLockDisplay(dpy); - _EGL_FUNC_START(disp, EGL_FALSE); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); if (!disp) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); @@ -553,7 +571,7 @@ eglTerminate(EGLDisplay dpy) { _EGLDisplay *disp = _eglLockDisplay(dpy); - _EGL_FUNC_START(disp, EGL_FALSE); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); if (!disp) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); @@ -577,13 +595,13 @@ eglQueryString(EGLDisplay dpy, EGLint name) _EGLDisplay *disp; _EGLDriver *drv; - _EGL_FUNC_START(NULL, NULL); - if (dpy == EGL_NO_DISPLAY && name == EGL_EXTENSIONS) { RETURN_EGL_SUCCESS(NULL, _eglGlobal.ClientExtensionString); } disp = _eglLockDisplay(dpy); + + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL); _EGL_CHECK_DISPLAY(disp, NULL, drv); switch (name) { @@ -609,7 +627,7 @@ eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, _EGLDriver *drv; EGLBoolean ret; - _EGL_FUNC_START(disp, EGL_FALSE); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config); @@ -626,7 +644,7 @@ eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLCo
[Mesa-dev] [PATCH 2/7] EGL: Implement eglLabelObjectKHR
From: Kyle Brenneman Added a label to the _EGLThreadInfo, _EGLDisplay, and EGLResource structs. Implemented the function eglLabelObjectKHR. Reviewed-by: Adam Jackson --- src/egl/main/eglapi.c | 63 +++ src/egl/main/eglcurrent.c | 9 +++ src/egl/main/eglcurrent.h | 4 +++ src/egl/main/egldisplay.h | 4 +++ 4 files changed, 80 insertions(+) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index df2dcd6..31b842f 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1791,6 +1791,68 @@ eglExportDMABUFImageMESA(EGLDisplay dpy, EGLImage image, RETURN_EGL_EVAL(disp, ret); } +static EGLint EGLAPIENTRY +eglLabelObjectKHR( + EGLDisplay dpy, + EGLenum objectType, + EGLObjectKHR object, + EGLLabelKHR label) +{ + if (objectType == EGL_OBJECT_THREAD_KHR) { + _EGLThreadInfo *t = _eglGetCurrentThread(); + if (!_eglIsCurrentThreadDummy()) { + t->Label = label; + } + return EGL_SUCCESS; + } else { + _EGLDisplay *disp = _eglLookupDisplay(dpy); + if (disp == NULL) { + _eglError(EGL_BAD_DISPLAY, "eglLabelObjectKHR"); + return EGL_BAD_DISPLAY; + } + + if (objectType == EGL_OBJECT_DISPLAY_KHR) { + if (dpy != (EGLDisplay) object) { +_eglError(EGL_BAD_PARAMETER, "eglLabelObjectKHR"); +return EGL_BAD_PARAMETER; + } + disp->Label = label; + return EGL_SUCCESS; + } else { + _EGLResourceType type; + switch (objectType) + { +case EGL_OBJECT_CONTEXT_KHR: + type = _EGL_RESOURCE_CONTEXT; + break; +case EGL_OBJECT_SURFACE_KHR: + type = _EGL_RESOURCE_SURFACE; + break; +case EGL_OBJECT_IMAGE_KHR: + type = _EGL_RESOURCE_IMAGE; + break; +case EGL_OBJECT_SYNC_KHR: + type = _EGL_RESOURCE_SYNC; + break; +case EGL_OBJECT_STREAM_KHR: +default: +_eglError(EGL_BAD_PARAMETER, "eglLabelObjectKHR"); + return EGL_BAD_PARAMETER; + } + + if (_eglCheckResource(object, type, disp)) { +_EGLResource *res = (_EGLResource *) object; +res->Label = label; +return EGL_SUCCESS; + } else { +_eglError(EGL_BAD_PARAMETER, "eglLabelObjectKHR"); +return EGL_BAD_PARAMETER; + } + } + } +} + + __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname) { @@ -1870,6 +1932,7 @@ eglGetProcAddress(const char *procname) { "eglGetSyncValuesCHROMIUM", (_EGLProc) eglGetSyncValuesCHROMIUM }, { "eglExportDMABUFImageQueryMESA", (_EGLProc) eglExportDMABUFImageQueryMESA }, { "eglExportDMABUFImageMESA", (_EGLProc) eglExportDMABUFImageMESA }, + { "eglLabelObjectKHR", (_EGLProc) eglLabelObjectKHR }, { NULL, NULL } }; EGLint i; diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c index 345f4cc..6dd6f4c 100644 --- a/src/egl/main/eglcurrent.c +++ b/src/egl/main/eglcurrent.c @@ -279,3 +279,12 @@ _eglError(EGLint errCode, const char *msg) return EGL_FALSE; } + +/** + * Returns the label set for the current thread. + */ +EGLLabelKHR _eglGetThreadLabel(void) +{ + _EGLThreadInfo *t = _eglGetCurrentThread(); + return t->Label; +} diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h index b922435..e139271 100644 --- a/src/egl/main/eglcurrent.h +++ b/src/egl/main/eglcurrent.h @@ -54,6 +54,7 @@ struct _egl_thread_info EGLint LastError; _EGLContext *CurrentContext; EGLenum CurrentAPI; + EGLLabelKHR Label; }; @@ -91,6 +92,9 @@ _eglGetCurrentContext(void); extern EGLBoolean _eglError(EGLint errCode, const char *msg); +extern EGLLabelKHR +_eglGetThreadLabel(void); + #ifdef __cplusplus } diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 6bfc858..d27f63a 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -79,6 +79,8 @@ struct _egl_resource EGLBoolean IsLinked; EGLint RefCount; + EGLLabelKHR Label; + /* used to link resources of the same type */ _EGLResource *Next; }; @@ -165,6 +167,8 @@ struct _egl_display /* lists of resources */ _EGLResource *ResourceLists[_EGL_NUM_RESOURCES]; + + EGLLabelKHR Label; }; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/7] EGL: Implement remaining functions from EGL_KHR_debug
From: Kyle Brenneman Implemented eglDebugMessageControlKHR and eglQueryDebugKHR. Added entries in _egl_global to hold the debug callback and the set of enabled message types. Added a _eglDebugReport function to report a debug message, plus some macros for each of the message types. Still to do is to replace existing calls to _eglError with _eglDebugReport. Reviewed-by: Adam Jackson --- src/egl/main/eglapi.c | 64 +++ src/egl/main/eglcurrent.c | 37 +-- src/egl/main/eglcurrent.h | 15 +++ src/egl/main/eglglobals.c | 5 +++- src/egl/main/eglglobals.h | 15 +++ 5 files changed, 133 insertions(+), 3 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 31b842f..e5b098e 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1852,6 +1852,68 @@ eglLabelObjectKHR( } } +static EGLint +eglDebugMessageControlKHR(EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list) +{ + mtx_lock(_eglGlobal.Mutex); + + if (callback != NULL) { + if (attrib_list != NULL) { + unsigned int newEnabled = _eglGlobal.debugTypesEnabled; + int i; + + for (i = 0; attrib_list[i] != EGL_NONE; i += 2) { +if (attrib_list[i] >= EGL_DEBUG_MSG_CRITICAL_KHR && + attrib_list[i] <= EGL_DEBUG_MSG_INFO_KHR) { + if (attrib_list[i + 1]) { + newEnabled |= DebugBitFromType(attrib_list[i]); + } else { + newEnabled &= ~DebugBitFromType(attrib_list[i]); + } +} else { + // On error, set the last error code, call the current + // debug callback, and return the error code. + mtx_unlock(_eglGlobal.Mutex); + _eglReportError(EGL_BAD_ATTRIBUTE, "eglDebugMessageControlKHR", NULL, + "Invalid attribute 0x%04lx", (unsigned long) attrib_list[i]); + return EGL_BAD_ATTRIBUTE; +} + } + + _eglGlobal.debugCallback = callback; + _eglGlobal.debugTypesEnabled = newEnabled; + } + } else { + _eglGlobal.debugCallback = NULL; + _eglGlobal.debugTypesEnabled = _EGL_DEBUG_BIT_CRITICAL | _EGL_DEBUG_BIT_ERROR; + } + + mtx_unlock(_eglGlobal.Mutex); + return EGL_SUCCESS; +} + +static EGLBoolean +eglQueryDebugKHR(EGLint attribute, EGLAttrib *value) +{ + mtx_lock(_eglGlobal.Mutex); + if (attribute >= EGL_DEBUG_MSG_CRITICAL_KHR && + attribute <= EGL_DEBUG_MSG_INFO_KHR) { + if (_eglGlobal.debugTypesEnabled & DebugBitFromType(attribute)) { + *value = EGL_TRUE; + } else { + *value = EGL_FALSE; + } + } else if (attribute == EGL_DEBUG_CALLBACK_KHR) { + *value = (EGLAttrib) _eglGlobal.debugCallback; + } else { + mtx_unlock(_eglGlobal.Mutex); + _eglReportError(EGL_BAD_ATTRIBUTE, "eglQueryDebugKHR", NULL, + "Invalid attribute 0x%04lx", (unsigned long) attribute); + return EGL_FALSE; + } + mtx_unlock(_eglGlobal.Mutex); + return EGL_TRUE; +} __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname) @@ -1933,6 +1995,8 @@ eglGetProcAddress(const char *procname) { "eglExportDMABUFImageQueryMESA", (_EGLProc) eglExportDMABUFImageQueryMESA }, { "eglExportDMABUFImageMESA", (_EGLProc) eglExportDMABUFImageMESA }, { "eglLabelObjectKHR", (_EGLProc) eglLabelObjectKHR }, + { "eglDebugMessageControlKHR", (_EGLProc) eglDebugMessageControlKHR }, + { "eglQueryDebugKHR", (_EGLProc) eglQueryDebugKHR }, { NULL, NULL } }; EGLint i; diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c index 6dd6f4c..83db229 100644 --- a/src/egl/main/eglcurrent.c +++ b/src/egl/main/eglcurrent.c @@ -26,8 +26,10 @@ **/ +#include #include #include +#include #include "c99_compat.h" #include "c11/threads.h" @@ -35,7 +37,6 @@ #include "eglcurrent.h" #include "eglglobals.h" - /* This should be kept in sync with _eglInitThreadInfo() */ #define _EGL_THREAD_INFO_INITIALIZER \ { EGL_SUCCESS, { NULL }, 0 } @@ -283,8 +284,40 @@ _eglError(EGLint errCode, const char *msg) /** * Returns the label set for the current thread. */ -EGLLabelKHR _eglGetThreadLabel(void) +EGLLabelKHR +_eglGetThreadLabel(void) { _EGLThreadInfo *t = _eglGetCurrentThread(); return t->Label; } + +void +_eglDebugReport(EGLenum error, const char *command, EGLint type, EGLLabelKHR objectLabel, const char *message, ...) +{ + EGLDEBUGPROCKHR callback = NULL; + + mtx_lock(_eglGlobal.Mutex); + if (_eglGlobal.debugTypesEnabled & DebugBitFromType(type)) { + callback = _eglGlobal.debugCallba
[Mesa-dev] [PATCH 4/7] EGL: Call the EGL_KHR_debug callback on errors
From: Kyle Brenneman Added a member to _EGLThreadInfo to hold the name of the current EGL function. Each EGL entrypoint will now set that at the beginning. _eglError will now call the debug callback function, using the function name stored in the current _EGLThreadInfo struct. This should allow the EGL_KHR_debug callback to work correctly without having to rewrite all of the _eglError calls. It also avoids having to pass the EGL function names down to driver and platform functions that may be called from multiple entrypoints. This is really the bare minimum functionality for EGL_KHR_debug, since the callback will be missing object labels and messages in most cases. Later changes can update the _eglError calls to provide more info. Reviewed-by: Adam Jackson --- src/egl/main/eglapi.c | 142 -- src/egl/main/eglcurrent.c | 35 ++-- src/egl/main/eglcurrent.h | 26 + src/egl/main/eglglobals.c | 5 +- 4 files changed, 187 insertions(+), 21 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index e5b098e..087077d 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -250,6 +250,27 @@ _eglUnlockDisplay(_EGLDisplay *dpy) mtx_unlock(&dpy->Mutex); } +#define _EGL_FUNC_START(disp, ret) \ + do { \ + if (!_eglSetFuncName(__func__)) { \ + if (disp) \ +_eglUnlockDisplay(disp); \ + return ret; \ + } \ + } while(0) + +static EGLBoolean +_eglSetFuncName(const char *funcName) +{ + _EGLThreadInfo *thr = _eglGetCurrentThread(); + if (!_eglIsCurrentThreadDummy()) { + thr->CurrentFuncName = funcName; + return EGL_TRUE; + } else { + _eglDebugReport(EGL_BAD_ALLOC, funcName, funcName, EGL_DEBUG_MSG_CRITICAL_KHR, NULL, NULL); + return EGL_FALSE; + } +} static EGLint * _eglConvertAttribsToInt(const EGLAttrib *attr_list) @@ -287,6 +308,8 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay) _EGLDisplay *dpy; void *native_display_ptr; + _EGL_FUNC_START(NULL, EGL_NO_DISPLAY); + STATIC_ASSERT(sizeof(void*) == sizeof(nativeDisplay)); native_display_ptr = (void*) nativeDisplay; @@ -301,6 +324,8 @@ eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, { _EGLDisplay *dpy; + _EGL_FUNC_START(NULL, EGL_NO_DISPLAY); + switch (platform) { #ifdef HAVE_X11_PLATFORM case EGL_PLATFORM_X11_EXT: @@ -331,8 +356,11 @@ eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list) { EGLDisplay display; - EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list); + EGLint *int_attribs; + _EGL_FUNC_START(NULL, EGL_NO_DISPLAY); + + int_attribs = _eglConvertAttribsToInt(attrib_list); if (attrib_list && !int_attribs) RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, NULL); @@ -473,6 +501,8 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGL_FUNC_START(disp, EGL_FALSE); + if (!disp) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); @@ -523,6 +553,8 @@ eglTerminate(EGLDisplay dpy) { _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGL_FUNC_START(disp, EGL_FALSE); + if (!disp) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); @@ -545,6 +577,8 @@ eglQueryString(EGLDisplay dpy, EGLint name) _EGLDisplay *disp; _EGLDriver *drv; + _EGL_FUNC_START(NULL, NULL); + if (dpy == EGL_NO_DISPLAY && name == EGL_EXTENSIONS) { RETURN_EGL_SUCCESS(NULL, _eglGlobal.ClientExtensionString); } @@ -575,6 +609,8 @@ eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_FALSE); + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config); @@ -590,6 +626,8 @@ eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_FALSE); + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs, config_size, num_config); @@ -607,6 +645,8 @@ eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_FALSE); + _EGL_CHECK_CONFIG(disp, conf, EGL_FALSE, drv); ret = drv->API.GetConfigAttrib(drv, disp, conf, attribute, value); @@ -625,6 +665,8 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, _EGLContext *context; EGLContext ret; + _EGL_FUNC_START(disp, EGL_NO_CONTEXT); + _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv); if (!config && !disp->Extensions.MESA_configless_context) @@ -648,6 +690,8 @@ eglDestroyContext(EGLDisplay dpy, EGLContex
[Mesa-dev] [PATCH 6/7] EGL: Fix some command names for EGL_KHR_debug
From: Kyle Brenneman Change a few EGL entrypoints to call a common internal function instead of forwarding to another entrypoint. If one EGL entrypoint calls another, then the second entrypoint would overwrite the current function name in the _EGLThreadInfo struct. That would cause it to pass the wrong function name to the EGL_KHR_debug callback. [ajax: Fixed up eglWaitClient] Reviewed-by: Adam Jackson --- src/egl/main/eglapi.c | 214 +- 1 file changed, 125 insertions(+), 89 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index a684b43..3bbf3de 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -326,7 +326,7 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay) _EGLDisplay *dpy; void *native_display_ptr; - _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_NO_DISPLAY); + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); STATIC_ASSERT(sizeof(void*) == sizeof(nativeDisplay)); native_display_ptr = (void*) nativeDisplay; @@ -336,14 +336,12 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay) return _eglGetDisplayHandle(dpy); } -static EGLDisplay EGLAPIENTRY -eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, +static EGLDisplay +_eglGetPlatformDisplayCommon(EGLenum platform, void *native_display, const EGLint *attrib_list) { _EGLDisplay *dpy; - _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_NO_DISPLAY); - switch (platform) { #ifdef HAVE_X11_PLATFORM case EGL_PLATFORM_X11_EXT: @@ -369,6 +367,14 @@ eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, return _eglGetDisplayHandle(dpy); } +static EGLDisplay EGLAPIENTRY +eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, + const EGLint *attrib_list) +{ + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); + return _eglGetPlatformDisplayCommon(platform, native_display, attrib_list); +} + EGLDisplay EGLAPIENTRY eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list) @@ -376,13 +382,13 @@ eglGetPlatformDisplay(EGLenum platform, void *native_display, EGLDisplay display; EGLint *int_attribs; - _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_NO_DISPLAY); + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); int_attribs = _eglConvertAttribsToInt(attrib_list); if (attrib_list && !int_attribs) RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, NULL); - display = eglGetPlatformDisplayEXT(platform, native_display, int_attribs); + display = _eglGetPlatformDisplayCommon(platform, native_display, int_attribs); free(int_attribs); return display; } @@ -788,7 +794,8 @@ eglQueryContext(EGLDisplay dpy, EGLContext ctx, static EGLSurface _eglCreateWindowSurfaceCommon(_EGLDisplay *disp, EGLConfig config, - void *native_window, const EGLint *attrib_list) + void *native_window, const EGLint *attrib_list, + EGLBoolean fromPlatform) { _EGLConfig *conf = _eglLookupConfig(config, disp); _EGLDriver *drv; @@ -797,6 +804,19 @@ _eglCreateWindowSurfaceCommon(_EGLDisplay *disp, EGLConfig config, _EGL_CHECK_CONFIG(disp, conf, EGL_NO_SURFACE, drv); +#ifdef HAVE_X11_PLATFORM + if (fromPlatform && disp->Platform == _EGL_PLATFORM_X11 && native_window != NULL) { + /* The `native_window` parameter for the X11 platform differs between + * eglCreateWindowSurface() and eglCreatePlatformPixmapSurfaceEXT(). In + * eglCreateWindowSurface(), the type of `native_window` is an Xlib + * `Window`. In eglCreatePlatformWindowSurfaceEXT(), the type is + * `Window*`. Convert `Window*` to `Window` because that's what + * dri2_x11_create_window_surface() expects. + */ + native_window = (void*) (* (Window*) native_window); + } +#endif + if (native_window == NULL) RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); @@ -816,7 +836,7 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_NO_SURFACE); STATIC_ASSERT(sizeof(void*) == sizeof(window)); return _eglCreateWindowSurfaceCommon(disp, config, (void*) window, -attrib_list); +attrib_list, EGL_FALSE); } @@ -827,22 +847,8 @@ eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, { _EGLDisplay *disp = _eglLockDisplay(dpy); _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_NO_SURFACE); - -#ifdef HAVE_X11_PLATFORM - if (disp->Platform == _EGL_PLATFORM_X11 && native_window != NULL) { - /* The `native_window` parameter for the X11 platform differs between - * eglCreateWindowSurface()
[Mesa-dev] [PATCH 7/7] egl: Fix DebugMessageControl(callback, NULL)
Treat a null attribute list as meaning "don't change attributes". This is semantically equivalent to a list consisting of just EGL_NONE. Signed-off-by: Adam Jackson --- src/egl/main/eglapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 3bbf3de..0034f1e 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -2069,9 +2069,9 @@ eglDebugMessageControlKHR(EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list } } - _eglGlobal.debugCallback = callback; _eglGlobal.debugTypesEnabled = newEnabled; } + _eglGlobal.debugCallback = callback; } else { _eglGlobal.debugCallback = NULL; _eglGlobal.debugTypesEnabled = _EGL_DEBUG_BIT_CRITICAL | _EGL_DEBUG_BIT_ERROR; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/7] EGL: Implement remaining functions from EGL_KHR_debug
On Thu, 2016-09-08 at 11:57 -0600, Kyle Brenneman wrote: > This one has the a bug in it where it doesn't set the callback if > (attrib_list == NULL), plus the more minor bug where it doesn't check > for invalid attributes if (callback == NULL). The first one is the same > bug you noticed in libglvnd, which got copied over when I adapted it for > Mesa. I can fix that and send out an updated patch if you like, or if > it's easier, I can add a commit to the end of this list. > Hah, indeed. Patch at the end of this series is probably easiest. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] egl: QueryContext on a configless context returns zero
MESA_configless_context does not specify the interaction with QueryContext at all, and the code to generate an error in this case predates the Mesa extension. Since EGL_NO_CONFIG_{KHR,MESA} are numerically identical there's no way to distinguish which one the application asked for, so use the KHR behaviour. Signed-off-by: Adam Jackson --- src/egl/main/eglcontext.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index 58740c3..7eac79a 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -538,9 +538,14 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c, switch (attribute) { case EGL_CONFIG_ID: - if (!c->Config) - return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext"); - *value = c->Config->ConfigID; + /* + * From EGL_KHR_no_config_context: + * + *"Querying EGL_CONFIG_ID returns the ID of the EGLConfig with + * respect to which the context was created, or zero if created + * without respect to an EGLConfig." + */ + *value = c->Config ? c->Config->ConfigID : 0; break; case EGL_CONTEXT_CLIENT_VERSION: *value = c->ClientMajorVersion; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/3] Implement EGL_KHR_no_config_context
KHR_no_config_context is virtually identical to MESA_configless_context, where they differ is only where the Mesa spec is silent, and for the most part the code already did what the Khronos spec wants. Fix up the one corner case, and mark the Mesa extension as superseded. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] egl: Rename MESA_configless_context bit to KHR_no_config_context
Keep the old name in the extension string, but refer to the KHR extension internally. Signed-off-by: Adam Jackson --- src/egl/drivers/dri2/egl_dri2.c | 2 +- src/egl/main/eglapi.c | 6 -- src/egl/main/eglcontext.c | 4 ++-- src/egl/main/egldisplay.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 859612f..bbc457c 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -603,8 +603,8 @@ dri2_setup_screen(_EGLDisplay *disp) disp->ClientAPIs |= EGL_OPENGL_ES3_BIT_KHR; assert(dri2_dpy->image_driver || dri2_dpy->dri2 || dri2_dpy->swrast); + disp->Extensions.KHR_no_config_context = EGL_TRUE; disp->Extensions.KHR_surfaceless_context = EGL_TRUE; - disp->Extensions.MESA_configless_context = EGL_TRUE; if (dri2_renderer_query_integer(dri2_dpy, __DRI2_RENDERER_HAS_FRAMEBUFFER_SRGB)) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index df2dcd6..ba8305e 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -406,11 +406,13 @@ _eglCreateExtensionsString(_EGLDisplay *dpy) _eglAppendExtension(&exts, "EGL_KHR_image"); _EGL_CHECK_EXTENSION(KHR_image_base); _EGL_CHECK_EXTENSION(KHR_image_pixmap); + _EGL_CHECK_EXTENSION(KHR_no_config_context); _EGL_CHECK_EXTENSION(KHR_reusable_sync); _EGL_CHECK_EXTENSION(KHR_surfaceless_context); _EGL_CHECK_EXTENSION(KHR_wait_sync); - _EGL_CHECK_EXTENSION(MESA_configless_context); + if (dpy->Extensions.KHR_no_config_context) + _eglAppendExtension(&exts, "EGL_MESA_configless_context"); _EGL_CHECK_EXTENSION(MESA_drm_image); _EGL_CHECK_EXTENSION(MESA_image_dma_buf_export); @@ -627,7 +629,7 @@ eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list, _EGL_CHECK_DISPLAY(disp, EGL_NO_CONTEXT, drv); - if (!config && !disp->Extensions.MESA_configless_context) + if (!config && !disp->Extensions.KHR_no_config_context) RETURN_EGL_ERROR(disp, EGL_BAD_CONFIG, EGL_NO_CONTEXT); if (!share && share_list != EGL_NO_CONTEXT) diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index 7eac79a..60625f6 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -642,9 +642,9 @@ _eglCheckMakeCurrent(_EGLContext *ctx, _EGLSurface *draw, _EGLSurface *read) (read && read->Config != ctx->Config)) return _eglError(EGL_BAD_MATCH, "eglMakeCurrent"); } else { - /* Otherwise we must be using the EGL_MESA_configless_context + /* Otherwise we must be using the EGL_KHR_no_config_context * extension */ - assert(dpy->Extensions.MESA_configless_context); + assert(dpy->Extensions.KHR_no_config_context); /* The extension doesn't permit binding draw and read buffers with * differing contexts */ diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 6bfc858..6f3340e 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -112,11 +112,11 @@ struct _egl_extensions EGLBoolean KHR_gl_texture_cubemap_image; EGLBoolean KHR_image_base; EGLBoolean KHR_image_pixmap; + EGLBoolean KHR_no_config_context; EGLBoolean KHR_reusable_sync; EGLBoolean KHR_surfaceless_context; EGLBoolean KHR_wait_sync; - EGLBoolean MESA_configless_context; EGLBoolean MESA_drm_image; EGLBoolean MESA_image_dma_buf_export; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] docs: Note MESA_configless_context as superseded
Signed-off-by: Adam Jackson --- docs/specs/MESA_configless_context.spec | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/specs/MESA_configless_context.spec b/docs/specs/MESA_configless_context.spec index f2fafb3..d7ba62d 100644 --- a/docs/specs/MESA_configless_context.spec +++ b/docs/specs/MESA_configless_context.spec @@ -12,11 +12,12 @@ Contact Status -Proposal +Superseded by the functionally identical EGL_KHR_no_config_context +extension. Version -Version 1, February 28, 2014 +Version 2, September 9, 2016 Number @@ -121,5 +122,8 @@ Issues Revision History +Version 2, September 9, 2016 +Defer to EGL_KHR_no_config_context (Adam Jackson) + Version 1, February 28, 2014 Initial draft (Neil Roberts) -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/7] EGL: Implement eglLabelObjectKHR
On Fri, 2016-09-09 at 11:27 +0100, Emil Velikov wrote: > > On 8 September 2016 at 18:46, Adam Jackson wrote: > > From: Kyle Brenneman > > Added a label to the _EGLThreadInfo, _EGLDisplay, and EGLResource > structs. Implemented the function eglLabelObjectKHR. > > > Coding style of the new hunk follows the GLVND one, which is _not_ > what we use in mesa/egl. Please don't do that ? Fixed in next version. > b) eglTerminate > It detaches/unlinks only contexts and surfaces (bug?). Thus even when > the display is no longer initialized we will get get to this point and > _eglCheckResource() will return true. Almost certainly a bug, patch in next version of the series. Not sure if any tests cover this bug, but I guess I'll find out. > > +/** > > + * Returns the label set for the current thread. > > + */ > > +EGLLabelKHR _eglGetThreadLabel(void) > > +{ > > + _EGLThreadInfo *t = _eglGetCurrentThread(); > > + return t->Label; > > Shouldn't the label be cleared in eglReleaseThread ? > It isn't, not explicitly, but eglReleaseThread -> _eglDestroyCurrentThread -> _eglDestroyThreadInfo which frees the struct containing the label. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 00/14] EGL_KHR_debug v3
This gets us to basically the same end state as before, but I've rearranged the sequence of changes to be a little easier to review and not introduce broken intermediate states. 01 updates eglext.h to the very latest. 02 is a bugfix for leaking images and syncs at eglTerminate, pointed out in review; technically it's an independent change. 04 through 11 factor out common code paths so that the eventual _EGL_FUNC_START macro can set the current function string correctly. 13 wires up the internals of debug state tracking, and 14 adds the user-facing API. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 13/14] egl: Track EGL_KHR_debug state when going through EGL API calls
From: Kyle Brenneman This decorates every EGL entrypoint with _EGL_FUNC_START, which records the function name and primary dispatch object label in the current thread state. It also adds debug report functions and calls them when appropriate. This would be useful enough for debugging on its own, if the user set a breakpoint when the report function was called. We will also need this state tracked in order to expose EGL_KHR_debug. --- src/egl/main/eglapi.c | 161 +++--- src/egl/main/eglcurrent.c | 89 - src/egl/main/eglcurrent.h | 22 +++ src/egl/main/eglglobals.h | 5 ++ 4 files changed, 266 insertions(+), 11 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 0477ad9..0a6ebe7 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -250,6 +250,46 @@ _eglUnlockDisplay(_EGLDisplay *dpy) mtx_unlock(&dpy->Mutex); } +static EGLBoolean +_eglSetFuncName(const char *funcName, _EGLDisplay *disp, EGLenum objectType, _EGLResource *object) +{ + _EGLThreadInfo *thr = _eglGetCurrentThread(); + if (!_eglIsCurrentThreadDummy()) { + thr->CurrentFuncName = funcName; + thr->CurrentObjectLabel = NULL; + + if (objectType == EGL_OBJECT_THREAD_KHR) { + thr->CurrentObjectLabel = thr->Label; + } else if (objectType == EGL_OBJECT_DISPLAY_KHR) { + if (disp != NULL) { +thr->CurrentObjectLabel = disp->Label; + } + } else { + /* + * Everything else will either be NULL or a valid _EGLResource + * pointer. + */ + if (object != NULL) { +thr->CurrentObjectLabel = object->Label; + } + } + + return EGL_TRUE; + } + + _eglDebugReportFull(EGL_BAD_ALLOC, funcName, funcName, + EGL_DEBUG_MSG_CRITICAL_KHR, NULL, NULL); + return EGL_FALSE; +} + +#define _EGL_FUNC_START(disp, objectType, object, ret) \ + do { \ + if (!_eglSetFuncName(__func__, disp, objectType, (_EGLResource *) object)) { \ + if (disp) \ +_eglUnlockDisplay(disp); \ + return ret; \ + } \ + } while(0) static EGLint * _eglConvertAttribsToInt(const EGLAttrib *attr_list) @@ -287,6 +327,8 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay) _EGLDisplay *dpy; void *native_display_ptr; + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); + STATIC_ASSERT(sizeof(void*) == sizeof(nativeDisplay)); native_display_ptr = (void*) nativeDisplay; @@ -330,6 +372,7 @@ static EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list) { + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); return _eglGetPlatformDisplayCommon(platform, native_display, attrib_list); } @@ -340,6 +383,8 @@ eglGetPlatformDisplay(EGLenum platform, void *native_display, EGLDisplay display; EGLint *int_attribs; + _EGL_FUNC_START(NULL, EGL_OBJECT_THREAD_KHR, NULL, EGL_NO_DISPLAY); + int_attribs = _eglConvertAttribsToInt(attrib_list); if (attrib_list && !int_attribs) RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, NULL); @@ -483,6 +528,8 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + if (!disp) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); @@ -533,6 +580,8 @@ eglTerminate(EGLDisplay dpy) { _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + if (!disp) RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE); @@ -560,6 +609,7 @@ eglQueryString(EGLDisplay dpy, EGLint name) } disp = _eglLockDisplay(dpy); + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, NULL); _EGL_CHECK_DISPLAY(disp, NULL, drv); switch (name) { @@ -585,6 +635,8 @@ eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config); @@ -600,6 +652,8 @@ eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs, config_size, num_config); @@ -617,6 +671,8 @@ eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, _EGLDriver *drv; EGLBoolean ret; + _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); + _EGL_CHECK_CONFIG(disp, conf, EGL_FALSE, drv); ret = drv->API.GetCo
[Mesa-dev] [PATCH 07/14] egl: Factor out _eglWaitClientCommon
From: Kyle Brenneman --- src/egl/main/eglapi.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index fac2d18..a74e5e4 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1081,8 +1081,8 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) } -EGLBoolean EGLAPIENTRY -eglWaitClient(void) +static EGLBoolean +_eglWaitClientCommon(void) { _EGLContext *ctx = _eglGetCurrentContext(); _EGLDisplay *disp; @@ -1108,12 +1108,17 @@ eglWaitClient(void) RETURN_EGL_EVAL(disp, ret); } +EGLBoolean EGLAPIENTRY +eglWaitClient(void) +{ + return _eglWaitClientCommon(); +} EGLBoolean EGLAPIENTRY eglWaitGL(void) { /* Since we only support OpenGL and GLES, eglWaitGL is equivalent to eglWaitClient. */ - return eglWaitClient(); + return _eglWaitClientCommon(); } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/14] egl: Factor out _eglGetPlatformDisplayCommon
From: Kyle Brenneman --- src/egl/main/eglapi.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index ba8305e..df355a5 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -295,9 +295,9 @@ eglGetDisplay(EGLNativeDisplayType nativeDisplay) return _eglGetDisplayHandle(dpy); } -static EGLDisplay EGLAPIENTRY -eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, - const EGLint *attrib_list) +static EGLDisplay +_eglGetPlatformDisplayCommon(EGLenum platform, void *native_display, +const EGLint *attrib_list) { _EGLDisplay *dpy; @@ -326,17 +326,25 @@ eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, return _eglGetDisplayHandle(dpy); } +static EGLDisplay EGLAPIENTRY +eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, + const EGLint *attrib_list) +{ + return _eglGetPlatformDisplayCommon(platform, native_display, attrib_list); +} + EGLDisplay EGLAPIENTRY eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list) { EGLDisplay display; - EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list); + EGLint *int_attribs; + int_attribs = _eglConvertAttribsToInt(attrib_list); if (attrib_list && !int_attribs) RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, NULL); - display = eglGetPlatformDisplayEXT(platform, native_display, int_attribs); + display = _eglGetPlatformDisplayCommon(platform, native_display, int_attribs); free(int_attribs); return display; } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/14] egl: Tear down images and syncs at eglTerminate
Signed-off-by: Adam Jackson --- src/egl/main/egldisplay.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c index bbc3063..3d4eb81 100644 --- a/src/egl/main/egldisplay.c +++ b/src/egl/main/egldisplay.c @@ -44,6 +44,8 @@ #include "egldriver.h" #include "eglglobals.h" #include "egllog.h" +#include "eglimage.h" +#include "eglsync.h" /* Includes for _eglNativePlatformDetectNativeDisplay */ #ifdef HAVE_MINCORE @@ -300,6 +302,26 @@ _eglReleaseDisplayResources(_EGLDriver *drv, _EGLDisplay *display) drv->API.DestroySurface(drv, display, surf); } assert(!display->ResourceLists[_EGL_RESOURCE_SURFACE]); + + list = display->ResourceLists[_EGL_RESOURCE_IMAGE]; + while (list) { + _EGLImage *image = (_EGLImage *) list; + list = list->Next; + + _eglUnlinkImage(image); + drv->API.DestroyImageKHR(drv, display, image); + } + assert(!display->ResourceLists[_EGL_RESOURCE_IMAGE]); + + list = display->ResourceLists[_EGL_RESOURCE_SYNC]; + while (list) { + _EGLSync *sync = (_EGLSync *) list; + list = list->Next; + + _eglUnlinkSync(sync); + drv->API.DestroySyncKHR(drv, display, sync); + } + assert(!display->ResourceLists[_EGL_RESOURCE_SYNC]); } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/14] egl: Lock the display in _eglCreateSync's callers
From: Kyle Brenneman --- src/egl/main/eglapi.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 658d0d7..dc61d5f 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1384,11 +1384,10 @@ eglDestroyImage(EGLDisplay dpy, EGLImage image) static EGLSync -_eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list, +_eglCreateSync(_EGLDisplay *disp, EGLenum type, const EGLint *attrib_list, const EGLAttrib *attrib_list64, EGLBoolean is64, EGLenum invalid_type_error) { - _EGLDisplay *disp = _eglLockDisplay(dpy); _EGLContext *ctx = _eglGetCurrentContext(); _EGLDriver *drv; _EGLSync *sync; @@ -1400,7 +1399,7 @@ _eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list, RETURN_EGL_EVAL(disp, EGL_NO_SYNC_KHR); /* return an error if the client API doesn't support GL_OES_EGL_sync */ - if (!ctx || ctx->Resource.Display != dpy || + if (!ctx || ctx->Resource.Display != disp || ctx->ClientAPI != EGL_OPENGL_ES_API) RETURN_EGL_ERROR(disp, EGL_BAD_MATCH, EGL_NO_SYNC_KHR); @@ -1431,7 +1430,8 @@ _eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list, static EGLSync EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) { - return _eglCreateSync(dpy, type, attrib_list, NULL, EGL_FALSE, + _EGLDisplay *disp = _eglLockDisplay(dpy); + return _eglCreateSync(disp, type, attrib_list, NULL, EGL_FALSE, EGL_BAD_ATTRIBUTE); } @@ -1439,7 +1439,8 @@ eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list) static EGLSync EGLAPIENTRY eglCreateSync64KHR(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list) { - return _eglCreateSync(dpy, type, NULL, attrib_list, EGL_TRUE, + _EGLDisplay *disp = _eglLockDisplay(dpy); + return _eglCreateSync(disp, type, NULL, attrib_list, EGL_TRUE, EGL_BAD_ATTRIBUTE); } @@ -1447,7 +1448,8 @@ eglCreateSync64KHR(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list) EGLSync EGLAPIENTRY eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list) { - return _eglCreateSync(dpy, type, NULL, attrib_list, EGL_TRUE, + _EGLDisplay *disp = _eglLockDisplay(dpy); + return _eglCreateSync(disp, type, NULL, attrib_list, EGL_TRUE, EGL_BAD_PARAMETER); } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/14] egl: Fix typo
From: Kyle Brenneman --- src/egl/main/eglglobals.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c index 938d953..04bb5ba 100644 --- a/src/egl/main/eglglobals.c +++ b/src/egl/main/eglglobals.c @@ -50,7 +50,7 @@ struct _egl_global _eglGlobal = _eglFiniDisplay }, - /* ClientExtensionsString */ + /* ClientExtensionString */ "EGL_EXT_client_extensions" " EGL_EXT_platform_base" " EGL_EXT_platform_wayland" -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/14] egl: Use _eglCreateWindowSurfaceCommon consistently
From: Kyle Brenneman This moves the native window fixup to a helper function so we don't repeat ourselves. --- src/egl/main/eglapi.c | 28 ++-- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index df355a5..dd2b4cc 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -762,14 +762,9 @@ eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, attrib_list); } - -static EGLSurface EGLAPIENTRY -eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, - void *native_window, - const EGLint *attrib_list) +static void * +fixupNativeWindow(_EGLDisplay *disp, void *native_window) { - _EGLDisplay *disp = _eglLockDisplay(dpy); - #ifdef HAVE_X11_PLATFORM if (disp->Platform == _EGL_PLATFORM_X11 && native_window != NULL) { /* The `native_window` parameter for the X11 platform differs between @@ -779,9 +774,20 @@ eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, * `Window*`. Convert `Window*` to `Window` because that's what * dri2_x11_create_window_surface() expects. */ - native_window = (void*) (* (Window*) native_window); + return (void *)(* (Window*) native_window); } #endif + return native_window; +} + +static EGLSurface EGLAPIENTRY +eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, + void *native_window, + const EGLint *attrib_list) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + + native_window = fixupNativeWindow(disp, native_window); return _eglCreateWindowSurfaceCommon(disp, config, native_window, attrib_list); @@ -793,14 +799,16 @@ eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list) { + _EGLDisplay *disp = _eglLockDisplay(dpy); EGLSurface surface; EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list); if (attrib_list && !int_attribs) RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_SURFACE); - surface = eglCreatePlatformWindowSurfaceEXT(dpy, config, native_window, - int_attribs); + native_window = fixupNativeWindow(disp, native_window); + surface = _eglCreateWindowSurfaceCommon(disp, config, native_window, + int_attribs); free(int_attribs); return surface; } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/14] egl: Factor out _eglWaitSyncCommon
From: Kyle Brenneman --- src/egl/main/eglapi.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index dc61d5f..c285c20 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1509,11 +1509,9 @@ eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout) } -static EGLint EGLAPIENTRY -eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags) +static EGLint +_eglWaitSyncCommon(_EGLDisplay *disp, _EGLSync *s, EGLint flags) { - _EGLDisplay *disp = _eglLockDisplay(dpy); - _EGLSync *s = _eglLookupSync(sync, disp); _EGLContext *ctx = _eglGetCurrentContext(); _EGLDriver *drv; EGLint ret; @@ -1534,6 +1532,14 @@ eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags) RETURN_EGL_EVAL(disp, ret); } +static EGLint EGLAPIENTRY +eglWaitSyncKHR(EGLDisplay dpy, EGLSync sync, EGLint flags) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLSync *s = _eglLookupSync(sync, disp); + return _eglWaitSyncCommon(disp, s, flags); +} + EGLBoolean EGLAPIENTRY eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags) @@ -1542,7 +1548,9 @@ eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags) * EGLBoolean. In both cases, the return values can only be EGL_FALSE and * EGL_TRUE. */ - return eglWaitSyncKHR(dpy, sync, flags); + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLSync *s = _eglLookupSync(sync, disp); + return _eglWaitSyncCommon(disp, s, flags); } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 11/14] egl: Factor out _eglGetSyncAttribCommon
From: Kyle Brenneman --- src/egl/main/eglapi.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index c285c20..0477ad9 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1570,11 +1570,9 @@ eglSignalSyncKHR(EGLDisplay dpy, EGLSync sync, EGLenum mode) } -EGLBoolean EGLAPIENTRY -eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value) +static EGLBoolean +_eglGetSyncAttribCommon(_EGLDisplay *disp, _EGLSync *s, EGLint attribute, EGLAttrib *value) { - _EGLDisplay *disp = _eglLockDisplay(dpy); - _EGLSync *s = _eglLookupSync(sync, disp); _EGLDriver *drv; EGLBoolean ret; @@ -1586,10 +1584,20 @@ eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *valu RETURN_EGL_EVAL(disp, ret); } +EGLBoolean EGLAPIENTRY +eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLSync *s = _eglLookupSync(sync, disp); + return _eglGetSyncAttribCommon(disp, s, attribute, value); +} + static EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *value) { + _EGLDisplay *disp = _eglLockDisplay(dpy); + _EGLSync *s = _eglLookupSync(sync, disp); EGLAttrib attrib; EGLBoolean result; @@ -1597,7 +1605,7 @@ eglGetSyncAttribKHR(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *valu RETURN_EGL_ERROR(NULL, EGL_BAD_PARAMETER, EGL_FALSE); attrib = *value; - result = eglGetSyncAttrib(dpy, sync, attribute, &attrib); + result = _eglGetSyncAttribCommon(disp, s, attribute, &attrib); /* The EGL_KHR_fence_sync spec says this about eglGetSyncAttribKHR: * -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 12/14] egl: Add storage for EGL_KHR_debug's state to EGL objects
From: Kyle Brenneman --- src/egl/main/eglcurrent.c | 3 +-- src/egl/main/eglcurrent.h | 8 src/egl/main/egldisplay.h | 4 src/egl/main/eglglobals.c | 5 - src/egl/main/eglglobals.h | 10 ++ 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c index 2a225bc..f093bec 100644 --- a/src/egl/main/eglcurrent.c +++ b/src/egl/main/eglcurrent.c @@ -35,10 +35,9 @@ #include "eglcurrent.h" #include "eglglobals.h" - /* This should be kept in sync with _eglInitThreadInfo() */ #define _EGL_THREAD_INFO_INITIALIZER \ - { EGL_SUCCESS, NULL, 0 } + { EGL_SUCCESS, NULL, 0, NULL, NULL, NULL } /* a fallback thread info to guarantee that every thread always has one */ static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER; diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h index b922435..b2638fd 100644 --- a/src/egl/main/eglcurrent.h +++ b/src/egl/main/eglcurrent.h @@ -54,6 +54,14 @@ struct _egl_thread_info EGLint LastError; _EGLContext *CurrentContext; EGLenum CurrentAPI; + EGLLabelKHR Label; + + /** +* The name of the EGL function that's being called at the moment. This is +* used to report the function name to the EGL_KHR_debug callback. +*/ + const char *CurrentFuncName; + EGLLabelKHR CurrentObjectLabel; }; diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 6f3340e..22fb5c8 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -79,6 +79,8 @@ struct _egl_resource EGLBoolean IsLinked; EGLint RefCount; + EGLLabelKHR Label; + /* used to link resources of the same type */ _EGLResource *Next; }; @@ -165,6 +167,8 @@ struct _egl_display /* lists of resources */ _EGLResource *ResourceLists[_EGL_NUM_RESOURCES]; + + EGLLabelKHR Label; }; diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c index 04bb5ba..dca5c21 100644 --- a/src/egl/main/eglglobals.c +++ b/src/egl/main/eglglobals.c @@ -56,7 +56,10 @@ struct _egl_global _eglGlobal = " EGL_EXT_platform_wayland" " EGL_EXT_platform_x11" " EGL_KHR_client_get_all_proc_addresses" - " EGL_MESA_platform_gbm" + " EGL_MESA_platform_gbm", + + NULL, /* debugCallback */ + _EGL_DEBUG_BIT_CRITICAL | _EGL_DEBUG_BIT_ERROR, /* debugTypesEnabled */ }; diff --git a/src/egl/main/eglglobals.h b/src/egl/main/eglglobals.h index ae1b75b..dfa3577 100644 --- a/src/egl/main/eglglobals.h +++ b/src/egl/main/eglglobals.h @@ -36,6 +36,13 @@ #include "egltypedefs.h" +enum +{ +_EGL_DEBUG_BIT_CRITICAL = 0x1, +_EGL_DEBUG_BIT_ERROR = 0x2, +_EGL_DEBUG_BIT_WARN = 0x4, +_EGL_DEBUG_BIT_INFO = 0x8, +}; /** * Global library data @@ -51,6 +58,9 @@ struct _egl_global void (*AtExitCalls[10])(void); const char *ClientExtensionString; + + EGLDEBUGPROCKHR debugCallback; + unsigned int debugTypesEnabled; }; -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/14] egl: Use _eglCreatePixmapSurfaceCommon consistently
From: Kyle Brenneman This moves the native pixmap fixup to a helper function so we don't repeat ourselves. --- src/egl/main/eglapi.c | 36 +--- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index dd2b4cc..fac2d18 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -813,6 +813,22 @@ eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, return surface; } +static void * +fixupNativePixmap(_EGLDisplay *disp, void *native_pixmap) +{ +#ifdef HAVE_X11_PLATFORM + /* The `native_pixmap` parameter for the X11 platform differs between + * eglCreatePixmapSurface() and eglCreatePlatformPixmapSurfaceEXT(). In + * eglCreatePixmapSurface(), the type of `native_pixmap` is an Xlib + * `Pixmap`. In eglCreatePlatformPixmapSurfaceEXT(), the type is + * `Pixmap*`. Convert `Pixmap*` to `Pixmap` because that's what + * dri2_x11_create_pixmap_surface() expects. + */ + if (disp->Platform == _EGL_PLATFORM_X11 && native_pixmap != NULL) + return (void *)(* (Pixmap*) native_pixmap); +#endif + return native_pixmap; +} static EGLSurface _eglCreatePixmapSurfaceCommon(_EGLDisplay *disp, EGLConfig config, @@ -849,19 +865,7 @@ eglCreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, { _EGLDisplay *disp = _eglLockDisplay(dpy); -#ifdef HAVE_X11_PLATFORM - /* The `native_pixmap` parameter for the X11 platform differs between - * eglCreatePixmapSurface() and eglCreatePlatformPixmapSurfaceEXT(). In - * eglCreatePixmapSurface(), the type of `native_pixmap` is an Xlib - * `Pixmap`. In eglCreatePlatformPixmapSurfaceEXT(), the type is - * `Pixmap*`. Convert `Pixmap*` to `Pixmap` because that's what - * dri2_x11_create_pixmap_surface() expects. - */ - if (disp->Platform == _EGL_PLATFORM_X11 && native_pixmap != NULL) { - native_pixmap = (void*) (* (Pixmap*) native_pixmap); - } -#endif - + native_pixmap = fixupNativePixmap(disp, native_pixmap); return _eglCreatePixmapSurfaceCommon(disp, config, native_pixmap, attrib_list); } @@ -872,14 +876,16 @@ eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list) { + _EGLDisplay *disp = _eglLockDisplay(dpy); EGLSurface surface; EGLint *int_attribs = _eglConvertAttribsToInt(attrib_list); if (attrib_list && !int_attribs) RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_SURFACE); - surface = eglCreatePlatformPixmapSurfaceEXT(dpy, config, native_pixmap, - int_attribs); + native_pixmap = fixupNativePixmap(disp, native_pixmap); + surface = _eglCreatePixmapSurfaceCommon(disp, config, native_pixmap, + int_attribs); free(int_attribs); return surface; } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/14] egl: Update eglext.h (v2)
From: Kyle Brenneman Updated eglext.h to revision 33111 from the Khronos repository. v2: - Don't (re)move extension includes from eglext.h (Emil Velikov) - Bump to revision 33111 (Adam Jackson) Reviewed-by: Adam Jackson --- include/EGL/eglext.h | 121 +-- 1 file changed, 118 insertions(+), 3 deletions(-) diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h index 6043b37..4ccbab8 100644 --- a/include/EGL/eglext.h +++ b/include/EGL/eglext.h @@ -6,7 +6,7 @@ extern "C" { #endif /* -** Copyright (c) 2013-2014 The Khronos Group Inc. +** Copyright (c) 2013-2016 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -38,7 +38,7 @@ extern "C" { #include -#define EGL_EGLEXT_VERSION 20150508 +#define EGL_EGLEXT_VERSION 20160809 /* Generated C header for: * API: egl @@ -99,6 +99,33 @@ EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, #define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3 #endif /* EGL_KHR_create_context_no_error */ +#ifndef EGL_KHR_debug +#define EGL_KHR_debug 1 +typedef void *EGLLabelKHR; +typedef void *EGLObjectKHR; +typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message); +#define EGL_OBJECT_THREAD_KHR 0x33B0 +#define EGL_OBJECT_DISPLAY_KHR0x33B1 +#define EGL_OBJECT_CONTEXT_KHR0x33B2 +#define EGL_OBJECT_SURFACE_KHR0x33B3 +#define EGL_OBJECT_IMAGE_KHR 0x33B4 +#define EGL_OBJECT_SYNC_KHR 0x33B5 +#define EGL_OBJECT_STREAM_KHR 0x33B6 +#define EGL_DEBUG_MSG_CRITICAL_KHR0x33B9 +#define EGL_DEBUG_MSG_ERROR_KHR 0x33BA +#define EGL_DEBUG_MSG_WARN_KHR0x33BB +#define EGL_DEBUG_MSG_INFO_KHR0x33BC +#define EGL_DEBUG_CALLBACK_KHR0x33B8 +typedef EGLint (EGLAPIENTRYP PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib *value); +typedef EGLint (EGLAPIENTRYP PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDebugKHR (EGLint attribute, EGLAttrib *value); +EGLAPI EGLint EGLAPIENTRY eglLabelObjectKHR (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); +#endif +#endif /* EGL_KHR_debug */ + #ifndef EGL_KHR_fence_sync #define EGL_KHR_fence_sync 1 typedef khronos_utime_nanoseconds_t EGLTimeKHR; @@ -223,6 +250,16 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface s #endif #endif /* EGL_KHR_lock_surface3 */ +#ifndef EGL_KHR_mutable_render_buffer +#define EGL_KHR_mutable_render_buffer 1 +#define EGL_MUTABLE_RENDER_BUFFER_BIT_KHR 0x1000 +#endif /* EGL_KHR_mutable_render_buffer */ + +#ifndef EGL_KHR_no_config_context +#define EGL_KHR_no_config_context 1 +#define EGL_NO_CONFIG_KHR ((EGLConfig)0) +#endif /* EGL_KHR_no_config_context */ + #ifndef EGL_KHR_partial_update #define EGL_KHR_partial_update 1 #define EGL_BUFFER_AGE_KHR0x313D @@ -402,11 +439,28 @@ EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobF #endif #endif /* EGL_ANDROID_blob_cache */ +#ifndef EGL_ANDROID_create_native_client_buffer +#define EGL_ANDROID_create_native_client_buffer 1 +#define EGL_NATIVE_BUFFER_USAGE_ANDROID 0x3143 +#define EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID 0x0001 +#define EGL_NATIVE_BUFFER_USAGE_RENDERBUFFER_BIT_ANDROID 0x0002 +#define EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID 0x0004 +typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLClientBuffer EGLAPIENTRY eglCreateNativeClientBufferANDROID (const EGLint *attrib_list); +#endif +#endif /* EGL_ANDROID_create_native_client_buffer */ + #ifndef EGL_ANDROID_framebuffer_target #define EGL_ANDROID_framebuffer_target 1 #define EGL_FRAMEBUFFER_TARGET_ANDROID0x3147 #endif /* EGL_ANDROID_framebuffer_target */ +#ifndef EGL_ANDROID_front_buffer_auto_refresh +#define EGL_ANDROID_front_buffer_auto_refresh 1 +#define EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID 0x314C +#endif /* EGL_ANDROID_front_buffer_auto_refresh */ + #ifndef EGL_ANDROID_image_native_buffer #define EGL_ANDROID_image_native_buffer 1 #define EGL_NATIVE_BUFFER_ANDROID 0x3140 @@ -424,6 +478,15 @@ EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR #endif #endif /* EGL_ANDROID_native
[Mesa-dev] [PATCH 14/14] egl: Implement EGL_KHR_debug
From: Kyle Brenneman Wire up the debug entrypoints to EGL dispatch, and add the extension string to the client extension list. --- src/egl/main/eglapi.c | 140 ++ src/egl/main/eglglobals.c | 3 +- 2 files changed, 142 insertions(+), 1 deletion(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 0a6ebe7..6b0fd2e 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1987,6 +1987,143 @@ eglExportDMABUFImageMESA(EGLDisplay dpy, EGLImage image, RETURN_EGL_EVAL(disp, ret); } +static EGLint EGLAPIENTRY +eglLabelObjectKHR(EGLDisplay dpy, EGLenum objectType, EGLObjectKHR object, + EGLLabelKHR label) +{ + _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_BAD_ALLOC); + + if (objectType == EGL_OBJECT_THREAD_KHR) { + _EGLThreadInfo *t = _eglGetCurrentThread(); + + if (!_eglIsCurrentThreadDummy()) { + t->Label = label; + return EGL_SUCCESS; + } else { + _eglDebugReportFull(EGL_BAD_ALLOC, __func__, __func__, + EGL_DEBUG_MSG_CRITICAL_KHR, NULL, NULL); + return EGL_BAD_ALLOC; + } + } else { + _EGLDisplay *disp = _eglLookupDisplay(dpy); + + if (disp == NULL) { + _eglError(EGL_BAD_DISPLAY, "eglLabelObjectKHR"); + return EGL_BAD_DISPLAY; + } + + if (objectType == EGL_OBJECT_DISPLAY_KHR) { + if (dpy != (EGLDisplay) object) { +_eglError(EGL_BAD_PARAMETER, "eglLabelObjectKHR"); +return EGL_BAD_PARAMETER; + } + disp->Label = label; + return EGL_SUCCESS; + } else { + _EGLResourceType type; + + switch (objectType) + { +case EGL_OBJECT_CONTEXT_KHR: + type = _EGL_RESOURCE_CONTEXT; + break; +case EGL_OBJECT_SURFACE_KHR: + type = _EGL_RESOURCE_SURFACE; + break; +case EGL_OBJECT_IMAGE_KHR: + type = _EGL_RESOURCE_IMAGE; + break; +case EGL_OBJECT_SYNC_KHR: + type = _EGL_RESOURCE_SYNC; + break; +case EGL_OBJECT_STREAM_KHR: +default: +_eglError(EGL_BAD_PARAMETER, "eglLabelObjectKHR"); + return EGL_BAD_PARAMETER; + } + + if (_eglCheckResource(object, type, disp)) { +_EGLResource *res = (_EGLResource *) object; +res->Label = label; +return EGL_SUCCESS; + } else { +_eglError(EGL_BAD_PARAMETER, "eglLabelObjectKHR"); +return EGL_BAD_PARAMETER; + } + } + } +} + +static EGLint +eglDebugMessageControlKHR(EGLDEBUGPROCKHR callback, + const EGLAttrib *attrib_list) +{ + unsigned int newEnabled; + + _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_BAD_ALLOC); + + mtx_lock(_eglGlobal.Mutex); + + newEnabled = _eglGlobal.debugTypesEnabled; + if (attrib_list != NULL) { + int i; + + for (i = 0; attrib_list[i] != EGL_NONE; i += 2) { + if (attrib_list[i] >= EGL_DEBUG_MSG_CRITICAL_KHR && + attrib_list[i] <= EGL_DEBUG_MSG_INFO_KHR) { +if (attrib_list[i + 1]) { + newEnabled |= DebugBitFromType(attrib_list[i]); +} else { + newEnabled &= ~DebugBitFromType(attrib_list[i]); +} + } else { +// On error, set the last error code, call the current +// debug callback, and return the error code. +mtx_unlock(_eglGlobal.Mutex); +_eglReportError(EGL_BAD_ATTRIBUTE, NULL, + "Invalid attribute 0x%04lx", (unsigned long) attrib_list[i]); +return EGL_BAD_ATTRIBUTE; + } + } + } + + if (callback != NULL) { + _eglGlobal.debugCallback = callback; + _eglGlobal.debugTypesEnabled = newEnabled; + } else { + _eglGlobal.debugCallback = NULL; + _eglGlobal.debugTypesEnabled = _EGL_DEBUG_BIT_CRITICAL | _EGL_DEBUG_BIT_ERROR; + } + + mtx_unlock(_eglGlobal.Mutex); + return EGL_SUCCESS; +} + +static EGLBoolean +eglQueryDebugKHR(EGLint attribute, EGLAttrib *value) +{ + _EGL_FUNC_START(NULL, EGL_NONE, NULL, EGL_BAD_ALLOC); + + mtx_lock(_eglGlobal.Mutex); + if (attribute >= EGL_DEBUG_MSG_CRITICAL_KHR && + attribute <= EGL_DEBUG_MSG_INFO_KHR) { + if (_eglGlobal.debugTypesEnabled & DebugBitFromType(attribute)) { + *value = EGL_TRUE; + } else { + *value = EGL_FALSE; + } + } else if (attribute == EGL_DEBUG_CALLBACK_KHR) { + *value = (EGLAttrib) _eglGlobal.debugCallback; + } else { + mtx_unlock(_eglGlobal.Mutex); + _eglReportError(EGL_BAD_ATTRIBUTE, NULL, + "Invalid attribute 0x%04lx", (unsigned long) attribute); + return EGL_FALSE; + } + mtx_unlock(_eglGlobal.Mutex); + return EGL_TRUE; +} + __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *proc
[Mesa-dev] [PATCH 08/14] egl: Factor out _eglCreateImageCommon
From: Kyle Brenneman --- src/egl/main/eglapi.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index a74e5e4..658d0d7 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -1309,11 +1309,10 @@ eglReleaseThread(void) } -static EGLImage EGLAPIENTRY -eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, +static EGLImage +_eglCreateImageCommon(_EGLDisplay *disp, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attr_list) { - _EGLDisplay *disp = _eglLockDisplay(dpy); _EGLContext *context = _eglLookupContext(ctx, disp); _EGLDriver *drv; _EGLImage *img; @@ -1337,18 +1336,27 @@ eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, RETURN_EGL_EVAL(disp, ret); } +static EGLImage EGLAPIENTRY +eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, + EGLClientBuffer buffer, const EGLint *attr_list) +{ + _EGLDisplay *disp = _eglLockDisplay(dpy); + return _eglCreateImageCommon(disp, ctx, target, buffer, attr_list); +} + EGLImage EGLAPIENTRY eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attr_list) { + _EGLDisplay *disp = _eglLockDisplay(dpy); EGLImage image; EGLint *int_attribs = _eglConvertAttribsToInt(attr_list); if (attr_list && !int_attribs) RETURN_EGL_ERROR(NULL, EGL_BAD_ALLOC, EGL_NO_IMAGE); - image = eglCreateImageKHR(dpy, ctx, target, buffer, int_attribs); + image = _eglCreateImageCommon(disp, ctx, target, buffer, int_attribs); free(int_attribs); return image; } -- 2.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/6] EGL_MESA_platform_surfaceless (v2)
On Fri, 2016-10-14 at 10:48 -0700, Chad Versace wrote: > Some people privately asked why we need to create this EGL platform. > I want to respond publicly. > > Mesa *already* *has* this EGL platform. In my view, the issue at hand > isn't whether to create or to not create the platform. It's whether to > specify its behavior (formally in an extension spec) or not. > > My motivation in writing the EGL_MESA_platform_surfaceless spec was not > to introduce any new features or behavior. My motivation was to > document longstanding existing behavior in Chrome OS, that upstream Mesa > eventually subsumed. > > During XDC, some people outside of the Chrome OS community complained to > me that the behavior of platform_surfaceless was ill-defined and > unstable, and they wanted the situation fixed. So I wrote a spec. As one of the people who complained: the big issue I had with the surfaceless platform was that the only way to use it was to set an environment variable before calling eglGetDisplay, which is just pointlessly unlike how you use every other platform. I was _happy_ when I discovered the feature, I was only unhappy with its interface. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] glx/glvnd: Fix dispatch function names and indices
On Fri, 2016-09-16 at 19:07 +0100, Emil Velikov wrote: > On 14 September 2016 at 19:06, Adam Jackson wrote: > > As this array was not actually sorted, FindGLXFunction's binary search > > would only sometimes work. > > > > This commit message is a bit iffy, yet again most of this and > g_glxglvnddispatchfuncs.c is dead code. > > Afaict the sole reason behind his file is to have the vendor driver > callback into libGLX in order to manage (add/remove) the relevant > fbconfig/drawable/context to vendor mappings. From a quick search we > have ~5 out of the 30+ functions that do that. > > Everyone else calls back into the vendor library to a) get the correct > vendor (dispatch) and using it dive via the vendor neutral library Yes. > _directly_ back into itself No. dispatch_BindTexImageEXT (for example) is a function that the app would be handed as the result of glXGetProcAddress. Yes it comes from Mesa, but the drawable might belong to another vendor. So: static void dispatch_BindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list) { PFNGLXBINDTEXIMAGEEXTPROC pBindTexImageEXT; __GLXvendorInfo *dd; /* look up which vendor is responsible for this drawable */ dd = GetDispatchFromDrawable(dpy, drawable); if (dd == NULL) return; /* fetch that vendor's implementation of BindTexImageEXT */ __FETCH_FUNCTION_PTR(BindTexImageEXT); if (pBindTexImageEXT == NULL) return; /* and tail call it */ (*pBindTexImageEXT)(dpy, drawable, buffer, attrib_list); } The "implementation" in Mesa would be __glXBindTexImageEXT. One could argue that dispatch_* could be smart enough to recognize their own dispatch tables, skip the glvnd call to ->fetchDispatchEntry in __FETCH_FUNCTION_PTR, and call the Mesa implementation directly. But GLX function calls are not exactly hot paths, and I'm not sure the complexity would be worth it. > (see the generated g_libglglxwrapper.c file) to get the entry point > via getProcAddress callback - see __glXFindVendorDispatchAddress(). Remember that getProcAddress from glvnd into the vendor library is binary like dlsym, not unary like glXGetProcAddress. It's asking for the implementation, not the dispatch. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] glx/glvnd: Fix dispatch function names and indices
On Fri, 2016-10-28 at 17:11 +0100, Emil Velikov wrote: > > On 19 October 2016 at 18:39, Adam Jackson wrote: > > The "implementation" in Mesa would be __glXBindTexImageEXT. One could > > argue that dispatch_* could be smart enough to recognize their own > > dispatch tables, skip the glvnd call to ->fetchDispatchEntry in > > __FETCH_FUNCTION_PTR, and call the Mesa implementation directly. But > > GLX function calls are not exactly hot paths, and I'm not sure the > > complexity would be worth it. > > > > Personally I agree, yet the rest (past this piece) of GLVND shows that > one is quite concerned with not making those slow. With not making _GL_ calls slow, sure. Having already spent that effort one might as well use the same technique for GLX though. > Last time I've asked for some clarification [over at github] it fell > on deaf ears. > > I mean seriously we could drop a very sizeable hunk of GLVND if that's > the case ;-) > Of which dozen or so cases of "exit(-1)". I have absolutely no idea what you're saying here. If _what_ is the case? What calls to exit(-1) are there besides can't-happens in the hash table code? > One nitpick: > Can we drop glXGetScreenDriver all together. Last time I've looked it > had zero users*, it has no spec and GLVND wasn't generating an entry > point/dispatch for it. One user, xdriinfo(1), which is admittedly pretty useless. But the glvnd code in mesa definitely implements dispatch for it (libglvnd itself does not, but is not expected to). - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] dri3: Flush and wait for X rendering upon glXWaitX()
On Sat, 2016-10-22 at 11:00 +0100, Chris Wilson wrote: > @@ -113,6 +113,11 @@ loader_dri3_drawable_fini(struct loader_dri3_drawable > *draw) > dri3_free_render_buffer(draw, draw->buffers[i]); > } > > + if (draw->sync_fence) { > + xcb_sync_destroy_fence(draw->conn, draw->sync_fence); > + xshmfence_unmap_shm(draw->shm_fence); > + } You're leaking the fence fd. Probably should just close it immediately after mapping it so you don't occupy an fd per drawable. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] dri2: Serialize with all X rendering on glXWaitX()
On Sat, 2016-10-22 at 11:00 +0100, Chris Wilson wrote: > Xorg may implement fine grained per-drawable serialisation. If the > client is reading from shared pixmap sources, flushing rendering to the > current drawable is not enough (even if the current code did that, it > does not). Instead, following a glXWaitX() ensure that all X rendering to > shared buffers associated with the glXContext is flushed by doing a > DRI2GetBuffers() roundtrip prior to GL rendering. > > References: https://bugs.freedesktop.org/show_bug.cgi?id=52930 > References: https://bugs.freedesktop.org/show_bug.cgi?id=90264 > References: https://bugs.freedesktop.org/show_bug.cgi?id=97914 > > Signed-off-by: Chris Wilson > --- > include/GL/internal/dri_interface.h | 12 - > src/glx/dri2_glx.c | 16 ++-- > src/mesa/drivers/dri/common/dri_util.c | 6 + > src/mesa/drivers/dri/common/dri_util.h | 4 +++ > src/mesa/drivers/dri/i965/brw_context.c | 38 > - > src/mesa/drivers/dri/i965/brw_context.h | 23 +++-- > src/mesa/drivers/dri/i965/intel_screen.c| 5 ++-- > src/mesa/drivers/dri/i965/intel_tex_image.c | 5 ++-- > 8 files changed, 71 insertions(+), 38 deletions(-) Hm, adding myself to REVIEWERS for src/glx/ doesn't seem to have done much. Also I'd still really like to see a server-side call chain for WaitX/WaitGL, but. With the fd leak from 2/3 fixed, this series is: Reviewed-by: Adam Jackson - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] glx/glvnd: Fix dispatch function names and indices
On Mon, 2016-10-31 at 20:28 +, Emil Velikov wrote: > > > > One user, xdriinfo(1), which is admittedly pretty useless. But the > > glvnd code in mesa definitely implements dispatch for it (libglvnd > > itself does not, but is not expected to). > > libglvnd doesn't dispatch to it one cannot really reach it, correct ? Incorrect. Consider: there's no explicit dispatch code in libglvnd for GLX_EXT_texture_from_pixmap either. And yet, somehow, glXGetProcAddress("glXBindTexImageEXT") will return a working function pointer. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] dri3: Flush and wait for X rendering upon glXWaitX()
On Tue, 2016-11-01 at 20:48 +, Chris Wilson wrote: > The fence_fd is closed by xcb_dri3_fence_from_fd() as > xcb_send_request_with_fds() always calls close(). > -Chris D'oh! You are correct. Objection withdrawn. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] glx/glvnd: Fix dispatch function names and indices
On Thu, 2016-11-03 at 16:21 +, Emil Velikov wrote: > I'm not a fan of keeping legacy stuff with only one (pretty useless) > user. Not to mention that the glXGetDriverConfig plumbing is missing > [in here]. But as you feel so strongly in keeping it ... Maybe I wasn't clear. I don't care at all about GetScreenDriver, the one consumer is not in fact useful. Saying I "feel so strongly in keeping it" is a complete misrepresentation, nothing in this series was specifically about GetScreenDriver at all. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] glx/glvnd: Fix dispatch function names and indices
On Thu, 2016-11-03 at 17:28 +, Emil Velikov wrote: > Your earlier reply did not have ack/nack on the topic of dropping it, > thus the above reads as a justification why one would wants to keep > it. I thought "useless" expressed my opinion of the value of the feature quite well. But I didn't address dropping it because the point was to fix a bug, not to remove anything. I'm fine with removing it, but as it's a logically separate change I didn't see any reason to address it in this series. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] egldevice: implement eglQueryDisplayAttribEXT
On Fri, 2015-07-24 at 16:20 +0200, Jonny Lamb wrote: > This adds a new vfunc to _EGLDriver, QueryDeviceName, which should > return a const string of the device name (usually in the format > '/dev/dri/cardN'). > > The EGLDevice could perhaps be cached in the EGLDisplay but there > usually aren't loads of devices and this lookup isn't particularly > costly so leave it as is for now. > > Right now this only works with the egl_dri2 driver. Ancient thread I know, but this doesn't work, at least in my wayland session. > static EGLBoolean > +_eglQueryDeviceFromDisplay(_EGLDeviceInfo *info, > + _EGLDriver *drv, > + _EGLDisplay *disp, > + EGLAttrib *value) > +{ > +#ifdef HAVE_LIBUDEV > + const char *device_name = NULL; > + _EGLDevice *dev; > + UDEV_SYMBOL(const char *, udev_device_get_property_value, > + (struct udev_device *, const char *)); > + > + if (dlsym_failed) > + return EGL_FALSE; > + > + if (!drv->QueryDeviceName) > + return EGL_FALSE; > + > + device_name = drv->QueryDeviceName(disp); This is /dev/dri/renderD128... > + mtx_lock(_eglGlobal.Mutex); > + > + assert(info->got_devices); > + > + for (dev = info->devices; dev; dev = dev->Next) { > + const char *devname = udev_device_get_property_value( > + dev->Info, "DEVNAME"); And this is /dev/dri/card0, so querying the display will always fail. Obviously I can paper over this when there's only one device in the list, but the whole reason I want this is to make multi-GPU work better. Any ideas on a better approach here? - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 8/8] egldevice: implement eglQueryDisplayAttribEXT
On Thu, 2016-07-21 at 16:18 +0100, Daniel Stone wrote: > On 21 July 2016 at 15:11, Emil Velikov wrote: > > I'd suggest opting for the drmDevice libdrm API. It can provide a list > > of devices with all the nodes and other misc info. Thus we could use > > the render/card/other node as any point as needed. > > Indeed. > > I don't believe Jonny is working on this anymore, and I'm pretty > preoccupied, so it would be great if someone could pick this one up. Happy to do so. glvnd's libEGL support gets a lot more useful if the device enumeration API actually exists and works, so this is sort of important to me. drmDevice looks like a good start and we already require a libdrm that has it. I might need to come up with a dummy implementation for software (eg KHR_surfaceless_context) but that's easy enough. I'll rework this series to target that instead of udev. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] glx: Hide xGLXMakeCurrentReply inside SendMakeCurrentRequest
Signed-off-by: Adam Jackson --- src/glx/indirect_glx.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c index f8944a7..d0457fe 100644 --- a/src/glx/indirect_glx.c +++ b/src/glx/indirect_glx.c @@ -59,8 +59,9 @@ static Bool SendMakeCurrentRequest(Display * dpy, CARD8 opcode, GLXContextID gc_id, GLXContextTag gc_tag, GLXDrawable draw, GLXDrawable read, - xGLXMakeCurrentReply * reply) + GLXContextTag *out_tag) { + xGLXMakeCurrentReply reply; Bool ret; LockDisplay(dpy); @@ -112,7 +113,10 @@ SendMakeCurrentRequest(Display * dpy, CARD8 opcode, } } - ret = _XReply(dpy, (xReply *) reply, 0, False); + ret = _XReply(dpy, (xReply *) &reply, 0, False); + + if (out_tag) + *out_tag = reply.contextTag; UnlockDisplay(dpy); SyncHandle(); @@ -124,7 +128,6 @@ static int indirect_bind_context(struct glx_context *gc, struct glx_context *old, GLXDrawable draw, GLXDrawable read) { - xGLXMakeCurrentReply reply; GLXContextTag tag; __GLXattribute *state; Display *dpy = gc->psc->dpy; @@ -137,13 +140,13 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old, tag = 0; } - SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read, &reply); + SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read, + &gc->currentContextTag); if (!IndirectAPI) IndirectAPI = __glXNewIndirectAPI(); _glapi_set_dispatch(IndirectAPI); - gc->currentContextTag = reply.contextTag; state = gc->client_state_private; if (state->array_state == NULL) { glGetString(GL_EXTENSIONS); @@ -159,7 +162,6 @@ indirect_unbind_context(struct glx_context *gc, struct glx_context *new) { Display *dpy = gc->psc->dpy; int opcode = __glXSetupForCommand(dpy); - xGLXMakeCurrentReply reply; if (gc == new) return; @@ -170,7 +172,7 @@ indirect_unbind_context(struct glx_context *gc, struct glx_context *new) */ if (!new || new->isDirect || new->psc->dpy != dpy) { SendMakeCurrentRequest(dpy, opcode, None, -gc->currentContextTag, None, None, &reply); +gc->currentContextTag, None, None, NULL); gc->currentContextTag = 0; } } -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] glx: Generate fewer errors in MakeContextCurrent
For a few reasons. 1: In the (current) common case, these conditionals are never true. All we're doing by checking them is slowing down MakeCurrent. The server does these checks already anyway. 2: GLX >= 3.0 contexts may legally be made current without a bound framebuffer. This does not fix piglit/glx-create-context-current-no-framebuffer, but is a prerequisite for fixing it. Signed-off-by: Adam Jackson --- src/glx/glxcurrent.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/src/glx/glxcurrent.c b/src/glx/glxcurrent.c index 3d8893c..a6884cf 100644 --- a/src/glx/glxcurrent.c +++ b/src/glx/glxcurrent.c @@ -231,16 +231,6 @@ MakeContextCurrent(Display * dpy, GLXDrawable draw, return GL_FALSE; } - if (gc == NULL && (draw != None || read != None)) { - __glXGenerateError(dpy, (draw != None) ? draw : read, - BadMatch, X_GLXMakeContextCurrent); - return False; - } - if (gc != NULL && (draw == None || read == None)) { - __glXGenerateError(dpy, None, BadMatch, X_GLXMakeContextCurrent); - return False; - } - _glapi_check_multithread(); __glXLock(); -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] glx: Propagate failures from SendMakeCurrentRequest where possible
Signed-off-by: Adam Jackson --- src/glx/indirect_glx.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c index d0457fe..d27b019 100644 --- a/src/glx/indirect_glx.c +++ b/src/glx/indirect_glx.c @@ -132,6 +132,7 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old, __GLXattribute *state; Display *dpy = gc->psc->dpy; int opcode = __glXSetupForCommand(dpy); + Bool ret; if (old != &dummyContext && !old->isDirect && old->psc->dpy == dpy) { tag = old->currentContextTag; @@ -140,8 +141,8 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old, tag = 0; } - SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read, - &gc->currentContextTag); + ret = SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read, +&gc->currentContextTag); if (!IndirectAPI) IndirectAPI = __glXNewIndirectAPI(); @@ -154,7 +155,7 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old, __glXInitVertexArrayState(gc); } - return Success; + return ret; } static void -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glx: Fix return value from indirect_bind_context
_XReply returns 1 on success, but indirect_bind_context returns 0 on success. Signed-off-by: Adam Jackson --- src/glx/indirect_glx.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c index d27b019..28b8cd0 100644 --- a/src/glx/indirect_glx.c +++ b/src/glx/indirect_glx.c @@ -132,7 +132,7 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old, __GLXattribute *state; Display *dpy = gc->psc->dpy; int opcode = __glXSetupForCommand(dpy); - Bool ret; + Bool sent; if (old != &dummyContext && !old->isDirect && old->psc->dpy == dpy) { tag = old->currentContextTag; @@ -141,8 +141,8 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old, tag = 0; } - ret = SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read, -&gc->currentContextTag); + sent = SendMakeCurrentRequest(dpy, opcode, gc->xid, tag, draw, read, +&gc->currentContextTag); if (!IndirectAPI) IndirectAPI = __glXNewIndirectAPI(); @@ -155,7 +155,7 @@ indirect_bind_context(struct glx_context *gc, struct glx_context *old, __glXInitVertexArrayState(gc); } - return ret; + return !sent; } static void -- 1.8.3.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glx: Fix return value from indirect_bind_context
On Fri, 2013-10-25 at 12:59 -0700, Ian Romanick wrote: > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70486 > Reviewed-and-tested-by: Ian Romanick Pushed, thanks and sorry. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glx: Verify that drawable creation on the client side actually worked
On Wed, 2013-02-27 at 14:02 +, Jon TURNEY wrote: > Attached is a patch to fix. Pushed, thanks. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] PowerPC: Altivec IROUND operation
From: Adhemerval Zanella This adds another rounding mode to the enum, which happens otherwise to match SSE4.1's rounding modes. This should be safe as long as the IROUND case never hits the SSE4.1 path. Reviewed-by: Adam Jackson Signed-off-by: Adhemerval Zanella --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 29 +++-- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index ec05026..021cd6e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -1360,10 +1360,17 @@ lp_build_int_to_float(struct lp_build_context *bld, static boolean arch_rounding_available(const struct lp_type type) { + /* SSE4 vector rounding. */ if ((util_cpu_caps.has_sse4_1 && (type.length == 1 || type.width*type.length == 128)) || (util_cpu_caps.has_avx && type.width*type.length == 256)) return TRUE; + /* SSE2 vector to word. */ + else if ((util_cpu_caps.has_sse2 && +((type.width == 32) && (type.length == 1 || type.length == 4))) || +(util_cpu_caps.has_avx && type.width == 32 && type.length == 8)) + return TRUE; + /* Altivec rounding and vector to word. */ else if ((util_cpu_caps.has_altivec && (type.width == 32 && type.length == 4))) return TRUE; @@ -1376,7 +1383,8 @@ enum lp_build_round_mode LP_BUILD_ROUND_NEAREST = 0, LP_BUILD_ROUND_FLOOR = 1, LP_BUILD_ROUND_CEIL = 2, - LP_BUILD_ROUND_TRUNCATE = 3 + LP_BUILD_ROUND_TRUNCATE = 3, + LP_BUILD_IROUND = 4 }; /** @@ -1400,6 +1408,7 @@ lp_build_round_sse41(struct lp_build_context *bld, assert(lp_check_value(type, a)); assert(util_cpu_caps.has_sse4_1); + assert(mode != LP_BUILD_IROUND); if (type.length == 1) { LLVMTypeRef vec_type; @@ -1526,8 +1535,6 @@ lp_build_iround_nearest_sse2(struct lp_build_context *bld, } -/* - */ static INLINE LLVMValueRef lp_build_round_altivec(struct lp_build_context *bld, LLVMValueRef a, @@ -1536,8 +1543,10 @@ lp_build_round_altivec(struct lp_build_context *bld, LLVMBuilderRef builder = bld->gallivm->builder; const struct lp_type type = bld->type; const char *intrinsic = NULL; + LLVMTypeRef ret_type = bld->vec_type; assert(type.floating); + assert(type.width == 32); assert(lp_check_value(type, a)); assert(util_cpu_caps.has_altivec); @@ -1555,9 +1564,12 @@ lp_build_round_altivec(struct lp_build_context *bld, case LP_BUILD_ROUND_TRUNCATE: intrinsic = "llvm.ppc.altivec.vrfiz"; break; + case LP_BUILD_IROUND: + ret_type = lp_build_int_vec_type(bld->gallivm, bld->type); + intrinsic = "llvm.ppc.altivec.vctsxs"; } - return lp_build_intrinsic_unary(builder, intrinsic, bld->vec_type, a); + return lp_build_intrinsic_unary(builder, intrinsic, ret_type, a); } static INLINE LLVMValueRef @@ -1565,7 +1577,9 @@ lp_build_round_arch(struct lp_build_context *bld, LLVMValueRef a, enum lp_build_round_mode mode) { - if (util_cpu_caps.has_sse4_1) + if (util_cpu_caps.has_sse2 && (mode == LP_BUILD_IROUND)) + return lp_build_iround_nearest_sse2(bld, a); + else if (util_cpu_caps.has_sse4_1) return lp_build_round_sse41(bld, a, mode); else /* (util_cpu_caps.has_altivec) */ return lp_build_round_altivec(bld, a, mode); @@ -1893,11 +1907,6 @@ lp_build_iround(struct lp_build_context *bld, assert(lp_check_value(type, a)); - if ((util_cpu_caps.has_sse2 && - ((type.width == 32) && (type.length == 1 || type.length == 4))) || - (util_cpu_caps.has_avx && type.width == 32 && type.length == 8)) { - return lp_build_iround_nearest_sse2(bld, a); - } if (arch_rounding_available(type)) { res = lp_build_round_arch(bld, a, LP_BUILD_ROUND_NEAREST); } -- 1.7.11.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] llvmpipe: add print for int128
From: Adhemerval Zanella Reviewed-by: Adam Jackson Signed-off-by: Adhemerval Zanella --- src/gallium/auxiliary/gallivm/lp_bld_printf.c | 56 +++ 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c index 7a6bbd9..71c4d1b 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c @@ -83,33 +83,47 @@ lp_build_print_value(struct gallivm_state *gallivm, LLVMTypeKind type_kind; LLVMTypeRef type_ref; LLVMValueRef params[2 + LP_MAX_VECTOR_LENGTH]; - char type_fmt[6] = " %x"; + char type_fmt[20]; char format[2 + 5 * LP_MAX_VECTOR_LENGTH + 2] = "%s"; - unsigned length; + unsigned vecsize; + unsigned nargs; unsigned i; type_ref = LLVMTypeOf(value); type_kind = LLVMGetTypeKind(type_ref); if (type_kind == LLVMVectorTypeKind) { - length = LLVMGetVectorSize(type_ref); + vecsize = LLVMGetVectorSize(type_ref); + nargs = vecsize; type_ref = LLVMGetElementType(type_ref); type_kind = LLVMGetTypeKind(type_ref); + } else if (LLVMGetIntTypeWidth(type_ref) == 128) { + vecsize = 1; + nargs = 2; } else { - length = 1; + vecsize = 1; + nargs = 1; } if (type_kind == LLVMFloatTypeKind || type_kind == LLVMDoubleTypeKind) { - type_fmt[2] = '.'; - type_fmt[3] = '9'; - type_fmt[4] = 'g'; - type_fmt[5] = '\0'; + snprintf(type_fmt, sizeof type_fmt, " %%9g"); } else if (type_kind == LLVMIntegerTypeKind) { - if (LLVMGetIntTypeWidth(type_ref) == 8) { - type_fmt[2] = 'u'; - } else { - type_fmt[2] = 'i'; + unsigned typeWidth = LLVMGetIntTypeWidth(type_ref); + if (LLVMGetIntTypeWidth(type_ref) <= 32) { + snprintf(type_fmt, sizeof type_fmt, " %%x"); + } else if (typeWidth == 64) { +#if __WORDSIZE == 64 + snprintf(type_fmt, sizeof type_fmt, " %%016lx"); +#else + snprintf(type_fmt, sizeof type_fmt, " %%016llx"); +#endif + } else if (typeWidth == 128) { +#if __WORDSIZE == 64 + snprintf(type_fmt, sizeof type_fmt, " %%016lx%%016lx"); +#else + snprintf(type_fmt, sizeof type_fmt, " %%016llx%%016llx"); +#endif } } else { /* Unsupported type */ @@ -117,14 +131,22 @@ lp_build_print_value(struct gallivm_state *gallivm, } /* Create format string and arguments */ - assert(strlen(format) + strlen(type_fmt) * length + 2 <= sizeof format); + assert(strlen(format) + strlen(type_fmt) * nargs + 2 <= sizeof format); params[1] = lp_build_const_string(gallivm, msg); - if (length == 1) { + if (vecsize == 1) { util_strncat(format, type_fmt, sizeof(format) - strlen(format) - 1); - params[2] = value; + if (LLVMGetIntTypeWidth(type_ref) <= 64) { + params[2] = value; + } else { + LLVMValueRef shift = LLVMConstInt(LLVMIntTypeInContext(gallivm->context, 128), 64, 0); + LLVMValueRef lshr = LLVMBuildLShr(builder, value, shift, ""); + LLVMTypeRef type64 = LLVMInt64TypeInContext(gallivm->context); + params[2] = LLVMBuildTrunc(builder, lshr, type64, ""); + params[3] = LLVMBuildTrunc(builder, value, type64, ""); + } } else { - for (i = 0; i < length; ++i) { + for (i = 0; i < vecsize; ++i) { LLVMValueRef param; util_strncat(format, type_fmt, sizeof(format) - strlen(format) - 1); param = LLVMBuildExtractElement(builder, value, lp_build_const_int32(gallivm, i), ""); @@ -144,7 +166,7 @@ lp_build_print_value(struct gallivm_state *gallivm, util_strncat(format, "\n", sizeof(format) - strlen(format) - 1); params[0] = lp_build_const_string(gallivm, format); - return lp_build_print_args(gallivm, 2 + length, params); + return lp_build_print_args(gallivm, 2 + nargs, params); } -- 1.7.11.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] mesa: don't memcmp() off the end of a cache key.
On Mon, 2013-04-01 at 13:04 +1300, Chris Forbes wrote: > @@ -38,6 +38,7 @@ struct cache_item > { > GLuint hash; > void *key; > + GLuint keysize; > struct gl_program *program; > struct cache_item *next; > }; Since GLuint is 32 bits, this creates another hole in the struct on LP64. This would be better written as: struct cache_item { GLuint hash; GLuint keysize; void *key; struct gl_program *program; struct cache_item *next; }; Looks good otherwise. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] llvmpipe: Work without sse2 if llvm is new enough
At least on llvm 3.2 this appears to work fine. Tested on an Athlon XP 2600+, which has sse and 3dnow but not sse2. Signed-off-by: Adam Jackson --- src/gallium/drivers/llvmpipe/lp_screen.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 6700887..ebcf680 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -485,9 +485,10 @@ llvmpipe_create_screen(struct sw_winsys *winsys) { struct llvmpipe_screen *screen; -#ifdef PIPE_ARCH_X86 - /* require SSE2 due to LLVM PR6960. */ util_cpu_detect(); + +#if defined(PIPE_ARCH_X86) && HAVE_LLVM < 0x0302 + /* require SSE2 due to LLVM PR6960. */ if (!util_cpu_caps.has_sse2) return NULL; #endif -- 1.8.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/2] Turning swrast into DRI2 drivers
On Sat, 2014-04-12 at 02:25 +0200, Giovanni Campagna wrote: > Hi everyone, > > Some time ago I sent patches to enable the swrast driver on > GBM/DRM, and I did them in the dumbest way possible (that is, > having GBM implement the dri-swrast interface), to make sure > it would work without kernel support. > This patch series is a little smarter, in that it creates > more than one KMS buffer and has llvmpipe render directly > into the KMS buffer, so we don't need to copy from the back > to the shadow (before the kernel copies from the shadow to > the front). Have you looked into making this work with -modesetting as the ddx driver, not just qxl? - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] radeonsi: Don't use anonymous struct trick in atom tracking
I'm somewhat impressed that current gccs will let you do this, but sufficiently old ones (including 4.4.7 in RHEL6) won't. Signed-off-by: Adam Jackson --- src/gallium/drivers/radeonsi/si_descriptors.c | 6 +++--- src/gallium/drivers/radeonsi/si_hw_context.c | 2 +- src/gallium/drivers/radeonsi/si_pipe.c| 6 +++--- src/gallium/drivers/radeonsi/si_pipe.h| 2 +- src/gallium/drivers/radeonsi/si_state.c | 2 +- src/gallium/drivers/radeonsi/si_state_draw.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index 0c58d5f..e0b211f 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -987,9 +987,9 @@ void si_init_all_descriptors(struct si_context *sctx) si_init_sampler_views(sctx, &sctx->samplers[i].views, i); - sctx->atoms.const_buffers[i] = &sctx->const_buffers[i].desc.atom; - sctx->atoms.rw_buffers[i] = &sctx->rw_buffers[i].desc.atom; - sctx->atoms.sampler_views[i] = &sctx->samplers[i].views.desc.atom; + sctx->atoms.s.const_buffers[i] = &sctx->const_buffers[i].desc.atom; + sctx->atoms.s.rw_buffers[i] = &sctx->rw_buffers[i].desc.atom; + sctx->atoms.s.sampler_views[i] = &sctx->samplers[i].views.desc.atom; } diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c index 383157b..d2a1dbe 100644 --- a/src/gallium/drivers/radeonsi/si_hw_context.c +++ b/src/gallium/drivers/radeonsi/si_hw_context.c @@ -63,7 +63,7 @@ void si_need_cs_space(struct si_context *ctx, unsigned num_dw, } /* Count in framebuffer cache flushes at the end of CS. */ - num_dw += ctx->atoms.cache_flush->num_dw; + num_dw += ctx->atoms.s.cache_flush->num_dw; #if SI_TRACE_CS if (ctx->screen->b.trace_bo) { diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index a1aea7b..2627571 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -105,10 +105,10 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, void * /* Initialize cache_flush. */ sctx->cache_flush = si_atom_cache_flush; - sctx->atoms.cache_flush = &sctx->cache_flush; + sctx->atoms.s.cache_flush = &sctx->cache_flush; - sctx->atoms.streamout_begin = &sctx->b.streamout.begin_atom; - sctx->atoms.streamout_enable = &sctx->b.streamout.enable_atom; + sctx->atoms.s.streamout_begin = &sctx->b.streamout.begin_atom; + sctx->atoms.s.streamout_enable = &sctx->b.streamout.enable_atom; switch (sctx->b.chip_class) { case SI: diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index a74bbcf..1601a4b 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -110,7 +110,7 @@ struct si_context { struct r600_atom *streamout_begin; struct r600_atom *streamout_enable; /* must be after streamout_begin */ struct r600_atom *framebuffer; - }; + } s; struct r600_atom *array[0]; } atoms; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 921264e..734054f 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2954,7 +2954,7 @@ void si_init_state_functions(struct si_context *sctx) { int i; - si_init_atom(&sctx->framebuffer.atom, &sctx->atoms.framebuffer, si_emit_framebuffer_state, 0); + si_init_atom(&sctx->framebuffer.atom, &sctx->atoms.s.framebuffer, si_emit_framebuffer_state, 0); sctx->b.b.create_blend_state = si_create_blend_state; sctx->b.b.bind_blend_state = si_bind_blend_state; diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c index 0676b15..c7c94fc 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.c +++ b/src/gallium/drivers/radeonsi/si_state_draw.c @@ -964,7 +964,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info) /* Check flush flags. */ if (sctx->b.flags) - sctx->atoms.cache_flush->dirty = true; + sctx->atoms.s.cache_flush->dirty = true; si_need_cs_space(sctx, 0, TRUE); -- 1.8.5.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glx: Don't uselessly dlopen libGL within libGL
This is entirely pointless. The DRI driver does not need any symbols from libGL, even if it did libGL would already be available to resolve them because that's how dlopen works. Signed-off-by: Adam Jackson --- src/glx/dri_common.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index e5a3f70..235d350 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -93,14 +93,11 @@ dri_message(int level, const char *f, ...) _X_HIDDEN void * driOpenDriver(const char *driverName) { - void *glhandle, *handle; + void *handle; const char *libPaths, *p, *next; char realDriverName[200]; int len; - /* Attempt to make sure libGL symbols will be visible to the driver */ - glhandle = dlopen("libGL.so.1", RTLD_NOW | RTLD_LOCAL); - libPaths = NULL; if (geteuid() == getuid()) { /* don't allow setuid apps to use LIBGL_DRIVERS_PATH */ @@ -146,9 +143,6 @@ driOpenDriver(const char *driverName) if (!handle) ErrorMessageF("unable to load driver: %s_dri.so\n", driverName); - if (glhandle) - dlclose(glhandle); - return handle; } -- 1.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glx: Don't uselessly dlopen libGL within libGL
On Thu, 2014-05-29 at 15:10 -0700, Ian Romanick wrote: > That code was originally added by: > > commit 061a3fe34051327fba418cc99599ecff0016ee15 > Author: Michel Dänzer > Date: Mon Aug 14 15:53:37 2006 + > > Bug #7169: Attempt to make libGL symbols visible to drivers. > > Some applications end up dlopening libGL without RTLD_GLOBAL, so the libGL > symbols referenced by the driver can't be unresolved when libGL dlopens > it. > This attempts to make the libGL symbols visible to the driver by dlopening > libGL (again) with RTLD_GLOBAL before dlopening the driver and dlclosing > the obtained handle afterwards. > > So... I think that's not how dlopen always works. For other reasons, I > don't think the DRI drivers directly access symbols from libGL, so this > may be safe anyway. I'd want to see it tested, though. Tested this with a cut-down version of glxdemo.c: http://people.freedesktop.org/~ajax/dlopen-glxdemo.c And with the dlopen of libGL removed indeed it doesn't DTRT: dmt:~% ./glxdemo libGL error: dlopen /usr/lib64/dri/i965_dri.so failed (/usr/lib64/dri/i965_dri.so: undefined symbol: _glapi_tls_Dispatch) libGL error: unable to load driver: i965_dri.so libGL error: driver pointer missing libGL error: failed to load driver: i965 Which I guess makes sense. The RTLD_LOCAL open of libGL means neither libGL nor its dependencies are made visible to other loaded objects, and libGL happens to be the only thing linked against libglapi. I think that's just a bug, the drivers should link against glapi as well. However just linking the drivers against glapi wouldn't necessarily mean we could eliminate the self-dlopen from libGL, because it would break the case of app doing dlopen(new libGL, LAZY) with an old driver. Is this a thing we actually care about? Can we not? In RHEL6 we have a package of Mesa 7.11 that just emits the DRI1 drivers for compatibility since we've rebased our real Mesa, but I'd be entirely happy to update mesa-dri1-drivers to be properly linked if we pulled this change into a future RHEL6 update. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH v2 0/3] Software rasterizer in the DRM EGL platform
On Thu, 2014-05-15 at 01:58 +0100, Emil Velikov wrote: > On 05/05/14 17:07, Giovanni Campagna wrote: > > This is my second attempt to bring swrast to the DRM EGL platform. > > It includes both the legacy loader, which will work with any > > swrast driver, and the new gallium winsys which works with the > > DRI2 loader and softpipe/llvmpipe. > > > Hi Giovanni, > > Just sent a handful of nitpicks for the patches. While I'm not the best person > to comment on the overall architecture/approach of the patches, I believe they > look quite good. Is there an updated version of this series with Emil's feedback incorporated? At least the Makefile changes probably should happen. The code itself looks reasonable enough to me. - ajax ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] linux: Don't emit a .note.ABI-tag section anymore (#26663)
We don't support pre-2.6 kernels anyway - the install docs say 2.6.28 for DRI - and apparently this confuses ld.so's sorting when multiple libGLs are installed. Just remove it. Signed-off-by: Adam Jackson --- src/mapi/entry_x86-64_tls.h | 13 - src/mapi/entry_x86_tls.h| 13 - src/mapi/glapi/gen/gl_x86-64_asm.py | 13 - src/mapi/glapi/gen/gl_x86_asm.py| 13 - 4 files changed, 52 deletions(-) diff --git a/src/mapi/entry_x86-64_tls.h b/src/mapi/entry_x86-64_tls.h index 72d4125..36cad00 100644 --- a/src/mapi/entry_x86-64_tls.h +++ b/src/mapi/entry_x86-64_tls.h @@ -28,19 +28,6 @@ #include "u_macros.h" -#ifdef __linux__ -__asm__(".section .note.ABI-tag, \"a\"\n\t" -".p2align 2\n\t" -".long 1f - 0f\n\t" /* name length */ -".long 3f - 2f\n\t" /* data length */ -".long 1\n\t"/* note length */ -"0: .asciz \"GNU\"\n\t" /* vendor name */ -"1: .p2align 2\n\t" -"2: .long 0\n\t" /* note data: the ABI tag */ -".long 2,4,20\n\t" /* Minimum kernel version w/TLS */ -"3: .p2align 2\n\t");/* pad out section */ -#endif /* __linux__ */ - __asm__(".text\n" ".balign 32\n" "x86_64_entry_start:"); diff --git a/src/mapi/entry_x86_tls.h b/src/mapi/entry_x86_tls.h index de91812..58d09ca 100644 --- a/src/mapi/entry_x86_tls.h +++ b/src/mapi/entry_x86_tls.h @@ -29,19 +29,6 @@ #include #include "u_macros.h" -#ifdef __linux__ -__asm__(".section .note.ABI-tag, \"a\"\n\t" -".p2align 2\n\t" -".long 1f - 0f\n\t" /* name length */ -".long 3f - 2f\n\t" /* data length */ -".long 1\n\t"/* note length */ -"0: .asciz \"GNU\"\n\t" /* vendor name */ -"1: .p2align 2\n\t" -"2: .long 0\n\t" /* note data: the ABI tag */ -".long 2,4,20\n\t" /* Minimum kernel version w/TLS */ -"3: .p2align 2\n\t");/* pad out section */ -#endif /* __linux__ */ - __asm__(".text"); __asm__("x86_current_tls:\n\t" diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py b/src/mapi/glapi/gen/gl_x86-64_asm.py index a3548c2..19e0e15 100644 --- a/src/mapi/glapi/gen/gl_x86-64_asm.py +++ b/src/mapi/glapi/gen/gl_x86-64_asm.py @@ -181,19 +181,6 @@ class PrintGenericStubs(gl_XML.gl_print_base): def printRealFooter(self): print '' -print '#if defined(GLX_USE_TLS) && defined(__linux__)' -print '.section ".note.ABI-tag", "a"' -print '.p2align 2' -print '.long 1f - 0f /* name length */' -print '.long 3f - 2f /* data length */' -print '.long 1 /* note length */' -print '0: .asciz "GNU" /* vendor name */' -print '1: .p2align 2' -print '2: .long 0 /* note data: the ABI tag */' -print '.long 2,4,20/* Minimum kernel version w/TLS */' -print '3: .p2align 2/* pad out section */' -print '#endif /* GLX_USE_TLS */' -print '' print '#if defined (__ELF__) && defined (__linux__)' print '.section .note.GNU-stack,"",%progbits' print '#endif' diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py index 8b0f6ee..919bbc0 100644 --- a/src/mapi/glapi/gen/gl_x86_asm.py +++ b/src/mapi/glapi/gen/gl_x86_asm.py @@ -189,19 +189,6 @@ class PrintGenericStubs(gl_XML.gl_print_base): print '\t\tALIGNTEXT16' print 'GLNAME(gl_dispatch_functions_end):' print '' -print '#if defined(GLX_USE_TLS) && defined(__linux__)' -print '.section ".note.ABI-tag", "a"' -print '.p2align 2' -print '.long 1f - 0f /* name length */' -print '.long 3f - 2f /* data length */' -print '.long 1 /* note length */' -print '0: .asciz "GNU" /* vendor name */' -print '1: .p2align 2' -print '2: .long 0 /* note data: the ABI tag */' -print '.long 2,4,20/* Minimum kernel version w/TLS */' -print '3: .p2align 2/* pad out section */' -print '#endif /* GLX_USE_TLS */' -print '' print '#if defined (__ELF__) && defined (__linux__)' print '.section .note.GNU-stack,"",%progbits' print '#endif' -- 1.8.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gallivm: Fix altivec intrinsics for 8xi16 add/sub
Signed-off-by: Adam Jackson --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index ec05026..524a8e7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -378,7 +378,7 @@ lp_build_add(struct lp_build_context *bld, if(type.width == 8) intrinsic = type.sign ? "llvm.ppc.altivec.vaddsbs" : "llvm.ppc.altivec.vaddubs"; if(type.width == 16) - intrinsic = type.sign ? "llvm.ppc.altivec.vaddsws" : "llvm.ppc.altivec.vadduws"; + intrinsic = type.sign ? "llvm.ppc.altivec.vaddshs" : "llvm.ppc.altivec.vadduhs"; } } @@ -655,7 +655,7 @@ lp_build_sub(struct lp_build_context *bld, if(type.width == 8) intrinsic = type.sign ? "llvm.ppc.altivec.vsubsbs" : "llvm.ppc.altivec.vsububs"; if(type.width == 16) - intrinsic = type.sign ? "llvm.ppc.altivec.vsubsws" : "llvm.ppc.altivec.vsubuws"; + intrinsic = type.sign ? "llvm.ppc.altivec.vsubshs" : "llvm.ppc.altivec.vsubuhs"; } } -- 1.8.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev