Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Rendering things in C++ using dispmanX on RPi3
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
pepi55
n00b
n00b


Joined: 28 Oct 2013
Posts: 37
Location: The Internet

PostPosted: Sat Mar 18, 2017 8:57 pm    Post subject: [Solved] Rendering things in C++ using dispmanX on RPi3 Reply with quote

Hello,

I need help with a very weird problem that I don't know how to solve or where to look for a solution.
The thing I'm trying to do is get a cube and terrain on screen in C++, but for some reason all I'm seeing on screen is a solid color, the color is an average hue of the textures I am trying to draw.
Now here is the problem, I know this is a Gentoo specific problem because I have raspbian and archlinux arm on 2 separate SD cards and on those 2 systems the scene renders fine:
http://imgur.com/ylz5xqH

First I thought it might be a library problem, one of the systems uses either outdated or newer vc libraries which causes this anomaly but after I ran rpi-update on both the Gentoo system and Raspbian, the problem persists.
I am very certain that both systems now use the same version of the proprietary VC libraries.

Now my imagination runs short so I have no clue where to look next. I am hopeful someone here might be able to point me in the right direction at the very least.

Thanks in advance!

EDIT: Here is a picture of how the same scene looks on Gentoo:
http://imgur.com/kgSjSyT

And here is an image of how it looks when I try to screenshot it the same way I screenshot it on Archlinux:
http://imgur.com/1OoBgnD
Using this
Code:
void Screenshot(GLint endX, GLint endY, GLint startX, GLint startY, std::string filename)
{
    GLubyte *pixels = new GLubyte[3 * endX * endY];

    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    glReadPixels(startX, startY, endX, endY, GL_RGB, GL_UNSIGNED_BYTE, pixels);

    stbi_write_png(filename.c_str(), endX, endY, 3, pixels, endX * 3);

    delete[] pixels;
}


EDIT2: Wrong gentoo screenshot image.


Last edited by pepi55 on Mon Mar 20, 2017 10:19 am; edited 1 time in total
Back to top
View user's profile Send private message
pepi55
n00b
n00b


Joined: 28 Oct 2013
Posts: 37
Location: The Internet

PostPosted: Sat Mar 18, 2017 11:54 pm    Post subject: Reply with quote

Something like progress:
The same project built on Archlinux runs on Gentoo, and vice versa.
When I run an Arch-build executable, I get an error saying that GLIBCXX_3.4.21 was not found in libstdc++.so.6. I fixed this by putting the libstdc++ from arch into the program's folder.
Then if I run it, the program runs and the scene is rendered perfectly fine.

When I run the Gentoo built version of this program on Archlinux, it runs without copying any libs and the scene is not rendered, just like on Gentoo itself.

I think this narrows down the problem to gcc itself. However, I am still not sure how to proceed. Is it an issue with the Gentoo version of gcc? Am I missing some kind of useflag? Is it related to ld?
Since this might be related to how I compile the program, here are the makefile settings I have set:
http://imgur.com/BOk4fzL
If there is a need for the makefile itself, please tell me I will post it.

I will try compiling gcc with the vanilla useflag, maybe that will help.
Back to top
View user's profile Send private message
pepi55
n00b
n00b


Joined: 28 Oct 2013
Posts: 37
Location: The Internet

PostPosted: Mon Mar 20, 2017 12:28 am    Post subject: Reply with quote

The vanilla useflag for gcc fixed my issue.

Where can I find what patches are applied to the gentoo version of GCC?
Back to top
View user's profile Send private message
R0b0t1
Apprentice
Apprentice


Joined: 05 Jun 2008
Posts: 264

PostPosted: Mon Mar 20, 2017 4:08 pm    Post subject: Reply with quote

Run `ebuild /usr/portage/sys-devel/gcc/gcc-4.9.4.ebuild prepare` or substitute the version of your choice.
Back to top
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10590
Location: Somewhere over Atlanta, Georgia

PostPosted: Mon Mar 20, 2017 5:47 pm    Post subject: Reply with quote

pepi55 wrote:
The vanilla useflag for gcc fixed my issue. ...
This is definitely worth a bug report on Gentoo Bugzilla. Are you planning to work through the applied patches to see what the real culprit is?

- John
_________________
I can confirm that I have received between 0 and 499 National Security Letters.
Back to top
View user's profile Send private message
pepi55
n00b
n00b


Joined: 28 Oct 2013
Posts: 37
Location: The Internet

PostPosted: Mon Mar 20, 2017 9:56 pm    Post subject: Reply with quote

I want to take a look to see what could cause the issue but I would like to work from the top down. As in: see what is patched and enable patches one by one to see which causes the problem.

For that I would need to know where I can see what patches are applied to the gentoo version of gcc, which I don't.

Also, please note that I am using gcc 4.9.4 which is the latest stable release. I have not tested newer versions of gcc in which the problem may not appear.

Since I am busy most of the time I cannot guarantee that I will find the culprit quickly, if ever.

EDIT: Missed R0b0t1's comment, I will look at it when possible and then file the bug report.
Back to top
View user's profile Send private message
pepi55
n00b
n00b


Joined: 28 Oct 2013
Posts: 37
Location: The Internet

PostPosted: Mon Mar 20, 2017 11:48 pm    Post subject: Reply with quote

This was way easier to find than I thought...
The very first patch "09_all_default-ssp.patch" causes the issue as far as I can see.
When this patch is applied it changes the default behaviour to -fstack-protector-striog from what I understood, and sure enough, if I compile with -fstack-protector-strong, nothing renders anymore.

Considering that this is the issue, I don't think this is bug worthy. I think I should fix my code to compile and work properly even with -fstack-protector-strong as an option.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum