Commit Graph

86 Commits

Author SHA1 Message Date
Christopher Michael 92faf6a0e1 ecore-drm2: Change ERR to WRN
No real need for these to be ERR because we are not going to crash if
these happen anyway.
2020-04-20 19:31:44 -04:00
Carsten Haitzler 703ca74d67 ecore drm2 - fix timeout in case case called from thread
so sw rendering make call ecore drm2 calls from a thread - i didnt
know that. so this makes my fix for gl hangs add hangs in sw as a
result. this fixes that. not perfect but better. do need refcoutnts on
outputs to be perfect...

also sometimes the commits fail so retry a few times...

this still leaves us wth another hang that is a separate issue.

@fix
2019-04-30 11:51:06 +01:00
Christopher Michael edd78d1800 ecore-drm2: Fill in crtc background color (if supported) during atomic
commits

Small patch to add the crtc background_color property (if supported)
to any atomic tests/commits

@feature
2019-04-18 07:21:39 -04:00
Carsten Haitzler e2b56fe71d ecore drm2 - handle possible NULL fb when doing a flip 2019-04-10 16:49:47 +01:00
Christopher Michael 9d301e4e03 ecore-drm2: Don't use AtomicAddProperty for plane rotation
Summary:
Apparently something has been changed recently in libdrm
that causes AtomicAddProperty to fail when trying to set plane rotation. Until
this can be found & fixed, let's just disable trying to rotate
hardware planes with atomic commits.

ref T7690

@fix

Reviewers: raster, cedric, zmike

Subscribers: zmike, cedric

Tags: #efl, #do_not_merge

Maniphest Tasks: T7690

Differential Revision: https://phab.enlightenment.org/D8110
2019-03-22 12:41:03 -04:00
Carsten Haitzler 39f224b3a6 ecore drm2 - work around kms/drm bug seemingly when no flip event comes
so we request a flip so we can do vsync events. the flip event never
comes. i am not sure why it never comes, but we ask and nothing
arrives, and this basically halts all rendering in wayland compositor
mode as we are syncing rendering to vsync (of course). put in a
timeout of 0.05s (50ms) to try ask again if the event never comes and
log the error. this is a pretty useful workaround becauswe having your
entire display freeze is a ... bad thing.

@fix
2019-02-21 09:52:31 +00:00
Christopher Michael 8079d6d38a ecore-drm2: Pass output as data to drmModePageFlip and drmModeAtomicCommit
In order to support per-output ticking, the drmModePageFlip and
drmModeAtomicCommit functions need to pass the actual Output as data
to the pageflip callback so that the pageflip callback function can
pass the proper rectangle to ecore_evas_animator_tick

Differential Revision: https://phab.enlightenment.org/D7678
2019-01-17 09:37:33 -06:00
Christopher Michael bd6d83bee7 ecore-drm2: Fix drmModeSetCrtc call during fb flip
drmModeSetCrtc x & y values are actually offsets into the framebuffer
memory. As such, we should not be sending output position here.

@fix
2019-01-02 10:03:06 -05:00
Christopher Michael cbac8eddb0 ecore-drm2: Minor formatting fixes
NB: No functional changes
2019-01-02 10:01:55 -05:00
Derek Foreman 8ff59b2c55 ecore_drm2: Pass Ecore_Drm2_Device instead of fd to most functions
Intended to simplify the upcoming commit that merges device find and
device open into a single function that returns a device.

The fd is something callers shouldn't really need to get their hands on,
right now there are still a few places where it's needed, but those will
be gone soon too.
2017-08-09 14:56:58 -05:00
Derek Foreman acc76cadd3 ecore_drm2: Stop making dumb fbs and mmapping for gbm fds
We were doing this so E could do screenshots in a hackish way,
E has been fixed so this hack here no longer needs to live.
2017-07-31 11:12:05 -05:00
Derek Foreman 3775a9645d ecore_drm2: fix scanout_on callback firing too often
We need to increase the on scanout count for a buffer only when the
plane it's on makes its transition from pending to visible.

Previously it was firing for every refresh which would break refcounting
for any plane using surface that didn't change every frame.
2017-06-30 10:26:41 -05:00
Derek Foreman 1552f85ede ecore_drm2: Add scanout status callbacks
This generates callbacks when a fb becomes scanned out on a hardware plane
or when it no longer is.
2017-06-23 08:15:41 -05:00
Derek Foreman c67da0c869 ecore_drm2: Add Fb deleted event 2017-06-23 08:15:41 -05:00
Derek Foreman 69181cc9e8 ecore_drm2: Track number of times an fb is on scanout
The same fb can be placed in multiple hardware planes, we need to keep
track of the number of planes it's on at any time so we can send events
to a compositor in a later commit.
2017-06-23 08:15:41 -05:00
Derek Foreman bc8b11bd78 ecore_drm2: Track whether an Ecore_Drm2_Plane has ever been on scanout 2017-06-23 08:15:41 -05:00
Derek Foreman 0d1082f947 ecore_drm2: Stop using the old per output release callbacks 2017-06-23 08:15:40 -05:00
Derek Foreman a97b1ac006 ecore_drm2: Update buffer release mechanism to send new status information
Begin moving internals over to the new per fb status updates.
2017-06-23 08:15:40 -05:00
Derek Foreman a3eed7865a ecore_drm2: Add ecore_drm2_fb_status_handler_set
The old per output release handler is no longer complicated enough.  In
the near future we'll need to be able to tell an engine that its fb has
been placed on scanout via hardware plane, or removed from a hardware
plane.

It's simpler to provide that information as well as release information
through a single callback.
2017-06-23 08:15:40 -05:00
Chris Michael bbd18510d6 ecore-drm2: Remove #ifdef HAVE_ATOMIC_DRM
As we now use static_libs/libdrm for compiling ecore-drm2, we can
remove the atomic #ifdefs as we can run-time check this now.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-06-09 14:20:05 -04:00
Chris Michael a55eafd960 ecore-drm2: Fix drm_mode variables to work with static lib
As we now use static_libs/libdrm to build ecore_drm2, we need to
fix how our drm_mode variables are declared so we can use them.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-06-09 13:50:22 -04:00
Derek Foreman df0595ebc0 ecore_drm2: Rename _release_buffer and make it private instead of static
Other files in ecore_drm2 need to release buffers too.
2017-06-02 15:50:08 -05:00
Chris Michael ac2c82b871 ecore-drm2: Remove useless return
This 'return' statement here is just useless as the code can fall
through and the function will return 0 anwyay.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-30 10:59:25 -04:00
Derek Foreman 12260dabb9 ecore_drm2: Better handle flip failure round 2
If the buffer being flipped to is the one already on screen then
releasing it on flip failure will leave it on scanout with no
references.  The next time a buffer is queued it will be removed
from scanout and deleted.

Not good.

Fix T5462
2017-05-17 17:31:13 -05:00
Derek Foreman 2c58d77ba9 ecore_drm2: Better handle flip failure
We need to release the buffer we couldn't flip to when a flip fails.

This makes whatever bug is causing a page flip to happen right after
dpms blanks the screen, which was leading to a failure to ever wake
from dpms because the flip left a pending buffer that never completed.

Fix T5462
2017-05-17 15:01:54 -05:00
Derek Foreman 88f328efd2 ecore_drm2: Clear next fb if we use it
Fixes a race that's either really hard to hit if you're a developer
or really easy to hit if you're a user.

Thanks to ApB for the debug assistance.

Fix T5484
2017-05-15 16:22:12 -05:00
Derek Foreman 51f5f43d43 ecore_drm2: Fix use after free
In trying to clean up some code and fix a hypothetical buffer leak, I added
a use after free error that can break rendering on the drm and gl_drm
evas engines.

Coverity did the heavy lifting for me on this one.

Fix Coverity CID 1375047
Fix T5484
2017-05-14 13:13:34 -05:00
Derek Foreman 44b57b5dfa ecore_drm2: Add some safety checks for accessing dead fbs
Accessing an fb after discarding it is bad karma, so we should log something
if it ever happens.
2017-05-12 17:51:34 -05:00
Derek Foreman edcbff59b7 ecore_drm2: refcount fbs
Removes the previous "busy" flag, as now we might have an fb attached to
multiple outputs at once, and need to be careful to destroy them only
after they've been removed from all outputs.

Removed the old "busy_set" API which nothing used, and renames fb_destroy
to fb_discard to make it more clear that it's not immediately destroyed.

It's all beta api, so I can do this.
2017-05-12 17:51:34 -05:00
Chris Michael af587c01cb ecore-drm2: Add start of refcounting for FB objects
Small patch which starts to implement refcounting on framebuffer
objects. This will be needed so that we do not free FB objects while
they are on the screen.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-09 11:47:04 -04:00
Derek Foreman 544cffaa19 ecore_drm2: Move test for atomic_req into atomic flip path
We ended up doing an occasional atomic ioctl when we shouldn't.
This should be a harmless failure, but it's also a pointless one.
2017-05-09 10:34:33 -05:00
Derek Foreman 8067b0146a ecore_drm2: Fix dmabuf fb destroy
I missed the fact that it'd run through the existing non-gbm path on
destroy, resulting in a (probably harmless) bad ioctl
2017-05-09 10:34:33 -05:00
Derek Foreman c722466a60 ecore_drm2: Replace plane state release flag with plane dead flag
The release flag is actually less useful than the existing in_use flag
for determining if a plane is unused.  If a new plane is assigned before
the next flip cleans up released planes, then it can point to a released
plane state, and both it and the previous user will be freed on the next
commit, leaking a plane.

Putting the flag in the plane structure fixes this while still allowing us
to keep released planes around to ensure a recently released plane is
cleared from atomic state.
2017-05-05 12:53:25 -05:00
Derek Foreman 7628977fbf ecore_drm2: Fix flip test error handling
We need to free the atomic req if commit fails, so let's merge these
failure paths and simplify code a bit.
2017-05-05 12:53:25 -05:00
Chris Michael 1d3ad70888 ecore-drm2: Release any marked planes during atomic commit
This patch fixes plane_state values during atomic flip test for any
planes marked for release. When the fb_flip actually completes, we
will remove the marked plane(s) from the output.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-05 12:53:24 -05:00
Chris Michael 7a50010536 ecore-drm2: Fix formatting
NB: No functional changes

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-05 12:53:24 -05:00
Derek Foreman 6b9a6a8bed ecore_drm2: Fix atomic flip with no new buffer
We don't have an atomic state, so we need to create one before the flip
2017-05-05 12:53:23 -05:00
Derek Foreman 9223b0d535 ecore_drm2: Pass user data to atomic flip
We need the user_data to come back to us in the flip handler like it does
in the non atomic flip.
2017-05-05 12:53:23 -05:00
Derek Foreman b6f67124e4 ecore_drm2: Add some atomic state tracking
I think we're now at the point where the two paths are merged.

Still no atomic functionality because nothing assigned the primary plane,
so we have no atomic state to commit.  The machinery should be in place
though.
2017-05-05 12:53:23 -05:00
Derek Foreman ba4d41ff63 ecore_drm2: Handle atomic state in _release_buffer
Further merging of atomic and non-atomic paths
2017-05-05 12:53:23 -05:00
Derek Foreman b902ef7c69 ecore_drm2: Make _release_buffer take a state struct instead of fb
Lets us push the NULL set into _release_buffer for some clean up
2017-05-05 12:53:23 -05:00
Derek Foreman 89630ddeb1 ecore_drm2: Refactor common code from non-atomic path
We'll need to perform all this for atomic operations as well.
2017-05-05 12:53:23 -05:00
Derek Foreman 8d72a2cf46 ecore_drm2: Fix typo in comment 2017-05-05 12:53:23 -05:00
Derek Foreman e7a494ba87 ecore_drm2: treat atomic flip without a req as an error
We should use the safety macro here instead of silently continuing so we
can get something in the log if this happens.
2017-05-05 12:53:22 -05:00
Derek Foreman 9da0f52642 ecore_drm2: remove fb parameter from _fb_flip()
Time to start smashing the atomic and non-atomic paths together.
2017-05-05 12:53:22 -05:00
Derek Foreman 8143abff2c ecore_drm2: Replace output fbs with state structs
next, pending, and current are going to have to deal with atomic state
instead of just fbs soon
2017-05-05 12:53:22 -05:00
Derek Foreman 63dbf061a9 ecore_drm2: Move atomic state into an output state struct
This should make it easier to share code paths between atomic and non
atomic operations.
2017-05-05 12:53:22 -05:00
Derek Foreman 8d42d7d50a ecore_drm2: Drop static from _fb_atomic_flip_test()
We're going to need this one in plane assign to test commits
2017-05-05 12:53:22 -05:00
Derek Foreman f1d779da06 ecore_drm2: remove flip test from commit path
We'll be doing tests as we build up plane state assignment.  it's too late
to do anything about it if we fail here - failed tests will block plane
assignment in the first place so the scene graph knows it still has to
render those visual elements.
2017-05-05 12:53:22 -05:00
Derek Foreman 7dd8d6d163 ecore_drm2: Don't use drmModeAtomicMerge
We're creating the entire state from scratch already - trying to merge
with the old state will likely bring in state we just tried to replace.
2017-05-05 12:53:21 -05:00