Commit Graph

69 Commits

Author SHA1 Message Date
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
Chris Michael ba4042da1e ecore-drm2: Don't fill output atomic states if not using atomic
If atomic support is not enabled (kernel or env var), then we should
not be filling in output atomic state

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-30 11:00:20 -04:00
Chris Michael e0a1e63072 ecore-drm2: Don't call fb_flip until output is enabled
When calling ecore_drm2_output_enabled_set, we cannot initiate a
pageflip until the output has been enabled, so remove call to fb_flip
here. The dpms_set function will handle issueing the pageflip anyway.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-19 11:33:19 -04:00
Chris Michael 851a2c72af ecore-drm2: Cleanup output_enabled_set function code
If we are using atomic, we don't need to set the crtc active values
here as they will be set in output_dpms_set function anyway.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-19 11:32:20 -04:00
Chris Michael 7a3c658759 ecore-drm2: Fix atomic dpms setting (round 2)
As it turns out, we still need to enable/disable the output crtc when
we enable/disable dpms in order for the screen itself to turn off, so
this patch "should" finally fix atomic dpms setting.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-19 11:29:47 -04:00
Chris Michael 76806fda80 ecore-drm2: Update connector state dpms value if setting works
If we successfully set dpms via atomic state, we should also update
the connector state dpms value

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-18 12:22:27 -04:00
Chris Michael 892b58fbf2 ecore-drm2: Fix setting dpms level using atomic state
The property we need to change during an atomic dpms change is
actually from the output connector state (not crtc state). This fix
should make dpms work when using atomic

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-18 12:14:01 -04: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
Chris Michael 2ba64a4c0a ecore-drm2: Free output atomic request on destruction
When we free an output, make sure we cleanup any existing atomic
commit requests

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-05 12:53:20 -05:00
Chris Michael 86bd42884a ecore-drm2: Fill output states regardless if atomic
This commit fills in various output 'state' structures during creation
so that those state structures can be reused for pageflip handling
even if Atomic support is not enabled.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-05 12:53:20 -05:00
Chris Michael eb1ed0fc0a ecore-drm2: Minor formatting fix
NB: No functional changes

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-05 12:53:20 -05:00
Derek Foreman 05e8d76021 ecore_drm2: Fix ticking when atomic mode set is enabled
Putting the PAGE_FLIP_EVENT flag on the set rotation request resulted
in an extra event on the drm device fd that screwed up page flipping
badly from that point on.

@fix
2017-04-21 16:39:19 -05:00
Chris Michael f1525ecf35 ecore-drm2: Cleanup list of output planes on output_destroy
Small patch to make sure we free memory previously allocated for
hardware planes when we destroy an output

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael 980ed70eb9 ecore-drm2: Support multiple planes on a given output
Various hardware can support multiple planes on a given output. As
such, we need to be able to store multiple plane states per-output.
This small patch adds support for that.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael c126ce2e70 ecore-drm2: Add API function to set output rotation
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>
2017-01-18 11:29:14 -05:00
Chris Michael ca194584d5 ecore-drm2: Add API function to return supported rotations of an output
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>
2017-01-18 10:38:01 -05:00
Chris Michael 6b350fc696 ecore-drm2: Add API function to allow setting gamma of a given output
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>
2016-11-29 09:15:07 -05:00
Chris Michael e0b61a35c5 ecore-drm2: Add API function to return screen dpi
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>
2016-11-28 10:09:41 -05:00
Derek Foreman 168a127c8c ecore_drm2: Make sure something's on screen after dpms wake
Flip to the previous buffer on dpms wake to make sure we show something
2016-11-16 15:05:40 -06:00
Chris Michael 8421a37313 ecore-drm2: Make calls to symlink'd libdrm functions
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>
2016-11-15 08:42:07 -05:00
Chris Michael aba152a8be ecore-drm2: Free Output modes on destroy
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>
2016-10-11 11:30:49 -04:00
Chris Michael fb112b8fab ecore-drm2: Use Atomic Modesetting for resolution changes
Since we have atomic properties now, we can use those to set given
Output modes (resolutions).

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-10-11 11:30:49 -04:00
Chris Michael bcf311ae3c ecore-drm2: Use Atomic State to enable/disable an output
If Atomic Modesetting is supported, we can use that to enable/disable
a given output.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-23 08:53:32 -04:00
Chris Michael bfff91bac5 ecore-drm2: Add code to support setting DPMS levels via Atomic
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-22 14:20:24 -04:00
Chris Michael a262629282 ecore-drm2: Add code to use Atomic for Edid if available
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-22 14:20:24 -04:00
Chris Michael 2bda227304 ecore-drm2: Add code to setup Plane Atomic state for Outputs
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-22 14:20:24 -04:00
Chris Michael a76eae227a ecore-drm2: Add code to setup Connector Atomic state for Outputs
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-22 14:20:24 -04:00
Chris Michael 3ca7e72bce ecore-drm2: Add code to setup Crtc Atomic state for Outputs
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-22 14:20:24 -04:00
Chris Michael 50aa37790f ecore-drm2: Add missing EINA_SAFETY checks for public facing API
functions

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-09 15:05:00 -04:00
Derek Foreman 30d14779a6 ecore_drm2: Add release handlers for buffers
Allow the engine to register a callback for buffer release.  This lets us
do appropriate buffer bookkeeping (for example, gbm locking) in the
engine.
2016-09-09 13:39:05 -05:00
Derek Foreman 255b990055 ecore_drm2: Remove get/set for next fb
We no longer needs these at all.
2016-09-08 13:55:25 -05:00
Derek Foreman cc29a25c47 ecore_drm2: simplify API to get latest FB
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.
2016-09-08 13:55:25 -05:00
Derek Foreman 3d39c1e9b8 ecore_drm2: Add a function to set the pageflip callback data once
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.
2016-09-08 13:55:23 -05:00
Derek Foreman 871a9cff03 ecore_drm2: Fix a condition where no outputs are enabled
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.
2016-08-02 13:29:09 -05:00
Derek Foreman f975cdf513 ecore-drm2: Silence compiler warning
We probably can't actually use this variable uninitialized, but
let's init it anyway to keep gcc happy.
2016-07-27 15:23:12 -05:00
Chris Michael 4431ff01ff ecore-drm2: Fix issue of VT-Switching going blank on returns
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>
2016-07-27 15:35:42 -04:00
Derek Foreman 55c59d3c40 ecore_drm2: Allow enabling outputs in drm events
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.
2016-07-15 12:15:09 -05:00