E_CONFIG_VAL(D, T, hwc_ignore_primary, UCHAR);
E_CONFIG_VAL(D, T, hwc_use_detach, UCHAR);
E_CONFIG_VAL(D, T, hwc_send_redraw_request, UCHAR);
+ E_CONFIG_VAL(D, T, hwc_prefer_gbm, UCHAR);
E_CONFIG_VAL(D, T, use_native_type_buffer, UCHAR);
E_CONFIG_VAL(D, T, nofade, UCHAR);
E_CONFIG_VAL(D, T, smooth_windows, UCHAR);
cfg->hwc_ignore_primary = 0;
cfg->hwc_use_detach = 0;
cfg->hwc_send_redraw_request = 0;
+ cfg->hwc_prefer_gbm = 0;
cfg->use_native_type_buffer = 0; // 1 if use_native(wl_buffer), 0 if use_tbm(tbm_surface)
cfg->nofade = 0;
cfg->smooth_windows = 0; // 1 if gl, 0 if not
#include "Eeze.h"
#include <tizen-extension-server-protocol.h>
#include <device/booting-internal.h>
+#include <tbm_drm_helper.h>
+#include <gbm.h>
#define PATH "/org/enlightenment/wm"
#define IFACE "org.enlightenment.wm.screen_rotation"
e_comp_screen->available_pp_formats = eina_list_remove(e_comp_screen->available_pp_formats, l);
}
}
+
+ if (e_comp_screen->gdevice) gbm_device_destroy(e_comp_screen->gdevice);
if (e_comp_screen->bufmgr) tbm_bufmgr_deinit(e_comp_screen->bufmgr);
if (e_comp_screen->fd >= 0) close(e_comp_screen->fd);
if (e_comp_screen->hdlr) ecore_main_fd_handler_del(e_comp_screen->hdlr);
return EINA_TRUE;
}
+EINTERN void *
+e_comp_screen_gbm_device_get(E_Comp_Screen *e_comp_screen)
+{
+ int fd;
+
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen, NULL);
+
+ if (e_comp_screen->gdevice) return e_comp_screen->gdevice;
+
+ fd = tbm_drm_helper_get_master_fd();
+ EINA_SAFETY_ON_FALSE_RETURN_VAL(fd >= 0, NULL);
+
+ e_comp_screen->gdevice = gbm_create_device(fd);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp_screen->gdevice, NULL);
+
+ return e_comp_screen->gdevice;
+}
+
EINTERN void
e_comp_screen_debug_info_get(Eldbus_Message_Iter *iter)
{
#include "e.h"
#include "services/e_service_quickpanel.h"
#include <Evas_GL.h>
+#include <gbm.h>
#define EHERR(f, hwc, x...) \
do \
hwc->target_buffer_queue = NULL;
}
+static void *
+_e_hwc_gbm_surface_alloc(void *data, int w, int h)
+{
+ E_Hwc *hwc = (E_Hwc *)data;
+ E_Output *output = hwc->output;
+ struct gbm_device *gdevice;
+ struct gbm_surface *gsurface;
+ int format = GBM_FORMAT_ABGR8888;
+
+ if (output->tdm_hwc)
+ {
+ EINA_SAFETY_ON_NULL_RETURN_VAL(e_comp, NULL);
+
+ gdevice = e_comp_screen_gbm_device_get(e_comp->e_comp_screen);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(gdevice, NULL);
+
+ gsurface = gbm_surface_create(gdevice, w, h,
+ format,
+ GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(gsurface, NULL);
+ }
+ else
+ {
+ EHERR("only tdm hwc support gbm_surface", hwc);
+ return (void *) NULL;
+ }
+
+ hwc->gsurface = gsurface;
+
+ EHINF("The gbm_surface(%p, %dx%d) fmt(%c%c%c%c)is created.", hwc, gsurface, w, h, FOURCC_STR(format));
+
+ return (void *)gsurface;
+}
+
+static void
+_e_hwc_gbm_surface_free(void *data, void *gsurface)
+{
+ E_Hwc *hwc = (E_Hwc *)data;
+
+ EHINF("The gbm_surface(%p) is destroyed.", NULL, gsurface);
+
+ gbm_surface_destroy(gsurface);
+ hwc->gsurface = NULL;
+}
+
+static Ecore_Evas *
+_e_hwc_ecore_evas_tbm_alloc(E_Hwc *hwc, int src_w, int src_h)
+{
+ Ecore_Evas *ee;
+
+ if (e_comp->avoid_afill)
+ {
+ ee = ecore_evas_tbm_allocfunc_new("gl_tbm_ES", src_w, src_h,
+ _e_hwc_tbm_surface_queue_alloc,
+ _e_hwc_tbm_surface_queue_free,
+ (void *)hwc);
+ }
+ else
+ {
+ ee = ecore_evas_tbm_allocfunc_new("gl_tbm", src_w, src_h,
+ _e_hwc_tbm_surface_queue_alloc,
+ _e_hwc_tbm_surface_queue_free,
+ (void *)hwc);
+ }
+
+ EHINF("ecore_evas engine:gl_tbm ee:%p avoid_afill:%d", hwc, ee, e_comp->avoid_afill);
+
+ return ee;
+}
+
+static Ecore_Evas *
+_e_hwc_ecore_evas_gbm_alloc(E_Hwc *hwc, int src_w, int src_h)
+{
+ Ecore_Evas *ee;
+ struct gbm_device *gdevice;
+
+ gdevice = e_comp_screen_gbm_device_get(e_comp->e_comp_screen);
+ if (!gdevice) return NULL;
+
+ if (e_comp->avoid_afill)
+ {
+ ee = ecore_evas_tbm_native_allocfunc_new("gl_tbm_ES", gdevice, src_w, src_h,
+ _e_hwc_gbm_surface_alloc,
+ _e_hwc_gbm_surface_free,
+ (void *)hwc);
+ }
+ else
+ {
+ ee = ecore_evas_tbm_native_allocfunc_new("gl_tbm", gdevice, src_w, src_h,
+ _e_hwc_gbm_surface_alloc,
+ _e_hwc_gbm_surface_free,
+ (void *)hwc);
+ }
+
+ EHINF("ecore_evas engine:gl_tbm with gbm ee:%p avaoid_afill:%d", hwc, ee, e_comp->avoid_afill);
+
+ return ee;
+}
+
static void
_e_hwc_ee_deinit(E_Hwc *hwc)
{
if ((e_comp_gl_get()) &&
(e_comp_config_get()->engine == E_COMP_ENGINE_GL))
{
- e_main_ts_begin("\tEE_GL_DRM New");
- if (e_comp->avoid_afill)
+ e_main_ts_begin("\tEE_GL_TBM New");
+ if (e_comp->hwc_prefer_gbm)
{
- ee = ecore_evas_tbm_allocfunc_new("gl_tbm_ES", scr_w, scr_h, _e_hwc_tbm_surface_queue_alloc, _e_hwc_tbm_surface_queue_free, (void *)hwc);
- EHINF("ecore_evas engine:gl_tbm_ES avoid_afill:%d", hwc, e_comp->avoid_afill);
+ ee = _e_hwc_ecore_evas_gbm_alloc(hwc, scr_w, scr_h);
+ if (!ee)
+ ee = _e_hwc_ecore_evas_tbm_alloc(hwc, scr_w, scr_h);
}
else
{
- ee = ecore_evas_tbm_allocfunc_new("gl_tbm", scr_w, scr_h, _e_hwc_tbm_surface_queue_alloc, _e_hwc_tbm_surface_queue_free, (void *)hwc);
- EHINF("ecore_evas engine:gl_tbm avoid_afill:%d", hwc, e_comp->avoid_afill);
+ ee = _e_hwc_ecore_evas_tbm_alloc(hwc, scr_w, scr_h);
+ if (!ee)
+ ee = _e_hwc_ecore_evas_gbm_alloc(hwc, scr_w, scr_h);
}
- snprintf(buf, sizeof(buf), "\tEE_GL_DRM New Done %p %dx%d", ee, scr_w, scr_h);
+
+ snprintf(buf, sizeof(buf), "\tEE_GL_TBM New Done %p %dx%d", ee, scr_w, scr_h);
e_main_ts_end(buf);
if (!ee)