[PATCH v2] Disable CRTCs when disabling the outputs

Piotr Redlewski predlewski at gmail.com
Wed Jun 24 09:14:27 PDT 2015


On Wed, Jun 24, 2015 at 11:33:00AM +0900, Michel Dänzer wrote:
> On 24.06.2015 04:38, Piotr Redlewski wrote:
> > When turning the outputs off (DPMSModeOff), CRTCs stayed enabled. This led
> > to higher gpu temperatures than with fglrx driver.
> > 
> > v2: when entering DPMS also disable active CRTCs
> > 
> > Signed-off-by: Piotr Redlewski <predlewski at gmail.com>
> 
> [...]
> 
> > +	output_ids = calloc(sizeof(uint32_t), xf86_config->num_output);
> > +	if (!output_ids)
> > +		return;
> > +
> > +	for (i = 0; i < xf86_config->num_output; i++) {
> > +		xf86OutputPtr output = xf86_config->output[i];
> > +		drmmode_output_private_ptr drmmode_output;
> > +
> > +		if (output->crtc != crtc)
> > +			continue;
> > +
> > +		drmmode_output = output->driver_private;
> > +		output_ids[output_count]
> > +			= drmmode_output->mode_output->connector_id;
> > +		output_count++;
> > +	}
> > +
> > +	drmmode_ConvertToKMode(crtc->scrn, &kmode, &crtc->mode);
> > +
> > +	drmModeSetCrtc(drmmode->fd, drmmode_crtc->mode_crtc->crtc_id,
> > +		       drmmode->fb_id, crtc->x, crtc->y, output_ids,
> > +		       output_count, &kmode);
> > +
> > +	free(output_ids);
> 
> This could be simplified to:
> 
> 	crtc->funcs->set_mode_major(crtc, &crtc->mode, crtc->rotation, crtc->x,
> 				    crtc->y);

I like the simplicity of it. I didn't do it like this from begining because
drmmode_set_mode_major() do few more things which I wasn't sure that are
necessary here. Thanks for pointing this out.

> 
> One side effect of that is it calls drmmode_output_dpms() to enable the
> outputs associated with the CRTC, but I think the X server would do
> that anyway after enabling the CRTC. What do you think?
> 

Yes, X server enable the outputs right after enabling the CRTC, so this is not a
problem.

> 
> -- 
> Earthling Michel Dänzer               |               http://www.amd.com
> Libre software enthusiast             |             Mesa and X developer


More information about the xorg-driver-ati mailing list