aboutsummaryrefslogblamecommitdiffstats
path: root/libgamma_linux_drm_internal_release_connectors_and_encoders.c
blob: 35cc6b9a1052dd43437e708dd2c2237a5b08e924 (plain) (tree)
1
2
                                                         
                             






























                                                                                                    
/* 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;
}