Gerald Pfeifer <gerald(a)pfeifer.com> writes:
> So, I admit I don't really know this code, but looking at it (triggered
> by a warning issued by GCC development versions), I noticed that this
> variable passed by reference is not initialized here.
It's initialized when we return a type, and it doesn't need to be
initialized on NULL return. The code is correct, but you could probably
set the variable to NULL in the caller to silence the warning.
--
Alexandre Julliard
julliard(a)winehq.org
Looking at
RPC_STATUS WINAPI RpcBindingVectorFree( RPC_BINDING_VECTOR** BindingVector )
{
RPC_STATUS status;
ULONG c;
TRACE("(%p)\n", BindingVector);
for (c=0; c<(*BindingVector)->Count; c++) {
status = RpcBindingFree(&(*BindingVector)->BindingH[c]);
}
HeapFree(GetProcessHeap(), 0, *BindingVector);
*BindingVector = NULL;
return RPC_S_OK;
}
we currently always ignore the outcome of RpcBindingFree and return
RPC_S_OK.
However, there is one case where RpcBindingFree returns something
different (which is if *Binding is null when RPC_S_INVALID_BINDING
is returned).
What is the proper way of handling this? Just keeping the code as
is and removing the unused status variable? Breaking the loop once
RpcBindingFree returns something different from RPC_S_OK? Continuing
and returning the first / the last status different from RPC_S_OK?
Gerald
Here are some things I've learned about PCI-passthrough recently, which
would be one way (probably the best) to add "real hardware" to the
TestBot.
I don't want to give anyone false hopes though: this just went from
"this is a mysterious thing I need to learn about" to "I think I know
how to do it but have not tried it yet".
So graphics card PCI-passthrough is now relatively well documented on
the Internet and seems to have seen some use-cases that would indicate
it may even be reasonably usable.
* There are two machines intended to run real GPU tests for Wine:
cw1-hd6800 and cw2-gtx560. For now they are only used to run WineTest
daily on Windows 8.1, Windows 10 1507, 1709, 1809 and Linux. That's
quite a bunch but it would be much better if they were integrated with
the TestBot as that would allow developers to submit their own tests.
So I had a look at what it would imply to convert them to VM hosts
using QEmu + PCI-passthrough.
* First one needs a processor with hardware virtualisation support. For
Intel that's VT-d. Both machines have an Intel Core 2600 which
supports VT-d. Good.
* Second the motherboard too needs to support VT-d. Both machines have
an ASRock P67 Extreme4 motherboard. Unfortunately UEFI says
"unsupported" next to the "VT-d" setting for the motherboard :-( It
looks like there was some confusion as to whether the P67 chipset
supported VT-d initially. From what I gathered it's only Q67 that does
but this caused some manufacturers, among which ASRock, to initially
claim support and later retract it.
* Then one needs to add the intel_iommu=on option to the kernel command
line (resp. amd_iommu). This is should make all the PCI devices appear
in /sys/kernel/iommu_groups. But that folder remains empty which
confirms that full VT-d support is missing.
* Another important aspect is to have a graphics card which is
hot-restartable. In some cases when a VM's graphics card is crashed
the only way to reset it is to reboot the host. The TestBot is likely
to crash the graphics card, particularly if we do a hard-power off on
the VMs like we currently do, and it would relaly be annoying to have
to reboot the host everytime the graphics card goes belly up.
I don't know if the AMD HD6800 and Nvidia GTX560 are suitable but it's
quite possible they are not. All I know for now is that we should
avoid AMD's R9 line of graphics cards. I still need to find a couple
of suitable reasonably lower power graphics cards: one AMD and one
Nvidia.
* Then one needs to prevent the host from using the graphics card.
Usually that's done by having the host use the processor's IGP and
dedicating the discrete GPU to the VMs. Unfortunately the 2600's IGP
cannot be active when there's a discrete card so that route is denied
to us. Fortunately there's quite a bit of documentation on how to shut
down not just X but also the Linux virtual consoles to free the GPU
and hand it over to the VMs after boot.
Doing so means losing KVM access to the host which is a bit annoying
in case something goes wrong. So ideally we'd make sure this does not
happen in grub's "safe mode" boot option.
* Although I have not done any test yet I'm reasonably certain that
PCI-passthrough rules out live snapshots: QEmu would have no way to
restore the graphics card's internal state.
- For Windows VMs that's not an issue: if we provide a power off
snapshot the TestBot already knows how to power on the VM and wait
for it to boot (as long as the boot is shorter than the connection
timeout but it works out usually).
- For Linux VM's that's more of an issue: the TestBot will power on
the VM as usual. The problem is when it updates Wine: after
recompiling everything it deletes the old snapshot and creates a new
one from the current state of the VM, which means a live snapshot.
So the TestBot will need to be modified so it knows when and how to
power off the VM and take a powered off snapshot.
* Since the VM has full control of the graphics card QEmu has no access
to the content of the screen. That's not an issue for the normal
TestBot operation, just for the initial VM setup. Fortunately the
graphics card is connected to a KVM so the screen can be accessed
through that means. It does mean assigning the mouse and keyboard to
the VM too. Should that prove impractical there are a bunch of other
options too: VNC, LookingGlass, Synergy, etc. But the less needs to be
installed in the VMs the better.
* Also the TestBot uses QEmu to take the screenshots. But QEmu does not
have access to the content of the screen. The fix is to use a tool to
take the screenshots from within the VM and use TestAgent to retrieve
them. On Linux there are standard tools we can use. On Windows there's
code floating around we can use.
So the next steps would be:
* Maybe test on my box using the builtin IGP.
But that likely won't be very conclusive beyond confirming the
snapshot issues, screen access, etc.
* Find a suitable AMD or Nvidia graphics card and test that on my box.
That would allow me to fully test integration with the TestBot, check
for stability issues, etc.
* Then see what can be done with the existing cw1 and cw2 boxes.
--
Francois Gouget <fgouget(a)codeweavers.com>
The idea of using PE libraries for some Wine library dependencies came
up recently because of a bug in CrossOver's 32-bit support on Mac
(which uses 64-bit system libraries). Wine's xaudio libraries don't do
any translation of 32-bit structures to 64-bit for the native FAudio,
meaning that in this configuration, they don't work at all. If FAudio
and xaudio were both built as a PE, 32-bit binary, we wouldn't need
this translation.
Not all dependencies could be used in PE form, anything that needs to
interact with the host system wouldn't work. We'll always need native
libraries for X11, OpenGL, Vulkan, and host audio libraries, for
example. Only libraries like libpng or FAudio which can function based
on win32 API's we provide (and/or other libraries) could work.
Advantages:
* This reduces the surface area of Wine's interface between the
virtual Windows environment and host libraries. That makes the
transition to PE simpler, and should make it easier to implement
32-bit with 64-bit host libraries in the official Wine release
(because fewer thunks to 64-bit host libraries will be required).
* It reduces dependencies on host libraries. If FAudio.dll is shipped
with Wine or in some other way, users won't need an FAudio package
from the host distribution.
* It allows code sharing between Wine itself and the Mono and Gecko
addons. It's kinda silly that Wine already ships an FAudio.dll, inside
Wine Mono, for its XNA support. Wine's xaudio could theoretically be
sharing this code, but it isn't.
Requirements:
* Any solution should function even if mingw is not available in the
build environment. This is a challenge because the headers may not
work correctly in the winelib build environment. In particular, the
calling convention is different between 64-bit Windows and everywhere
else, which requires us to decorate Gecko and Mono exports with CDECL
so we can call them correctly. It may be possible to work around this
problem by wrapping the headers with pragma GCC target.
* We probably shouldn't break anything that works in any currently
supported ports. With llvm-mingw, we now have the ability to build PE
libraries for arm and aarch64 (I've built SDL2 and FAudio this way
myself, but I don't have a test environment for them). I'm not sure of
the status of the PowerPC and sparc ports. Are these maintained? Do we
care? If we do, we'll need to preserve the ability to use native
libraries, or build the libraries in winelib.
* Our versions of PE dependency libraries must be independent of an
application shipping the same libraries. If we ship an FAudio.dll, and
an application ships an incompatible FAudio.dll, Wine and the
application should each load their own version. This is not an
unlikely scenario, as many libraries make use of C standard library
features such as FILE or malloc/free in their API's, which means that
the ABI depends on which version of the Microsoft C runtime was used
to compile it.
I started a proof of concept, but I got stuck on the question of how
to distribute the FAudio headers, link-time libraries, and binaries.
Part of my proof of concept is a repo on github:
https://github.com/madewokherd/wine-pedeps
Currently, that project builds a couple of PE libraries and does
nothing else. It could be developed further to generate packages of
headers, libraries, and/or binaries. I'll be referring to that project
as wine-pedeps.
Options for distributing dependencies:
* Distribute headers and libs in a tarball built from wine-pedeps.
The binaries would be part of an addon, also built from wine-pedeps.
* Import the headers into the Wine tree, and link using LoadLibrary
so we don't need .lib files. The headers could be an output from
wine-pedeps that gets dropped into a folder like
include/wine/external. For building Gecko and Mono, we'd still get
headers and libs from wine-pedeps. No one seems to like this idea.
* Depend on headers from the host distribution for the corresponding
Linux library, and link using LoadLibrary. I'm not sure if this can
work reliably, or even if we can make host headers accessible inside
mingw without breaking things. For building Gecko and Mono, we'd still
get headers and libs from wine-pedeps.
* Import entire projects into the Wine tree, perhaps as a submodule.
We would then build them and distribute them with Wine. In case mingw
is not available, we'd need the option of building them with winelib,
or using a host library instead. I don't think the Wine maintainer
likes submodules, and I personally don't like the idea of bloating the
Wine source distribution the way Mono's use of this approach has
forced bloat on the Wine Mono source tree.
* Rely on the host distribution to package mingw headers, libs, and
binaries for the dependencies we need. The binaries would then be
distributed with Wine. Fedora is the only distribution I'm aware of
that has an extensive library of mingw packages. To make this easier
on other distros, I could maintain wine-pedeps as an alternative
source of headers, libraries, and binaries at build time. The trouble
with this approach is that it's not clear how we can keep Wine's
libraries independent from the application. Perhaps an automated
process could rename the binaries and edit their import tables, or sxs
could be added after the fact.
Hi all,
Last night Martin pushed an update to llvm-mingw bumping version of LLVM
to a commit that includes a number of fixes for Wine. See [1] for
details. Thank you, Martin! Meantime, Wine got required fixes, so that
it all should mostly work together. If you want to try it, just clone
[2] git and run:
DEFAULT_MSVCRT=msvcrt-os ./build-all.sh /path/to/install
If the installation is on PATH, current Wine should be able to use it
without any additional tweaks. You should be able to configure it just
like configuration on GCC-based mingw works.
DEFAULT_MSVCRT=msvcrt-os part is needed because Wine can't deal with
mingw-w64 defaulting to crt version other than msvcrt.dll. This is not a
problem specific to LLVM, we will hit the same problem on GCC if
mingw-w64 is configured to use other crt (usually ucrt, things like
msvcrt100 is also possible). It is not yet a popular setup, but it will
probably be more popular over time, so it would be great to have it
supported. The ultimate solution for Wine is to always use
-nodefaultlibs for all its binaries. It's already the case for all Wine
builtin DLLs, we just need to do the same for EXEs. I have some
unfinished patches for that, but it's not something appropriate for code
freeze. I'm experimenting with a smaller fix, because it would be great
to have something sooner, but using DEFAULT_MSVCRT=msvcrt-os is required
for now.
One of nice LLVM features is support for PDB files. If you want to make
a build with PDB files, configure Wine like this:
configure CROSSCFLAGS="-g -gcodeview -O2" CROSSLDFLAGS="-Wl,-pdb="
#append your usual args
and then run make like:
make CROSSLDFLAGS="-Wl,-pdb="
The additional make argument is needed because Wine does not yet
propagate CROSSLDFLAGS from configure. Patch [3] should fix it.
Cheers,
Jacek
[1]
https://github.com/mstorsjo/llvm-mingw/commit/056c1f5cd22b1c5ca76af38f2d1f9…
[2] https://github.com/mstorsjo/llvm-mingw
[3] https://source.winehq.org/patches/data/176054
Even after patches by Michael Cronenworth and me, cf.
https://www.winehq.org/pipermail/wine-devel/2020-January/157945.htmlhttps://www.winehq.org/pipermail/wine-devel/2020-January/158454.html
Wine still fails to build with GCC 10 development snapshots.
This is due to a change of defaults in GCC, from -fcommon to -fno-common,
cf. the following from http://gcc.gnu.org/gcc-10/porting_to.html :
A common mistake in C is omitting extern when declaring a global
variable in a header file. If the header is included by several files it
results in multiple definitions of the same variable. In previous GCC
versions this error is ignored. GCC 10 defaults to -fno-common, which
means a linker error will now be reported. To fix this, use extern in
header files when declaring global variables, and ensure each global is
defined in exactly one C file. As a workaround, legacy C code can be
compiled with -fcommon.
The failure left is
gmake[1]: Entering directory '/home/gerald/wine/dlls/schedsvc/tests'
../../../tools/winegcc/winegcc -o schedsvc_test-stripped.exe.so
--wine-objdir ../../.. -fno-PIC -fasynchronous-unwind-tables \
-s -Wb,-F,schedsvc_test.exe -mno-cygwin atsvcapi.o rpcapi.o atsvc_c.o
schrpc_c.o testlist.o \ -lrpcrt4 -lole32 -L/home/gerald/11-i386/lib
schrpc_c.o:(.bss+0x0): multiple definition of `rpc_handle'
atsvc_c.o:(.bss+0x0): first defined here
winebuild: /home/gerald/11-i386/bin/ld failed with status 1
winegcc: ../../../tools/winebuild/winebuild failed
gmake[1]: *** [Makefile:367: schedsvc_test-stripped.exe.so] Error 2
gmake[1]: Leaving directory '/home/gerald/wine/dlls/schedsvc/tests'
gmake: *** [Makefile:8961: dlls/schedsvc/tests] Error 2
atsvc_c.c and schrpc_c.c are auto-generated from atsvc.idl and
schrpc.idl, so I'm not sure how to tackle this.
Anyone who can help and take this?
Thank you,
Gerald
Hi,
Since we had troubles getting GSoC students and project ideas in the past year I'd like to bring up a controversial suggestion: Talk to the projects that popped up around Wine like PlayOnLinux, Lutris, DXVK if they have GSoC-compatible ideas and host them as a Wine GSoC project.
Ideally those projects would be something that reduces friction between upstream Wine and other projects. E.g. on FOSDEM I talked with Josh Ashton and he mentioned d3d behaviors that some games depend on for which we don't have tests and that sometimes work in wined3d by accident or don't work. Syncing those lessons by writing and upstreaming proper Wine tests would be a valuable thing for everyone.
I don't know enough about PlayOnLinux or Lutris to suggest anything outright, but I still think it's worth asking them.
Cheers,
Stefan