1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-29 10:05:21 +02:00

liballegro: fix fbdev driver, also package examples

This commit is contained in:
David Kühling 2011-05-31 17:14:29 +02:00
parent e7f7d81bc0
commit 2e457ea3d0
3 changed files with 94 additions and 3 deletions

View File

@ -5,6 +5,17 @@
#
# OpenWRT package for the Allegro game and multimedia library
# todo:
#
# * GFX_SAFE has a problem switching to 32bpp mode (maybe it falsely
# attempts switching to 24bpp mode?), so it fails. doing a
# set_color_depth(32) and GFX_AUTODETECT works.
#
# * both shooter and skater try to load a demo.dat from /usr/bin. hack them to
# use usr/share subdirs?
#
# * similar problem with setup?
#
include $(TOPDIR)/rules.mk
PKG_NAME:=liballegro
@ -84,6 +95,17 @@ $(call Package/liballegro/Default/description)
This package contains the Allegro setup program
endef
define Package/liballegro-examples
$(call Package/liballegro/Default)
TITLE+= (examples)
DEPENDS:=+liballegro
endef
define Package/liballegro-examples/description
$(call Package/liballegro/Default/description)
This package contains the Allegro example programs named "ex*"
endef
define Package/liballegro-utils
$(call Package/liballegro/Default)
TITLE+= (utils)
@ -231,6 +253,13 @@ define Package/liballegro-setup/install
$(CP) $(PKG_BUILD_DIR)/setup/setup.dat $(1)/usr/share/allegro/
endef
define Package/liballegro-examples/install
$(INSTALL_DIR) $(1)/usr/bin/allegro
$(CP) $(PKG_BUILD_DIR)/examples/* $(1)/usr/bin/allegro/
rm $(1)/usr/bin/allegro/{*.c,*.h,*.txt,*.cmake}
rm -r $(1)/usr/bin/allegro/CMakeFiles
endef
define Package/liballegro-utils/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin $(1)/usr
@ -242,6 +271,7 @@ $(eval $(call BuildPackage,liballegro))
#$(eval $(call BuildPackage,liballegro-data))
$(eval $(call BuildPackage,liballegro-demo))
$(eval $(call BuildPackage,liballegro-setup))
$(eval $(call BuildPackage,liballegro-examples))
$(eval $(call BuildPackage,liballegro-utils))

View File

@ -1,15 +1,21 @@
Index: allegro-4.4.2/demos/shooter/demo.c
===================================================================
--- allegro-4.4.2.orig/demos/shooter/demo.c 2011-05-29 12:56:58.000000000 +0200
+++ allegro-4.4.2/demos/shooter/demo.c 2011-05-29 13:50:44.000000000 +0200
@@ -90,9 +90,9 @@
+++ allegro-4.4.2/demos/shooter/demo.c 2011-05-31 15:57:29.000000000 +0200
@@ -1,3 +1,5 @@
+#define DEBUGMODE
+
#include "demo.h"
#include "data.h"
#include "expl.h"
@@ -90,9 +92,9 @@
allegro_message("Error initialising joystick\n%s\n", allegro_error);
install_joystick(JOY_TYPE_NONE);
}
-
- if (set_gfx_mode(GFX_AUTODETECT, 320, 200, 0, 0) != 0) {
- if (set_gfx_mode(GFX_SAFE, 320, 200, 0, 0) != 0) {
+ set_color_depth(32);
+ /* set_color_depth(32); */
+ if (set_gfx_mode(GFX_AUTODETECT, 320, 240, 0, 0) != 0) {
+ if (set_gfx_mode(GFX_SAFE, 320, 240, 0, 0) != 0) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);

View File

@ -0,0 +1,55 @@
Index: allegro-4.4.2/src/linux/fbcon.c
===================================================================
--- allegro-4.4.2.orig/src/linux/fbcon.c 2011-05-31 15:57:15.000000000 +0200
+++ allegro-4.4.2/src/linux/fbcon.c 2011-05-31 17:04:32.000000000 +0200
@@ -19,6 +19,10 @@
* See readme.txt for copyright information.
*/
+/* #define DEBUGMODE */
+
+#include <errno.h>
+#include <string.h>
#include "allegro.h"
#include "allegro/internal/aintern.h"
@@ -263,6 +267,7 @@
case -1:
/* let's see if we can get the actual screen mode */
/* shouldn't we be keeping the previous color depth setting? */
+ TRACE(PREFIX_I "...orig bpp %i...\n", (int)orig_mode.bits_per_pixel);
switch (orig_mode.bits_per_pixel) {
case 8:
case 16:
@@ -360,9 +365,21 @@
continue;
/* try to set the mode */
+ TRACE(PREFIX_I "...trying w %i h %i vw %i vh %i bpp %i...\n",
+ (int)my_mode.xres, (int)my_mode.yres,
+ (int)my_mode.xres_virtual, (int)my_mode.yres_virtual,
+ my_mode.bits_per_pixel);
if (ioctl(fbfd, FBIOPUT_VSCREENINFO, &my_mode) == 0) {
+ TRACE(PREFIX_I "...ioctl ok w %i h %i vw %i vh %i bpp %i...\n",
+ (int)my_mode.xres, (int)my_mode.yres,
+ (int)my_mode.xres_virtual, (int)my_mode.yres_virtual,
+ my_mode.bits_per_pixel);
if (my_mode.bits_per_pixel == (unsigned)color_depth)
goto got_a_nice_mode;
+ }
+ else
+ {
+ TRACE(PREFIX_I "...ioctl said %i %s\n", errno, strerror(errno));
}
}
@@ -377,6 +394,9 @@
close(fbfd);
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Framebuffer resolution not available"));
TRACE(PREFIX_E "Resolution %dx%d not available...\n", w, h);
+ /* bugfix: if we don't reset fb_mode_read than the next call to
+ set_gfx_mode() is going to fail with "bad file descriptor" */
+ fb_mode_read = FALSE;
return NULL;
got_a_nice_mode: