aboutsummaryrefslogtreecommitdiffstats
path: root/libgamma_linux_drm_internal_release_connectors_and_encoders.c
blob: 35cc6b9a1052dd43437e708dd2c2237a5b08e924 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* See LICENSE file for copyright and license details. */
#define IN_LIBGAMMA_LINUX_DRM
#include "common.h"


/**
 * Release all connectors and encoders
 * 
 * @param  this  The graphics card data
 */
void
libgamma_linux_drm_internal_release_connectors_and_encoders(libgamma_drm_card_data_t *restrict this)
{
	size_t i, n;

	/* Release individual encoders */
	if (this->encoders)
		for (i = 0, n = (size_t)(this->res->count_connectors); i < n; i++)
			if (this->encoders[i])
				drmModeFreeEncoder(this->encoders[i]);
	/* Release encoder array */
	free(this->encoders);
	this->encoders = NULL;

	/* Release individual connectors */
	if (this->connectors)
		for (i = 0, n = (size_t)(this->res->count_connectors); i < n; i++)
			if (this->connectors[i])
				drmModeFreeConnector(this->connectors[i]);
	/* Release connector array */
	free(this->connectors);
	this->connectors = NULL;
}