DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 1st September 2017
billy_bazooka billy_bazooka is offline
Port Guard
 
Join Date: Sep 2016
Posts: 31
Default SDL2 not working in netbsd - "no available video device"

since my sdl2 programs run slow in openbsd, and blazing fast in slackware, i decided to try them on netbsd 7.1

Code:
#include <stdio.h>
#include <stdlib.h>
#include <SDL.h>

void die (char *msg)
{
  fprintf (stderr, "err: %s\n", msg);
  exit (0x0f);
}

int main (int ac, char **av)
{
  if (SDL_Init (SDL_INIT_VIDEO))
    die (SDL_GetError ());
  puts ("SDL init -> OK");
  return 0;
}
compile it with
Code:
gcc testing.c -o testing `sdl2-config --libs --cflags`
and when i start it i get
Code:
err: No available video device
i am missing something really obvious here.. why cant it find a video device?
Reply With Quote
  #2   (View Single Post)  
Old 16th September 2022
talos4 talos4 is offline
Real Name: morty mcfly
Port Guard
 
Join Date: Sep 2022
Location: stuck on earth, in the timeline of Yesterday's Enterprise
Posts: 10
Default

Found an "answer" elsewhere that might help you: Before you run the program, type "export DISPLAY=:0" or whichever display you'd like to target.

Before I tried that, I was receiving your same error. After I did that, the program appeared as a new window in my X11 session.

For me, the "answer" doesn't help. I'm trying to run everything without X and had started experimenting with "SDL games" because I (mistakenly?) thought SDL made it possible to display graphics within a console virtual terminal.
Reply With Quote
  #3   (View Single Post)  
Old 16th September 2022
frakswe frakswe is offline
Port Guard
 
Join Date: Oct 2020
Posts: 18
Default

@talos4 well on linux you can with sdl1 so you weren't totally mistaken.
Reply With Quote
  #4   (View Single Post)  
Old 17th September 2022
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Bitchy Nerd Elitist
 
Join Date: Dec 2015
Location: London
Posts: 461
Default

Quote:
Originally Posted by talos4 View Post
I (mistakenly?) thought SDL made it possible to display graphics within a console virtual terminal
SDL uses fbdev for console output. Not sure if NetBSD supports that.
Reply With Quote
  #5   (View Single Post)  
Old 18th September 2022
talos4 talos4 is offline
Real Name: morty mcfly
Port Guard
 
Join Date: Sep 2022
Location: stuck on earth, in the timeline of Yesterday's Enterprise
Posts: 10
Default

Thanks, frakswe and head_on_a_stick.

But, when I didn't specify a DISPLAY and then launched several different SDL-dependent games in ports (dhewm3, freeorion), I received the same errors as billy_bazooka. (Any relation to "Bazooka, Joe"? I wonder...)

I ran those games really just to test, hoping to see something in the distribution render graphics to the console. But, what I really would like to do is run:
http://uobikiemukot.github.io/yaft/
which claims to support 256 colors in the terminal. Yaft doc says to set:
FRAMEBUFFER="/dev/fb1" # seems specific to linux
before running "yaft". But, I don't know the "/dev/fb1" equivalent on OpenBSD. Would it be "/dev/dri/card0" or card1?

If I launch "yaft" w/o setting the FRAMEBUFFER envar or if I set it to "/dev/dri/card0", I get:
"WSDISPLAYIO_SETGFXMODE failed"

Unless anyone points out something obvious I'm overlooking, guess I should ping the "yaft" author for possible help.
Reply With Quote
  #6   (View Single Post)  
Old 19th September 2022
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Bitchy Nerd Elitist
 
Join Date: Dec 2015
Location: London
Posts: 461
Default

Quote:
Originally Posted by talos4 View Post
Yaft doc says to set:
FRAMEBUFFER="/dev/fb1" # seems specific to linux
before running "yaft". But, I don't know the "/dev/fb1" equivalent on OpenBSD. Would it be "/dev/dri/card0" or card1?
/dev/dri/ is for the DRM stack. The framebuffer device is an abstraction layer and that's what is used by programs for console output. There is no fbdev API in OpenBSD.

Disclaimer: I'm no programmer.
Reply With Quote
  #7   (View Single Post)  
Old 19th September 2022
talos4 talos4 is offline
Real Name: morty mcfly
Port Guard
 
Join Date: Sep 2022
Location: stuck on earth, in the timeline of Yesterday's Enterprise
Posts: 10
Default

Thanks, Head.
Reply With Quote
  #8   (View Single Post)  
Old 19th September 2022
frakswe frakswe is offline
Port Guard
 
Join Date: Oct 2020
Posts: 18
Default

https://gitlab.com/osen/openbsd_drmfb_gnuboy

don't know your level of programming expertise but this emulator uses the framebuffer and openbsd, might learn something from the code how to go about it.

maybe try putting a single pixel on the screen then go from there.
Reply With Quote
  #9   (View Single Post)  
Old 19th September 2022
talos4 talos4 is offline
Real Name: morty mcfly
Port Guard
 
Join Date: Sep 2022
Location: stuck on earth, in the timeline of Yesterday's Enterprise
Posts: 10
Default

@ frakswe

Thanks! That's interesting.

I've hardly written any C and never worked on this level of the stack. (I'm an old rdbms guy.) But, I've bookmarked that and hopefully someday will look into it, as I'd like my console emacs to use 256 colors for syntax highlighting and maybe even displaying images inline.

Last edited by talos4; 19th September 2022 at 01:30 PM.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between"arp info overwritten" and " duplicate IP address " varag OpenBSD Security 1 6th April 2015 02:57 PM
Fresh installation 6.1.2 amd64 freezes in the line "root device" divel NetBSD Installation and Upgrading 2 22nd November 2013 07:11 PM
"no root device found" while installing kondziq FreeBSD Installation and Upgrading 4 29th November 2011 10:01 AM
System stops booting after "GEOM_MIRROR: Force device gm0 start due to timeout." indienick FreeBSD General 1 25th March 2010 09:46 PM
Fixed "xinit" after _7 _8, "how" here in case anyones' "X" breaks... using "nvidia" jb_daefo Guides 0 5th October 2009 09:31 PM


All times are GMT. The time now is 11:27 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick