From 6327f45d4f8c944dc3e98a47523fce6018fc31db Mon Sep 17 00:00:00 2001 From: Tobias Jakobi Date: Fri, 20 Feb 2015 10:39:27 +0100 Subject: [PATCH 1/4] exynos_gfx: update copyright --- gfx/drivers/exynos_gfx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/drivers/exynos_gfx.c b/gfx/drivers/exynos_gfx.c index bfdef1c94e..85cd8661fc 100644 --- a/gfx/drivers/exynos_gfx.c +++ b/gfx/drivers/exynos_gfx.c @@ -1,5 +1,5 @@ /* RetroArch - A frontend for libretro. - * Copyright (C) 2013-2014 - Tobias Jakobi + * Copyright (C) 2013-2015 - Tobias Jakobi * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- From 5574d95addea372e4fe43fb21067d41e807f8ca8 Mon Sep 17 00:00:00 2001 From: Tobias Jakobi Date: Fri, 20 Feb 2015 10:41:13 +0100 Subject: [PATCH 2/4] exynos_gfx: fix memory leak in exynos_free The exynos_device object was never freed, so we had a tiny memory leak when reinitializing the gfx backend. --- gfx/drivers/exynos_gfx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gfx/drivers/exynos_gfx.c b/gfx/drivers/exynos_gfx.c index 85cd8661fc..df18538007 100644 --- a/gfx/drivers/exynos_gfx.c +++ b/gfx/drivers/exynos_gfx.c @@ -910,6 +910,9 @@ static void exynos_free(struct exynos_data *pdata) exynos_bo_destroy(pdata->buf[i]); pdata->buf[i] = NULL; } + + exynos_device_destroy(pdata->device); + pdata->device = NULL; } #if (EXYNOS_GFX_DEBUG_LOG == 1) From 551123d4d680752d0f6be5d8a051c21efada3219 Mon Sep 17 00:00:00 2001 From: Tobias Jakobi Date: Fri, 20 Feb 2015 10:44:54 +0100 Subject: [PATCH 3/4] exynos_gfx: set connector_id in exynos_init The connector ID is only used for initial setup of the CRTC and when deinitializing the backend, so this bug probably wasn't noticed at all. --- gfx/drivers/exynos_gfx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gfx/drivers/exynos_gfx.c b/gfx/drivers/exynos_gfx.c index df18538007..b308fcfbce 100644 --- a/gfx/drivers/exynos_gfx.c +++ b/gfx/drivers/exynos_gfx.c @@ -743,6 +743,7 @@ static int exynos_init(struct exynos_data *pdata, unsigned bpp) } drm->crtc_id = drm->encoder->crtc_id; + drm->connector_id = drm->connector->connector_id; drm->orig_crtc = drmModeGetCrtc(fd, drm->crtc_id); if (!drm->orig_crtc) RARCH_WARN("video_exynos: cannot find original crtc\n"); From cf3eea13dff84e56ef3fb06c9fa3d1f6f7d59c6e Mon Sep 17 00:00:00 2001 From: Tobias Jakobi Date: Fri, 20 Feb 2015 10:54:23 +0100 Subject: [PATCH 4/4] exynos_gfx: handle drmModeSetCrtc failing This shouldn't happen anymore after the connector ID fix, but the checks don't hurt and protect us from future mishaps. --- gfx/drivers/exynos_gfx.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gfx/drivers/exynos_gfx.c b/gfx/drivers/exynos_gfx.c index b308fcfbce..7b45351951 100644 --- a/gfx/drivers/exynos_gfx.c +++ b/gfx/drivers/exynos_gfx.c @@ -874,13 +874,17 @@ static int exynos_alloc(struct exynos_data *pdata) } } + /* Setup CRTC: display the last allocated page. */ + if (drmModeSetCrtc(pdata->fd, pdata->drm->crtc_id, pages[pdata->num_pages - 1].buf_id, + 0, 0, &pdata->drm->connector_id, 1, pdata->drm->mode)) + { + RARCH_ERR("video_exynos: initial crtc setup failed\n"); + goto fail; + } + pdata->pages = pages; pdata->device = device; - /* Setup CRTC: display the last allocated page. */ - drmModeSetCrtc(pdata->fd, pdata->drm->crtc_id, pages[pdata->num_pages - 1].buf_id, - 0, 0, &pdata->drm->connector_id, 1, pdata->drm->mode); - return 0; fail: @@ -898,8 +902,9 @@ static void exynos_free(struct exynos_data *pdata) unsigned i; /* Disable the CRTC. */ - drmModeSetCrtc(pdata->fd, pdata->drm->crtc_id, 0, - 0, 0, &pdata->drm->connector_id, 1, NULL); + if (drmModeSetCrtc(pdata->fd, pdata->drm->crtc_id, 0, + 0, 0, &pdata->drm->connector_id, 1, NULL)) + RARCH_WARN("video_exynos: failed to disable the crtc\n"); clean_up_pages(pdata->pages, pdata->num_pages);