disp->DriverData = NULL;
}
+struct dri2_egl_display *
+dri2_display_create(void)
+{
+ struct dri2_egl_display *dri2_dpy = calloc(1, sizeof *dri2_dpy);
+ if (!dri2_dpy) {
+ _eglError(EGL_BAD_ALLOC, "eglInitialize");
+ return NULL;
+ }
+
+ dri2_dpy->fd_render_gpu = -1;
+ dri2_dpy->fd_display_gpu = -1;
+ return dri2_dpy;
+}
+
__DRIbuffer *
dri2_egl_surface_alloc_local_buffer(struct dri2_egl_surface *dri2_surf,
unsigned int att, unsigned int format)
void
dri2_display_destroy(_EGLDisplay *disp);
+struct dri2_egl_display *
+dri2_display_create(void);
+
__DRIbuffer *
dri2_egl_surface_alloc_local_buffer(struct dri2_egl_surface *dri2_surf,
unsigned int att, unsigned int format);
dri2_initialize_device(_EGLDisplay *disp)
{
_EGLDevice *dev;
- struct dri2_egl_display *dri2_dpy;
const char *err;
-
- dri2_dpy = calloc(1, sizeof *dri2_dpy);
+ struct dri2_egl_display *dri2_dpy = dri2_display_create();
if (!dri2_dpy)
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
+ return EGL_FALSE;
/* Extension requires a PlatformDisplay - the EGLDevice. */
dev = disp->PlatformDisplay;
- dri2_dpy->fd_render_gpu = -1;
- dri2_dpy->fd_display_gpu = -1;
disp->Device = dev;
disp->DriverData = (void *)dri2_dpy;
err = "DRI2: failed to load driver";
dri2_initialize_drm(_EGLDisplay *disp)
{
_EGLDevice *dev;
- struct dri2_egl_display *dri2_dpy;
struct gbm_device *gbm;
const char *err;
-
- dri2_dpy = calloc(1, sizeof *dri2_dpy);
+ struct dri2_egl_display *dri2_dpy = dri2_display_create();
if (!dri2_dpy)
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
+ return EGL_FALSE;
- dri2_dpy->fd_render_gpu = -1;
- dri2_dpy->fd_display_gpu = -1;
disp->DriverData = (void *)dri2_dpy;
gbm = disp->PlatformDisplay;
EGLBoolean
dri2_initialize_surfaceless(_EGLDisplay *disp)
{
- struct dri2_egl_display *dri2_dpy;
const char *err;
bool driver_loaded = false;
-
- dri2_dpy = calloc(1, sizeof *dri2_dpy);
+ struct dri2_egl_display *dri2_dpy = dri2_display_create();
if (!dri2_dpy)
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
+ return EGL_FALSE;
- dri2_dpy->fd_render_gpu = -1;
- dri2_dpy->fd_display_gpu = -1;
disp->DriverData = (void *)dri2_dpy;
/* When ForceSoftware is false, we try the HW driver. When ForceSoftware
dri2_initialize_wayland_drm(_EGLDisplay *disp)
{
_EGLDevice *dev;
- struct dri2_egl_display *dri2_dpy;
-
- dri2_dpy = calloc(1, sizeof *dri2_dpy);
+ struct dri2_egl_display *dri2_dpy = dri2_display_create();
if (!dri2_dpy)
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
+ return EGL_FALSE;
- dri2_dpy->fd_render_gpu = -1;
- dri2_dpy->fd_display_gpu = -1;
disp->DriverData = (void *)dri2_dpy;
if (dri2_wl_formats_init(&dri2_dpy->formats) < 0)
dri2_initialize_wayland_swrast(_EGLDisplay *disp)
{
_EGLDevice *dev;
- struct dri2_egl_display *dri2_dpy;
-
- dri2_dpy = calloc(1, sizeof *dri2_dpy);
+ struct dri2_egl_display *dri2_dpy = dri2_display_create();
if (!dri2_dpy)
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
+ return EGL_FALSE;
- dri2_dpy->fd_render_gpu = -1;
- dri2_dpy->fd_display_gpu = -1;
disp->DriverData = (void *)dri2_dpy;
if (dri2_wl_formats_init(&dri2_dpy->formats) < 0)
dri2_initialize_x11_swrast(_EGLDisplay *disp)
{
_EGLDevice *dev;
- struct dri2_egl_display *dri2_dpy;
-
- dri2_dpy = calloc(1, sizeof *dri2_dpy);
+ struct dri2_egl_display *dri2_dpy = dri2_display_create();
if (!dri2_dpy)
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
+ return EGL_FALSE;
- dri2_dpy->fd_render_gpu = -1;
- dri2_dpy->fd_display_gpu = -1;
if (!dri2_get_xcb_connection(disp, dri2_dpy))
goto cleanup;
dri2_initialize_x11_dri3(_EGLDisplay *disp)
{
_EGLDevice *dev;
- struct dri2_egl_display *dri2_dpy;
+ struct dri2_egl_display *dri2_dpy = dri2_display_create();
- dri2_dpy = calloc(1, sizeof *dri2_dpy);
if (!dri2_dpy)
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
+ return EGL_FALSE;
- dri2_dpy->fd_render_gpu = -1;
- dri2_dpy->fd_display_gpu = -1;
if (!dri2_get_xcb_connection(disp, dri2_dpy))
goto cleanup;
dri2_initialize_x11_dri2(_EGLDisplay *disp)
{
_EGLDevice *dev;
- struct dri2_egl_display *dri2_dpy;
-
- dri2_dpy = calloc(1, sizeof *dri2_dpy);
+ struct dri2_egl_display *dri2_dpy = dri2_display_create();
if (!dri2_dpy)
- return _eglError(EGL_BAD_ALLOC, "eglInitialize");
+ return EGL_FALSE;
- dri2_dpy->fd_render_gpu = -1;
- dri2_dpy->fd_display_gpu = -1;
if (!dri2_get_xcb_connection(disp, dri2_dpy))
goto cleanup;