aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Michael <cp.michael@samsung.com>2019-01-29 09:54:44 -0500
committerChristopher Michael <cp.michael@samsung.com>2019-03-13 11:40:25 -0400
commitde2f6a027a6021259d3185b1a3b85ad617a52f4c (patch)
treecf83e069ff495bb61b728fd4211a4b3a50f95cdc
parenteina_error: On Windows strerror_s() is the same than POSIX strerror_r() (diff)
downloadefl-de2f6a027a6021259d3185b1a3b85ad617a52f4c.tar.gz
evas-drm: Remove old engine code
-rw-r--r--src/modules/evas/engines/drm/Evas_Engine_Drm.h27
-rw-r--r--src/modules/evas/engines/drm/evas_engine.c286
-rw-r--r--src/modules/evas/engines/drm/evas_engine.h87
-rw-r--r--src/modules/evas/engines/drm/evas_outbuf.c551
4 files changed, 0 insertions, 951 deletions
diff --git a/src/modules/evas/engines/drm/Evas_Engine_Drm.h b/src/modules/evas/engines/drm/Evas_Engine_Drm.h
deleted file mode 100644
index 24d0fa41d5..0000000000
--- a/src/modules/evas/engines/drm/Evas_Engine_Drm.h
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef _EVAS_ENGINE_DRM_H
-# define _EVAS_ENGINE_DRM_H
-
-# include <Ecore_Drm2.h>
-
-typedef struct _Evas_Engine_Info_Drm
-{
- /* PRIVATE - don't mess with this baby or evas will poke its tongue out */
- /* at you and make nasty noises */
- Evas_Engine_Info magic;
-
- struct
- {
- Ecore_Drm2_Device *dev;
- int depth, bpp;
- unsigned int format, rotation;
-
- Ecore_Drm2_Output *output;
- Eina_Bool alpha : 1;
- Eina_Bool vsync : 1;
- } info;
-
- /* non-blocking or blocking mode */
- Evas_Engine_Render_Mode render_mode;
-} Evas_Engine_Info_Drm;
-
-#endif
diff --git a/src/modules/evas/engines/drm/evas_engine.c b/src/modules/evas/engines/drm/evas_engine.c
deleted file mode 100644
index 63719018ec..0000000000
--- a/src/modules/evas/engines/drm/evas_engine.c
+++ /dev/null
@@ -1,286 +0,0 @@
-#include "evas_engine.h"
-#include "../software_generic/evas_native_common.h"
-
-typedef struct _Render_Engine
-{
- Render_Output_Software_Generic generic;
-
- Ecore_Drm2_Device *dev;
-} Render_Engine;
-
-struct scanout_handle
-{
- Evas_Native_Scanout_Handler handler;
- void *data;
-};
-
-static Evas_Func func, pfunc;
-
-int _evas_engine_drm_log_dom;
-
-static void *
-eng_output_setup(void *engine, void *einfo, unsigned int w, unsigned int h)
-{
- Evas_Engine_Info_Drm *info = einfo;
- Render_Engine *re;
- Outbuf *ob;
-
- re = calloc(1, sizeof(Render_Engine));
- if (!re) return NULL;
-
- ob = _outbuf_setup(info, w, h);
- if (!ob) goto err;
-
- re->dev = info->info.dev;
-
- if (!evas_render_engine_software_generic_init(engine, &re->generic, ob,
- _outbuf_state_get,
- _outbuf_rotation_get,
- _outbuf_reconfigure,
- NULL,
- NULL,
- _outbuf_update_region_new,
- _outbuf_update_region_push,
- NULL,
- NULL,
- _outbuf_flush,
- _outbuf_redraws_clear,
- _outbuf_free,
- ob->w, ob->h))
- goto init_err;
-
- evas_render_engine_software_generic_merge_mode_set(&re->generic);
-
- re->generic.ob->info = einfo;
-
- return re;
-
-init_err:
- evas_render_engine_software_generic_clean(engine, &re->generic);
-err:
- free(re);
- return NULL;
-}
-
-static void
-eng_output_info_setup(void *info)
-{
- Evas_Engine_Info_Drm *einfo = info;
-
- einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
-}
-
-static void
-eng_output_resize(void *engine EINA_UNUSED, void *data, int w, int h)
-{
- Render_Engine *re = data;
- Evas_Engine_Info_Drm *info;
-
- info = re->generic.ob->info;
- if (!info) return;
-
- _outbuf_reconfigure(re->generic.ob, w, h,
- info->info.rotation, info->info.depth);
-
- evas_common_tilebuf_free(re->generic.tb);
- if ((re->generic.tb = evas_common_tilebuf_new(w, h)))
- evas_common_tilebuf_set_tile_size(re->generic.tb, TILESIZE, TILESIZE);
-
- re->generic.w = w;
- re->generic.h = h;
-}
-
-static int
-eng_output_update(void *engine, void *data, void *einfo EINA_UNUSED, unsigned int w, unsigned int h)
-{
- Render_Engine *re = data;
-
- eng_output_resize(engine, data, w, h);
-
- evas_render_engine_software_generic_update(&re->generic,
- re->generic.ob, w, h);
-
- return 1;
-}
-
-static void
-eng_output_free(void *engine, void *data)
-{
- Render_Engine *re = data;
-
- evas_render_engine_software_generic_clean(engine, &re->generic);
- free(re);
-}
-
-static Ecore_Drm2_Fb *
-drm_import_simple_dmabuf(Ecore_Drm2_Device *dev, struct dmabuf_attributes *attributes)
-{
- unsigned int stride[4] = { 0 };
- int dmabuf_fd[4] = { 0 };
- int i;
-
- for (i = 0; i < attributes->n_planes; i++)
- {
- stride[i] = attributes->stride[i];
- dmabuf_fd[i] = attributes->fd[i];
- }
-
- return ecore_drm2_fb_dmabuf_import(dev, attributes->width,
- attributes->height, 32, 32,
- attributes->format, stride,
- dmabuf_fd, attributes->n_planes);
-}
-
-static void
-_eng_fb_release(Ecore_Drm2_Fb *fb EINA_UNUSED, Ecore_Drm2_Fb_Status status, void *data)
-{
- struct scanout_handle *sh;
-
- sh = data;
- if (status == ECORE_DRM2_FB_STATUS_DELETED)
- {
- free(sh);
- return;
- }
-
- if (!sh->handler) return;
-
- switch (status)
- {
- case ECORE_DRM2_FB_STATUS_SCANOUT_ON:
- sh->handler(sh->data, EVAS_NATIVE_SURFACE_STATUS_SCANOUT_ON);
- break;
- case ECORE_DRM2_FB_STATUS_SCANOUT_OFF:
- sh->handler(sh->data, EVAS_NATIVE_SURFACE_STATUS_SCANOUT_OFF);
- break;
- case ECORE_DRM2_FB_STATUS_PLANE_ASSIGN:
- sh->handler(sh->data, EVAS_NATIVE_SURFACE_STATUS_PLANE_ASSIGN);
- break;
- case ECORE_DRM2_FB_STATUS_PLANE_RELEASE:
- sh->handler(sh->data, EVAS_NATIVE_SURFACE_STATUS_PLANE_RELEASE);
- break;
- default:
- ERR("Unhandled framebuffer status");
- }
-}
-
-static void *
-eng_image_plane_assign(void *data, void *image, int x, int y)
-{
- Render_Engine *re;
- Outbuf *ob;
- RGBA_Image *img;
- Native *n;
- Ecore_Drm2_Fb *fb = NULL;
- Ecore_Drm2_Plane *plane = NULL;
- struct scanout_handle *g;
-
- EINA_SAFETY_ON_NULL_RETURN_VAL(image, NULL);
-
- re = (Render_Engine *)data;
- EINA_SAFETY_ON_NULL_RETURN_VAL(re, NULL);
-
- ob = re->generic.ob;
- EINA_SAFETY_ON_NULL_RETURN_VAL(ob, NULL);
-
- img = image;
- n = img->native.data;
-
- /* Perhaps implementable on other surface types, but we're
- * sticking to this one for now */
- if (n->ns.type != EVAS_NATIVE_SURFACE_WL_DMABUF) return NULL;
-
- fb = drm_import_simple_dmabuf(re->dev, &n->ns_data.wl_surface_dmabuf.attr);
- if (!fb) return NULL;
-
- g = calloc(1, sizeof(struct scanout_handle));
- if (!g) goto out;
-
- g->handler = n->ns.data.wl_dmabuf.scanout.handler;
- g->data = n->ns.data.wl_dmabuf.scanout.data;
- ecore_drm2_fb_status_handler_set(fb, _eng_fb_release, g);
-
- /* Fail or not, we're going to drop that fb and let refcounting get rid of
- * it later
- */
- plane = ecore_drm2_plane_assign(ob->priv.output, fb, x, y);
-
-out:
- ecore_drm2_fb_discard(fb);
- return plane;
-}
-
-static void
-eng_image_plane_release(void *data EINA_UNUSED, void *image EINA_UNUSED, void *plin)
-{
- Ecore_Drm2_Plane *plane = plin;
-
- ecore_drm2_plane_release(plane);
-}
-
-static int
-module_open(Evas_Module *em)
-{
- /* check for valid evas module */
- if (!em) return 0;
-
- /* try to inherit functions from software_generic engine */
- if (!_evas_module_engine_inherit(&pfunc, "software_generic",
- sizeof(Evas_Engine_Info_Drm)))
- return 0;
-
- /* try to create eina logging domain */
- _evas_engine_drm_log_dom =
- eina_log_domain_register("evas-drm", EVAS_DEFAULT_LOG_COLOR);
-
- /* if we could not create a logging domain, error out */
- if (_evas_engine_drm_log_dom < 0)
- {
- EINA_LOG_ERR("Can not create a module log domain.");
- return 0;
- }
-
- ecore_init();
-
- /* store parent functions */
- func = pfunc;
-
- /* override the methods we provide */
-#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
- ORD(output_info_setup);
- ORD(output_setup);
- ORD(output_update);
- ORD(output_free);
- ORD(output_resize);
- ORD(image_plane_assign);
- ORD(image_plane_release);
-
- /* advertise our engine functions */
- em->functions = (void *)(&func);
-
- return 1;
-}
-
-static void
-module_close(Evas_Module *em EINA_UNUSED)
-{
- /* unregister the eina log domain for this engine */
- if (_evas_engine_drm_log_dom >= 0)
- {
- eina_log_domain_unregister(_evas_engine_drm_log_dom);
- _evas_engine_drm_log_dom = -1;
- }
-
- ecore_shutdown();
-}
-
-static Evas_Module_Api evas_modapi =
-{
- EVAS_MODULE_API_VERSION, "drm", "none", { module_open, module_close }
-};
-
-EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, drm);
-
-#ifndef EVAS_STATIC_BUILD_DRM
-EVAS_EINA_MODULE_DEFINE(engine, drm);
-#endif
diff --git a/src/modules/evas/engines/drm/evas_engine.h b/src/modules/evas/engines/drm/evas_engine.h
deleted file mode 100644
index ea8a6cec03..0000000000
--- a/src/modules/evas/engines/drm/evas_engine.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef EVAS_ENGINE_H
-# define EVAS_ENGINE_H
-
-# include "evas_common_private.h"
-# include "evas_macros.h"
-# include "evas_private.h"
-# include "Evas.h"
-# include "Evas_Engine_Drm.h"
-# include <Ecore.h>
-# include <Ecore_Drm2.h>
-# include <drm_fourcc.h>
-# include <xf86drm.h>
-# include <xf86drmMode.h>
-
-# include "../software_generic/Evas_Engine_Software_Generic.h"
-
-extern int _evas_engine_drm_log_dom;
-
-# ifdef ERR
-# undef ERR
-# endif
-# define ERR(...) EINA_LOG_DOM_ERR(_evas_engine_drm_log_dom, __VA_ARGS__)
-
-# ifdef DBG
-# undef DBG
-# endif
-# define DBG(...) EINA_LOG_DOM_DBG(_evas_engine_drm_log_dom, __VA_ARGS__)
-
-# ifdef INF
-# undef INF
-# endif
-# define INF(...) EINA_LOG_DOM_INFO(_evas_engine_drm_log_dom, __VA_ARGS__)
-
-# ifdef WRN
-# undef WRN
-# endif
-# define WRN(...) EINA_LOG_DOM_WARN(_evas_engine_drm_log_dom, __VA_ARGS__)
-
-# ifdef CRI
-# undef CRI
-# endif
-# define CRI(...) EINA_LOG_DOM_CRIT(_evas_engine_drm_log_dom, __VA_ARGS__)
-
-typedef struct _Outbuf_Fb
-{
- int age;
- Ecore_Drm2_Fb *fb;
-
- Eina_Bool valid : 1;
- Eina_Bool drawn : 1;
-} Outbuf_Fb;
-
-struct _Outbuf
-{
- Ecore_Drm2_Device *dev;
- int w, h, bpp, rotation;
- unsigned int depth, format;
-
- Evas_Engine_Info_Drm *info;
-
- struct
- {
- Eina_List *fb_list;
- Outbuf_Fb *draw;
- Ecore_Drm2_Output *output;
- Ecore_Drm2_Plane *plane;
- Eina_List *pending;
- Eina_Rectangle *rects;
- unsigned int rect_count;
- int unused_duration;
- } priv;
-
- Eina_Bool alpha : 1;
- Eina_Bool vsync : 1;
-};
-
-Outbuf *_outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h);
-void _outbuf_free(Outbuf *ob);
-int _outbuf_rotation_get(Outbuf *ob);
-void _outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth);
-Render_Output_Swap_Mode _outbuf_state_get(Outbuf *ob);
-void *_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch);
-void _outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h);
-void _outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage, Tilebuf_Rect *buffer_damage, Evas_Render_Mode render_mode);
-void _outbuf_redraws_clear(Outbuf *ob);
-
-#endif
diff --git a/src/modules/evas/engines/drm/evas_outbuf.c b/src/modules/evas/engines/drm/evas_outbuf.c
deleted file mode 100644
index f53f9683db..0000000000
--- a/src/modules/evas/engines/drm/evas_outbuf.c
+++ /dev/null
@@ -1,551 +0,0 @@
-#include "evas_engine.h"
-
-/* FIXME: We NEED to get the color map from the VT and use that for the mask */
-#define RED_MASK 0xff0000
-#define GREEN_MASK 0x00ff00
-#define BLUE_MASK 0x0000ff
-
-#define MAX_BUFFERS 10
-#define QUEUE_TRIM_DURATION 100
-
-static void
-_outbuf_buffer_swap(Outbuf *ob, Eina_Rectangle *rects, unsigned int count)
-{
- /* Ecore_Drm2_Plane *plane; */
- Outbuf_Fb *ofb;
-
- ofb = ob->priv.draw;
- if (!ofb) return;
-
- ecore_drm2_fb_dirty(ofb->fb, rects, count);
-
- if (!ob->priv.plane)
- ob->priv.plane = ecore_drm2_plane_assign(ob->priv.output, ofb->fb, 0, 0);
- else ecore_drm2_plane_fb_set(ob->priv.plane, ofb->fb);
-
- ecore_drm2_fb_flip(ofb->fb, ob->priv.output);
- ofb->drawn = EINA_TRUE;
- ofb->age = 0;
-}
-
-static Outbuf_Fb *
-_outbuf_fb_create(Outbuf *ob, int w, int h)
-{
- Outbuf_Fb *out;
-
- out = calloc(1, sizeof(Outbuf_Fb));
- if (!out) return NULL;
-
- out->fb =
- ecore_drm2_fb_create(ob->dev, w, h,
- ob->depth, ob->bpp, ob->format);
- if (!out->fb)
- {
- WRN("Failed To Create FB: %d %d", w, h);
- free(out);
- return NULL;
- }
-
- out->age = 0;
- out->drawn = EINA_FALSE;
- out->valid = EINA_TRUE;
-
- return out;
-}
-
-static void
-_outbuf_fb_destroy(Outbuf_Fb *ofb)
-{
- ecore_drm2_fb_discard(ofb->fb);
-
- memset(ofb, 0, sizeof(*ofb));
- ofb->valid = EINA_FALSE;
- ofb->drawn = EINA_FALSE;
- ofb->age = 0;
- free(ofb);
-}
-
-Outbuf *
-_outbuf_setup(Evas_Engine_Info_Drm *info, int w, int h)
-{
- Outbuf *ob;
-
- ob = calloc(1, sizeof(Outbuf));
- if (!ob) return NULL;
-
- ob->w = w;
- ob->h = h;
- ob->dev = info->info.dev;
- ob->alpha = info->info.alpha;
- ob->rotation = info->info.rotation;
-
- ob->bpp = info->info.bpp;
- ob->depth = info->info.depth;
- ob->format = info->info.format;
-
- ob->priv.output = info->info.output;
-
- return ob;
-}
-
-void
-_outbuf_free(Outbuf *ob)
-{
- Outbuf_Fb *ofb;
-
- while (ob->priv.pending)
- {
- RGBA_Image *img;
- Eina_Rectangle *rect;
-
- img = ob->priv.pending->data;
- ob->priv.pending =
- eina_list_remove_list(ob->priv.pending, ob->priv.pending);
-
- rect = img->extended_info;
-
- evas_cache_image_drop(&img->cache_entry);
-
- eina_rectangle_free(rect);
- }
-
- /* TODO: idle flush */
-
- _outbuf_flush(ob, NULL, NULL, EVAS_RENDER_MODE_UNDEF);
-
- EINA_LIST_FREE(ob->priv.fb_list, ofb)
- _outbuf_fb_destroy(ofb);
-
- free(ob);
-}
-
-int
-_outbuf_rotation_get(Outbuf *ob)
-{
- return ob->rotation;
-}
-
-void
-_outbuf_reconfigure(Outbuf *ob, int w, int h, int rotation, Outbuf_Depth depth)
-{
- Outbuf_Fb *ofb;
- unsigned int format = DRM_FORMAT_ARGB8888;
-
- switch (depth)
- {
- case OUTBUF_DEPTH_RGB_16BPP_565_565_DITHERED:
- format = DRM_FORMAT_RGB565;
- break;
- case OUTBUF_DEPTH_RGB_16BPP_555_555_DITHERED:
- format = DRM_FORMAT_RGBX5551;
- break;
- case OUTBUF_DEPTH_RGB_16BPP_444_444_DITHERED:
- format = DRM_FORMAT_RGBX4444;
- break;
- case OUTBUF_DEPTH_RGB_16BPP_565_444_DITHERED:
- format = DRM_FORMAT_RGB565;
- break;
- case OUTBUF_DEPTH_RGB_32BPP_888_8888:
- format = DRM_FORMAT_RGBX8888;
- break;
- case OUTBUF_DEPTH_ARGB_32BPP_8888_8888:
- format = DRM_FORMAT_ARGB8888;
- break;
- case OUTBUF_DEPTH_BGRA_32BPP_8888_8888:
- format = DRM_FORMAT_BGRA8888;
- break;
- case OUTBUF_DEPTH_BGR_32BPP_888_8888:
- format = DRM_FORMAT_BGRX8888;
- break;
- case OUTBUF_DEPTH_RGB_24BPP_888_888:
- format = DRM_FORMAT_RGB888;
- break;
- case OUTBUF_DEPTH_BGR_24BPP_888_888:
- format = DRM_FORMAT_BGR888;
- break;
- case OUTBUF_DEPTH_INHERIT:
- default:
- depth = ob->depth;
- format = ob->format;
- break;
- }
-
- if ((ob->w == w) && (ob->h == h) && (ob->rotation == rotation) &&
- (ob->depth == depth) && (ob->format == format))
- return;
-
- ob->w = w;
- ob->h = h;
- ob->depth = depth;
- ob->format = format;
- ob->rotation = rotation;
- ob->priv.unused_duration = 0;
-
- EINA_LIST_FREE(ob->priv.fb_list, ofb)
- _outbuf_fb_destroy(ofb);
-
- /* TODO: idle flush */
-}
-
-static Outbuf_Fb *
-_outbuf_fb_wait(Outbuf *ob)
-{
- Eina_List *l;
- Outbuf_Fb *ofb, *best = NULL;
- int best_age = -1, num_required = 1, num_allocated = 0;
-
- /* We pick the oldest available buffer to avoid using the same two
- * repeatedly and then having the third be stale when we need it
- */
- EINA_LIST_FOREACH(ob->priv.fb_list, l, ofb)
- {
- num_allocated++;
- if (ecore_drm2_fb_busy_get(ofb->fb))
- {
- num_required++;
- continue;
- }
- if (ofb->valid && (ofb->age > best_age))
- {
- best = ofb;
- best_age = best->age;
- }
- }
-
- if (num_required < num_allocated)
- ob->priv.unused_duration++;
- else
- ob->priv.unused_duration = 0;
-
- /* If we've had unused buffers for longer than QUEUE_TRIM_DURATION, then
- * destroy the oldest buffer (currently in best) and recursively call
- * ourself to get the next oldest.
- */
- if (best && (ob->priv.unused_duration > QUEUE_TRIM_DURATION))
- {
- ob->priv.unused_duration = 0;
- ob->priv.fb_list = eina_list_remove(ob->priv.fb_list, best);
- _outbuf_fb_destroy(best);
- best = _outbuf_fb_wait(ob);
- }
-
- return best;
-}
-
-static Eina_Bool
-_outbuf_fb_assign(Outbuf *ob)
-{
- int fw = 0, fh = 0;
- Outbuf_Fb *ofb;
- Eina_List *l;
-
- ob->priv.draw = _outbuf_fb_wait(ob);
- if (!ob->priv.draw)
- {
- EINA_SAFETY_ON_TRUE_RETURN_VAL(eina_list_count(ob->priv.fb_list) >= MAX_BUFFERS, EINA_FALSE);
-
- if ((ob->rotation == 0) || (ob->rotation == 180))
- {
- fw = ob->w;
- fh = ob->h;
- }
- else if ((ob->rotation == 90) || (ob->rotation == 270))
- {
- fw = ob->h;
- fh = ob->w;
- }
- ob->priv.draw = _outbuf_fb_create(ob, fw, fh);
- if (ob->priv.draw)
- ob->priv.fb_list = eina_list_append(ob->priv.fb_list, ob->priv.draw);
- }
-
- while (!ob->priv.draw)
- {
- ecore_drm2_fb_release(ob->priv.output, EINA_TRUE);
- ob->priv.draw = _outbuf_fb_wait(ob);
- }
-
- EINA_LIST_FOREACH(ob->priv.fb_list, l, ofb)
- {
- if ((ofb->valid) && (ofb->drawn))
- {
- ofb->age++;
- if (ofb->age > 4)
- {
- ofb->age = 0;
- ofb->drawn = EINA_FALSE;
- }
- }
- }
-
- return EINA_TRUE;
-}
-
-Render_Output_Swap_Mode
-_outbuf_state_get(Outbuf *ob)
-{
- int age;
-
- if (!_outbuf_fb_assign(ob)) return MODE_FULL;
-
- age = ob->priv.draw->age;
- if (age > 4) return MODE_FULL;
- else if (age == 1) return MODE_COPY;
- else if (age == 2) return MODE_DOUBLE;
- else if (age == 3) return MODE_TRIPLE;
- else if (age == 4) return MODE_QUADRUPLE;
-
- return MODE_FULL;
-}
-
-void *
-_outbuf_update_region_new(Outbuf *ob, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch)
-{
- RGBA_Image *img = NULL;
- Eina_Rectangle *rect;
-
- if ((w <= 0) || (h <= 0)) return NULL;
-
- RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, ob->w, ob->h);
-
- if (!(rect = eina_rectangle_new(x, y, w, h)))
- return NULL;
-
- img = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
-
- if (!img)
- {
- eina_rectangle_free(rect);
- return NULL;
- }
-
- img->cache_entry.flags.alpha = ob->alpha;
-
- evas_cache_image_surface_alloc(&img->cache_entry, w, h);
-
- img->extended_info = rect;
-
- if (cx) *cx = 0;
- if (cy) *cy = 0;
- if (cw) *cw = w;
- if (ch) *ch = h;
-
- /* add this cached image data to pending writes */
- ob->priv.pending =
- eina_list_append(ob->priv.pending, img);
-
- return img;
-}
-
-void
-_outbuf_update_region_push(Outbuf *ob, RGBA_Image *update, int x, int y, int w, int h)
-{
- Gfx_Func_Convert func = NULL;
- Eina_Rectangle rect = {0, 0, 0, 0}, pr;
- DATA32 *src;
- DATA8 *dst;
- Ecore_Drm2_Fb *buff;
- int bpp = 0, bpl = 0;
- int rx = 0, ry = 0;
- int bw = 0, bh = 0;
-
- /* check for valid output buffer */
- if (!ob) return;
-
- /* check for pending writes */
- if (!ob->priv.pending) return;
-
- /* check for valid source data */
- if (!(src = update->image.data)) return;
-
- /* check for valid desination data */
- if (!ob->priv.draw) return;
- buff = ob->priv.draw->fb;
-
- dst = ecore_drm2_fb_data_get(buff);
- if (!dst) return;
-
- if ((ob->rotation == 0) || (ob->rotation == 180))
- {
- func =
- evas_common_convert_func_get(0, w, h, ob->bpp,
- RED_MASK, GREEN_MASK, BLUE_MASK,
- PAL_MODE_NONE, ob->rotation);
- }
- else if ((ob->rotation == 90) || (ob->rotation == 270))
- {
- func =
- evas_common_convert_func_get(0, h, w, ob->bpp,
- RED_MASK, GREEN_MASK, BLUE_MASK,
- PAL_MODE_NONE, ob->rotation);
- }
-
- /* make sure we have a valid convert function */
- if (!func) return;
-
- /* based on rotation, set rectangle position */
- if (ob->rotation == 0)
- {
- rect.x = x;
- rect.y = y;
- }
- else if (ob->rotation == 90)
- {
- rect.x = y;
- rect.y = (ob->w - x - w);
- }
- else if (ob->rotation == 180)
- {
- rect.x = (ob->w - x - w);
- rect.y = (ob->h - y - h);
- }
- else if (ob->rotation == 270)
- {
- rect.x = (ob->h - y - h);
- rect.y = x;
- }
-
- /* based on rotation, set rectangle size */
- if ((ob->rotation == 0) || (ob->rotation == 180))
- {
- rect.w = w;
- rect.h = h;
- }
- else if ((ob->rotation == 90) || (ob->rotation == 270))
- {
- rect.w = h;
- rect.h = w;
- }
-
- bpp = ob->bpp / 8;
- bw = ob->w;
- bh = ob->h;
- /* bpp = (ob->depth / 8); */
- /* if (bpp <= 0) return; */
-
- bpl = ecore_drm2_fb_stride_get(buff);
-
- if (ob->rotation == 0)
- {
- RECTS_CLIP_TO_RECT(rect.x, rect.y, rect.w, rect.h,
- 0, 0, bw, bh);
- dst += (bpl * rect.y) + (rect.x * bpp);
- w -= rx;
- }
- else if (ob->rotation == 180)
- {
- pr = rect;
- RECTS_CLIP_TO_RECT(rect.x, rect.y, rect.w, rect.h,
- 0, 0, bw, bh);
- rx = pr.w - rect.w;
- ry = pr.h - rect.h;
- src += (update->cache_entry.w * ry) + rx;
- w -= rx;
- }
- else if (ob->rotation == 90)
- {
- pr = rect;
- RECTS_CLIP_TO_RECT(rect.x, rect.y, rect.w, rect.h,
- 0, 0, bw, bh);
- rx = pr.w - rect.w; ry = pr.h - rect.h;
- src += ry;
- w -= ry;
- }
- else if (ob->rotation == 270)
- {
- pr = rect;
- RECTS_CLIP_TO_RECT(rect.x, rect.y, rect.w, rect.h,
- 0, 0, bw, bh);
- rx = pr.w - rect.w; ry = pr.h - rect.h;
- src += (update->cache_entry.w * rx);
- w -= ry;
- }
-
- if ((rect.w <= 0) || (rect.h <= 0)) return;
-
- func(src, dst, (update->cache_entry.w - w), ((bpl / bpp) - rect.w),
- rect.w, rect.h, x + rx, y + ry, NULL);
-}
-
-void
-_outbuf_flush(Outbuf *ob, Tilebuf_Rect *surface_damage EINA_UNUSED, Tilebuf_Rect *buffer_damage EINA_UNUSED, Evas_Render_Mode render_mode)
-{
- Eina_Rectangle *r;
- RGBA_Image *img;
- unsigned int i = 0;
-
- if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return;
-
- if (ob->priv.rect_count) free(ob->priv.rects);
-
- /* get number of pending writes */
- ob->priv.rect_count = eina_list_count(ob->priv.pending);
- if (ob->priv.rect_count == 0) return;
-
- /* allocate rectangles */
- ob->priv.rects = malloc(ob->priv.rect_count * sizeof(Eina_Rectangle));
- if (!ob->priv.rects) return;
- r = ob->priv.rects;
-
- /* loop the pending writes */
- EINA_LIST_FREE(ob->priv.pending, img)
- {
- Eina_Rectangle *rect;
- int x = 0, y = 0, w = 0, h = 0;
-
- rect = img->extended_info;
- if (!rect) continue;
-
- x = rect->x; y = rect->y; w = rect->w; h = rect->h;
-
- /* based on rotation, set rectangle position */
- if (ob->rotation == 0)
- {
- r[i].x = x;
- r[i].y = y;
- }
- else if (ob->rotation == 90)
- {
- r[i].x = y;
- r[i].y = (ob->w - x - w);
- }
- else if (ob->rotation == 180)
- {
- r[i].x = (ob->w - x - w);
- r[i].y = (ob->h - y - h);
- }
- else if (ob->rotation == 270)
- {
- r[i].x = (ob->h - y - h);
- r[i].y = x;
- }
-
- /* based on rotation, set rectangle size */
- if ((ob->rotation == 0) || (ob->rotation == 180))
- {
- r[i].w = w;
- r[i].h = h;
- }
- else if ((ob->rotation == 90) || (ob->rotation == 270))
- {
- r[i].w = h;
- r[i].h = w;
- }
-
- eina_rectangle_free(rect);
-
- evas_cache_image_drop(&img->cache_entry);
-
- i++;
- }
-}
-
-void
-_outbuf_redraws_clear(Outbuf *ob)
-{
- if (!ob->priv.rect_count) return;
-
- _outbuf_buffer_swap(ob, ob->priv.rects, ob->priv.rect_count);
- free(ob->priv.rects);
- ob->priv.rect_count = 0;
-}