RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Possible to run an x session through runcommand?

    Scheduled Pinned Locked Moved Help and Support
    startxruncommand
    29 Posts 5 Posters 3.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mituM
      mitu Global Moderator @quicksilver
      last edited by

      @quicksilver said in Possible to run an x session through runcommand?:

      Id also like to report the issue upstream. Is saying that the game is exiting but not the x session enough of a description? Or should I post my logs there as well?

      Only if using it from a normal desktop session exhibits the same issue. Use startx to start the desktop, then run the game from an xterm/terminal and see if it's the same problem.

      quicksilverQ 1 Reply Last reply Reply Quote 1
      • quicksilverQ
        quicksilver
        last edited by

        Thank you again for all your help. I have learned a lot from you guys. I am hoping to continue to learn more, so my next task is to start teaching myself some basic bash scripting in the hopes that I can start putting together some script modules for people to try out. If I am successful at it, I would eventually like to try submitting some pull requests to get them added to retropie. I am curious what the criteria are for getting PRs for new ports accepted? I can understand that the more script modules accepted, the more the maintenance burden becomes for you guys.

        1 Reply Last reply Reply Quote 0
        • mituM
          mitu Global Moderator
          last edited by

          @quicksilver said in Possible to run an x session through runcommand?:

          I am curious what the criteria are for getting PRs for new ports accepted?

          Besides the technical aspects of the new script adding the port (correctness, syntax, upstream support, gamepad support), I'm not sure there's a definitive answer to this.

          I can understand that the more script modules accepted, the more the maintenance burden becomes for you guys.

          Yes, that's true for all additions. It depends on how complicated is the setup/configuration/installation of the Port (emulator). It helps if there is an upstream project that offers support (forums, issues, bug reports, etc.).

          1 Reply Last reply Reply Quote 1
          • quicksilverQ
            quicksilver
            last edited by

            Just for posterity, if anyone encounters the same issue with dhewm3 not closing properly. You can cntrl-alt-backspace to close the x session and return to emulation station.

            1 Reply Last reply Reply Quote 0
            • quicksilverQ
              quicksilver @mitu
              last edited by

              @mitu so before I even loaded up the desktop environment I ran dhewm3 through the terminal using the startx command and when I exit the game, the game and x session terminate correctly and take me back to the terminal. I guess in this case it's not likely an upstream issue then right? Are there any other options that I could run with XINIT: to try to get correct closing behavior?

              1 Reply Last reply Reply Quote 0
              • mituM
                mitu Global Moderator
                last edited by

                @quicksilver said in Possible to run an x session through runcommand?:

                I guess in this case it's not likely an upstream issue then right?

                No, it doesn't look like it.

                Are there any other options that I could run with XINIT: to try to get correct closing behavior?

                For runcommand, that's pretty much all the configuration to get a game running via X. Where exactly - in the log file - does the game gets stuck, before you kill it ?

                quicksilverQ 1 Reply Last reply Reply Quote 0
                • quicksilverQ
                  quicksilver @mitu
                  last edited by

                  @mitu here is the log after I have closed doom 3 but xinit is still running

                  Hello logfile - runcommand-onstart checking in here
                  Parameters: 
                  Executing: xinit /dev/shm/retropie_xinitrc -- vt1 -keeptty
                  
                  
                  X.Org X Server 1.20.4
                  X Protocol Version 11, Revision 0
                  Build Operating System: Linux 4.15.0-48-generic armv8l Raspbian
                  Current Operating System: Linux pi4 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l
                  Kernel command line: coherent_pool=1M 8250.nr_uarts=1 cma=64M snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 cma=256M video=HDMI-A-1:1920x1080M@60 smsc95xx.macaddr=DC:A6:32:02:9B:85 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=ttyS0,115200 console=tty1 root=PARTUUID=0096c5d2-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait consoleblank=0 plymouth.enable=0 usbhid.mousepoll=0
                  Build Date: 05 June 2019  12:49:54PM
                  xorg-server 2:1.20.4-1+rpt1 (https://www.debian.org/support) 
                  Current version of pixman: 0.36.0
                  	Before reporting problems, check http://wiki.x.org
                  	to make sure that you have the latest version.
                  Markers: (--) probed, (**) from config file, (==) default setting,
                  	(++) from command line, (!!) notice, (II) informational,
                  	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
                  (==) Log file: "/home/pi/.local/share/xorg/Xorg.0.log", Time: Wed Jun 10 12:09:13 2020
                  (==) Using system config directory "/usr/share/X11/xorg.conf.d"
                  (II) modeset(0): Initializing kms color map for depth 24, 8 bpc.
                  Set mode 640x480@60Hz on HDMI-1
                  
                  Executing (via xinit): SDL_VIDEO_KMSDRM_CRTCID=49 SDL_VIDEO_KMSDRM_MODEID=48 /home/pi/Doom3/dhewm3
                  
                  dhewm3 1.5.1pre.1304 linux-armv7l Jun  5 2020 13:34:05 using SDL v2.0.10
                  Running in background, disabling terminal support.
                  pid: 16739
                  1936 MB System Memory
                  found interface lo - loopback
                  found interface wlan0 - 192.168.1.175/255.255.255.0
                  WARNING: base path '/usr/local/share/dhewm3' does not exist
                  WARNING: using path of executable: /home/pi/Doom3
                  ----- Initializing File System -----
                  Loaded pk4 /home/pi/Doom3/base/pak000.pk4 with checksum 0x28d208f1
                  Loaded pk4 /home/pi/Doom3/base/pak001.pk4 with checksum 0x40244be0
                  Loaded pk4 /home/pi/Doom3/base/pak002.pk4 with checksum 0xc51ecdcd
                  Loaded pk4 /home/pi/Doom3/base/pak003.pk4 with checksum 0xcd79d028
                  Loaded pk4 /home/pi/Doom3/base/pak004.pk4 with checksum 0x765e4f8b
                  Loaded pk4 /home/pi/Doom3/base/pak005.pk4 with checksum 0x8ffc3621
                  Loaded pk4 /home/pi/Doom3/base/pak006.pk4 with checksum 0x95b65ab
                  Loaded pk4 /home/pi/Doom3/base/pak007.pk4 with checksum 0x666bdb3c
                  Loaded pk4 /home/pi/Doom3/base/pak008.pk4 with checksum 0x23ae5993
                  Current search path:
                  /home/pi/.config/dhewm3/base
                  /home/pi/.local/share/dhewm3/base
                  /home/pi/Doom3/base
                  /home/pi/Doom3/base/pak008.pk4 (3 files)
                  /home/pi/Doom3/base/pak007.pk4 (38 files)
                  /home/pi/Doom3/base/pak006.pk4 (48 files)
                  /home/pi/Doom3/base/pak005.pk4 (63 files)
                  /home/pi/Doom3/base/pak004.pk4 (5137 files)
                  /home/pi/Doom3/base/pak003.pk4 (4676 files)
                  /home/pi/Doom3/base/pak002.pk4 (6120 files)
                  /home/pi/Doom3/base/pak001.pk4 (8972 files)
                  /home/pi/Doom3/base/pak000.pk4 (2698 files)
                  Addon pk4s:
                  ----- Initializing Decls -----
                  5206 strings read from strings/english.lang
                  Couldn't open journal files
                  execing editor.cfg
                  execing default.cfg
                  execing dhewm.cfg
                  couldn't exec autoexec.cfg
                  5206 strings read from strings/english.lang
                  ----- Initializing OpenAL -----
                  Setup OpenAL device and context
                  OpenAL: found device 'ALSA Default'
                  OpenAL: found device 'bcm2835 HDMI 1, bcm2835 HDMI 1 (CARD=b1,DEV=0)'
                  OpenAL: found device 'bcm2835 Headphones, bcm2835 Headphones (CARD=Headphones,DEV=0)'
                  OpenAL vendor: OpenAL Community
                  OpenAL renderer: OpenAL Soft
                  OpenAL version: 1.1 ALSOFT 1.19.1
                  OpenAL: found extensions for resetting disconnected devices
                  OpenAL: found EFX extension
                  OpenAL: found 256 hardware voices
                  ----- Initializing OpenGL -----
                  Initializing OpenGL subsystem
                  Using 8 color bits, 24 depth, 8 stencil display
                  OpenGL vendor: Broadcom
                  OpenGL renderer: V3D 4.2
                  OpenGL version: 2.1 Mesa 19.3.2
                  ...using GL_ARB_multitexture
                  ...using GL_ARB_texture_env_combine
                  ...using GL_ARB_texture_cube_map
                  ...using GL_ARB_texture_env_dot3
                  ...using GL_ARB_texture_env_add
                  ...using GL_ARB_texture_non_power_of_two
                  ...using GL_ARB_texture_compression
                  X..GL_EXT_texture_compression_s3tc not found
                  X..GL_EXT_texture_filter_anisotropic not found
                  ...using GL_1.4_texture_lod_bias
                  X..GL_EXT_shared_texture_palette not found
                  ...using GL_EXT_texture3D
                  ...using GL_EXT_stencil_wrap
                  ...using GL_EXT_stencil_two_side
                  ... got GL2.0+ glStencilOpSeparate()
                  ...using GL_ARB_vertex_buffer_object
                  ...using GL_ARB_vertex_program
                  ...using GL_ARB_fragment_program
                  X..EXT_depth_bounds_test not found
                  ARB2 renderer: Available.
                  ----- R_ReloadARBPrograms -----
                  glprogs/test.vfp
                  glprogs/test.vfp
                  glprogs/interaction.vfp
                  glprogs/interaction.vfp
                  glprogs/bumpyEnvironment.vfp
                  glprogs/bumpyEnvironment.vfp
                  glprogs/ambientLight.vfp
                  glprogs/ambientLight.vfp
                  glprogs/shadow.vp
                  glprogs/environment.vfp
                  glprogs/environment.vfp
                  glprogs/arbVP_glasswarp.txt: File not found
                  glprogs/arbFP_glasswarp.txt: File not found
                  using ARB_vertex_buffer_object memory
                  using ARB2 renderSystem
                  loaded game library '/home/pi/Doom3/base.so'.
                  ----- Initializing Game -----
                  gamename: baseDOOM-1
                  gamedate: Jun  5 2020
                  Initializing event system
                  ...473 event definitions
                  Initializing class hierarchy
                  ...142 classes, 382184 bytes for event callbacks
                  Initializing scripts
                  Compiled 'weapon_rocketlauncher': 1263 ms
                  ----- Compile stats -----
                  Memory usage:
                       Strings: 79, 12592 bytes
                    Statements: 67875, 1357500 bytes
                     Functions: 2109, 250532 bytes
                     Variables: 147376 bytes
                      Mem used: 2579384 bytes
                   Static data: 2477552 bytes
                     Allocated: 3484640 bytes
                   Thread size: 13212 bytes
                  ...6 aas types
                  ----- Initializing Session -----
                  ----- Warnings -----
                  during dhewm 3 initialization...
                  WARNING: base path '/usr/local/share/dhewm3' does not exist
                  WARNING: using path of executable: /home/pi/Doom3
                  2 warnings
                  ----- Game Map Shutdown -----
                  Shutting down sound hardware
                  idRenderSystem::Shutdown()
                  Shutting down OpenGL subsystem
                  ----- Game Shutdown -----
                  ----- Game Map Shutdown -----
                  Shutdown event system
                  
                  mituM R 2 Replies Last reply Reply Quote 0
                  • quicksilverQ
                    quicksilver
                    last edited by quicksilver

                    So I have been experimenting using XINIT: for emulators that dont scale properly on the pi 4 (dosbox, streets of rage remake etc.). From my tests performance seems just as good and I am able to control video mode properly using runcommand or via in game settings! It might be worth using XINIT: on the pi 4 for older SDl1 based emulators or other oddball emulators.

                    BuZzB 1 Reply Last reply Reply Quote 0
                    • mituM
                      mitu Global Moderator @quicksilver
                      last edited by

                      @quicksilver said in Possible to run an x session through runcommand?:

                      I have closed doom 3 but xinit is still running

                      yeah, doesn't ring any bells.

                      1 Reply Last reply Reply Quote 0
                      • BuZzB
                        BuZz administrators @quicksilver
                        last edited by BuZz

                        @quicksilver I planned to make this configurable. Due to time restrictions, I felt it was best to fix up sdl1 apps via dispmanx backend but later add the ability to switch to X. This is still likely to happen, but there's no ETA of course - when I get round to it. But in the meantime you can always add an emulators.cfg entry with another name and use XINIT and it won't get overwritten with updates.

                        To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                        quicksilverQ 1 Reply Last reply Reply Quote 1
                        • quicksilverQ
                          quicksilver @BuZz
                          last edited by quicksilver

                          @BuZz thanks buzz, that is what I will do. No rush of course, I just wanted to make you guys aware that it seemed to be a good option. Though it looks like you are way ahead of me :). I may recommend this to others as well if the have similar issues as I. Just a quick question. Is xinit already installed in a default retropie image?

                          mituM 1 Reply Last reply Reply Quote 0
                          • mituM
                            mitu Global Moderator @quicksilver
                            last edited by

                            @quicksilver said in Possible to run an x session through runcommand?:

                            Is xinit already installed in a default retropie image?

                            No, I don't think there's a package that installs it automatically in the base image. However, if the configuration will change, it will be added as a dependency to the packages requiring it.
                            For now, the simplest method to have it installed is to install the desktop.

                            quicksilverQ 1 Reply Last reply Reply Quote 0
                            • quicksilverQ
                              quicksilver @mitu
                              last edited by

                              @mitu Gotcha. I have been playing with compiling source projects so much I cant remember what I may have installed as a dependency along the way. I havent installed the desktop environment, so I must have installed it at some point over the last few weeks.

                              1 Reply Last reply Reply Quote 0
                              • BuZzB
                                BuZz administrators
                                last edited by BuZz

                                Yeah it's not. That was another reason why I went the dispmanx route. As it would have required adding X dependencies everywhere and additional logic. When I get around to making it configurable, my plan is to also handle the dependencies aspect. But I also wanted to do more work on this first.

                                On a code level this would be in a similar fashion to the recently added dependency aliases. This exists already for kernel headers. But it will be expanded. Just simplifies module coding as for example kernel header naming differs between Debian/Ubuntu. A module can now just ask for LINUX-HEADERS and the core code will install the right packages. I wanted this for the X dependencies also - but transparent to the module. The module would specify some flags which would advertise which backends it works on. And the rest would be done automatically.

                                Rushed explanation, but this is why it's not done yet as it requires some reworking of existing code.

                                To help us help you - please make sure you read the sticky topics before posting - https://retropie.org.uk/forum/topic/3/read-this-first

                                1 Reply Last reply Reply Quote 2
                                • R
                                  RussellB @quicksilver
                                  last edited by

                                  @quicksilver

                                  I added Doom 3 to my ports section and ran into the same issue. It seems when dhewm3 exits the process goes defunct put persists so it keeps the X session running. I modified the startup script prior to executing runcommand to run a process that watches for "[dhewm3] <defunct>" to appear and then calls killall xinit to shut it down.

                                  B 1 Reply Last reply Reply Quote 0
                                  • B
                                    boolean @RussellB
                                    last edited by

                                    @russellb Would you be so kind to share it? Your approach is probably the most convenient way. TIA!

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post

                                    Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                    Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.