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

Fix Error: Couldn't import RGB Image: 00003002 and 00003004 #761

Merged
merged 2 commits into from
Jan 26, 2023

Conversation

manteuffel723
Copy link
Contributor

@manteuffel723 manteuffel723 commented Jan 12, 2023

Description

surface_descriptor_t::fds (graphics.h) did not get properly initialized in platf::kms::display_t::refresh.
That resulted in egs::import_source reading values from uninitialized variable/array elements from surface_descriptor_t and passing them to eglCreateImage.
eglCreateImage then fails with error code 3002 (EGL_BAD_ACCESS) (see https://registry.khronos.org/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import.txt)

This fix ensures that surface_descriptor_t::fds does not contain uninitialized array elements after a successfull call to platf::kms::dislplay_t::refresh. Elements corresponding to invalid handles get set to -1.
That way the check that was already in place in egs::import_source fd < 1 (line 490 graphics.h) properly prevents passing invalid/unsupported/unwanted attributes to eglCreateImage. This check was basically dead code before this fix.

Issues Fixed or Closed

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

@CLAassistant
Copy link

CLAassistant commented Jan 12, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot changed the base branch from master to nightly January 12, 2023 12:51
@github-actions
Copy link

Your PR was set to master, PRs should be sent to nightly.
The base branch of this PR has been automatically changed to nightly.
Please check that there are no merge conflicts

@KuleRucket
Copy link
Contributor

KuleRucket commented Jan 12, 2023

Is it possible this fixes #453 as well? I'll give it a try later

@Deytron
Copy link

Deytron commented Jan 13, 2023

I just tested the fix, and I can confirm that this fixes both #373 and #453 (00003002 and 00003004 respectively)

Test environment

OS: EndeavourOS Linux x86_64
Kernel: 6.1.4-zen2-1-zen
Resolution: 1920x1080
DE: Plasma 5.26.5
WM: kwin-wayland
CPU: AMD Ryzen 5 3600X (12) @ 4.000GHz
GPU: NVIDIA GeForce RTX 2060 Rev. A
Memory: 32GB

What works

  • NVENC HEVC encoder seems to work
  • Mouse and keyboard both work
  • Latency is close to zero in LAN
  • Sound works

What does not work

  • May be me, but the web UI has a blank page and gives me (localhost : not authorized)
  • I get a black screen on the client
  • This errors pops up in terminal :

[2023:01:13:11:39:24]: Error: GL: /home/romain/Sunshine/src/platform/linux/graphics.cpp:529: [00000501]

The error lies somewhere between line 477 and 532

  • This also pops up even on Wayland :

[2023:01:13:11:51:11]: Info: Executing: [xrandr --output HDMI-1 --mode 1920x1200]

@KuleRucket
Copy link
Contributor

KuleRucket commented Jan 13, 2023

This fixes #453 for me too. For the first time ever I can screencast with KMS under wayland on Nvidia

EDIT: Actually I also get the "Error: GL:" and a black screen for the client, but at least is now initialises which it did not do before.

@KuleRucket
Copy link
Contributor

The graphics.cpp Error: GL: problem is reported in #404

@manteuffel723
Copy link
Contributor Author

The graphics.cpp Error: GL: problem is reported in #404

What error do you get? 00000501 (GL_INVALID_VALUE) like Deytron or 00000502 (GL_INVALID_OPERATION) as in #404?

Looks like calls to:

  • BindTexture
  • GenTextures

can cause these errors. Conditions for these Errors are documented in https://registry.khronos.org/OpenGL-Refpages/gl4/.
Maybe you can do some printf debugging to see, where exactly the error comes from. There are 2 calls to BindTexture in import_source. I didn´t find documentation for EGLImageTargetTexture2DOES, so maybe even after that call.
Additionally there are calls to GenTextures and BindTexture in tex_t::make (line 26 graphics.cpp) that is called from import_source.

I don´t have a nvidia gpu, so i cannot reprduce it. Screencasting works just fine on my amd card now.

@KuleRucket
Copy link
Contributor

What error do you get? 00000501 (GL_INVALID_VALUE) like Deytron or 00000502 (GL_INVALID_OPERATION) as in #404?

You're right I didn't notice the difference. I get 00000501 like Deytron above.

@Deytron
Copy link

Deytron commented Jan 14, 2023

I will be able to investigate in the following week, I'll keep you updated

@zastrixarundell
Copy link

zastrixarundell commented Jan 20, 2023

Running this as a flatpak on fedora silverblue 37 fixed #453 but as Deytron said, I'm getting a black screen on the client. I can control the keyboard/mouse and hear audio but just no video feedback.

I'm also constantly getting

[2023:01:20:09:48:13]: Error: GL: /run/build/sunshine/src/platform/linux/graphics.cpp:529: [00000501]

in my terminal, around 10 times a second.

@Deytron
Copy link

Deytron commented Jan 22, 2023

I don't know if this will help much, but here's some debugging I did :

[2023:01:22:22:18:31]: Error: GL: /home/romain/Sunshine/src/platform/linux/graphics.cpp:534: [00000501]

eglCreateImage returned 0x7f1378379c91

egl_display: 0x7f137800b4f0
attribs: 0x7f139d7f9910
rgb->tex[0]: 1
rgb->xrgb8: 0x7f1378379c91
rgb->tex[0]: 1
rgb->xrgb8: 0x7f1378379c91

@Deytron
Copy link

Deytron commented Jan 23, 2023

For reference, #649 should have fixed the GL errors, but it didn't fix it on my end

@zastrixarundell
Copy link

zastrixarundell commented Jan 23, 2023

Another thing I noticed with a multi-monitor setup (3 monitors horizontally aligned) is that when I move the cursor on the monitor at +0+0 position I get a weird mouse-following artifact.

Keep in mind that after I connected on moonlight I did NOT move the mouse on the client (it's near the l on latency at the performance info), rather, I moved it on the host.

So the video feed manages to capture the cursor but not anything below it.

I had a similar issue when I installed openbox without a compositor on a clean fedora installation.

mouse.mp4

Edit 1:

It seems that this happens only when my mouse if hovering over Spotify and Discord so it most likely affects only Electron applications. Firefox and KDE Qt based applications don't behave like this.

After randomly moving my mouse while a non-electron app was covering the screen:
image
And the monitor on which the stream took the information:
image

Edit 2:

It is also attaching on the wrong (left) monitor and not the primary (center) one. While running under Xorg/X11 it only focused on my primary monitor. The mouse would leave the primary monitor when I moved my mouse out of range but on the client it would still be shown withing the normal margins. On Wayland+Nvidia it's focusing only on most-left one.

@ReenigneArcher ReenigneArcher changed the title Fix Error: Couldn't import RGB Image: 00003002 (#373) Fix Error: Couldn't import RGB Image: 00003002 Jan 25, 2023
@ReenigneArcher ReenigneArcher changed the title Fix Error: Couldn't import RGB Image: 00003002 Fix Error: Couldn't import RGB Image: 00003002 and 00003004 Jan 25, 2023
@ReenigneArcher
Copy link
Member

Am I correct in that this solves 00003002, and only removes the error for 00003004?

@zastrixarundell
Copy link

zastrixarundell commented Jan 26, 2023

I can't say for 00003002 as I've never had that issue but on a wayland + nvidia setup it does remove the error 00003004 and for the first time I can initialize the stream. The video stream itself doesn't work how it should but everything else does (audio and input capture).

@Deytron
Copy link

Deytron commented Jan 26, 2023

Am I correct in that this solves 00003002, and only removes the error for 00003004?

Yes, this is correct, both 0003002 and 00003004 are solved. I guess we should open a new issue concerning the new GL error.

@Deytron
Copy link

Deytron commented Jan 26, 2023

Created issue #838 for further investigation and better tracking

@KuleRucket
Copy link
Contributor

I think this fix should be merged. At least the behaviour is better than it was.

@ReenigneArcher ReenigneArcher merged commit 0698210 into LizardByte:nightly Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants