Commit Graph

290 Commits

Author SHA1 Message Date
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 6482367aa2 ecore_drm2: Perform test flip during plane assignment
Make sure we can commit that plane at assign time so when we hook up to
the scene graph it knows when it can safely use a plane.
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 ba2275b7ec ecore_drm2: Add ecore_drm2_plane_release to release planes
Opposite of plane assign.
2017-05-05 12:53:22 -05:00
Derek Foreman 014e84d8fa ecore_drm2: Store output in plane structure
This will simplify a bunch of API that would otherwise have to pass in
both output and plane - and in some cases we might not have the output
handy anyway.
2017-05-05 12:53:21 -05:00
Derek Foreman aae1c50dd3 ecore_drm2: Remove next, current, pending from plane state
These will be output state eventually
2017-05-05 12:53:21 -05:00
Derek Foreman 308a11cfd6 ecore_drm2: Assign planes in ecore_drm2_plane_assign
Don't just test, allocate the resource, and then prevent further
assignments from trying to use it as well.
2017-05-05 12:53:21 -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
Derek Foreman eb305727d0 ecore_drm2: Remove extra #ifdef
It's the same as the previous one, so combine them.
2017-05-05 12:53:21 -05:00
Derek Foreman 63bc30dd5b ecore_drm2: Fix typo in error message
Stop printing "commit test failed" from non-test commits.
2017-05-05 12:53:21 -05:00
Derek Foreman 950df19c67 ecore_drm2: Add an env var to disable atomic pageflips
Allows testing non-atomic paths without a reboot or a rebuild.
2017-05-05 12:53:21 -05:00
Chris Michael 0595e70b22 ecore-drm2: Do atomic commits per-output
In cases where output monitors have different frequencies, we need to
be doing atomic commits on a per-output basis. This patch modifies the
ecore_drm2_fb_flip function to support doing atomic commits per output.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-05 12:53:21 -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 03cb02fa74 ecore-drm2: Remove newly added atomic API functions
As we need to do atomic commits on a per-output basis, these 2 newly
added API functions can go because these functions did one atomic
commit for all outputs

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-05 12:53:20 -05:00
Chris Michael e5de325e90 ecore-drm2: Remove #ifdef for HAVE_ATOMIC in plane_assign function
As there is nothing inside this function which requires any Atomic API
calls, this #ifdef can be removed and the function can then still be
used to assign Primary planes for non-atomic use cases.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-05 12:53:20 -05:00
Chris Michael b9f4641762 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
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 f07f2e6e4e ecore-drm2: Enable filling state structures without atomic support
This commit enables the ability to fill our state structures even if
atomic support is not enabled. This will allow us to reuse those state
structures for dealing with pageflip in both the atomic & non-atomic
use cases.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-05-05 12:53:20 -05:00
Chris Michael e1b26f6320 ecore-drm2: Enable reuse of existing state structures for non-atomic
As there is nothing 'atomic' specific in these structures, we can move
them outside the atomic ifdef and make use of them for handling
pageflip for both atomic and non-atomic use cases.

@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 c4b22eb59c ecore-drm2: Iterate plane formats properly
This patch addresses an issue where plane formats were not being
properly copied into our Plane State structure and causing any usage
of our atomic code paths to crash and burn

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-19 14:58:11 -04:00
Chris Michael e2a6ee29f0 ecore-drm2: Add fields to plane structure for current, next, pending
FBOs

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael d3d9ab2296 ecore-drm2: Free any previous atomic request
If we fail the atomic request merge, cleanup any previous request and
just use the new one.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael 345fefd3ef ecore-drm2: Add API functions for atomic commit test and commit
This patch adds 2 new API functions, one which we can use to test atomic
commits before actually applying them, and another which does the
actual Atomic commit.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael 9d5c76e0d5 ecore-drm2: Add library symlink to merge atomic commit requests
Small commit to symlink to drmModeAtomicMerge function so we can use
that for atomic commit tests.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael 9e07d37320 ecore-drm2: Add API function to set plane destination
When we do an atomic commit, we need to know where to place a given
plane (in the case of overlays) in relation to the CRTC, so provide an
API function that can be used for that purpose.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael 44d5c855e0 ecore-drm2: Store plane src values on assign
As we will need the plane state source values when we do an atomic
commit, we can store them when plane_assign is called as we already
have the FBO available.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael 19da4706f3 ecore-drm2: Add hardware plane functions
This patch adds a new file where we can store any additional functions
we may need to work with hardware planes. Currently the file contains
a public function that can be used to assign a given Ecore_Drm2_Fb to
a hardware plane

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04: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 9dbf54e2f6 ecore-drm2: Move defines for CAP_CURSOR sizes to private header
As we may need these defines in other files, move them to the private
header so there is access to them.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael 205c829a11 ecore-drm2: Store cursor size on device
As we will need these values later to determine if an FBO can go onto
the cursor plane, we should store this in the device structure to
avoid having to refetch them later.

@fix

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 4f8f41299f ecore-drm2: Add support for plane formats
Small patch to store supported formats on a given plane state. This
will be used for assigning dmabuf clients to a hardware plane based on
size and supported format.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael 0a647f9fce ecore-drm2: Remove old atomic flipping code
As we are refactoring the usage of hardware planes and atomic commits,
we need to remove the old usage of atomic flipping for ecore_drm2_fb
because atomic flipping will be handled differently.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael 43104a7268 ecore-drm2: Add opaque structure to represent a hardware plane
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-04-18 07:55:10 -04:00
Chris Michael 554883c048 ecore-drm2: Disable driver whitelist tests
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>
2017-04-18 07:55:10 -04:00
Derek Foreman 61f40d58f7 ecore_drm2: Add ecore_drm2_fb_dmabuf_import
Imports a set of dmabuf buffers as a single Ecore_Drm2_Fb
2017-04-18 07:55:10 -04:00
Derek Foreman f0fc86516d ecore_drm2: store 4 handles, strides, and planes
We're going to support multi-planar formats soon.

It'll be great, you'll love it.
2017-04-18 07:55:10 -04:00
Derek Foreman 45e173d186 ecore_drm2: Use library function instead of ioctl for addfb2
Minor clean up.
2017-04-18 07:55:10 -04:00
Derek Foreman e5dd8327ba ecore_drm2: Use correct drm context version
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.
2017-04-07 09:09:56 -05:00
Chris Michael 1a3bae8133 ecore-drm2: Remove unused field in Output structure
The 'planes' field in Ecore_Drm2_Output structure is unused and can
thus be removed here.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-03-24 08:54:52 -04:00
Derek Foreman ae5d002466 ecore_drm2: ERR once when page flip fails with EBUSY
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.
2017-02-15 09:53:43 -06:00
Chris Michael 0001240120 ecore-drm2: Fix debug messages to use proper type
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>
2017-02-13 09:45:20 -05: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 f32268ad1b ecore-drm2: Expose Ecore_Drm2_Rotation enum
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>
2017-01-18 10:06:20 -05:00
Chris Michael 7c829d1669 ecore-drm2: Minor formatting fix
NB: No functional changes, just formatting

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-01-18 10:05:13 -05:00
Chris Michael 639ad420aa ecore-drm2: Add API to determine if a device prefers shadow buffers
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>
2017-01-18 09:48:01 -05:00
Carsten Haitzler 46a1bc2d22 ecore_drm2 - work with broken kernels that EBUSY on drm page flip
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
2017-01-07 13:23:02 +09:00
Derek Foreman 515362efe2 ecore_drm2: Make ecore_drm2_fb_release return status
We need to use this to free up gbm buffers on a surface release, so it
has to report when it successfully frees a buffer.
2016-12-07 11:30:03 -06: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 4b4201584f ecore-drm2: Add symlink to gamma setting function
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-11-29 09:14:31 -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 aa3479570d ecore_drm2: Add a panic mode to drm2_fb_release
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.
2016-11-18 09:41:52 -06: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 cd0c1d9857 ecore-drm2: Symlink to drmModePageFlip function
Somehow this got missed in initial commit, so fix to symlink to
drmModePageFlip function.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-11-15 11:44:12 -05:00
Chris Michael f5a5a9df44 ecore-drm2: Remove unused structure
As we don't ever use drmVersionBroken structure in this code, remove it

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-11-15 09:14:50 -05:00
Chris Michael 491c059620 ecore-drm2: Add copyright information from included headers
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>
2016-11-15 09:12:53 -05:00
Chris Michael fbc58c3424 ecore-drm2: Add API function for drmHandleEvent
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>
2016-11-15 08:42:07 -05: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 0a2c06fc58 ecore-drm2: Symlink to libdrm functions during init time
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-11-15 08:42:07 -05:00
Chris Michael b820ad3676 ecore-drm2: Add structure definitions and function symlinks for libdrm
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>
2016-11-15 08:42:07 -05:00
Derek Foreman 8368f6e1d2 ecore_drm2: Follow direct crtc sets with a page flip
Now that the bugs generating extra ticks are fixed, we need to make sure
we can actually generate one here.
2016-11-14 16:39:03 -06: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 1abed3dcaf ecore-drm2: Remove useless if check for atomic_modeset flag
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>
2016-09-23 08:51:35 -04:00
Derek Foreman af82abb57a drm: Fix typoe
DRM_MODE_ATOMIC_ALLOW_MODSET should have been _MODESET
2016-09-22 14:52:14 -05:00
Derek Foreman de5305e224 ecore-drm2: Merge initial modesetting with atomic flip code 2016-09-22 14:24:56 -04:00
Chris Michael 84cb88fe8c ecore-drm2: Use just DRM_MODE_ATOMIC_ALLOW_MODESET for initial setting
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>
2016-09-22 14:20:24 -04:00
Chris Michael 3c243c3ebb ecore-drm2: Add support for Atomic Pageflips
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>
2016-09-22 14:20:24 -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 ecc000d84c ecore-drm2: Add code to free Atomic state on shutdown
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-22 14:20:24 -04:00
Chris Michael f8e28f37dc ecore-drm2: Add code to fill Plane Atomic state
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-22 14:20:24 -04:00
Chris Michael 91739d10b0 ecore-drm2: Add code to fill Connector Atomic state
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-22 14:20:24 -04:00
Chris Michael 7041202a0a ecore-drm2: Add code to fill Atomic Crtc State
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>
2016-09-22 14:20:24 -04:00
Chris Michael 541be05bf2 ecore-drm2: Add code to check if Atomic Modesettting is usable
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>
2016-09-22 14:20:24 -04:00
Chris Michael 7770bc17bb ecore-drm2: Add private structures to support Atomic Modesetting
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2016-09-22 14:20:24 -04:00
Chris Michael 45ce4c8008 ecore-drm2: Rename output_fb_release to just fb_release
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>
2016-09-09 15:10:47 -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 21ad56aa32 ecore_drm2: Add ecore_drm2_output_fb_release way to force buffer release
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.
2016-09-09 13:39:05 -05: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 0722eae960 ecore_drm2: Store gbm_bo for Fbs and add a getter function for it
This will aid with proper locking in gl_drm later
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 b4cbf860b9 ecore_drm2: Add a page flip completion call
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
2016-09-08 13:55:24 -05:00
Derek Foreman 33043ff1eb ecore_drm2: distinguish real flip failure from flip deferral
If we try to flip too soon we get EBUSY and should queue up the buffer
for later presentation.  Only the other errors need to be dealt with
elsewhere.
2016-09-08 13:55:24 -05:00
Derek Foreman 3be2630a30 ecore_drm2: make flip to NULL buffer mean something
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.
2016-09-08 13:55:24 -05:00
Derek Foreman ce7991b993 ecore_drm2: Implicitly set buffer busy status when flipping
This simplifies other code that shouldn't need to deal with this.
2016-09-08 13:55:23 -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 d8c9f8ef17 ecore_drm2: Add busy status to ecore_drm2_fb
We've been tracking this in the outbuf code, but that logic is going to
be moved into ecore_evas_drm to use the new ticking paradigm.
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
Chris Michael 1bbc23b086 ecore-drm2: Add API for vt-switching
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>
2016-07-27 13:28:10 -04:00
Jean-Philippe Andre a9d4d7e836 drm2: Fix shadow variable
int ret is not even needed here.
2016-07-19 17:55:07 +09: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
Derek Foreman f8e07c4d7c ecore_drm2: Try to mmap gbm buffers
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.
2016-07-14 16:25:05 -05:00
Chris Michael 5a482e9af4 ecore-drm2: Perform input device calibration based on output name
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>
2016-07-08 08:05:20 -04:00
Jean-Philippe Andre 570a398e29 ecore_drm2: Fix mouse pointer when using absolute coords
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.
2016-07-07 16:15:59 +09:00
Chris Michael 7b0a1933a0 ecore-drm2: Don't leak return from _output_name_get function
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>
2016-06-30 11:11:22 -04:00
Derek Foreman 761b89b741 ecore_drm: Don't pass uninit garbage to drm ioctls
Hasn't actually caused us any problems so far, but valgrind
whines about it, so fixing anyway.
2016-06-28 15:57:41 -05:00
Chris Michael 51b589da6a ecore-drm2: Fix redrawing screen when we vt-switch back to a session
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>
2016-06-21 12:55:17 -04:00
Chris Michael 09805d2b15 ecore-drm2: Add API functions to support cacheing of context & keymap
@feature

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael 0416aa6bf3 ecore-drm2: Add API function to calibrate input devices
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>
2016-05-27 11:57:53 -04:00
Mike Blumenkrantz da8bcbc7c6 ecore-drm2: update to latest elput 2016-05-27 11:57:53 -04:00
Mike Blumenkrantz c1253164b2 ecore-drm2: perform logind connection after finding device path in ecore_drm2_device_find 2016-05-27 11:57:53 -04:00
Chris Michael 7b5af2f0df ecore-drm2: Add API function to set left-handed mouse mode
This commit adds an API function used to set a mouse to be left-handed

@feature

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael 8b3e05a7f1 ecore-drm2: Check return of elput_manager_open
We should check to make sure that opening the device has succeeded
before trying to continue

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael 92553e167e ecore-drm2: Initialize elput input when device gets opened
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael 6697584fb9 ecore-drm2: Fix potential invalid access to output current_mode
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael e934f546ad ecore-drm2: Add API function to get screen size range
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael f3b7672551 ecore-drm2: Add API function to return available crtcs
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael 0c0dd22b5f ecore-drm2: Add API function to get possible crtc of a given output
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael 253f88b3ec ecore-drm2: Add API to return current fb used on a given output
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael d08d7e18e3 ecore-drm2: Add API to return current resolution of a given output
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael 1eb85aab57 ecore-drm2: Add API function to return connector type of an output
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael bd2ab7de96 ecore-drm2: Add API function to get cloned & connected properties of an output
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael bdddc912d7 ecore-drm2: Add API functions to get name & model of an output
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael a6b018a2a8 ecore-drm2: Add API function to set the mode of an output
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael 55f228a238 ecore-drm2: Add API function to return information about a given output mode
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael ed58056e06 ecore-drm2: Add API function to return list of output modes for a given output
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael ad58670c56 ecore-drm2: Add API function to return physical size of a given output
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael b634f9485a ecore-drm2: Add API functions to get/set if an output is enabled
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael 758ce91719 ecore-drm2: Add API functions to get/set if an output is primary
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael 13337c2583 ecore-drm2: Add API functions needed to port Ecore_Evas drm
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>
2016-05-27 11:57:53 -04:00
Chris Michael 3c332e1f88 ecore-drm2: Add drm2 event for session activation
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>
2016-05-27 11:57:53 -04:00
Chris Michael 296d233f64 ecore-drm2: Add API functions to get and set pointer position
Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael d2b4176592 ecore-drm2: Add API functions to work with framebuffer objects
This patch adds support for creating, deleting, and manipulating
framebuffer objects via exposed API.

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-05-27 11:57:53 -04:00
Chris Michael 4e38aabdc0 ecore-drm2: Add API functions to work with outputs
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>
2016-05-27 11:57:53 -04:00
Chris Michael 9c7b657287 ecore-drm2: Add API functions to work with a drm device
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>
2016-05-27 11:57:53 -04:00
Chris Michael a0d3b955bf ecore-drm2: Add start of Ecore_Drm2 library
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>
2016-05-27 11:57:53 -04:00