[PATCH xf86-video-amdgpu 3/7] Configure color properties when creating output resources

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2018-06-01 06:03 PM, sunpeng.li at amd.com wrote:
> From: "Leo (Sunpeng) Li" <sunpeng.li at amd.com>
> 
> List color management properties on outputs if there's at least one
> CRTC that supports color management. Otherwise, don't list them at
> all.
> 
> If there's no CRTC attached to the output, and there exists a CRTC
> that supports color management, then list "disabled" properties
> (immutable and NULL-valued).
> 
> Signed-off-by: Leo (Sunpeng) Li <sunpeng.li at amd.com>
> 
> [...]
>  
> +	if (cm_prop_index == CM_GAMMA_LUT_SIZE) {
> +		format = 32;
> +		length = 1;
> +		data = crtc ? &crtc->gamma_lut_size : &zero;
> +		range[0] = 0;
> +		range[1] = -1;
> +
> +	} else if (cm_prop_index == CM_DEGAMMA_LUT_SIZE) {
> +	[...]

Better use a switch statement here instead of if with multiple else if.
(Same in patch 5)


> +	/* Always issue a non-pending change. We'll push cm properties
> +	 * ourselves.
> +	 */
> +	err = RRChangeOutputProperty(output->randr_output, atom,
> +				     XA_INTEGER, format,
> +				     PropModeReplace,
> +				     length, data, FALSE, FALSE);
> +	if (err) {
> +		xf86DrvMsg(output->scrn->scrnIndex, X_ERROR,
> +			   "Changing color management property %s failed with %d\n",
> +			   cm_prop_names[cm_prop_index], err);
> +		return err;
> +	}
> +
> +	return 0;
> +}

Could simply always return err here.


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


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux