test_console: fix console deinitialization bug
We must not destroy the compositor object if there is still a console using the GL context. Otherwise we get a SEGFAULT when calling any gl* function. In future we may need propoper dependencies here. We use reference counts so this should be easy to implement. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
74d8ba5eea
commit
0f44dfdde8
5
TODO
5
TODO
@ -8,7 +8,10 @@ Output Subsystem:
|
||||
you have only one card, multiple active contexts are not really needed.
|
||||
|
||||
- Avoid EGL_EGLEXT_PROTOTYPES and GL_GLEXT_PROTOTYPES and instead retrieve
|
||||
function pointers dynamically.
|
||||
function pointers dynamically. This may also fix invalid function pointers if
|
||||
no GL context is available and we deinitialize the console subsystem. Or we
|
||||
may need to use proper dependencies here. The GL context shouldn't be
|
||||
destroyed as long as a console uses it.
|
||||
|
||||
- How to get bpp and colordepth?
|
||||
|
||||
|
@ -233,6 +233,11 @@ unsigned int kmscon_console_get_height(struct kmscon_console *con)
|
||||
* Pass 0 for each parameter if you want to use the current value. Therefore:
|
||||
* kmscon_console_resize(con, 0, 0, 0) has no effect as it doesn't change
|
||||
* anything.
|
||||
* If you called this once you must make sure that the GL context stays alive
|
||||
* for as long as this console object does. Otherwise, on deinitialization we
|
||||
* may call invalid OpenGL functions.
|
||||
* TODO: Use proper dependencies here. Maybe pass in a kmscon_output or similar
|
||||
* so we correctly activate GL contexts.
|
||||
*/
|
||||
int kmscon_console_resize(struct kmscon_console *con, unsigned int x,
|
||||
unsigned int y, unsigned int height)
|
||||
|
@ -249,8 +249,8 @@ static void destroy_eloop(struct console *con)
|
||||
{
|
||||
kmscon_eloop_rm_idle(con->idle);
|
||||
kmscon_idle_unref(con->idle);
|
||||
kmscon_compositor_unref(con->comp);
|
||||
kmscon_console_unref(con->con);
|
||||
kmscon_compositor_unref(con->comp);
|
||||
kmscon_vt_unref(con->vt);
|
||||
kmscon_eloop_rm_fd(con->stdin_fd);
|
||||
kmscon_eloop_rm_signal(con->sig_int);
|
||||
@ -293,11 +293,11 @@ static int setup_eloop(struct console *con)
|
||||
if (ret)
|
||||
goto err_loop;
|
||||
|
||||
ret = kmscon_console_new(&con->con);
|
||||
ret = kmscon_compositor_new(&con->comp);
|
||||
if (ret)
|
||||
goto err_loop;
|
||||
|
||||
ret = kmscon_compositor_new(&con->comp);
|
||||
ret = kmscon_console_new(&con->con);
|
||||
if (ret)
|
||||
goto err_loop;
|
||||
|
||||
@ -327,6 +327,8 @@ int main(int argc, char **argv)
|
||||
return abs(ret);
|
||||
}
|
||||
|
||||
log_info("Starting console\n");
|
||||
|
||||
schedule_draw(&con);
|
||||
|
||||
while (!terminate) {
|
||||
@ -335,6 +337,8 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
log_info("Stopping console\n");
|
||||
|
||||
destroy_eloop(&con);
|
||||
return abs(ret);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user