Create drm_free

This commit is contained in:
twinaphex 2015-11-26 17:34:35 +01:00
parent e06121b661
commit 7e08f5d908
4 changed files with 18 additions and 23 deletions

View File

@ -41,3 +41,14 @@ void drm_restore_crtc(void)
drmModeFreeCrtc(g_orig_crtc);
g_orig_crtc = NULL;
}
void drm_free(void)
{
if (g_drm_encoder)
drmModeFreeEncoder(g_drm_encoder);
if (g_drm_connector)
drmModeFreeConnector(g_drm_connector);
if (g_drm_resources)
drmModeFreeResources(g_drm_resources);
}

View File

@ -38,6 +38,8 @@ extern drmModeModeInfo *g_drm_mode;
/* Restore the original CRTC. */
void drm_restore_crtc(void);
void drm_free(void);
#ifdef __cplusplus
}
#endif

View File

@ -197,19 +197,6 @@ static int exynos_get_device_index(void)
return index;
}
static void exynos_clean_up_drm(void)
{
if (g_drm_encoder)
drmModeFreeEncoder(g_drm_encoder);
if (g_drm_connector)
drmModeFreeConnector(g_drm_connector);
if (g_drm_resources)
drmModeFreeResources(g_drm_resources);
close(g_drm_fd);
}
/* The main pageflip handler, which the DRM executes
* when it flips to the page.
*
@ -657,7 +644,8 @@ static int exynos_open(struct exynos_data *pdata)
fail:
free(fliphandler);
exynos_clean_up_drm();
drm_free();
close(g_drm_fd);
return -1;
}
@ -670,7 +658,8 @@ static void exynos_close(struct exynos_data *pdata)
memset(pdata->drmname, 0, sizeof(char) * 32);
exynos_clean_up_drm();
drm_free();
close(g_drm_fd);
g_drm_fd = -1;
}

View File

@ -298,14 +298,7 @@ static void free_drm_resources(gfx_ctx_drm_egl_data_t *drm)
if (drm->g_gbm_dev)
gbm_device_destroy(drm->g_gbm_dev);
if (g_drm_encoder)
drmModeFreeEncoder(g_drm_encoder);
if (g_drm_connector)
drmModeFreeConnector(g_drm_connector);
if (g_drm_resources)
drmModeFreeResources(g_drm_resources);
drm_free();
if (g_drm_fd >= 0)
retro_fclose(drm->g_drm);