New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[yamui] Reimplement as event based application. JB#59812 #11
[yamui] Reimplement as event based application. JB#59812 #11
Conversation
At least drm backend can have situation where gr_init() gets non-null gr_draw buffer from backend init - which then turns to null due to failure within gr_flip(). As the latter is not checked, gr_init() can return success and application then crashes later on when null gr_draw gets dereferenced. Check that gr_draw remains non-null after initial gr_flip() calls. Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
Images that are larger than screen size are completely ignored by gr_blit(). This combined with display size variance between different device types can lead to problems that might be difficult to analyze. Calculate portion of the image that fits on screen and draw it instead of skipping the image altogether. Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
It is perfectly fine not to have a font file installed, but yamui application still complains every time it is invoked. Complain only when there are problems loading existing font file. Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
As fbdev is legacy interface, it is perfectly normal not to have the device node present but yamui still complains about it every time it is invoked. Do not complain if fbdev can't be opened because the device node not does not exist. Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
minui/graphics.c:96:4: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
minui/graphics.c:98:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
Assume that the code layout matches the intent and add missing {} braces.
minui/resources.c:67:29: warning: variable ‘result’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
Assume that this is optimization issue that can be avoided by marking
the variable as volatile and thus not eligible for storage in a register.
minui/graphics_drm.c:71:38: warning: unused parameter ‘backend’ [-Wunused-parameter]
minui/graphics_drm.c:307:43: warning: unused parameter ‘backend’ [-Wunused-parameter]
minui/graphics_drm.c:381:43: warning: unused parameter ‘backend’ [-Wunused-parameter]
minui/graphics_drm.c:392:37: warning: unused parameter ‘backend’ [-Wunused-parameter]
"Use" the parameters by involving them in dummy casts.
minui/graphics_drm.c:316:15: warning: implicit declaration of function ‘asprintf’; did you mean ‘vsprintf’? [-Wimplicit-function-declaration]
Software that relies on GNU features might as well define _GNU_SOURCE
globally from Makefile to avoid subtle issues like e.g. missing prototypes.
minui/graphics_drm.c:402:13: warning: initialization of ‘GRSurface * (*)(struct minui_backend *, _Bool)’ {aka ‘struct <anonymous> * (*)(struct minui_backend *, _Bool)’} from incompatible pointer type ‘GRSurface * (*)(minui_backend *)’ {aka ‘struct <anonymous> * (*)(struct minui_backend *)’} [-Wincompatible-pointer-types]
minui/graphics_drm.c:402:13: note: (near initialization for ‘drm_backend.init’)
Make drm_init() function match the expected backend callback template.
yamui-tools.c:99:36: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 245 [-Wformat-truncation=]
Add buffer too small check.
Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
All applications that take over display should implement compositor D-Bus service to facilitate controlled display ownership and handover. Arranging such behavior in yamui is difficult as it uses procedural logic that is not really adaptable for asynchronous dbus activity. Reimplement yamui as glib mainloop based application that functions as compositor D-Bus service. If yamui is executed before D-Bus SystemBus becomes available, it assumes that it has permission to draw, and utilizes unix socket service as display ownership mutex. When SystemBus socket later on becomes available, display ownership is arbitrated by D-Bus service name ownership. If executed with --systemd command line option, ready notification is sent to systemd when permission to draw has been received from mce over D-Bus. Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
94c34bc
to
53130bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rough overview of the change. Didn't spot anything special. That said, didn't test on device either. Once integrated easier to test as well. Approving.
There is already double-open workaround in use for initializing drm graphics backend. Looks like most of the times it is not needed, but sometimes immediate retry does not help. Retry drm initialization upto 5 times with 100ms in between tries. Refactor code a bit by splitting fbdev and drm specific bits in separate functions in an attempt to make control flow easier to follow. Signed-off-by: Simo Piiroinen <simo.piiroinen@jolla.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last commit seems ok for me.
All applications that take over display should implement compositor
D-Bus service to facilitate controlled display ownership and handover.
Yamui uses procedural logic that is not really compatible with e.g.
asynchronous dbus activity.
Reimplement yamui as glib mainloop based application that functions
as compositor D-Bus service.
If yamui is executed before D-Bus SystemBus becomes available, it
assumes that it has permission to draw, and utilizes unix socket
service as display ownership mutex. When SystemBus socket later on
becomes available, display ownership is arbitrated by D-Bus service
name ownership.
If executed with --systemd command line option, ready notification is
sent to systemd when permission to draw has been received from mce
over D-Bus.
Signed-off-by: Simo Piiroinen simo.piiroinen@jolla.com