While having the ability to test for specific driver and kernel
versions is nice to ensure that Atomic is supported, it quickly can
get out of hand trying to maintain this whitelist so (for now) disable
it and rely on the kernel results from drmSetCap.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
We should be setting this to the context version we understand, not
the highest version supported by the library.
From Daniel Stone's recent intel-gpu-tools commit fixing the same bug:
With libdrm 2.4.78, setting a higher context version than 2 will attempt
to call the page_flip_handler2 vfunc if it was non-NULL, which being a
random chunk of stack memory, it might well have been.
On systems where this happens it'll probably happen a lot, so
we don't want to continuously log this, but since it's definitely
showing a bug somewhere (efl or kernel) it probably should be an ERR.
Small patch which fixes some FB flipping messages to use the proper
type (ie: some messages were ERR when should be DBG or WRN, etc).
NB: No functional changes
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This patch adds a new API function that can be called from
Enlightenment wl_drm module to enable output rotation.
NB: Only works if Atomic support is enabled as it rotates the hardware
plane directly...and we don't support planes without Atomic enabled.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to add an API function which can be used to return the
supported rotations of a given output. This is used inside the
Enlightenment wl_drm module to determine if rotations is supported on
an output.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
As we will need these values when doing rotation checks inside wl_drm
module (for randr rotation support), let's move them out of the
private header and expose them in Ecore_Drm2.h
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Small patch to add a new API function that can be called to determine
if a given drm device prefers the use of shadow buffers. This API
will be used later to provide some optimizations on various platforms.
NB: Requested by Derek
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
so thelatest rpi kernels available e.g. in raspbian contain no fixes
for this yet so thatmeans basically ALL users would be affected, so
best to have a small workaround in ecore_drm2 to try the page flip a
few times until it works. this actually works. i try a usleep for 100
then try again. up to 500 times max then give up. actual numbers show
that betwee 1 to about 60 tries gets the flip to happen when these
glitches happen. log an error when this happens so we know it's
happening and a workaround is kicking in.
technically this would be much nicer if swapping had a dedicated
thread that could stall in this case and keep trying, but the odd
times it happens (seems to happen on average maybe once every 30
seconds) it wouldnt stall the mainloop or rendering and JUSt stall a
dedicated swapper thread. this requires a lot mor work to implement
though and we'd have to then ensure swaps ARe async with the swap
result coming back as an event etc... so a lot more work.
this at least makes rendering on the rpi stable and i can dig into
other issues like libproxy throws exceptions and causes a whole
process abort() as a result, or the latest mesa pkgs have totally
broken partial gl rnedering with all non-rendered areas being black
(it used to work though... until i updated).
@fix
Small patch to add an API function which will allow setting the gamma
level of a given output.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This patch adds a new API function which will be called from
Ecore_Evas to return the screen dpi
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Previously we'd call this only when we absolutely needed to, so it made
sense to always attempt to free a buffer, including ones on scanout or
pending flip.
However, it's useful to have a way to release the "next" only, so we can
do that before starting a render to free up the buffer that's never going
to be scanned out.
Small patch to reorganize defines & structures from included files,
and to add copyright information related to each file where defines &
structures were borrowed from.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
As we are not compile-time linking to libdrm anymore, Ecore_Evas_Drm
needs to be able to call drmHandleEvent, so add an API function to
Ecore_Drm2 that can be used there.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Instead of linking to libdrm and calling drmMode functions, we will
instead symlink the functions we need during runtime and call those
symlinks.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
As we are moving away from linking to libdrm during compile time, and
instead dlsym to things we need at runtime, we need to include copies
of the libdrm structures that we will be using along with function
declarations that we symlink to.
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
When we destroy outputs, we should be freeing the Output's Modes also
as that was previously allocated memory.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
As we always set this flag in the drm2_fb_flip function, having this
check here is now pointless.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
of mode
This fixes an issue where gl_drm engine would end up flickering
everytime a frame was being set.
Thanks derek ;)
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This patch modifies our ecore_drm2_fb_flip code to use Atomic/Nuclear
pageflips.
NB: Works perfectly under software drm engine .. some flickering with the
gl_drm engine that needs investigating.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This patch adds code to enable Atomic Modesetting support (via ioctl)
and to fill in Atomic Crtc state during startup.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This code will detect the drm driver name and check that the kernel
itself is new enough to use Atomic Modesetting. This is needed as some
drivers (i915) do not handle Atomic Modesetting propertly without a
new enough kernel.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
As this function releases FBOs on a given output, lets just shorten
the API function name so it can stay grouped into the ecore_drm2_fb.c
file ... leaving it as ecore_drm2_output_fb_release reads like it
should have gone into the ecore_drm2_output.c file...
NB: No real function changes here, just an API rename.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Adds an api to attempt to release an fb from an output. This will try
to first free any queued but not display buffers, which may harmlessly
give us a render target.
However, if that fails it will try to get buffers that have been sent to
scanout, which can lead to tearing.
What we've always wanted when getting the "current" FB is to get
the most recently submit one - this may be current, next, or pending.
Replace ecore_drm2_output_current_fb_get() with a function that gets the
most recent one - ecore_drm2_output_latest_fb_get(). Now callers don't
have to check the next buffer themselves first, and we don't have to
add an API for pending.
Add a function for ecore_evas_drm to call after a page flip happens so
ecore_drm2 can track busy status for fbs itself (including for the fb
that's currently being flipped to scanout)
Also, call the completion function from ecore_evas_drm
When triple buffering we'll have a buffer in ecore_drm2's "next" position.
Until now we've had to query it from the engine then try to re post it.
Also, when generating ticks we need to flip to the current buffer when no
changes have been made to get another callback.
Now a NULL fb to fb_flip will either flip to next, if available, or current
if there's nothing new to flip to.
Instead of passing the user data for the page flip callback every time,
set it just once.
This will make it easier to push tick logic into ecore_evas_drm, as there
will be a transitional period where page flips are driven in two places
that don't have access to the same pointers.
If the first output we test is disconnected but has the crtc of
the primary display assigned then we'll fail to assign the crtc
to the connector it's really connected to later.
This is a quick hack as trying to sort this out properly may be
too invasive for the upcoming 1.18 and isn't really important until
1.19 supports multihead anyway.
As it turns out, when we vt-switch Back to a running Enlightenment,
it ends up processing all outputs and causes Evas to create a giant
canvas to cover all outputs. This new canvas causes a blank screen as
the pageflipping fails (due to fb being too large). As we do not yet
support output on more an one screen anyway, temporarily disable any
output which is not marked as primary.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit adds a function we can call from inside Enlightenment in
order to fix an issue with VT-Switching. The problem was when a client
application is open, the compositor does not pass along the key-combo
for vt-switch but rather sends it to an application. This patch (along
with upcoming Enlightenment one) fixes the issue.
NB: This late API add approved by Stefan ;)
@feature
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Previously a drm event could create a new output or disconnect an output,
but could not re-enable an existing output.
This results in failure to properly wake from screen blanker.
We're currently doing screenshots in E under wayland by copying data
out of the framebuffer, mmaping gbm buffers makes screenshots work
again when rendering with GL.
When a new input device gets added, device calibration may need to be
performed. In order for that to be done properly, we need to know
which output this input device is associated with. This patch makes a
function call to Elput in order to retrieve that output name and
perform the proper calibration.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Running E wl2 in KVM led to the following issue: integrated mouse
pointer would always be stuck at (0,0).
The reason was that calibration would never happen, and it's
required* for absolute pointing devices, such as the qemu mouse
integration.
Fix: Listen to device add and calibrate based on the first
output. No idea if we could calibrate on any other output,
or how this should be done in case of multiple screens.
[*] I believe calibration might actually not be required, as
the absolute position is already the correct one when
received from libinput.
Coverity reports that we end up leaking the return from
_output_name_get as the storage is never freed.
Fixes Coverity CID1357161
@fix
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
When we vt-switch away from a running session, we need to disable
rendering to an output and re-enable when we switch back. This patch
set essentially makes vt-switching work again in Enlightenment Wayland.
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This adds a new API function that Ecore_Evas can call to calibrate
input devices given size of the output
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This patch adds 2 new API functions which are required by Ecore_Evas
in order for it to function with drm. These API functions allow for
restricting pointer movement, and for setting the window id which will
be used when sending input events
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This patch adds a new Ecore_Drm2_Event_Activate that can be raised to
inform Enlightenment that a session has been activated or suspended so
that rendering can be paused/resumed
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This patch adds support for creating, deleting, and manipulating
framebuffer objects via exposed API.
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This patch adds support for creating, destroying, and otherwise
working with outputs via exposed API functions.
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This commit adds new API functions to find, open, and close a drm
device, along with API functions to retrieve clock_id and cursor size.
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This new library is going to replace the existing Ecore_Drm. This will
refactor a lot of the code, bring improvements over the existing API,
and provide additional support for missing features.
@feature
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>