Masking is not used (there even was a recent commit by Hermet to
remove most of the occurences of mask shaders in GL), and I've
introduced a new ETC1+Alpha feature. Replace the old texm and
associated variables by texa for alpha texures.
Software Generic backend can send us OUTBUF_DEPTH_INHERIT during a
reconfigure. If we are inheriting the previous depth, let's check that
so we don't get needless destrouction/recreation of shm buffers.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Seems the new software_generic backend is passing in
OUTBUF_DEPTH_INHERIT during a reconfigure, so let's add a check for
that else if not, the entire drm engine stops rendering due to output
buffers not being created to match the framebuffer depth.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Adjust the ob->w/h dimensions After the framebuffer has been setup
because we cannot have output buffers smaller than the framebuffer
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
We cannot use epd->output.w/h in these calls as the setup of the
output buffer May cause a resize. Drm buffers cannot be allocated
Smaller than the framebuffer size, so evas_drm_outbuf_setup function
May resize the ob->w/h to match the framebuffer.
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Eeeeh. Not only we don't support atlasses with this RGB+A thing
yet, but ETC1 does not even support SubImage2D (according to the
current spec).
Also, fix a few typos in that same function.
Some colorspaces (ETC, S3TC, GRY, ...) don't care about the value
of BGRA support or the alpha flag. So, let's introduce the
new boolean^Wenum value MATCH_ANY ;)
Note: the compressed texture formats with alpha support have been
marked as matching both TRUE and FALSE for alpha. The images
should always have the alpha flag set to TRUE, though.
The BGRA flag really doesn't matter.
The TGV loader is an Evas_Loader, not part of evas itself
(eg. in cserve), so we can't use evas functions from there.
eina_cpu provides appropriate CPU features detection.
Save images with alpha in two planes:
- RGB data as ETC1
- Alpha as ETC1 (from a greyscale image)
The second plane alpha is located right after the RGB plane.
The RGBA data is not premultiplied, so that RGB can be encoded
at a better quality in ETC1. This should avoid some blockiness
artifacts that we can see in the current ETC2 mode (which supports
alpha natively). Eventually ETC2 should also support non
premultiplied data for a better encoding quality.
This patch implements the saver and the loader.
@feature
These shaders take two textures as input and sample RGB from
texture 1 and alpha from texture 2. This is the non-premultiplied
version, so RGB' = RGB*A.
This includes only the GLSL code.
We need to check if evas_outbuf_setup Failed and did not return a new
ob for us to work with...so this if check was invalid
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
We need to have the drm fd & tty setup Prior to creating the output
buffer so that the output buffer knows what drm card to use
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This reverts commit 31ad73efa9.
Conflicts:
src/modules/evas/engines/drm/evas_engine.c
Revert this commit as these functions are needed to run evas engine
standalone (expedite) on drm
I saw some GL error messages (with the GLERR() macro activated),
that were caused by GL_INVALID_VALUE.
For some (many) textures, tex->y was 0 but since we now use a 2D
atlas (rectangle allocator), the first row of pixels should be
repeated. This caused uploads to Y = tex->y - 1 = -1, which is
invalid.
Now, the evas loader is supposed to advertise the actual border
size in case of compressed texture formats.
The only case where the border was non zero was ETC formats,
from the TGV loader, so I think we don't need to keep the
previous behaviour (auto-calculate borders for ETC).
We use this functionality already from ecore_drm. The evas version does
not even use udev to acquire the device which means we could not support
hotplugging. The only missing feature was the capability check for
DUMB_BUFFER which I added to ecore_drm now.
Summary:
90 or 270 degree rotation is not working properly
width should be regarded as height, and vice versa.
if this patch and D1082 were commited, rotation from metadata will be working properly by using evas_object_image_load_orientation_set()
@fix
Test Plan: add image object and invoke evas_object_image_load_orientation_set() -> load file with orientation metadata -> check whether image is rotated properly or not
Reviewers: raster, cedric, jpeg
CC: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D1084
Signed-off-by: Cedric Bail <cedric.bail@free.fr>
To avoid texture bleeding in the texture atlas,
we adjust texture uv point as much as a half uv point.
Especially, this improves the rendering quality when the image has the border
area.
Unless apply this patch,
You might find the rendering result is different with software backened,
if the image has the borders.
In the software backened,
the border line was clear but the gl wasn't.
because the border line was interpolated so the rendering result was not the one we expected.
@fix
In case of png, grayscale with transparency format (transparency doesn't mean the png has alpha channel)
gl doesn't prepare that format render.
In this case, set it argb8888 to convert the data in the png loader.
@fix
Summary:
This patch introduce various new logic for packing/unpacking of Eina Rectangle in a pool.
It is then used by Evas GL backend texture allocation to improve how efficiently we pack
image in texture atlas. This lead to improved memory usage and reduced power consumption
with usually a more stable higher FPS (as it use less texture to do the same task, their
is less texture switch, so saving memory and speed at the same time).
This patch was developped on Cedric's suggestions to optimize the packing logic using Skyline
algorithm. This patch is based on master and is a new submission for earlier phab link
https://phab.enlightenment.org/D774.
Signed-off-by: Sanjay Nirankari <sanjay.n1@samsung.com>
Signed-off-by: Rajeev Ranjan <rajeev.r@samsung.com>
Signed-off-by: Sreedeep Moulik <sreedeep.m@samsung.com>
Reviewers: cedric, raster
CC: wonsik, jpeg, sreedeep.m, sanjay, govi
Differential Revision: https://phab.enlightenment.org/D1063
Signed-off-by: Cedric BAIL <c.bail@partner.samsung.com>
ETC2 textures were allocated using the same empty slots pool
as RGBA textures.
ETC1 texture atlasses should still be tested.
An extension string is required to avoid using the bad
fallback in place right now. But there is no such thing yet.
this fixes @draisch's report of blankness, but doesn't fix the
garbage. it's something to do with the always render move in elm gl -
it just doesn't seem to be rendering before evas renders, or if it is,
it's failing to work/produce content.
ecore_evas_convert: Add -e/--encoding option
This uses directly the encoding parameter.
For now, used only by the TGV saver, but there is no other way
to specify between ETC1 and ETC2. And we don't have a mixed ETC1+2
mode (yet).
@feature
We prefer ETC2 textures when ETC2 support has been detected.
According to the spec, glCompressedTexSubImage2D should work
for ETC2.
Try even with ETC1. This may fail at runtime. The fallback path
is very dubious right now but without a proper test case I'm
not sure which approach to take.
We can also imagine cases where the GPU supports TexSubImage for
ETC1 but ETC2 is not supported at all. This will need testing, as
this case is not handled.
@feature
Summary:
For drivers that support IMG_multisampled_render_to_texture,
GL_MAX_SAMPLES_IMG should be used to query max supported samples
Likewise, for drivers that support EXT_multisampled_render_to_texture,
GL_MAX_SAMPLES_EXT should be used to query max supported samples
@fix
Reviewers: seoz, Hermet, raster, cedric
Reviewed By: cedric
CC: cedric
Differential Revision: https://phab.enlightenment.org/D948
This will call the new ETC2 encoding functions.
Note that the quality and performance will be horrible, but at
least alpha should be supported.
Also, there is no way to choose between ETC1 and ETC2 from
the client API side, which, well, sucks. So ETC2 is selected
if and only if the image has alpha (according to its flag).
@feature: Encode images in ETC2 with support for Alpha (if needed).
Summary: re->win pointer was not compared with NULL pointer before re->win was referenced.
Reviewers: Hermet
Reviewed By: Hermet
CC: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D910
Summary: The comparison gc->dc with NULL is not necessary. So the unnecessary conditional expression is removed.
Reviewers: Hermet
CC: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D909
@bugfix: When creating a temporary file for the buffer's mmaped data,
we need to make sure there is an appending '/' in the name else
mkstemp will fail due to improperly formatted filename.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
buffer file.
@bugfix: When we create the mmap'd file for shm buffer access, try
using the XDG_RUNTIME_DIR first as the place to create the file. If
that does not exist in the environment, Then fallback to using /tmp
directory.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
CID 1210818
It would be a better and more working fix to use Evas_GL_Image, sadly
no time to do it right now and may be to intrusive for an alpha release.
ETC1/2 textures are (for now) allocated one by one for each image,
because we use only glCompressedTexImage (not SubImage). So,
the texture height must fit that of its content.
This commit bypasses the usual pool allocation logic where textures
are rounded up to the next multiple of 16 pixels in height, in
case of ETC1/2.
There is an ifdef HAVE_ETC2_DECODER to disable unimplemented code.
Since these ETC2 decoding function are not implemented yet,
they should be disabled at compile time.
Yes, this means Evas will not be able to load those images in case
of SW engine or GL engine w/o ETC2 support.
@feature
Enable 3D features using --enable-evas-3d=yes when configuring.
APIs are exposed through Evas_3D.h.
Currently, evas-3d is being supported only on gl_x11 engine.
Conflicts:
src/lib/evas/Evas_Eo.h
Gif decoder decodes prior frames sequentially to decode a specific frame.
The last frame of sequential decoding, which is the frame we want to decode,
remains un-decoded until the while loop stops.
The frame count should be incremented after the comparison statement.
Due to some invalid geometry considerations, there was a
1 pixel distortion in images, varying with the lz4 compressed
macro-block size.
Anyhow, I couldn't wrap my head around Cedric's code. So I rewrote
the whole thing instead, fixed it and improved the block size
selection (based on the image size, to optimize lz4 compression).
Since rg_etc1 now outputs proper BGRA data, the shaders should not
swizzle the colors around. Stick to the normal fragment shaders.
Note: This is not tested.
Since the introduction of new colorspaces for GL_X11
(GRY8, AGRY88 and ETC1), stride_get() would return
an invalid value and data_get() would just abort().
Add proper support for these functions.
ETC1 data will NOT be returned from data_get() and
stride_get() will return 0. This is to avoid people from
messing up badly with encoded color spaces.
Since the introduction of color spaces other than RGBA8888 in
the GL engines, there was an issue with border images scaled in
GL. The left and right edges were simply not properly copied.
This would then show artifacts when scaling very thin images
(typically 2px wide).
The default quality is 80 and high quality is horribly slow,
so default to medium quality instead (it's already very slow).
If you really want to shoot yourself in the foot and use high
quality, just set quality > 95 and go make some coffee.
Also, disable dithering, it creates horrible artifacts on real
life pictures (gradients and flat surfaces especially).
LZ4HC has a higher compression ratio than LZ4 but basically the
same decompression speed.
The performance cost during encoding is actually still pretty low
considering how expensive ETC1 compression can be (even at medium
quality).
this fixes the png loader code to use png_read_row properly with the
number of passes needed to load aninterlaced image as well as handling
this right with scale ratio scaledown set.
Async page flip can cause tearing, is not supported on all cards, and
apparently requires a specific libdrm patchlevel...in general, more
trouble than it's worth, so let's just remove it.
@bugfix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This symbol should be part of the loaded libraries, can be found
using dlsym, even if eglGetProcAddress() returns NULL.
Add etc1 flag in the debug output.
With OpenGL, the border of a texture are not "well" defined. So interpolation at
the border can result in weird/bad looking texture border. To avoid that we do
duplicate the border in all direction at the time of the texture upload. But with
ETC1 it is not possible as the border are grouped with 15 others pixels. It needs
to be done at saving time. So internally we do have an image that would be of
size width + 2 pixels and height + 2 pixels.
If region is specified we will not allow ETC1 colorspace as it would
basically break at the frontier as we would be unable to generate a
duplicate of the border as GPU require if you want nice and correct
rendering. So no region and ETC1 output at the same time.
The TGV file format is specifically created for Evas. It is designed to allow
region decompression and parallele decompression with a fast path for GPU that
do handle ETC1 compression. Plan for adding other compression method will come
later.
@bugfix: This adds some safety trapping for trying to create a canvas
below the drm framebuffer size. Drm does not support creating a canvas
smaller than the framebuffer output, so we will add some trapping to
catch that, and internally create the framebuffers to the proper size.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Summary:
Warning fixed of evas
modules/evas/engines/gl_common/evas_gl_context.c: In function 'evas_gl_common_context_new':
modules/evas/engines/gl_common/evas_gl_context.c:392:32: warning: 'minor' may be used uninitialized in this function [-Wuninitialized]
modules/evas/engines/gl_common/evas_gl_context.c:314:8: note: 'minor' was declared here
modules/evas/engines/gl_common/evas_gl_context.c:392:16: warning: 'major' may be used uninitialized in this function [-Wuninitialized]
modules/evas/engines/gl_common/evas_gl_context.c:313:8: note: 'major' was declared here
@fix
Compilation Warning Fixed
Test Plan: Compile efl
Reviewers: singh.amitesh
CC: seoz, cedric
Differential Revision: https://phab.enlightenment.org/D656
@fix: ecore_evas_window_get expects an Ecore_Window to be returned.
Because of this, we need to have a 'window' that can be returned via
ecore_evas. For this case, we will use the output's framebuffer id as
the 'window' so we need to set that into the engine info so that
ecore_evas can fetch it.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
In evas_gl_common_image_draw, if an image is drawn with a fresh context,
containing no clip and no cutouts, then it will be wrongly clipped to
the source image size instead of the destination surface size.
This case seems to never happen, ever, since the contexts are always
fully set by the render functions.
@fix
evas_gl_common_buffer_dump can be used to dump all frames into
a series of PNG files. But the filename contained some garbage
characters (and potential segv, too).
(cherry picked from commit a0f886138ed5a28d0d1596df3b805fca06d1ae31)
It is not necessary to dynamically link to glReadPixels since
this is not an extension. This code wouldn't even work on some
devices.
Also, the pixels returned are not premultiplied (yeah >_<)
And some devices (EGL) don't support GL_BGRA... so glReadPixels
would just fail and not fill in the pixels. Conversion is required.
@bugfix: structure fb_var_screeninfo does not have a colorspace field
defined in linux/fb.h, so (for now) comment out code which was
referencing that field. Not sure what the intent was here, but build
was broken because of this.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
GL_READ_FRAMEBUFFER isn't defined when compiling for Wayland
Thanks Stefan for the report.
Also, import GL_FRAMEBUFFER overrides from other GL files, so
that it points to the proper extension (_OES or _EXT if applicable).
While most framebuffes use stride = width, some may have stride bigger
than width to provide better alignment. Then we must always use stride.
Thanks to Arjan van de Ven, the one that spotted the issue.
@fix
This will be needed by the filters for proxy rendering,
for textures and maps (displacement).
Add new engine functions to unleash the (sluggish) power of glReadPixels.
The idea is to be able to bypass glReadPixels later, so 3 new APIs are
added:
- surface_lock
- surface_read_pixels
- surface_unlock
They must be called in that order.
Note (for history):
glReadPixels was always getting the wrong data during first draw,
but the right data during a redraw...
Why? Well simply because for OpenGL itself, the image had never
been drawn in teh first place! Only the Evas GL context knew
about the image drawing, as it was queued somewhere in the pipe.
One line solution: Call evas_gl_common_context_flush before
doing anything else.
FrameBuffer can be tricky with all combinations and it's hard to tell
users to send useful information, then print the information we use so
we can get useful bug reports.
clean evas_fb_main.c so it returns -1 to indicate invalid fds, same as
open() and what is written in evas_fb.h example.
call fb_cleanup() in all error conditions and always return -1 in
fb_postinit() if we did call fb_cleanup().
@bugfix: Removed hardware acceleration fields from engine structure.
These are now located inside the buffer management code itself, so no
need for them here.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
@bugfix: Set cached image alpha flag properly
This fixes issue where cached image alpha flag was not set properly.
Set it according to the outbuf's destination alpha flag.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
@bugfix: Check (and set) buffer validity before calling
framebuffer_send. This fixes an issue where buffer was not valid,
causing next_update_get to do full Copies.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
@bugfix: We cannot call framebuffer_set from within the send function
because if we are not vsync'd then framebuffer_set would never be
called and thus the buffer would not be marked as valid, causing full
Copies to happen.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
@bugfix: Draw to the front buffer first, instead of the back buffer.
Frenchie says this improves the "initial rendering delay" of expedite
tests. Originally, we were drawing to the back buffer first, then
flipping it onto the crtc when drawing was done. This presented a
"perceived" rendering delay when running expedite tests as it would
wait for the back buffer to be drawn before presenting it. Personally,
I think it is not good to draw directly to the front buffer first as
it may get presented "incomplete" ... but cedric says it draws fine so
we'll leave it starting on the front buffer (for now).
Signed-off-by: Chris Michael <devilhorns@comcast.net>
@feature: Add support for EVAS_DRM_VSYNC environment variable to
@feature: Add support for marking a Framebuffer as dirty.
@bugfix: Fix color mask values for evas conversion functions.
@bugfix: Start with using the Backbuffer for drawing.
@bugfix: Fix previous Slowness with evas_cache image data.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
@feature: Add ability to render software buffers using vsync or not
@bugfix: Fix drmModeAddFB to use proper depth & bpp when adding FB
@bugfix: Fix mmap to use NULL (not 0) so that kernel assigns memory
address.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
@bugfix: this cleans up the Outbuf structure by removing unused
fields, Fixing some function declarations, and defaulting the number
of buffers to 2 (double-buffering)
Signed-off-by: Chris Michael <cp.michael@samsung.com>
@feature: Start on hardware Plane support
- Add Plane structure
- Store list of Planes in the Output buffer
Signed-off-by: Chris Michael <cp.michael@samsung.com>
- Typically this will come from ecore_evas and be used by evas to
allocate hardware accelerated buffers (gbm, tbm, etc)
Signed-off-by: Chris Michael <cp.michael@samsung.com>
@feature: Add code to check if async page flipping is supported by the driver.
@bugfix: Add code to get the proper drm driver name when we init the card.
@bugfix: Use drmOpen when opening the card so that any sub-driver gets initialized.
@bugfix: Add some debug/testing code to enumerate planes.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
updated sooner.
@bugfix: set framebuffer on crtc earlier in process
@bugfix: Set the rendered image's alpha flag to be equal to the output buffer's
Signed-off-by: Chris Michael <cp.michael@samsung.com>
When rotation is 0, we need to advance the destination pointer in the
X direction by a Multiple of Bits-Per-Pixel...not an addition.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This looks like a typo: if (animated > 1) when animated is a... Bool!
So, I am not entirely sure why this bug is visible in case of gif
proxies, all it seems that the load_data function may be called
multiple times when the object is visible. So gif close and reopen
happen properly, and the first frame can be decoded.
When running in direct rendering mode, properly support partial
rendering if the extension is properly supported.
Also, fixed the SwapBufferwWithDamage rectangle coordinate bug.
It wasn't properly y-inverted before.
even though we don't support rectangle bits in texture targets for
texture-from-pixmap the code checked and complained - problem is it
checked the wrong thing. fixes CID 1135267
Summary: Ensure Evas's eglContext when several eglContexts are used.
Test Plan:
1. Native GLES application works with evas_object_image_native_surface_set
2. One Evas object works with evas map.
Reviewers: seoz, tasn, cedric
Reviewed By: cedric
CC: cedric, raster
Differential Revision: https://phab.enlightenment.org/D534
Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
Summary: This patch is for QUADRUPLE window buffers.
Test Plan:
When enlightenment uses quadruple buffers or window system can support quadruple buffers,
application can use quadruple buffers with partial rendering
Reviewers: tasn, seoz, raster
Reviewed By: raster
CC: cedric
Differential Revision: https://phab.enlightenment.org/D527
Quick and dirty solution to support the OpenGL engine:
[1] Allocate CPU buffers
[2] Render text and process all effects to these buffers
[3] Push final image as an OpenGL texture.
This patch implements [1].
Summary: Ensure eng_window_use in image_content_hint_set
Test Plan:
1. make native OpenGLES application.
2. set evas object image with evas_object_image_native_surface_set.
3. GLES Application try to call eglMakeCurrent with own eglContext, then resize evas object resize
Reviewers: Hermet, raster, cedric
Reviewed By: cedric
CC: cedric, seoz
Differential Revision: https://phab.enlightenment.org/D523
Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
this changes the internal encoding of font glyphs in evas to use 4bit
uncompressed if small, or 4bit rle (run length encoded) if larger.
this caves at least 50% of memory on fonts - and more if bigger. with
large fonts (40-80pixel size) we can save in the region of 80% of
memory used for glyphs. this also happesn to allow speedups in
rendering too.
if alpha4 is possible (desktopgl) then use it for fonts as this should
cut memory in half for them and possibly speed things up due to less
memory bandwidth needed
this makes efl ignore certain env vars for thnigs and entirely removes
user modules (that no one ever used) etc. etc. to ensure that *IF* an
app is setuid, there isn't a priv escalation path that is easy.