[Intel-gfx] [PATCH 08/11] drm: nouveau: remove dead code and pointless local lut storage

Peter Rosin peda at axentia.se
Wed Jun 21 10:35:02 UTC 2017


On 2017-06-20 21:25, Peter Rosin wrote:
> The redundant fb helpers .load_lut, .gamma_set and .gamma_get are
> no longer used. Remove the dead code and hook up the crtc .gamma_set
> to use the crtc gamma_store directly instead of duplicating that
> info locally.

[...]

> -	for (i = 0; i < 256; i++) {
> -		u16 r = nv_crtc->lut.r[i] >> 2;
> -		u16 g = nv_crtc->lut.g[i] >> 2;
> -		u16 b = nv_crtc->lut.b[i] >> 2;
> +	r = crtc->gamma_store;
> +	g = r + crtc->gamma_size;
> +	b = g + crtc->gamma_size;
>  
> +	for (i = 0; i < 256; i++) {
>  		if (disp->disp->oclass < GF110_DISP) {
> -			writew(r + 0x0000, lut + (i * 0x08) + 0);
> -			writew(g + 0x0000, lut + (i * 0x08) + 2);
> -			writew(b + 0x0000, lut + (i * 0x08) + 4);
> +			writew((*r++ >> 2) + 0x0000, lut + (i * 0x08) + 0);
> +			writew((*g++ >> 2) + 0x0000, lut + (i * 0x08) + 2);
> +			writew((*b++ >> 2) + 0x0000, lut + (i * 0x08) + 4);
>  		} else {
> -			writew(r + 0x6000, lut + (i * 0x20) + 0);
> -			writew(g + 0x6000, lut + (i * 0x20) + 2);
> -			writew(b + 0x6000, lut + (i * 0x20) + 4);
> +			writew((*r++ >> 2) + 0x6000, lut + (i * 0x20) + 0);
> +			writew((*g++ >> 2) + 0x6000, lut + (i * 0x20) + 2);
> +			writew((*b++ >> 2) + 0x6000, lut + (i * 0x20) + 4);
>  		}
>  	}
>  }

I forgot to mention this, but the above is very strange for
disp->disp->oclass >= GF110_DISP because 0x6000 interferes with
the 14 bits that appear to be the lut depth in the registers.

I suspect some other bit-shift should be used for that case?

Someone should probably consult a datasheet...

Cheers,
peda


More information about the Intel-gfx mailing list