New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS opengl-cb backend #4833
macOS opengl-cb backend #4833
Conversation
video/out/vo_opengl_cb.c
Outdated
int r = VO_NOTIMPL; | ||
if (p->ctx->control_cb) { | ||
int events = 0; | ||
r = p->ctx->control_cb(p->ctx->control_cb_ctx, &events, request, data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsynchronized access to the callback.
player/screenshot.c
Outdated
write_screenshot(mpctx, img, filename, NULL, true); | ||
talloc_free(filename); | ||
talloc_free(img); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really like this approach, and also synchronization of any form is missing.
As I said in the previous issue, I tested it for a bit and so far I didn't notice any particular difference performance wise compared to master, and it definitely seems to fix the mentioned issues (not 100% sure about #3978, only time and use will tell since it's difficult to reproduce at will). Just one question though: during testing I once forgot to type --vo=opengl-cb, so it started with regular vo=opengl and hanged without drawing any window. Are the two cocoa backends mutually exclusive or in the final version will be still possible to select and use the current one (e.g. for testing purposes)? |
that will be fixed in the final version. it's just a matter of a proper option and updating the init routine of it (a little bit). after that using both will be possible. |
This may not be useful, but on OS X 10.9 and later, the |
|
Ok, I wasn't sure if some of the dual GPU systems could have only one GPU capable of OpenGL 4.1, which if not already selected as the default, could be switched over by the system if this were set.? Essentially, would it ever be desirable to raise the minimum bound that high for the |
Thanks for working on this. I tried to build d5c93df on high sierra (17A360a) but it fails with:
Any ideas? |
if you can run the build with |
It's the same error I had when I tried to build it without the full Xcode. |
Thanks for the hint AirPort. I modified wscript_build.py file like so (I have xcode 9 beta installed) - '-L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift_static/macosx',
+ '-L/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift_static/macosx', But still it wont build, looks like it might be Swift 4 errors. I have put the verbose log here: https://gist.github.com/ottob/11648da514c0986f72b2c7a60fceb9cf |
It seems it just produces a black screen when mpv's dithering is enabled. Tested with d5c93df. |
I can reproduce the black screen, but only with |
@ottob yeah i tested this with swift 3. you can add a @macdavis dithering is always enabled by default. it's just the size of the fruit dither you used. it already takes ages to load here with the normal cocoa backend. it also does work with cocoa-cb you just have to wait (the same time) till the video appears. the difference is that with the normal cocoa backend the mpv core blocks till it's done computing, with opengl-cb it can already start drawing without the blocking, that results in a temporary black screen. |
Thanks! The video does show after some time of waiting. |
c8abfa0
to
4cb9c98
Compare
|
indeed a single dash. i blame mpv for that. |
Ive only done some very basic testing, but have not noticed any regressions. Thanks for maintaining the macOS code :) Some debug prints are still around, but you probably know that:
|
e372b57
to
5f29284
Compare
video/out/vo_opengl_cb.c
Outdated
@@ -479,7 +484,13 @@ static int reconfig(struct vo *vo, struct mp_image_params *params) | |||
|
|||
void mp_client_set_icc_profile(struct mpv_opengl_cb_context *ctx, bstr icc_data) | |||
{ | |||
pthread_mutex_lock(&ctx->icc_lock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to always call the function on the renderer thread? That's probably also how an official opengl-cb API for this would work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh do you mean like it was before (thought the current approach was preferable) or do it in the mpv_opengl_cb_draw function via a flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just rule that mp_client_set_icc_profile
can be called in the GL thread only, so that no additional synchronization is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure can do that. something broke anyway when i rebased it with the current "vo_gpu" changes. just getting a "blue screen" and shader errors on some icc profile changes.
should i mention that rule somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a comment on the function would be good.
1eedec0
to
c0eea88
Compare
572676c
to
76a78bf
Compare
If ever this emoji was justified. |
Thank you very much @Akemi for the work you put in that PR and especially for making mpv a first class citizen in the every changing Apple environment again. |
When I try to upgrade from brew, I get this:
Might be an error on their side, but maybe good to know anyway. |
Damn, did not test it with python3 in my setup. Can you try if b' -version' fixes this? |
yeah i am in the process of fixing a few issues. |
@maru-sama I would love to, but I'm not sure how to change brew's compilation files. There is a git folder in |
Forget it, this won't work anyway since split is used afterwards which will obviously fail. Akemi is working on it right now. |
Thanks for fixing the python3 issue for the configuration step! Unfortunately, brew still fails in the linking/compiling step:
|
i believe it's because cocoa-cb is statically linked to the swift libs. for now either build with |
Okay, thanks for your work. I'll try to edit the homebrew formula to see if I can pass those flags. |
a quick look, it seems like the problem is that it doesn't try to link to the swift object file when libmpv is linked. maybe my first guess was wrong too. |
Another question, is it intentional that |
yeah it's explicitly filtered out here. is this a problem and should be changed? it's like this since opengl-cb was only meant to be used with libmpv. |
Using vo=opengl-cb, the stats script (shift-i), does not show anything on the second page. This is with MPV HEAD (8762818) with --enable-libmpv-static. Using vo=gpu, the second page works as expected. Is this expected? |
yes this is a known limitation of opengl-cb. i added the functionality but it was buggy and i had to remove it for now, also see #5322. i will (re)add it with a future PR, i already have a working branch. |
I've been busy the last couple of days so I couldn't test it in its final version, but now that it's finally been merged I rushed to build it. Unfortunately it seems that commit 235eb60 broke the ffmpeg detection check on my end (macOs 10.13.3).
since 235eb60 waf gives an error and then it stops
(of course it's the latest ffmpeg git version in both cases). Any idea? |
i will try too look at it tomorrow. seems kinda weird though. |
If it can be useful, this is the waf config.log file (and here's the one for the last working commit, abf2efb). |
@AirPort i see this
can you maybe rebuild ffmpeg and if this doesn't work addtiotnally disable could be that libtheoraenc was updated without ffmpeg being rebuild or something. |
I'll try and report, but the strange thing about that is that I'm trying to build mpv against the exact same static built ffmpeg's libraries in both cases. BTW, what about
a few lines beneath? |
that's the libav check and is supposed to fail, in your case. it also fails in both of your logs. |
Oh crap, you're right. Maybe tomorrow I'll try with shared ffmpeg, maybe the issue is with static libraries? |
the same error shouldn't happen if nothing else depends on it or it picks up an older version of ffmpeg. could you maybe try maybe also try removing line 106-109, the whole if. i just tried building on 10.13 too and it worked for me. |
So, I made it work by removing the the --enable-libsoxr option from ffmpeg build (toghether with --enable-libtheora). I don't know why the presence of those two options suddenly caused the build to fail between those two commit i referenced before, but I honestly think I can live without them. If you still want to investigate more on the matter, I'll be glad to provide any useful information tomorrow. Anyways, good job on the cocoa-cb backend! Seeing all those annoying little issue going away for good is just great. |
i still can't reproduce the ffmpeg linking issue. my ffmpeg is also build with |
To provide another data point, I have no problem installing homebrew ffmpeg with: |
Well, I honestly don't care for those two options enough to make you lose your time chasing an elusive issue for basically no gain. |
if it's a widespread issue i bet we will get a lot more complains from homebrew and more input on the source of the problem. i will probably investigate it at that point some more. sry we only have a workaround for that atm. |
this is a WIP and attempts to fix various annoying macOS bugs and the very long standing fullscreen regression completely. it still needs testing and some fix-ups.
this will definitely fix: #5478, #5393, #5152, #5151, #4615, #4476, #3746, #3739, #2392, #2217
and possibly fixes: #3978
feel free to test and report unknown bugs. for now one just needs to set
--vo=opengl-cb
,though if the mpv core is too fast you might get a "No context set." error.there are a few things to do where i don't know how to solve them yet and i might need some help.
TODO cocoa-cb:
proper cocoa-cb init routine, (--no-config --vo=opengl-cb fails since no context yet)cocoa-cb vo option or comparable(just compile time flag, uses vo=opengl-cb)doesn't draw when minimised, off screen, different space etc.get a hide (and unhide) event for windowless playbackremove "[opengl-cb] icc-profile-auto is not available with opengl-cb" warning in an acceptable waychange lux scale(db0fb3c)remove "Taking screenshot failed." warning, appears on screenshot (window), not too happy with the window screenshot codeon shutdown wait for animations to finishperformance data buggyICC profile switching leads to flicker in some cases (with icc-profile-auto=no, most likely an Apple bug)TODO Build:
flag to deactivate cocoa-cbdynamic developer path for static_swiftset build target min system requirementsthings i will fix soonish:
fullscreen animation stretches video to target aspect ratiocrashes on video stream switch to no-video (related to "hide and unhide event for windowless")implement none-native fsadd license headers(deactivate the early flush on macOS)TODO misc:
add a deprecation warning for the old opengl cocoa backend?