Author Topic: RS-90: Using SDL_Init and SDL_SetVideoMode in terminal (release 2019.05.17)  (Read 459 times)

slaanesh (OP)

  • **
  • Posts: 509
    • Slaanesh Dev
I'm just wondering a couple things ( @pcercuei )  :

1). When you ssh into the RS90 you login using "od/odrocks").
Does gp2xmenu run in normal user space? or run as root?

2). How do I change the 'od' user password to... nothing? passwd from ssh isn't available.

3). The terminal mode doesn't seem to useful unless you are root. What am I missing here? Run with sudo?

4). if I run my program with sudo, and I do SDL_Init followed by SDL_SetVideoMode(240,160,16,SDL_HWSURFACE) I get a fail "No video mode large enough for 240x160"... wtf?

5). if I run my program without sudo, using SDL_Init followed by SDL_SetVideoMode(240,160,16,SDL_HWSURFACE) I get a fail "Unable to set keyboard in raw mode". This generally means you need to be root or you don't own the tty.

None of this happened on the GCW-Zero as everything ran as root.

Any help appreciated.


pcercuei

  • ***
  • Posts: 1492
    • My devblog
I'm just wondering a couple things ( @pcercuei )  :

1). When you ssh into the RS90 you login using "od/odrocks").
Does gp2xmenu run in normal user space? or run as root?

2). How do I change the 'od' user password to... nothing? passwd from ssh isn't available.

3). The terminal mode doesn't seem to useful unless you are root. What am I missing here? Run with sudo?

4). if I run my program with sudo, and I do SDL_Init followed by SDL_SetVideoMode(240,160,16,SDL_HWSURFACE) I get a fail "No video mode large enough for 240x160"... wtf?

5). if I run my program without sudo, using SDL_Init followed by SDL_SetVideoMode(240,160,16,SDL_HWSURFACE) I get a fail "Unable to set keyboard in raw mode". This generally means you need to be root or you don't own the tty.

None of this happened on the GCW-Zero as everything ran as root.

Any help appreciated.

1. I transferred my public key to .ssh/authorized_keys, then I don't have to type the password every time. GMenu2X does run as the "od" user.

2. SSH password login should be available, I don't remember disabling it... You cannot change the password.

3. Run with "setsid".

4. 240x160 isn't a regular resolution, SDL chokes on it. You need to set the SDL_FB_BROKEN_MODES environment variable. This one is set in /etc/profile, so applications launched from within a shell or from GMenu2X will see the variable. "sudo" completely resets the environment, I think.

5. The application needs to be the session leader to be able to control the TTY. See point 3. It's a PITA but I didn't find a better way yet.

slaanesh (OP)

  • **
  • Posts: 509
    • Slaanesh Dev
Thanks for the quick reply!

I don't think a password is necessary on these kind of devices - unless it's required for something?

Also is there any issue with running as root like the GCW-Zero?

slaanesh (OP)

  • **
  • Posts: 509
    • Slaanesh Dev
@pcercuei  Okay got my little "app" going :)

I see access to "/dev/mem" is gone now.  Is there some way of getting this back?

I need access to "/dev/mem" to use the IPU.

I assume you've set the CONFIG_STRICT_DEVMEM Kconfig switch?  >:(

mth

  • *
  • Posts: 317
Also is there any issue with running as root like the GCW-Zero?

The Zero ran everything as root only because we didn't have time to figure out how to not run everything as root before releasing the first firmware. And once that was released, changing it to run applications as non-root would have caused too many compatibility headaches.

Running stuff as root means small mistakes can easily damage the system. We've had people who were trying to clean up their Zero's file system and removed the rootfs image by accident, for example.

I see access to "/dev/mem" is gone now.  Is there some way of getting this back?

Other than compiling your own kernel, no.

What do you want to use the IPU for? The JZ4725B's IPU doesn't take packed RGB input like the JZ4770's does, so it's only really useful to do YUV decoding.

The proper way to support the IPU would be via a v4l2 driver. Accessing it via /dev/mem is fine for prototyping but shouldn't be a solution used for released applications.

slaanesh (OP)

  • **
  • Posts: 509
    • Slaanesh Dev
The IPU is totally useful and yes I do want to use it for hardware scaling.

Being YUV isn't a big deal as my "app" draws everything as palette indexes which are mapped at the last blit anyway.
If I'm mapping YUV or RGB makes no difference - so the IPU is still useful.

Is there some other way of getting to IPU registers?
Can the kernel have a special device at "/dev/IPU" that exposes what I need and user accessible?
I need the registers starting at physical address 0x13080000 -only for a length of about 0x100.

Also would need three other chunks of contiguous memory that are the Y, U and V buffers. That would be swell, thanks  ;D

pcercuei

  • ***
  • Posts: 1492
    • My devblog
We try to do things the right way in OpenDingux - that includes not accessing the hardware directly from userspace.

It would be great to add support for the IPU, indeed. Unlike the JZ4740, the one in the JZ4725B does support outputing directly to the LCD controller, so I think we shouldn't implement it as a V4L2 driver but as a DRM plane.

In userspace, I think you would use a SDL_Overlay. If you can run your app on PC, try to make it use YUV over a SDL_Overlay.

slaanesh (OP)

  • **
  • Posts: 509
    • Slaanesh Dev
Code: [Select]
SDL_Overlay -- YUV video overlay
typedef struct{
  Uint32 format;
  int w, h;
  int planes;
  Uint16 *pitches;
  Uint8 **pixels;
  Uint32 hw_overlay:1;
} SDL_Overlay;

format:Overlay format (see below)
w, h: Width and height of overlay
planes: Number of planes in the overlay. Usually either 1 or 3
pitches: An array of pitches, one for each plane. Pitch is the length of a row in bytes.
pixels: An array of pointers to the data of each plane. The overlay should be locked before these pointers are used.
hw_overlay:This will be set to 1 if the overlay is hardware accelerated.

@pcercuei will you be willing to support this and honor hw_overlay using the IPU? This looks perfect if that's that case.

What do you need from me to make this happen? A PC linux version of my "app" using SDL_Overlay?

By the way, do certain combos of button presses do not work?

I find a combo of <SELECT> and <Left Shoulder> come out as <Left Shoulder> only.
« Last Edit: May 19, 2019, 07:36:46 am by slaanesh »

zear

  • * Board Moderators
  • Posts: 2381
By the way, do certain combos of button presses do not work?

I find a combo of <SELECT> and <Left Shoulder> come out as <Left Shoulder> only.
That's down to hardware limitation - both buttons are internally connected to the same ADC input.

pcercuei

  • ***
  • Posts: 1492
    • My devblog
@pcercuei will you be willing to support this and honor hw_overlay using the IPU? This looks perfect if that's that case.

What do you need from me to make this happen? A PC linux version of my "app" using SDL_Overlay?
Yes, that's the plan, but I don't think that will happen soon... I need a break :(

slaanesh (OP)

  • **
  • Posts: 509
    • Slaanesh Dev
The following weekend will be fine :)

 

Post a new topic
Post a new topic