aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2019-04-16 13:43:59 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-04-16 13:43:59 +0200
commit63b5412f8c410694e8c67452452273ae8a9a6871 (patch)
tree541e7568118c16508465c512df08ab4a9ea4f971
parent1bc4ff02dc49e8860414317bab577eee88fd3ad0 (diff)
downloadfbida-63b5412f8c410694e8c67452452273ae8a9a6871.tar.gz
resume display tweak
-rw-r--r--drmtools.c7
-rw-r--r--fbi.c7
-rw-r--r--fbtools.c3
-rw-r--r--gfx.h2
4 files changed, 15 insertions, 4 deletions
diff --git a/drmtools.c b/drmtools.c
index 8fab4b5..c1199ec 100644
--- a/drmtools.c
+++ b/drmtools.c
@@ -246,12 +246,17 @@ static void drm_suspend_display(void)
drm_fd = -1;
}
-static void drm_resume_display(void)
+static int drm_resume_display(void)
{
drm_fd = device_open(drm_dev);
+ if (drm_fd < 0) {
+ fprintf(stderr, "drm: open %s: %s\n", drm_dev, strerror(errno));
+ return -1;
+ }
drm_init_fb(&fb1, drm_fmt, false);
if (fb2.mem)
drm_init_fb(&fb2, drm_fmt, false);
+ return 0;
}
static void drm_flush_display(bool second)
diff --git a/fbi.c b/fbi.c
index 8e6a5e8..72baf9d 100644
--- a/fbi.c
+++ b/fbi.c
@@ -38,6 +38,7 @@
#include "filter.h"
#include "desktop.h"
#include "fbiconfig.h"
+#include "logind.h"
#include "transupp.h" /* Support routines for jpegtran */
#include "jpegtools.h"
@@ -1201,11 +1202,15 @@ static void cleanup_and_exit(int code)
static void console_switch_suspend(void)
{
kbd_suspend();
+ gfx->suspend_display();
+ logind_release_control();
}
static void console_switch_resume(void)
{
- gfx->resume_display();
+ logind_take_control();
+ if (gfx->resume_display() < 0)
+ cleanup_and_exit(1);
shadow_render(gfx);
kbd_resume();
}
diff --git a/fbtools.c b/fbtools.c
index 6c2d52b..a459585 100644
--- a/fbtools.c
+++ b/fbtools.c
@@ -185,10 +185,11 @@ static void fb_suspend_display(void)
{
}
-static void fb_resume_display(void)
+static int fb_resume_display(void)
{
ioctl(fb,FBIOPAN_DISPLAY,&fb_var);
fb_set_palette();
+ return 0;
}
static void fb_cleanup_display(void)
diff --git a/gfx.h b/gfx.h
index 212f4ef..bd5131c 100644
--- a/gfx.h
+++ b/gfx.h
@@ -44,7 +44,7 @@ struct gfxstate {
/* calls */
void (*suspend_display)(void);
- void (*resume_display)(void);
+ int (*resume_display)(void);
void (*cleanup_display)(void);
void (*flush_display)(bool second);
};