summaryrefslogtreecommitdiff
path: root/src/libsystemd-terminal/grdev-drm.c
AgeCommit message (Collapse)Author
2014-10-03terminal/drm: clear 'applied' flag when changing stateDavid Herrmann
If a pipe is enabled/disabled, we have to clear crtc->applied of the linked CRTC. Otherwise, we will not run a deep modeset, but leave the crtc in the pre-configured state.
2014-10-03terminal/grdev: allow arbitrary fb-age contextsDavid Herrmann
Instead of limiting fb-aging to 64bit integers, allow any arbitrary context together with a release function to free it once the FB is destroyed.
2014-10-03terminal/drm: provide pipe->target() callbackDavid Herrmann
Instead of looking for available back-buffers on each operation, set it to NULL and wait for the next frame request. It will call back into the pipe to request the back-buffer via ->target(), where we can do the same and look for an available backbuffer. This simplifies the code and avoids double lookups if we run short of buffers.
2014-10-03terminal/grdev: simplify DRM event parsingDavid Herrmann
Coverity complained about this code and is partially right. We are not really protected against integer overflows. Sure, unlikely, but lets just avoid any overflows and properly protect our parser loop.
2014-10-03terminal: fix back-buffer selection on DRM page-flipDavid Herrmann
We currently select front-buffers as new back-buffer if they happen to be the last buffer in our framebuffer-array. Fix this by never selecting a new front buffer as back buffer.
2014-09-23terminal: verify kernel-returned DRM events are not truncatedDavid Herrmann
Make sure the kernel always returns events properly. This is guaranteed right now, otherwise, we do something really wrong. But lets be sure and verify the received values properly. This also silences some coverity warnings.
2014-09-23Silence some "unchecked return-value" warningsDavid Herrmann
This adds some log-messages to ioctl() calls where we don't really care for the return value. It isn't strictly necessary to look for those, but lets be sure and print warnings. This silences gcc and coverity, and also makes sure we get reports in case something goes wrong and we didn't expect it to fail that way.
2014-09-20terminal: fix mode sync for connectorsDavid Herrmann
The GETXY ioctls of DRM are usually called twice by libdrm: Once to retrieve the number of objects, a second time with suitably sized buffers to actually retrieve all objects. In grdrm, we avoid these excessive calls and instead just call ioctls with cached buffers and resize them if they were too small. However, connectors need to read the mode list via EDID, which is horribly slow. As the kernel still cannot do that asynchronously (seriously, we need to fix this!), it has a hack to only do it if count_modes==0. This is fine with libdrm, as it calls every ioctl twice, anyway. However, we fail horribly with this as we usually never pass 0. Fix this by calling into GETCONNECTOR ioctls twice in case we received an hotplug event. Only in those cases, we need to re-read modes, so this should be totally fine.
2014-09-20terminal: restructure some logging calls in grdrmDavid Herrmann
Multiple issues here: 1) Don't print excessive card dumps on each resync. Disable it and make developers add it themselves. 2) Ignore EINVAL on page-flips. Some cards don't support page-flips, so we'd print it on each frame. Maybe, at some point, the kernel will add support to retrieve capabilities for that. Until then, simply ignore it. 3) Replace the now dropped card-dump with a short message about resyncing the card.
2014-09-20terminal: grdev: schedule virtual frame events if hw doesn't support itDavid Herrmann
Whenever we cannot use hardware frame events, we now schedule a virtual frame event to make sure applications don't have to do this. Usually, applications render only on data changes, but we can further reduce render-time by also limiting rendering to vsyncs.
2014-09-20terminal: split grdrm_crtc_commit() apartDavid Herrmann
This helper is quite huge, split it apart to make it easier to follow.
2014-09-20terminal: grdev: refresh device state on hotplug eventsDavid Herrmann
Whenever we get udev hotplug events, re-read the device state so we properly detect any changed in the display setups.
2014-09-19terminal: add grdev DRM backendDavid Herrmann
The grdev-drm backend manages DRM cards for grdev. Any DRM card with DUMB_BUFFER support can be used. So far, our policy is to configure all available connectors, but keep pipes inactive as long as users don't enable the displays on top. We hard-code double-buffering so far, but can easily support single-buffering or n-buffering. We also require XRGB8888 as format as this is required to be supported by all DRM drivers and it is what VTs use. This allows us to switch from VTs to grdev via page-flips instead of deep modesets. There is still a lot room for improvements in this backend, but it works smoothly so far so more enhanced features can be added later.