Skip to content
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

Doesn't work for webos 4.9 ... #23

Closed
Sanek78 opened this issue Dec 25, 2021 · 30 comments
Closed

Doesn't work for webos 4.9 ... #23

Sanek78 opened this issue Dec 25, 2021 · 30 comments
Labels
dile_vt Issues related to webOS low-level capture backend

Comments

@Sanek78
Copy link

Sanek78 commented Dec 25, 2021

Super project, thanks! But it doesn't work for me. Here is the log:

root@LGwebOSTV:/media/developer/apps/usr/palm/services/org.webosbrew.piccap.service# /media/developer/apps/usr/palm/services/org.webosbrew.piccap.service/hyperion-webos_libvt -a 192.168.1.97
[EGL] Display, major = 1, minor = 4
[EGL] Surface size: 192x108
[EGL] init complete
[VT] VT_CreateVideoWindow
[VT] window_id=0
[VT] VT_AcquireVideoWindowResource
[VT] resource_id=85
[VT] VT_CreateContext
[VT] VT_CreateContext Failed

"board_type": "K5LP_DVB",
"hardware_id": "HE_DTV_W19P_AFADABAA",
"product_id": "60UM7100PLB",
"core_os_release": "4.9.0-53904",
"webos_manufacturing_version": "05.00.15",

Can I fix it somehow?

@Informatic
Copy link
Member

Informatic commented Dec 26, 2021

First try changing resolution by adding these options: -x 384 -y 216 and see if it starts up properly.

Then you can try downloading latest development CI build here: https://github.com/webosbrew/hyperion-webos/actions/runs/1612798406
How to run it: https://github.com/webosbrew/hyperion-webos#running

Seems like this TV may work with --backend libdile_vt option.

@Sanek78
Copy link
Author

Sanek78 commented Dec 26, 2021

Such results:

  1. root@LGwebOSTV:~# /media/developer/apps/usr/palm/services/org.webosbrew.piccap.service/hyperion-webos_libvt -a 192.168.1.97 -x 384 -y 216
    [EGL] Display, major = 1, minor = 4
    [EGL] Surface size: 384x216
    [EGL] init complete
    [VT] VT_CreateVideoWindow
    [VT] window_id=0
    [VT] VT_AcquireVideoWindowResource
    [VT] resource_id=85
    [VT] VT_CreateContext
    [VT] VT_CreateContext Failed

  2. root@LGwebOSTV:/tmp# LD_LIBRARY_PATH=. ./hyperion-webos -b libvt -a 192.168.1.97 -x 384 -y 216
    [EGL] Display, major = 1, minor = 4
    [EGL] Surface size: 384x216
    [EGL] init complete
    [VT] VT_CreateVideoWindow
    [VT] window_id=0
    [VT] VT_AcquireVideoWindowResource
    [VT] resource_id=85
    [VT] VT_CreateContext
    [VT] VT_CreateContext Failed
    Error! capture_initialize: -1.
    osal_Mutexlock failed
    : Operation not permitted
    hyperion-webos: Threads.cpp:537: HRESULT osal_MutexLock(osal_mutex_t*): Assertion `0' failed.
    Aborted

  3. root@LGwebOSTV:/tmp# LD_LIBRARY_PATH=. ./hyperion-webos -b libdile_vt -a 192.168.1.97 -x 384 -y 216
    Error! capture_start: -1.
    osal_Mutexlock failed
    : Invalid argument
    hyperion-webos: Threads.cpp:537: HRESULT osal_MutexLock(osal_mutex_t*): Assertion `0' failed.
    Aborted

root@LGwebOSTV:/usr/lib# ls -l | grep libdile_vt
lrwxrwxrwx 1 root root 19 Jan 15 2021 libdile_vt.so.0 -> libdile_vt.so.0.1.0
-rwxr-xr-x 1 root root 64140 Jan 15 2021 libdile_vt.so.0.1.0

@seacred
Copy link

seacred commented Dec 26, 2021

First try changing resolution by adding these options: -x 384 -y 216 and see if it starts up properly.

Then you can try downloading latest development CI build here: https://github.com/webosbrew/hyperion-webos/actions/runs/1612798406 How to run it: https://github.com/webosbrew/hyperion-webos#running

Seems like this TV may work with --backend libdile_vt option.

got the same problems.
Sadly none of those seem to work...
Screenshot 2021-12-27 002332

@Informatic
Copy link
Member

Informatic commented Dec 31, 2021

Can you please check if this command creates a proper capture image, with valid Video and UI layers? (eg. simple check would be to open YouTube, start any video and pause it - paused video is still displayed on a capture)

luna-send -n 1 -f 'luna://com.webos.service.tv.capture/executeOneShot' '{"path":"/tmp/capture.png","method":"DISPLAY","format":"PNG"}'

This can later be extracted using scp from /tmp directory, eg. like so: scp root@TV:/tmp/capture.png . (downloads into current directory)

@seacred
Copy link

seacred commented Dec 31, 2021

Can you please check if this command creates a proper capture image, with valid Video and UI layers? (eg. simple check would be to open YouTube, start any video and pause it - paused video is still displayed on a capture)

luna-send -n 1 -f 'luna://com.webos.service.tv.capture/executeOneShot' '{"path":"/tmp/capture.png","method":"DISPLAY","format":"PNG"}'

This can later be extracted using scp from /tmp directory, eg. like so: scp root@TV:/tmp/capture.png . (downloads into current directory)

this is the output i got:
-root@LGwebOSTV:~# /media/developer/apps/usr/palm/services/org.webosbrew.piccap.service/hyperion-webos_libvt -a 192.168.178.107 -x 384 -y 216
-sh: /media/developer/apps/usr/palm/services/org.webosbrew.piccap.service/hyperion-webos_libvt: not found

-root@LGwebOSTV:~# LD_LIBRARY_PATH=. ./hyperion-webos -b libvt -a 192.168.178.107 -x 384 -y 216
-[EGL] Display, major = 1, minor = 4
[EGL] Surface size: 384x216
[EGL] init complete
[VT] VT_CreateVideoWindow
[VT] window_id=0
[VT] VT_AcquireVideoWindowResource
[VT] resource_id=85
[VT] VT_CreateContext
[VT] VT_CreateContext Failed
Error! capture_initialize: -1.
osal_Mutexlock failed
: Operation not permitted
hyperion-webos: Threads.cpp:537: HRESULT osal_MutexLock(osal_mutex_t*): Assertion `0' failed.
Aborted

-root@LGwebOSTV:~# LD_LIBRARY_PATH=. ./hyperion-webos -b libdile_vt -a 192.168.178.108 -x 384 -y 216
-Error! capture_start: -1.
osal_Mutexlock failed
: Invalid argument
hyperion-webos: Threads.cpp:537: HRESULT osal_MutexLock(osal_mutex_t*): Assertion `0' failed.
Aborted

for those i needed to correct some permissions, because otherwise i just got a permission denied as root@LGwebOSTV in /tmp

-luna-send -n 1 -f 'luna://com.webos.service.tv.capture/executeOneShot' '{"path":"/tmp/capture.png","method":"DISPLAY","format":"PNG"}'
{
"capturedWidth": 0,
"returnValue": true,
"capturedHeight": 0
}

i tried using the #6 service rewrite from piccap: TBSniller/piccap#18

unfortunatly i dont now how to uninstall piccap to try it again from scratch. i think i messed some things up here.

@Sanek78
Copy link
Author

Sanek78 commented Jan 1, 2022

Can you please check if this command creates a proper capture image, with valid Video and UI layers? (eg. simple check would be to open YouTube, start any video and pause it - paused video is still displayed on a capture)

luna-send -n 1 -f 'luna://com.webos.service.tv.capture/executeOneShot' '{"path":"/tmp/capture.png","method":"DISPLAY","format":"PNG"}'

This can later be extracted using scp from /tmp directory, eg. like so: scp root@TV:/tmp/capture.png . (downloads into current directory)

Used this build: https://github.com/webosbrew/hyperion-webos/actions/runs/1640930323

The result is like this:
root@LGwebOSTV:/tmp# LD_LIBRARY_PATH=. ./hyperion-webos -b libvt -a 192.168.1.97 -x 384 -y 216
0.001s [INFO main ] Starting up...

root@LGwebOSTV:/tmp# LD_LIBRARY_PATH=. ./hyperion-webos -b libdile_vt -a 192.168.1.97 -x 384 -y 216
0.001s [INFO main ] Starting up...

This is good?

root@LGwebOSTV:/tmp# luna-send -n 1 -f 'luna://com.webos.service.tv.capture/executeOneShot' '{"path":"/tmp/capture.png","method":"DISPLAY","format":"PNG"}'
{
"capturedWidth": 0,
"returnValue": true,
"capturedHeight": 0
}

The image .png was captured correctly!

@Informatic
Copy link
Member

That build is very early WIP branch for logging refactor, and shouldn't really change anything, from the one I posted above. Let us merge everything together and we'll come back to you - is that ok? We'll likely need to reverse a little bit how your TV does screenshot capture, and that'll need some time.

@Sanek78
Copy link
Author

Sanek78 commented Jan 1, 2022

Thank you, I hope for you!

@Informatic
Copy link
Member

So seems like the issue here is that on K5LP platform DILE_VT_CreateEx needs to be called instead (eg. with 0, 1 arguments) - this still seems to crash on someone's TV but this may be an unrelated issue! :)

@Informatic
Copy link
Member

Seems like that TV also uses pixelFormat 4 (YUV422sp) we don't support yet, so needs adjusting for that. But the outlook is very positive, we'll likely have a working support for these models this week.

@Sanek78
Copy link
Author

Sanek78 commented Jan 10, 2022

But the outlook is very positive, we'll likely have a working support for these models this week.

Great news, thanks!

@Informatic
Copy link
Member

Informatic commented Jan 10, 2022

Managed to implement YUV422sp, but seems like that device doesn't want to update the captured texture after initial context dile_vt creation. We are still investigating this.

Changing capture region on every frame causes refreshes, however it also peaks at around 11fps. Basically useless.

@Sanek78
Copy link
Author

Sanek78 commented Jan 11, 2022

Changing capture region on every frame causes refreshes, however it also peaks at around 11fps. Basically useless.

I want to test it.

Used this build: https://github.com/webosbrew/hyperion-webos/actions/runs/1679191069

root@LGwebOSTV:/tmp# LD_LIBRARY_PATH=. ./hyperion-webos -b libvt -a 192.168.1.97 -x 384 -y 216
0.001s [INFO main ] Starting up...
0.005s [ ERR main ] Unable to register on Luna bus: Invalid permissions for org.webosbrew.piccap.service
root@LGwebOSTV:/tmp# LD_LIBRARY_PATH=. ./hyperion-webos -b libdile_vt -a 192.168.1.97 -x 384 -y 216
0.001s [INFO main ] Starting up...
0.005s [ ERR main ] Unable to register on Luna bus: Invalid permissions for org.webosbrew.piccap.service

This error has not occurred before.

@Informatic
Copy link
Member

Informatic commented Jan 11, 2022

You can add --no-service option - then it will not try to bind to luna bus and not fail.

BTW that version does not contain "region changing" hack I mentioned, but you still can try that anyways.

@Sanek78
Copy link
Author

Sanek78 commented Jan 11, 2022

root@LGwebOSTV:/tmp# LD_LIBRARY_PATH=. ./hyperion-webos -b libvt -a 192.168.1.97 --no-service -x 384 -y 216
0.001s [INFO main ] Starting up...
0.033s [INFO capture_preinit ] Preinit called. Copying config..
0.037s [INFO egl_init ] [EGL] Display, major = 1, minor = 4
0.042s [INFO egl_init ] [EGL] Surface size: 384x216
0.043s [INFO egl_init ] [EGL] init complete
0.044s [INFO capture_init ] [VT] VT_CreateVideoWindow
0.044s [INFO capture_init ] [VT] window_id=0
0.044s [INFO capture_init ] [VT] VT_AcquireVideoWindowResource
0.045s [INFO capture_init ] [VT] resource_id=85
0.045s [INFO capture_init ] [VT] VT_CreateContext
0.047s [ ERR capture_init ] [VT] VT_CreateContext Failed
0.048s [ ERR capture_main ] Error! capture_init: -1
0.048s [ ERR main ] ERROR: Capture main init failed!
osal_Mutexlock failed
: Operation not permitted
hyperion-webos: Threads.cpp:537: HRESULT osal_MutexLock(osal_mutex_t*): Assertion `0' failed.
Aborted

root@LGwebOSTV:/tmp# LD_LIBRARY_PATH=. ./hyperion-webos -b libdile_vt -a 192.168.1.97 --no-service -x 384 -y 216
0.001s [INFO main ] Starting up...
0.021s [INFO capture_preinit ] Preinit called. Copying config..
0.021s [INFO capture_init ] Init called
0.021s [INFO capture_start ] Capture start called.
0.022s [WARN capture_start ] DILE_VT_Create failed, attempting DILE_VT_CreateEx
0.143s [INFO capture_start ] [DILE_VT] framerate divider: 1
0.184s [INFO capture_start ] [DILE_VT] frametime: 20133; estimated fps before divider: 49.66970
0.225s [INFO capture_start ] [DILE_VT] frametime: 20102; estimated fps after divider: 49.74629
0.225s [INFO capture_start ] [DILE_VT] vfbs: 1; planes: 2
0.226s [INFO capture_start ] [DILE_VT] pixelFormat: 4; width: 384; height: 216; stride: 384...
0.228s [INFO capture_thread_target] capture_thread_target called.
0.228s [INFO vsync_thread_target ] vsync_thread_target called.
0.228s [INFO connection_loop ] Connecting hyperion-client..
0.229s [INFO connection_loop ] hyperion-client connected!

On the hyperion server there is only one frame in live video...

"region changing" hack

Perhaps I missed it. Where can I read about this?

@Informatic
Copy link
Member

It was the matter of adding these absolutely disgusting lines at the end of capture_frame function in src/backends/libdile_vt.c:

    if (framecount % 2 == 0) {
        region.width = region.width + 1;
    } else {
        region.width = region.width - 1;
    }
    DILE_VT_SetVideoFrameOutputDeviceOutputRegion(vth, DILE_VT_DISPLAY_OUTPUT, &region);

@Sanek78
Copy link
Author

Sanek78 commented Jan 11, 2022

It turns out that things are bad... And where is the build with the change capture region? I will test it.

@Informatic
Copy link
Member

No need to yet, I spent whole evening yesterday testing out with one of the people on Discord. I'll post here whenever I find something out.

@Informatic
Copy link
Member

Just got a report that libdile_vt works perfectly on 05.20.08 software version released for W19P devices today. That should work with RootMyTV v2 still. Said user had 05.10.25 before, which failed in an exactly the same manner as in this issue. Does anyone want to test out?

@Sanek78
Copy link
Author

Sanek78 commented Jan 24, 2022

I tested it and it works! It remains only for the LEDs to light up, but this is already in the hyperion settings. Thanks a lot!

@Informatic
Copy link
Member

Informatic commented Jan 24, 2022

It'd be great if (some of) you filled out a comment in that issue, whenever you have some free time :)
#16

@Informatic Informatic added the dile_vt Issues related to webOS low-level capture backend label Jan 24, 2022
@mrhackcz
Copy link

I tested it and it works! It remains only for the LEDs to light up, but this is already in the hyperion settings. Thanks a lot!

Hi @Sanek78 ! How did you fix the "one frame" problem? I have the same on my setup. Thank you !

@Sanek78
Copy link
Author

Sanek78 commented Jan 27, 2022

Hi @mrhackcz! Updated to firmware 05.20.08, got root (RootMyTV v2). Everything is working now.

@janchrillesen
Copy link

I just upgraded from 05.10.25 to 05.20.08 and everything works. Using libdile_vt

"board_type": "K5LP_DVB",
"hardware_id": "HE_DTV_W19P_AFADABAA",
"product_id": "65SM8200PLA",
"core_os_release": "4.9.5-8",
"webos_manufacturing_version": "05.20.08",

Tested with both DRM (netflix) and non-DRM (youtube) content

@ghost
Copy link

ghost commented Jan 29, 2022

    "board_type": "K5LP_DVB",
    "hardware_id": "HE_DTV_W19P_AFADABAA",
    "product_id": "65UM7510PLA",
    "core_os_release": "4.9.5-8",
    "webos_manufacturing_version": "05.20.08",

When I use Libdile_vt I get a capture image that will never change.
So I use Old TV (libvt+libgm) and it works perfectly.
It's strange that we have almost the same hardware and that it doesn't use the same libraries.

@Sanek78
Copy link
Author

Sanek78 commented Jan 31, 2022

It works for me with both Old TV (libvt+libgm) and libdile_vt.

@gmelikov
Copy link

@Sanek78 @janchrillesen haven't you test 05.20.15 firmware? LG shipped it and I'm afraid it may be unrootable yet.

@ghost
Copy link

ghost commented Mar 15, 2022 via email

@gmelikov
Copy link

@Stef67000 I'm on older version now, which has problems with image capture.

@TBSniller
Copy link
Collaborator

With latest releases, we now support webOS 3.4 and above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dile_vt Issues related to webOS low-level capture backend
Projects
None yet
Development

No branches or pull requests

7 participants