forked from enlightenment/efl
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
This commit is contained in:
parent
864394e793
commit
399c571ab6
|
@ -61,9 +61,6 @@ typedef struct _Ecore_Drm_Fb
|
|||
unsigned int stride, size;
|
||||
int fd;
|
||||
void *mmap;
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* struct gbm_bo *bo; */
|
||||
/* #endif */
|
||||
} Ecore_Drm_Fb;
|
||||
|
||||
struct _Ecore_Drm_Device
|
||||
|
@ -108,16 +105,6 @@ struct _Ecore_Drm_Device
|
|||
struct xkb_context *xkb_ctx;
|
||||
|
||||
unsigned int window;
|
||||
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* struct gbm_device *gbm; */
|
||||
/* struct */
|
||||
/* { */
|
||||
/* EGLDisplay disp; */
|
||||
/* EGLContext ctxt; */
|
||||
/* EGLConfig cfg; */
|
||||
/* } egl; */
|
||||
/* #endif */
|
||||
};
|
||||
|
||||
/* opaque structure to represent a drm device */
|
||||
|
|
|
@ -142,10 +142,6 @@ ecore_drm_gbm_get(Ecore_Drm_Device *dev)
|
|||
{
|
||||
if (!dev) return NULL;
|
||||
|
||||
#ifdef HAVE_GBM
|
||||
return dev->gbm;
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ _cb_device_paused(void *ctxt EINA_UNUSED, const Eldbus_Message *msg)
|
|||
{
|
||||
if (!strcmp(type, "pause"))
|
||||
{
|
||||
/* TODO: device pause done */
|
||||
_ecore_drm_dbus_device_pause_done(maj, min);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,49 +5,6 @@
|
|||
#include "ecore_drm_private.h"
|
||||
#include <dlfcn.h>
|
||||
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* static Eina_Bool */
|
||||
/* _ecore_drm_device_egl_config_get(Ecore_Drm_Device *dev, const EGLint *attribs, const EGLint *visual) */
|
||||
/* { */
|
||||
/* EGLint c = 0, m = 0; */
|
||||
/* EGLConfig *cfgs; */
|
||||
/* int i = 0; */
|
||||
|
||||
/* if (!eglGetConfigs(dev->egl.disp, NULL, 0, &c) || (c < 1)) */
|
||||
/* return EINA_FALSE; */
|
||||
|
||||
/* if (!(cfgs = calloc(c, sizeof(*cfgs)))) return EINA_FALSE; */
|
||||
|
||||
/* if (!eglChooseConfig(dev->egl.disp, attribs, cfgs, c, &m)) */
|
||||
/* { */
|
||||
/* free(cfgs); */
|
||||
/* return EINA_FALSE; */
|
||||
/* } */
|
||||
|
||||
/* for (i = 0; i < m; i++) */
|
||||
/* { */
|
||||
/* EGLint id; */
|
||||
|
||||
/* if (visual) */
|
||||
/* { */
|
||||
/* if (!eglGetConfigAttrib(dev->egl.disp, cfgs[i], */
|
||||
/* EGL_NATIVE_VISUAL_ID, &id)) */
|
||||
/* continue; */
|
||||
|
||||
/* if ((id != 0) && (id != *visual)) */
|
||||
/* continue; */
|
||||
/* } */
|
||||
|
||||
/* dev->egl.cfg = cfgs[i]; */
|
||||
/* free(cfgs); */
|
||||
/* return EINA_TRUE; */
|
||||
/* } */
|
||||
|
||||
/* free(cfgs); */
|
||||
/* return EINA_FALSE; */
|
||||
/* } */
|
||||
/* #endif */
|
||||
|
||||
static void
|
||||
_ecore_drm_device_cb_page_flip(int fd EINA_UNUSED, unsigned int frame EINA_UNUSED, unsigned int sec EINA_UNUSED, unsigned int usec EINA_UNUSED, void *data)
|
||||
{
|
||||
|
@ -322,76 +279,6 @@ ecore_drm_device_open(Ecore_Drm_Device *dev)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* if (getenv("ECORE_DRM_HW_ACCEL")) */
|
||||
/* { */
|
||||
/* Typically, gbm loads the dri driver However some versions of Mesa
|
||||
* do not have libglapi symbols linked in the driver. Because of this,
|
||||
* using hardware accel for our drm code Could fail with a
|
||||
* message that the driver could not load. Let's be proactive and
|
||||
* work around this for the user by preloading the glapi library */
|
||||
/* dlopen("libglapi.so.0", (RTLD_LAZY | RTLD_GLOBAL)); */
|
||||
|
||||
/* if ((dev->gbm = gbm_create_device(dev->drm.fd))) */
|
||||
/* { */
|
||||
/* EGLint major, minor, visual; */
|
||||
/* const EGLint attribs[] = */
|
||||
/* { */
|
||||
/* EGL_SURFACE_TYPE, EGL_WINDOW_BIT, */
|
||||
/* EGL_RED_SIZE, 1, EGL_GREEN_SIZE, 1, */
|
||||
/* EGL_BLUE_SIZE, 1, EGL_ALPHA_SIZE, 0, */
|
||||
/* EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE */
|
||||
/* }; */
|
||||
|
||||
/* dev->use_hw_accel = EINA_TRUE; */
|
||||
/* dev->format = GBM_FORMAT_XRGB8888; */
|
||||
|
||||
/* dev->egl.disp = eglGetDisplay(dev->gbm); */
|
||||
/* if (dev->egl.disp == EGL_NO_DISPLAY) */
|
||||
/* { */
|
||||
/* ERR("Could not get egl display"); */
|
||||
/* goto init_software; */
|
||||
/* } */
|
||||
|
||||
/* if (!eglInitialize(dev->egl.disp, &major, &minor)) */
|
||||
/* { */
|
||||
/* ERR("Could not initialize egl"); */
|
||||
/* goto init_software; */
|
||||
/* } */
|
||||
|
||||
/* visual = dev->format; */
|
||||
/* if (!_ecore_drm_device_egl_config_get(dev, attribs, &visual)) */
|
||||
/* { */
|
||||
/* ERR("Could not get egl config"); */
|
||||
/* goto init_software; */
|
||||
/* } */
|
||||
/* } */
|
||||
/* else */
|
||||
/* { */
|
||||
/* WRN("Failed to create gbm device"); */
|
||||
/* goto init_software; */
|
||||
/* } */
|
||||
/* } */
|
||||
/* else */
|
||||
/* #endif */
|
||||
/* { */
|
||||
/* TODO: init software */
|
||||
/* init_software: */
|
||||
/* DBG("Init Software Engine"); */
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* if (dev->egl.disp) */
|
||||
/* { */
|
||||
/* eglMakeCurrent(dev->egl.disp, EGL_NO_SURFACE, EGL_NO_SURFACE, */
|
||||
/* EGL_NO_CONTEXT); */
|
||||
/* eglTerminate(dev->egl.disp); */
|
||||
/* eglReleaseThread(); */
|
||||
/* } */
|
||||
|
||||
/* if (dev->gbm) gbm_device_destroy(dev->gbm); */
|
||||
/* dev->gbm = NULL; */
|
||||
/* #endif */
|
||||
/* } */
|
||||
|
||||
/* try to create xkb context */
|
||||
if (!(dev->xkb_ctx = xkb_context_new(0)))
|
||||
{
|
||||
|
@ -426,22 +313,6 @@ ecore_drm_device_close(Ecore_Drm_Device *dev)
|
|||
/* check for valid device */
|
||||
if (!dev) return EINA_FALSE;
|
||||
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* if (dev->use_hw_accel) */
|
||||
/* { */
|
||||
/* if (dev->egl.disp) */
|
||||
/* { */
|
||||
/* eglMakeCurrent(dev->egl.disp, EGL_NO_SURFACE, EGL_NO_SURFACE, */
|
||||
/* EGL_NO_CONTEXT); */
|
||||
/* eglTerminate(dev->egl.disp); */
|
||||
/* eglReleaseThread(); */
|
||||
/* } */
|
||||
|
||||
/* if (dev->gbm) gbm_device_destroy(dev->gbm); */
|
||||
/* dev->gbm = NULL; */
|
||||
/* } */
|
||||
/* #endif */
|
||||
|
||||
/* close xkb context */
|
||||
if (dev->xkb_ctx) xkb_context_unref(dev->xkb_ctx);
|
||||
|
||||
|
|
|
@ -95,60 +95,3 @@ ecore_drm_fb_destroy(Ecore_Drm_Fb *fb)
|
|||
drmIoctl(fb->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &darg);
|
||||
free(fb);
|
||||
}
|
||||
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* static void */
|
||||
/* _ecore_drm_fb_user_data_destroy(struct gbm_bo *bo EINA_UNUSED, void *data) */
|
||||
/* { */
|
||||
/* Ecore_Drm_Fb *fb; */
|
||||
|
||||
/* if (!(fb = data)) return; */
|
||||
/* ecore_drm_fb_destroy(fb); */
|
||||
/* } */
|
||||
|
||||
/* Ecore_Drm_Fb * */
|
||||
/* _ecore_drm_fb_bo_get(Ecore_Drm_Device *dev, struct gbm_bo *bo) */
|
||||
/* { */
|
||||
/* Ecore_Drm_Fb *fb; */
|
||||
/* unsigned int width, height; */
|
||||
/* unsigned int h[4], p[4], o[4]; */
|
||||
/* int ret = -1; */
|
||||
|
||||
/* if ((fb = gbm_bo_get_user_data(bo))) return fb; */
|
||||
|
||||
/* if (!(fb = calloc(1, sizeof(Ecore_Drm_Fb)))) return NULL; */
|
||||
|
||||
/* fb->bo = bo; */
|
||||
|
||||
/* width = gbm_bo_get_width(bo); */
|
||||
/* height = gbm_bo_get_height(bo); */
|
||||
/* fb->stride = gbm_bo_get_stride(bo); */
|
||||
/* fb->hdl = gbm_bo_get_handle(bo).u32; */
|
||||
/* fb->size = (fb->stride * height); */
|
||||
/* fb->fd = dev->drm.fd; */
|
||||
|
||||
/* h[0] = fb->hdl; */
|
||||
/* p[0] = fb->stride; */
|
||||
/* o[0] = 0; */
|
||||
|
||||
/* ret = drmModeAddFB2(dev->drm.fd, width, height, dev->format, h, p, o, */
|
||||
/* &fb->id, 0); */
|
||||
/* if (ret) */
|
||||
/* { */
|
||||
/* ret = drmModeAddFB(dev->drm.fd, width, height, 24, 32, */
|
||||
/* fb->stride, fb->hdl, &fb->id); */
|
||||
|
||||
/* } */
|
||||
|
||||
/* if (ret) */
|
||||
/* { */
|
||||
/* ERR("Error during ModeAddFb"); */
|
||||
/* free(fb); */
|
||||
/* return NULL; */
|
||||
/* } */
|
||||
|
||||
/* gbm_bo_set_user_data(bo, fb, _ecore_drm_fb_user_data_destroy); */
|
||||
|
||||
/* return fb; */
|
||||
/* } */
|
||||
/* #endif */
|
||||
|
|
|
@ -14,145 +14,6 @@ static const char *conn_types[] =
|
|||
};
|
||||
|
||||
/* local functions */
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* static Eina_Bool */
|
||||
/* _ecore_drm_output_context_create(Ecore_Drm_Device *dev, EGLSurface surface) */
|
||||
/* { */
|
||||
/* EGLBoolean r; */
|
||||
/* static const EGLint attribs[] = */
|
||||
/* { */
|
||||
/* EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE */
|
||||
/* }; */
|
||||
|
||||
/* if ((!dev->egl.disp) || (!dev->egl.cfg)) return EINA_FALSE; */
|
||||
|
||||
/* if (!eglBindAPI(EGL_OPENGL_ES_API)) */
|
||||
/* { */
|
||||
/* ERR("Could not bind egl api"); */
|
||||
/* return EINA_FALSE; */
|
||||
/* } */
|
||||
|
||||
/* dev->egl.ctxt = */
|
||||
/* eglCreateContext(dev->egl.disp, dev->egl.cfg, EGL_NO_CONTEXT, attribs); */
|
||||
/* if (!dev->egl.ctxt) */
|
||||
/* { */
|
||||
/* ERR("Could not create Egl Context"); */
|
||||
/* return EINA_FALSE; */
|
||||
/* } */
|
||||
|
||||
/* r = eglMakeCurrent(dev->egl.disp, surface, surface, dev->egl.ctxt); */
|
||||
/* if (r == EGL_FALSE) */
|
||||
/* { */
|
||||
/* ERR("Could not make surface current"); */
|
||||
/* return EINA_FALSE; */
|
||||
/* } */
|
||||
|
||||
/* return EINA_TRUE; */
|
||||
/* } */
|
||||
|
||||
/* static Eina_Bool */
|
||||
/* _ecore_drm_output_hardware_setup(Ecore_Drm_Device *dev, Ecore_Drm_Output *output) */
|
||||
/* { */
|
||||
/* unsigned int i = 0; */
|
||||
/* int flags = 0; */
|
||||
/* int w = 0, h = 0; */
|
||||
|
||||
/* if ((!dev) || (!output)) return EINA_FALSE; */
|
||||
|
||||
/* if (output->current_mode) */
|
||||
/* { */
|
||||
/* w = output->current_mode->width; */
|
||||
/* h = output->current_mode->height; */
|
||||
/* } */
|
||||
/* else */
|
||||
/* { */
|
||||
/* w = 1024; */
|
||||
/* h = 768; */
|
||||
/* } */
|
||||
|
||||
/* flags = (GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); */
|
||||
|
||||
/* if (!(output->surface = */
|
||||
/* gbm_surface_create(dev->gbm, w, h, GBM_FORMAT_ARGB8888, flags))) */
|
||||
/* { */
|
||||
/* ERR("Could not create output surface"); */
|
||||
/* return EINA_FALSE; */
|
||||
/* } */
|
||||
|
||||
/* if (!(output->egl.surface = */
|
||||
/* eglCreateWindowSurface(dev->egl.disp, dev->egl.cfg, */
|
||||
/* output->surface, NULL))) */
|
||||
/* { */
|
||||
/* ERR("Could not create output egl surface"); */
|
||||
/* gbm_surface_destroy(output->surface); */
|
||||
/* return EINA_FALSE; */
|
||||
/* } */
|
||||
|
||||
/* if (!dev->egl.ctxt) */
|
||||
/* { */
|
||||
/* if (!_ecore_drm_output_context_create(dev, output->egl.surface)) */
|
||||
/* { */
|
||||
/* ERR("Could not create context"); */
|
||||
/* gbm_surface_destroy(output->surface); */
|
||||
/* return EINA_FALSE; */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* flags = (GBM_BO_USE_CURSOR_64X64 | GBM_BO_USE_WRITE); */
|
||||
/* for (i = 0; i < NUM_FRAME_BUFFERS; i++) */
|
||||
/* { */
|
||||
/* if (output->cursor[i]) continue; */
|
||||
/* if (!(output->cursor[i] = */
|
||||
/* gbm_bo_create(dev->gbm, 64, 64, dev->format, flags))) */
|
||||
/* { */
|
||||
/* continue; */
|
||||
/* } */
|
||||
/* } */
|
||||
|
||||
/* if ((!output->cursor[0]) || (!output->cursor[1])) */
|
||||
/* { */
|
||||
/* WRN("Hardware Cursor Buffers not available"); */
|
||||
/* dev->cursors_broken = EINA_TRUE; */
|
||||
/* } */
|
||||
|
||||
/* return EINA_TRUE; */
|
||||
/* } */
|
||||
|
||||
/* static void */
|
||||
/* _ecore_drm_output_hardware_render(Ecore_Drm_Output *output) */
|
||||
/* { */
|
||||
/* struct gbm_bo *bo; */
|
||||
/* int ret; */
|
||||
|
||||
/* if (!output) return; */
|
||||
/* if (!output->current_mode) return; */
|
||||
|
||||
/* glViewport(output->x, output->y, */
|
||||
/* output->current_mode->width, output->current_mode->height); */
|
||||
|
||||
/* if (eglMakeCurrent(output->dev->egl.disp, output->egl.surface, */
|
||||
/* output->egl.surface, output->dev->egl.ctxt) == EGL_FALSE) */
|
||||
/* return; */
|
||||
|
||||
/* glClearColor(1.0, 1.0, 0.0, 1.0); */
|
||||
/* glClear(GL_COLOR_BUFFER_BIT); */
|
||||
/* glFlush(); */
|
||||
|
||||
/* eglSwapBuffers(output->dev->egl.disp, output->egl.surface); */
|
||||
|
||||
/* if (!(bo = gbm_surface_lock_front_buffer(output->surface))) */
|
||||
/* { */
|
||||
/* ERR("Failed to lock front buffer"); */
|
||||
/* return; */
|
||||
/* } */
|
||||
|
||||
/* if (!(output->next = _ecore_drm_fb_bo_get(output->dev, bo))) */
|
||||
/* { */
|
||||
/* ERR("Failed to get FB from bo"); */
|
||||
/* gbm_surface_release_buffer(output->surface, bo); */
|
||||
/* } */
|
||||
/* } */
|
||||
/* #endif */
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_drm_output_software_setup(Ecore_Drm_Device *dev, Ecore_Drm_Output *output)
|
||||
|
@ -510,23 +371,6 @@ _ecore_drm_output_create(Ecore_Drm_Device *dev, drmModeRes *res, drmModeConnecto
|
|||
if (!output->current_mode) goto mode_err;
|
||||
}
|
||||
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* if ((dev->use_hw_accel) && (dev->gbm)) */
|
||||
/* { */
|
||||
/* if (!_ecore_drm_output_hardware_setup(dev, output)) */
|
||||
/* { */
|
||||
/* ERR("Could not setup output for hardware acceleration"); */
|
||||
/* dev->use_hw_accel = EINA_FALSE; */
|
||||
/* if (!_ecore_drm_output_software_setup(dev, output)) */
|
||||
/* goto mode_err; */
|
||||
/* else */
|
||||
/* DBG("Setup Output %d for Software Rendering", output->crtc_id); */
|
||||
/* } */
|
||||
/* else */
|
||||
/* DBG("Setup Output %d for Hardware Acceleration", output->crtc_id); */
|
||||
/* } */
|
||||
/* else */
|
||||
/* #endif */
|
||||
{
|
||||
dev->use_hw_accel = EINA_FALSE;
|
||||
if (!_ecore_drm_output_software_setup(dev, output))
|
||||
|
@ -597,10 +441,6 @@ _ecore_drm_output_fb_release(Ecore_Drm_Output *output, Ecore_Drm_Fb *fb)
|
|||
|
||||
if ((fb->mmap) && (fb != output->dumb[0]) && (fb != output->dumb[1]))
|
||||
ecore_drm_fb_destroy(fb);
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* else if (fb->bo) */
|
||||
/* gbm_bo_destroy(fb->bo); */
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -854,15 +694,6 @@ ecore_drm_output_fb_release(Ecore_Drm_Output *output, Ecore_Drm_Fb *fb)
|
|||
|
||||
if ((fb->mmap) && (fb != output->dumb[0]) && (fb != output->dumb[1]))
|
||||
ecore_drm_fb_destroy(fb);
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* else if (fb->bo) */
|
||||
/* { */
|
||||
/* if (fb->from_client) */
|
||||
/* gbm_bo_destroy(fb->bo); */
|
||||
/* else */
|
||||
/* gbm_surface_release_buffer(output->surface, fb->bo); */
|
||||
/* } */
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -880,13 +711,6 @@ ecore_drm_output_repaint(Ecore_Drm_Output *output)
|
|||
|
||||
if (!output->next)
|
||||
{
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* if (output->dev->use_hw_accel) */
|
||||
/* { */
|
||||
/* _ecore_drm_output_hardware_render(output); */
|
||||
/* } */
|
||||
/* else */
|
||||
/* #endif */
|
||||
{
|
||||
_ecore_drm_output_software_render(output);
|
||||
}
|
||||
|
|
|
@ -28,14 +28,6 @@
|
|||
# include <xf86drmMode.h>
|
||||
# include <drm_fourcc.h>
|
||||
|
||||
/* # ifdef HAVE_GBM */
|
||||
/* # include <gbm.h> */
|
||||
/* # include <EGL/egl.h> */
|
||||
/* # include <EGL/eglext.h> */
|
||||
/* # include <GLES2/gl2.h> */
|
||||
/* # include <GLES2/gl2ext.h> */
|
||||
/* # endif */
|
||||
|
||||
# include <Eeze.h>
|
||||
# include <Eldbus.h>
|
||||
# include <Ecore_Drm.h>
|
||||
|
@ -136,17 +128,6 @@ struct _Ecore_Drm_Output
|
|||
Ecore_Drm_Fb *current, *next;
|
||||
Ecore_Drm_Fb *dumb[NUM_FRAME_BUFFERS];
|
||||
Ecore_Drm_Backlight *backlight;
|
||||
|
||||
/* # ifdef HAVE_GBM */
|
||||
/* struct gbm_surface *surface; */
|
||||
/* struct gbm_bo *cursor[NUM_FRAME_BUFFERS]; */
|
||||
/* struct */
|
||||
/* { */
|
||||
/* EGLSurface surface; */
|
||||
/* } egl; */
|
||||
/* # endif */
|
||||
|
||||
/* TODO: finish */
|
||||
};
|
||||
|
||||
struct _Ecore_Drm_Seat
|
||||
|
@ -259,10 +240,6 @@ void _ecore_drm_evdev_device_destroy(Ecore_Drm_Evdev *evdev);
|
|||
Ecore_Drm_Fb *_ecore_drm_fb_create(Ecore_Drm_Device *dev, int width, int height);
|
||||
void _ecore_drm_fb_destroy(Ecore_Drm_Fb *fb);
|
||||
|
||||
/* #ifdef HAVE_GBM */
|
||||
/* Ecore_Drm_Fb *_ecore_drm_fb_bo_get(Ecore_Drm_Device *dev, struct gbm_bo *bo); */
|
||||
/* #endif */
|
||||
|
||||
void _ecore_drm_output_fb_release(Ecore_Drm_Output *output, Ecore_Drm_Fb *fb);
|
||||
void _ecore_drm_output_repaint_start(Ecore_Drm_Output *output);
|
||||
void _ecore_drm_output_frame_finish(Ecore_Drm_Output *output);
|
||||
|
|
Loading…
Reference in New Issue