Commit Graph

25 Commits

Author SHA1 Message Date
Felipe Magno de Almeida 95c2248065 ecore_drm: Rename EAPI macro to ECORE_DRM_API in Ecore DRM library
Patch from a series of patches to rename EAPI symbols to specific
library DSOs.

EAPI was designed to be able to pass
```__attribute__ ((visibility ("default")))``` for symbols with
GCC, which would mean that even if -fvisibility=hidden was used
when compiling the library, the needed symbols would get exported.

MSVC __almost__ works like GCC (or mingw) in which you can
declare everything as export and it will just work (slower, but
it will work). But there's a caveat: global variables will not
work the same way for MSVC, but works for mingw and GCC.

For global variables (as opposed to functions), MSVC requires
correct DSO visibility for MSVC: instead of declaring a symbol as
export for everything, you need to declare it as import when
importing from another DSO and export when defining it locally.

With current EAPI definitions, we get the following example
working in mingw and MSVC (observe it doesn't define any global
variables as exported symbols).

Example 1:
dll1:
```
EAPI void foo(void);

EAPI void bar()
{
  foo();
}
```
dll2:
```
EAPI void foo()
{
  printf ("foo\n");
}
```

This works fine with API defined as __declspec(dllexport) in both
cases and for gcc defining as
```__atttribute__((visibility("default")))```.

However, the following:
Example 2:

dll1:

```
EAPI extern int foo;
EAPI void foobar(void);

EAPI void bar()
{
  foo = 5;
  foobar();
}
```

dll2:

```
EAPI int foo = 0;
EAPI void foobar()
{
  printf ("foo %d\n", foo);
}
```

This will work on mingw but will not work for MSVC. And that's why
EAPI is the only solution that worked for MSVC.

Co-authored-by: João Paulo Taylor Ienczak Zanette <jpaulotiz@gmail.com>
Co-authored-by: Ricardo Campos <ricardo.campos@expertise.dev>
Co-authored-by: Lucas Cavalcante de Sousa <lucks.sousa@gmail.com>
2020-10-15 15:48:08 -03:00
Elyes HAOUAS 1fd0435f21 Get rid of trailing whitespaces (4 / 14)
Remove trailing whitespaces
Differential Revision: https://phab.enlightenment.org/D12002
2020-06-23 10:29:14 +02:00
Chris Michael 7d450fba64 ecore-drm: Add missing initializer for fb2 command
drm_mode_fb_cmd2 has fields for a modifier to handle tiling,
compression, etc (per plane). Even tho we do not use these, we should
at least initialize them to zero else we end up with uninitialized
bytes in the cmd structure.

==11706== Syscall param ioctl(generic) points to uninitialised byte(s)
==11706==    at 0x57E05D9: ioctl (in /usr/lib/libc-2.20.so)
==11706==    by 0x4D30FA3: drmIoctl (in /usr/lib/libdrm.so.2.4.0)
==11706==    by 0x4CDF66B: _ecore_drm_fb_create2 (ecore_drm_fb.c:63)

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-04-26 11:00:40 -04:00
Chris Michael d4307e3494 ecore-drm: Don't re-include config.h
As ecore_drm_private.h already includes config.h header, we don't need
to include it here in these files also

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-03-09 08:27:05 -05:00
Chris Michael 2dbe2732a2 ecore-drm: Update copyright notice
As portions of this code have been derived from existing code in
Weston, we should also be including their copyright/licence text to
give credit.

NB: Fixes T3286

@fix

Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
2016-03-09 08:22:22 -05:00
Derek Foreman aa584dad19 ecore_drm: Refactor ecore_drm_fb_send into two functions
We'll need to set outputs individually from the page flip handle to handle
page flip problems, so we need the per output setting logic in its own
function.
2016-02-18 15:50:15 -05:00
Derek Foreman 5d7271683b ecore_drm: Change page flipping logic so we can't tear
Summary:
Previously if we ever tried to queue up two page flips in less than a
retrace interval (which can easily happen since the evas clock isn't
based on vblank) we'd give up on ever using page flips again, and tear
on every screen update.

This fixes that by using a vblank callback for custom ticks and using
page flips whenever possible.

If a page flip fails it means a page flip raced with the vblank ticker,
so we need to queue up that frame when the current page flip completes.
This ensures that while we might drop interim frames, we will never
lose the most recent.

Now it should only be possible to tear if two ticks fire during the
wait for a page flip to complete.  This would result in rendering
taking place in the front buffer.  I don't think this can happen,
but an error is logged if it does.

Reviewers: zmike, devilhorns

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3594
2016-02-18 15:50:15 -05:00
Derek Foreman 943f2df006 ecore_drm/ecore_wl2: logging: remove errant usage of %m
Summary:
printf %m stringifies and prints errno.  I've tried to remove its use
anywhere that the immediately preceding function might not set errno
or is a complicated function for which knowing errno doesn't really
give any useful information.

I've left a few of the drmMode calls because they're just wrappers
around ioctl, which legitimately sets errno.

@fix

Reviewers: zmike, devilhorns

Reviewed By: zmike, devilhorns

Subscribers: cedric, jpeg

Differential Revision: https://phab.enlightenment.org/D3572
2016-01-14 13:06:02 -05:00
Stefan Schmidt 8d19716865 ecore_drm: pass NULL to mmap() instead 0 for address
The second find of these. The other one was in evas generic loaders.
mmap() expects a void * as address here. If we want to let the kernel
choose the address we should really pass in NULL instead of the
integer 0.

Thanks goes to the sparse semantic parser for pointing this out.
2015-11-10 16:34:13 +01:00
Chris Michael ae7a243c99 ecore-drm: Fix issue of duplicate page flips
Summary: If we already have a pending pageflip scheduled for a given
framebuffer, don't reschedule another one. This also includes a minor
fix when mmap'ing the framebuffer (previously was also mapped
PROT_READ).

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-05 09:01:36 -05:00
Chris Michael f77ba645d5 ecore-drm: Check return value of drmHandleEvent and cleanup
Summary: drmHandleEvent will return 0 on success, or -1 on error. We
should trap for the error case so that we can cleanup any allocated
callback structures.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-04 12:44:29 -05:00
Chris Michael 49d9b3d303 ecore-drm: Don't always check fb size against dumb buffer
Summary: If we are running using gl_drm, then we don't need to create
software dumb buffers on the drm device. Since we may not have the
dumb buffers (only used in software rendering), then we should not
always be checking the framebuffer size against the dumb buffer size.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-04 09:40:54 -05:00
Chris Michael 027d974004 ecore-drm: Remove erroneous error messages from EINA_SAFETY checks
Summary: As the gl_drm engine code will almost always pass NULL
rectangles, remove the EINA_SAFETY checks so that logs don't fill with
meaningles error messages.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-06-05 10:00:44 -04:00
Chris Michael edf13dca59 ecore-drm: Remove debug output
Summary: This should not have been included in the previous push as it
was just debug noise which was added during testing

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-05-13 14:57:39 -04:00
Chris Michael 443010b465 ecore-drm: Greatly improve drm rendering speed
Summary: This greatly improves rendering speed in evas drm engine.
Previously we would always call drmModeSetCrtc regardless if it was
needed or not. These changes greatly improve rendering speed in drm as
we now only call drmModeSetCrtc if it is needed.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-05-13 14:42:10 -04:00
Mike Blumenkrantz 3d71a10891 ecore-drm: add safety checks to all EAPI functions 2015-04-24 12:53:01 -04:00
Chris Michael 39e380f754 ecore-drm: Change ecore_drm_fb_set warning level
Summary: This is not actually "critical", it just means that we tried
to set a dumb buffer of the wrong size. Ecore_Evas will call this
function again after the canvas has been resized to the proper size,
so just issue a WRN here.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-04-21 13:59:56 -04:00
Chris Michael 50c47e36eb ecore-drm: Add pending_flip field to Ecore_Drm_Fb
Summary: This adds a pending_flip field to Ecore_Drm_Fb structure so
that when we schedule a pageflip event we can wait until the flip is
complete before trying to reuse the buffer again.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-04-16 10:25:46 -04:00
Chris Michael 10985880c2 ecore-drm: Add 2 new API functions for setting and sending framebuffers
Summary: This adds 2 new API functions we can use from within the evas
drm engine to set framebuffers as current, and to call a pageflip on
given buffers.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-04-10 11:09:51 +02:00
Chris Michael a3a6399c3a ecore-drm: Add API function to mark a Framebuffer as dirty
Summary: This adds an API function used to mark a framebuffer as dirty

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-04-10 11:09:49 +02:00
Chris Michael 318f2c435a ecore-drm: Add width & height to Ecore_Drm_Fb structure
Summary: This adds a w & h field to the Ecore_Drm_Fb structure so it
can be used from within the Evas engine

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-04-09 17:40:42 +02:00
Chris Michael 2f62ebb223 ecore-drm: Create all framebuffers using XRGB8888 by default
Summary: By default, we should be creating dumb buffers using XRGB8888
that way it does not matter if we have an alpha channel or not in the
buffer.

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-04-09 17:40:22 +02:00
Srivardhan Hebbar 399c571ab6 ecoreidrm: Cleaned up unwanted code.
Summary: Cleaned up all unwanted code's in ecore_drm. This just
removes a bunch of already commented out code.

@fix

Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>

Reviewers: devilhorns

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D1615
2014-10-30 09:36:21 -04:00
Jeff Grimshaw 9ff9faae70 ecore_drm: fix Doxygen markup to prevent warnings.
Summary:
These files are missing group titles on the @defgroup line.  Added the titles so Doxygen does not
complain.

Test Plan: make doc 2> doc/doxyerr.log

CC: cedric

Differential Revision: https://phab.enlightenment.org/D612

Signed-off-by: Cedric BAIL <cedric.bail@free.fr>
2014-03-15 20:04:24 +09:00
Chris Michael 3762e85c39 ecore-drm: Add Ecore_Drm code
@feature: Add Ecore_Drm library code for setting up drm card, outputs,
virtual terminals, framebuffers, and input for use with ecore_evas drm
code.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2014-03-06 10:57:26 +00:00