Commit Graph

106 Commits

Author SHA1 Message Date
Christopher Michael d0dbc48f1b ecore-drm2: Change _output_crtc_find to accept an int
There is no reason to be passing the whole device structure here just
to get the fd
2020-04-28 12:40:53 -04:00
Chris Michael 2288c92bc5 ecore-drm2: Fix issue of shifting 1 by more than 32bits
Based on 9ca573f40f, this patch fixes
potential undefined behaviour on 64 bit systems.

@fix
2019-11-14 12:21:40 -05:00
Christopher Michael b462d9bc11 ecore-drm2: Fix API function parameters for background color set
Passing int as parameters here is too small for left shifting the
colors so make these parameters uint64_t
2019-04-18 09:10:49 -04:00
Christopher Michael 2aaca58de0 ecore-drm2: Add API function to set crtc background color
This patch adds a new API function we can be called in order to set
the crtc background color of a given output.

@feature
2019-04-18 07:21:39 -04: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
Christopher Michael e63c36056e ecore-drm2: Factor in output rotation when getting output info
Summary:
Enlightenment uses this function to get information about a given
output, so we should be accounting for output rotation when returning
width/height values.

ref T7690

@fix

Depends on D8114

Reviewers: raster, cedric, zmike

Reviewed By: cedric

Subscribers: cedric

Tags: #efl, #do_not_merge

Maniphest Tasks: T7690

Differential Revision: https://phab.enlightenment.org/D8115
2019-03-22 12:41:25 -04:00
Christopher Michael 828984393e ecore-drm2: Add API function to return output rotation
Summary:
Small patch to add an API function which can be used to return a given
output's rotation value

ref T7690

@feature

Depends on D8113

Reviewers: raster, cedric, zmike, stefan_schmidt, bu5hm4n

Reviewed By: cedric

Subscribers: cedric

Tags: #efl, #do_not_merge

Maniphest Tasks: T7690

Differential Revision: https://phab.enlightenment.org/D8114
2019-03-22 12:41:21 -04:00
Christopher Michael 9c08fe29d4 ecore-drm2: Set output rotation value
Summary:
When we call ecore_drm2_output_rotation_set we need to store that
value in the Output structure so that it can be checked later when
needed.

ref T7690

Depends on D8112

Reviewers: raster, cedric, zmike

Reviewed By: cedric

Subscribers: cedric

Tags: #efl, #do_not_merge

Maniphest Tasks: T7690

Differential Revision: https://phab.enlightenment.org/D8113
2019-03-22 12:41:17 -04:00
Christopher Michael 3315c0dd1c ecore-drm2: Disable hardware rotation for outputs
Summary:
Setting output primary plane rotation is broken at the moment, so this
commit will disable that for now until this can be investigated

ref T7690

Depends on D8111

Reviewers: raster, cedric, zmike

Subscribers: cedric

Tags: #efl, #do_not_merge

Maniphest Tasks: T7690

Differential Revision: https://phab.enlightenment.org/D8112
2019-03-22 12:41:12 -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 c62bac00cb ecore-drm2: Minor formatting fixes.
NB: No functional changes
2019-02-06 10:07:20 -05:00
Christopher Michael 3999a97579 ecore-drm2: Reduce duplicated code
No need for this line to be there twice as it is going to be called in
either case.

NB: No functional changes
2019-02-06 10:03:02 -05:00
Christopher Michael 65bf9c6e0f ecore-drm2: Remove useless if check
_ecore_drm2_use_atomic is already checked just above this, so there is
no need for this if statement
2019-02-06 10:00:51 -05:00
Christopher Michael 9dedaddf2d ecore-drm2: Support multiple gpus during vblank
Summary:
When we try to calculate a drm vblank type, we should take into
account the output's pipe value which is used to determine if we are
using multiple gpus (if so, we need to use the high_crtc_mask.

Reviewers: ManMower

Reviewed By: ManMower

Subscribers: cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7803
2019-01-28 14:45:23 -05:00
Christopher Michael c6ebe8241e ecore-drm2: Fix formatting
NB: No functional changes
2019-01-17 10:58:43 -05: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
Chris Michael ccf064f5ae ecore-drm2: Add API function to retrieve output user data
With the rework of Ecore_Evas drm engine, we need to get the
ecore_evas itself in the pageflip callback so we have to reassign
output->user_data to the ecore_evas which we can then use to retrieve
via this function

This is needed as the pageflip callback will pass us the output on
which the pageflip completed.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-02-27 09:31:33 -05:00
Chris Michael 72b192c012 ecore-drm2: Free stringshare for relative output during output_free
When we destroy a given output, we should be freeing the
eina_stringshare for relative.to

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-02-27 09:22:04 -05:00
Chris Michael fc4f66c6c2 ecore-drm2: Add API to get/set which output is relative to another
In order to know which output we should clone, we need a way to
store/retrieve the output which should be cloned. This patch adds a
small api we can use in randr config dialog to get/set that value.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-02-27 09:16:00 -05:00
Chris Michael 124c7535bb ecore-drm2: Fix typo when comparing output relative mode
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-02-20 09:40:14 -05:00
Chris Michael f877f6c09f ecore-drm2: Account for output relative mode when getting cloned value
As an output may have it's relative mode set to clone from the E randr
dialog, we should account for that also when returning output cloned
mode.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-02-20 08:53:59 -05:00
Chris Michael a78dc2d816 ecore-drm2: Add API functions to get/set output relative mode
These API functions will be used inside Enlightenment in order to
determine the proper extended screen size based on outputs relative
position.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-02-13 11:44:11 -05:00
Chris Michael e93f7bce30 ecore-drm2: Ensure output changed event is sent for removed outputs
If an output gets disconnected, we would still like to be notified of
that. In the _outputs_update function, we mark an output as
disconnected by setting output->connected and output->enabled to
FALSE. With this line in place (in the output_event_send function) we
would never get notified if an output was disconnected.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-02-06 13:01:25 -05:00
Chris Michael 2ac8458238 ecore-drm2: return supported rotations if not using hardware
If we are Not using Atomic/Hardware support for output rotations, we
should return all available rotations as these will still work in
software mode.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-01-09 12:48:25 -05:00
Chris Michael 4aeca75cff ecore-drm2: Fix enabling outputs
Commit 9d583b3fdb broke
ecore_drm2_output_enabled_set function due changing order of setting
output->enabled value. This patch fixes both issues by checking the
'enabled' variable being passed in.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2018-01-09 12:48:07 -05:00
Chris Michael 9021c752cb ecore-drm2: Fix issue of not being able to set output mode
If we pass in screen geometry here when trying to set an output mode,
we can encounter "out of memory" errors from libdrm with outputs
that have a high resolution. As it turns out, we should be passing 0, 0 for
the x/y values when trying to set an output mode.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-11-01 08:52:03 -04:00
Chris Michael bd2588e72f ecore-drm2: Minor formatting fix
NB: No functional changes

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-09-19 11:45:43 -04:00
Derek Foreman 1848f9a8e6 ecore_drm2: Better handling of blank time checks
On some systems we'll successfully complete the vblank ioctl but get
a reply of 0.  When that happens we can't use that time for ticking
as it will break all of the entire world.

Fixes immediate screen blank on rpi3.

@ref T5977
2017-09-05 12:12:30 -05:00
Derek Foreman eec565cc0f ecore_drm2: Add query for pending pageflip
We've been tracking this in ecore_evas, but ecore_evas isn't the only
caller, and it doesn't know about flips initiated by the evas engines.
2017-08-11 17:11:12 -05:00
Derek Foreman 9fd0ed736d ecore_drm2: Remove ecore_drm2_output_resolution_get()
No local callers.  Superseded by ecore_drm2_output_info_get()
2017-08-09 14:56:59 -05:00
Derek Foreman 5ecfe6a8b5 ecore_drm2: Remove ecore_drm2_output_crtc_size_get()
Replaced with ecore_drm2_output_info_get()
2017-08-09 14:56:59 -05:00
Derek Foreman 846db0e0e7 ecore_drm2: Remove ecore_drm2_output_geometry_get()
Replaced with ecore_drm2_output_info_get()
2017-08-09 14:56:59 -05:00
Derek Foreman 1b853dcfad ecore_drm2: Add ecore_drm2_output_info_get
We've got too many ways to query output information, so let's add more.
(this will soon replace all of them)
2017-08-09 14:56:59 -05:00
Derek Foreman 9b9d704292 ecore_drm2: Remove connector bitfield
This is unreliable - there's no reason to expect these connector ids
will be low enough to sensibly store in a bit field.
2017-08-09 14:56:58 -05:00
Derek Foreman 2f9cb33f0b ecore_drm2: remove unused crtc bitfield
We'll need something like this when multi-head works, but it can't
be implemented this way anyway.  There's no guarantee that crtc
ids will be low enough to fit sensibly in a bitfield.
2017-08-09 14:56:58 -05:00
Derek Foreman df658a6d15 ecore_drm2: Remove dead code in blank time get
When I added the fallback block I left an if statement that could
never evaluate to true.  Remove it.
2017-07-31 10:57:56 -05:00
Carsten Haitzler 2c1e2db876 ecore_drm2 - fix startup if edid blob is null.. assume all 0's
this causes a crash when no edid is available. survive and dont crash.
this causes e wayland to not work at all on my baytrail laptop.

@fix
2017-07-30 23:27:56 +09:00
Derek Foreman 0584fc81a2 ecore_drm2: Add a fallback method for vblank waiting
We can't depend on vblank waits being implemented by the driver, but we
can count on page flips functioning, so add a fallback that does a page
flip and waits for it.
2017-07-28 15:35:03 -05:00
Derek Foreman 8e500c6835 ecore_drm2: Allow picking a sequence number for blanktime_get
This lets us do a blocking wait for a vsync.  Something we should try to
do as infrequently as possible, but in some cases we need it one time at
startup to catch graphics driver bugs.
2017-07-28 10:41:11 -05:00
Derek Foreman 20def4da21 ecore_drm2: Add a query for the next vblank time
I guess this is a feature, and we're deep in freeze, but:

a) this is critical for fixing T5462 properly without any side effects.
b) ecore_drm2 is all beta api
c) this should only affect wayland users

ref T5462
2017-07-13 18:07:42 -05:00
Derek Foreman 74290490ad ecore_drm2: Remove obsolete per output fb callback api
It's all beta API so I can throw this away now that there are no in-tree
users anymore.
2017-06-23 08:15:40 -05:00
Mike Blumenkrantz a3d0af0069 ecore-drm2: add ecore_drm2_output_subpixel_get()
@feature
2017-06-16 12:23:08 -04: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 0ecf044080 ecore-drm2: Fix potential SIGFPE when adding output mode
If we receive bad crtc info from libdrm, then we could end up with a
SIGFPE here due to division by zero if info h/v total are not set.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-06-08 10:34:29 -04:00
Chris Michael 96347d1ee2 ecore-drm2: Don't use Atomic functions to set DPMS levels
This was initially an experiment in trying to use Atomic properties to
set dpms on/off, however it does not turn off backlight support when
triggered so it is useless.

Fixes T5462

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-06-06 11:06:34 -04:00
Chris Michael 2f10ce1055 ecore-drm2: Add internal functions to get backlight values
Small patch to add an internal function which can be used to retrieve
backlight values on output creation.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-06-06 10:37:01 -04:00
Derek Foreman e24670b1e2 ecore_drm2: Fix error handling in _output_dpms_atomic_set
This was skipping the error path on failure and setting some state as if
it was successful.  Then the next attempt at a page flip was actually
setting this state.

So _output_dpms_atomic_set (which has always been broken) wasn't actually
the function that successfully disabled dpms.

This is confounding attempts to debug why dpms isn't coming back on
properly.

Now it won't turn *off* either, because it really never should have.

Ref T5462
2017-06-05 16:25:14 -05:00
Derek Foreman 9d583b3fdb ecore_drm2: Fix dpms shutdown while disabling outputs
We need to set output->enabled to disabled *after* dpms takes place or set
it to enabled *before* dpms takes place.  We can't just set it at the
start of the function or one of enable/disable will hit the dpms path
with a disabled display.
2017-06-02 15:50:08 -05:00
Derek Foreman 0df7299526 ecore_drm2: Properly release buffers on output disable
Give back all buffers, and do it through the release mechanism that can
fire a callback into the engine.

Previously we just leaked one and left the rest.
2017-06-02 15:50:08 -05:00
Chris Michael dc3da87139 ecore-drm2: Don't free output plane states if not using atomic
If atomic support is not enabled (kernel or env var), then we will not
be filling output plane_states, so no need to free them (if non-atomic).

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-30 15:57:07 -04:00