aboutsummaryrefslogblamecommitdiffstats
path: root/libgamma_linux_drm_internal_release_connectors_and_encoders.c
blob: fe61dac61f508877d91f0e1ea2289ac964ed2c72 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
                                                         
                             








                                       
                                                                                                         




                                         
                                                                                







                                                                      
                                                                                





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