<commit_before>#include "e.h"
#include <Ecore_Drm.h>

EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" };

static Ecore_Event_Handler *activate_handler;
static Eina_Bool session_state = EINA_FALSE;

static Eina_Bool
_e_mod_drm_cb_activate(void *data, int type EINA_UNUSED, void *event)
{
   Ecore_Drm_Event_Activate *e;
   E_Comp *c;

   if ((!event) || (!data)) goto end;
   e = event;
   c = data;

   if (e->active)
     {
        E_Client *ec;

        if (session_state) goto end;
        session_state = EINA_TRUE;

        ecore_evas_show(c->ee);
        E_CLIENT_FOREACH(c, ec)
          {
             if (ec->visible && (!ec->input_only))
               e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
          }
        e_comp_render_queue(c);
        e_comp_shape_queue_block(c, 0);
        ecore_event_add(E_EVENT_COMPOSITOR_ENABLE, NULL, NULL, NULL);
     }
   else
     {
        session_state = EINA_FALSE;
        ecore_evas_hide(c->ee);
        edje_file_cache_flush();
        edje_collection_cache_flush();
        evas_image_cache_flush(c->evas);
        evas_font_cache_flush(c->evas);
        evas_render_dump(c->evas);

        e_comp_render_queue(c);
        e_comp_shape_queue_block(c, 1);
        ecore_event_add(E_EVENT_COMPOSITOR_DISABLE, NULL, NULL, NULL);
     }

end:
   return ECORE_CALLBACK_PASS_ON;
}

EAPI void *
e_modapi_init(E_Module *m)
{
   E_Comp *comp;
   int w = 0, h = 0;

   printf("LOAD WL_DRM MODULE\n");

   /* try to init ecore_drm */
   /* if (!ecore_drm_init()) */
   /*   { */
   /*      fprintf(stderr, "Could not initialize ecore_drm"); */
   /*      return NULL; */
   /*   } */

   if (!(comp = e_comp))
     {
        comp = e_comp_new();
        comp->comp_type = E_PIXMAP_TYPE_WL;
     }

   if ((e_comp_gl_get()) &&
       (e_comp_config_get()->engine == E_COMP_ENGINE_GL))
     {
        /* TOOD: create ecore_evas for new drm gl backend */
        /* NB: If that fails, call e_comp_gl_set(EINA_FALSE) */
     }

   /* fallback to framebuffer drm (non-accel) */
   if (!comp->ee)
     comp->ee = ecore_evas_drm_new(NULL, 0, 0, 0, 1, 1);
<commit_msg>wl_drm: create ecore_evas for drm gl backend<commit_after>#include "e.h"
#include <Ecore_Drm.h>

EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Drm" };

static Ecore_Event_Handler *activate_handler;
static Eina_Bool session_state = EINA_FALSE;

static Eina_Bool
_e_mod_drm_cb_activate(void *data, int type EINA_UNUSED, void *event)
{
   Ecore_Drm_Event_Activate *e;
   E_Comp *c;

   if ((!event) || (!data)) goto end;
   e = event;
   c = data;

   if (e->active)
     {
        E_Client *ec;

        if (session_state) goto end;
        session_state = EINA_TRUE;

        ecore_evas_show(c->ee);
        E_CLIENT_FOREACH(c, ec)
          {
             if (ec->visible && (!ec->input_only))
               e_comp_object_damage(ec->frame, 0, 0, ec->w, ec->h);
          }
        e_comp_render_queue(c);
        e_comp_shape_queue_block(c, 0);
        ecore_event_add(E_EVENT_COMPOSITOR_ENABLE, NULL, NULL, NULL);
     }
   else
     {
        session_state = EINA_FALSE;
        ecore_evas_hide(c->ee);
        edje_file_cache_flush();
        edje_collection_cache_flush();
        evas_image_cache_flush(c->evas);
        evas_font_cache_flush(c->evas);
        evas_render_dump(c->evas);

        e_comp_render_queue(c);
        e_comp_shape_queue_block(c, 1);
        ecore_event_add(E_EVENT_COMPOSITOR_DISABLE, NULL, NULL, NULL);
     }

end:
   return ECORE_CALLBACK_PASS_ON;
}

EAPI void *
e_modapi_init(E_Module *m)
{
   E_Comp *comp;
   int w = 0, h = 0;

   printf("LOAD WL_DRM MODULE\n");

   /* try to init ecore_drm */
   /* if (!ecore_drm_init()) */
   /*   { */
   /*      fprintf(stderr, "Could not initialize ecore_drm"); */
   /*      return NULL; */
   /*   } */

   if (!(comp = e_comp))
     {
        comp = e_comp_new();
        comp->comp_type = E_PIXMAP_TYPE_WL;
     }

   if ((e_comp_gl_get()) &&
       (e_comp_config_get()->engine == E_COMP_ENGINE_GL))
     {
        comp->ee == ecore_evas_gl_drm_new(NULL, 0, 0, 0, 1, 1);
        if(!comp->ee)
          e_comp_gl_set(EINA_FALSE);
     }

   /* fallback to framebuffer drm (non-accel) */
   if (!comp->ee)
     comp->ee = ecore_evas_drm_new(NULL, 0, 0, 0, 1, 1);

{'fraction_non_alphanumeric': 0.13202705854910193, 'fraction_numerical': 0.006298110566829951, 'mean_word_length': 2.506132461161079, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7534759', 'n_tokens_mistral': 1731, 'n_tokens_neox': 1666, 'n_words': 303}