Commit Graph

243 Commits

Author SHA1 Message Date
Derek Foreman 54fede47a9 ecore_drm2: simplify device selection code
The platform check was added for systems (like ARM) that don't generally
have PCI graphics devices.  However, now we pick a fallback device that
doesn't have a PCI constraint, so the platform check should no longer be
necessary.
2018-01-10 12:54:42 -06:00
Derek Foreman 324c917a20 ecore_drm2: Allow non-pci DRM devices to be selected
Summary: This is a tweak to c264ef264f for D5712 . chosen_dev in the loop was only being set for DRM devices attached to PCI devices. While this is useful for determining if the device is the preferred boot_vga device, There is no apparent requirement (comparing to Weston) for all DRM devices to be attached to a PCI device. (This is considering USB DisplayLink devices. I am not sure how the parent device tree is with these...)

Reviewers: devilhorns, ManMower

Reviewed By: devilhorns, ManMower

Subscribers: cedric, jpeg, #efl

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D5727
2018-01-10 12:23:34 -06: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
Derek Foreman 0d845ce3aa ecore_drm2: Remove pointless goto
This "out" label probably used to be the target of multiple gotos,
but now it's just being used to jump over a single line of code.
2018-01-05 12:28:36 -06:00
Derek Foreman c264ef264f ecore_drm2: Don't fail if there's no boot_vga device
In a multi-seat configuration it's quite likely that only one
seat will have a boot_vga device.

While we should use the boot_vga device if possible, we shouldn't
fail just because a seat's gpu isn't the boot_vga device.  Fallback
to the last viable drm device we saw.

Reported-by: n3rdopolis
ref D5712
ref T6455
2018-01-05 11:51:22 -06:00
Vincent Torri 4ae6eeb2cf efl: remove _MSC_VER (Visual Studio macro) usage in source code 2018-01-04 12:59:47 -08: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
Chris Michael 474da25165 ecore-drm2: Add API to allow setting pointer acceleration profile
Small patch to allow setting pointer acceleration profile (for
wayland) from within Enlightenment.

ref T4736

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-08-24 11:42:57 -04:00
Chris Michael b43f6c14dd ecore-drm2: Add API function to allow setting pointer acceleration speed
Small patch to add a new API function which can be called from
Enlightenment in order to allow setting pointer acceleration speed.

ref T4736

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-08-24 11:32:51 -04: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 70c1ce3be3 ecore_drm2: Remove useless safety checks
Now that the device is opened and found in one operation it's impossible
to have fd == -1, so we can stop testing for it.
2017-08-09 14:56:59 -05:00
Derek Foreman afd65a8a99 ecore_drm2: Merge ecore_drm2_device_free and _close
There's no reason to have them be separate, all callers must do them
back to back, so let's just combine them.
2017-08-09 14:56:58 -05:00
Derek Foreman d8a9b895bb ecore_drm2: Merge ecore_drm2_device_find and ecore_drm2_device_open
There's never a reason to find a device and not open it, so all callers
end up calling these two functions back to back.
2017-08-09 14:56:58 -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 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 bc5ebd0a20 ecore_drm2: Fix linker problems
Accidentally used functions in the library directly instead of through
the sym_* dlsym looked-up variants.

Why this only caused problems in some installations may still be worth
investigating - we may be pulling in libdrm at link time from some
other library?
2017-08-04 12:13:40 -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 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 414d406b3b ecore_drm2: Ensure device we find can mode set
Some systems have dri devices that can't mode set, and if they're first in
the directory they'll get picked by our code and things fall apart later.

So, open the potential device and ensure it has basic functionality before
selecting it.

This is a little inefficient as it gets the device via elput twice before
it can be used - this will be addressed later as the changes are a little
more invasive to optimize.
2017-07-21 16:46:00 -05:00
Derek Foreman 57e826db69 ecore_drm2: Open elput manager before drm device
We're going to need to access the device as part of the find process,
so we need a manager.
2017-07-21 16:46:00 -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 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 5f2d4e75ab ecore_drm2: Add callbacks for plane assign/release
E will need these to gate wayland buffer releases.
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 a8c7b89cb7 ecore_drm2: Move fb from plane state struct to plane struct
The plane state struct needs the fb id for drm updates, and the plane
state can be updated even if it's pointed to by a dead plane.

Dead planes need to keep their fb so we can properly handle the fb
lifetime.
2017-06-23 08:15:41 -05:00
Derek Foreman be90b91ac1 ecore_drm2: Don't clear plane fb on release
We'll need this later for post-page flip bookkeeping, and nothing will
notice that it's not cleared now anyway.
2017-06-23 08:15:41 -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
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
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 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
Chris Michael 6e37d13a1c ecore-drm2: Use static libdrm to build ecore-drm2
As we will now use static_libs/libdrm to build ecore_drm2, we no
longer need to include the copied code from the libdrm headers so
remove all of the copied code from our source files.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-06-09 13:48:55 -04:00
Chris Michael 05f770a1ab ecore-drm2: Group API functions within their doxy group
NB: No functional changes

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2017-06-09 12:29:25 -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