Lines Matching +full:flip +full:- +full:x

22  * Implementation based on the pre-KMS implementation in xf86-video-nouveau,
40 bool flip; member
70 * sin(x degrees) ~= 4 x (180 - x) / (40500 - x (180 - x) )
72 * Also note that sin(x) == -sin(x - 180)
78 degrees -= 180; in sin_mul()
79 factor *= -1; in sin_mul()
81 return factor * 4 * degrees * (180 - degrees) / in sin_mul()
82 (40500 - degrees * (180 - degrees)); in sin_mul()
85 /* cos(x) = sin(x + 90) */
98 DRM_DEBUG_KMS("Unsuitable framebuffer scaling: %dx%d -> %dx%d\n", in verify_scaling()
100 return -ERANGE; in verify_scaling()
106 return -ERANGE; in verify_scaling()
120 struct nouveau_drm *drm = nouveau_drm(plane->dev); in nv10_update_plane()
121 struct nvif_object *dev = &drm->client.device.object; in nv10_update_plane()
125 struct nouveau_bo *cur = nv_plane->cur; in nv10_update_plane()
127 bool flip = nv_plane->flip; in nv10_update_plane() local
128 int soff = NV_PCRTC0_SIZE * nv_crtc->index; in nv10_update_plane()
129 int soff2 = NV_PCRTC0_SIZE * !nv_crtc->index; in nv10_update_plane()
130 unsigned shift = drm->client.device.info.chipset >= 0x30 ? 1 : 3; in nv10_update_plane()
144 nvbo = nouveau_gem_object(fb->obj[0]); in nv10_update_plane()
149 nv_plane->cur = nvbo; in nv10_update_plane()
154 nvif_wr32(dev, NV_PVIDEO_BASE(flip), 0); in nv10_update_plane()
155 nvif_wr32(dev, NV_PVIDEO_OFFSET_BUFF(flip), nvbo->offset); in nv10_update_plane()
156 nvif_wr32(dev, NV_PVIDEO_SIZE_IN(flip), src_h << 16 | src_w); in nv10_update_plane()
157 nvif_wr32(dev, NV_PVIDEO_POINT_IN(flip), src_y << 16 | src_x); in nv10_update_plane()
158 nvif_wr32(dev, NV_PVIDEO_DS_DX(flip), (src_w << 20) / crtc_w); in nv10_update_plane()
159 nvif_wr32(dev, NV_PVIDEO_DT_DY(flip), (src_h << 20) / crtc_h); in nv10_update_plane()
160 nvif_wr32(dev, NV_PVIDEO_POINT_OUT(flip), crtc_y << 16 | crtc_x); in nv10_update_plane()
161 nvif_wr32(dev, NV_PVIDEO_SIZE_OUT(flip), crtc_h << 16 | crtc_w); in nv10_update_plane()
163 if (fb->format->format == DRM_FORMAT_YUYV || in nv10_update_plane()
164 fb->format->format == DRM_FORMAT_NV12) in nv10_update_plane()
166 if (fb->format->format == DRM_FORMAT_NV12 || in nv10_update_plane()
167 fb->format->format == DRM_FORMAT_NV21) in nv10_update_plane()
169 if (nv_plane->color_encoding == DRM_COLOR_YCBCR_BT709) in nv10_update_plane()
171 if (nv_plane->colorkey & (1 << 24)) in nv10_update_plane()
175 nvif_wr32(dev, NV_PVIDEO_UVPLANE_BASE(flip), 0); in nv10_update_plane()
176 nvif_wr32(dev, NV_PVIDEO_UVPLANE_OFFSET_BUFF(flip), in nv10_update_plane()
177 nvbo->offset + fb->offsets[1]); in nv10_update_plane()
179 nvif_wr32(dev, NV_PVIDEO_FORMAT(flip), format | fb->pitches[0]); in nv10_update_plane()
182 nvif_wr32(dev, NV_PVIDEO_BUFFER, flip ? 0x10 : 0x1); in nv10_update_plane()
183 nv_plane->flip = !flip; in nv10_update_plane()
195 struct nvif_object *dev = &nouveau_drm(plane->dev)->client.device.object; in nv10_disable_plane()
200 if (nv_plane->cur) { in nv10_disable_plane()
201 nouveau_bo_unpin(nv_plane->cur); in nv10_disable_plane()
202 nv_plane->cur = NULL; in nv10_disable_plane()
219 struct nvif_object *dev = &nouveau_drm(plane->base.dev)->client.device.object; in nv10_set_params()
220 u32 luma = (plane->brightness - 512) << 16 | plane->contrast; in nv10_set_params()
221 u32 chroma = ((sin_mul(plane->hue, plane->saturation) & 0xffff) << 16) | in nv10_set_params()
222 (cos_mul(plane->hue, plane->saturation) & 0xffff); in nv10_set_params()
229 nvif_wr32(dev, NV_PVIDEO_COLOR_KEY, plane->colorkey & 0xffffff); in nv10_set_params()
231 if (plane->cur) { in nv10_set_params()
232 if (plane->color_encoding == DRM_COLOR_YCBCR_BT709) in nv10_set_params()
234 if (plane->colorkey & (1 << 24)) in nv10_set_params()
236 nvif_mask(dev, NV_PVIDEO_FORMAT(plane->flip), in nv10_set_params()
251 if (property == nv_plane->props.colorkey) in nv_set_property()
252 nv_plane->colorkey = value; in nv_set_property()
253 else if (property == nv_plane->props.contrast) in nv_set_property()
254 nv_plane->contrast = value; in nv_set_property()
255 else if (property == nv_plane->props.brightness) in nv_set_property()
256 nv_plane->brightness = value; in nv_set_property()
257 else if (property == nv_plane->props.hue) in nv_set_property()
258 nv_plane->hue = value; in nv_set_property()
259 else if (property == nv_plane->props.saturation) in nv_set_property()
260 nv_plane->saturation = value; in nv_set_property()
261 else if (property == nv_plane->base.color_encoding_property) in nv_set_property()
262 nv_plane->color_encoding = value; in nv_set_property()
264 return -EINVAL; in nv_set_property()
266 if (nv_plane->set_params) in nv_set_property()
267 nv_plane->set_params(nv_plane); in nv_set_property()
289 switch (drm->client.device.info.chipset) { in nv10_overlay_init()
299 ret = drm_universal_plane_init(device, &plane->base, 3 /* both crtc's */, in nv10_overlay_init()
307 plane->props.colorkey = drm_property_create_range( in nv10_overlay_init()
309 plane->props.contrast = drm_property_create_range( in nv10_overlay_init()
310 device, 0, "contrast", 0, 8192 - 1); in nv10_overlay_init()
311 plane->props.brightness = drm_property_create_range( in nv10_overlay_init()
313 plane->props.hue = drm_property_create_range( in nv10_overlay_init()
315 plane->props.saturation = drm_property_create_range( in nv10_overlay_init()
316 device, 0, "saturation", 0, 8192 - 1); in nv10_overlay_init()
317 if (!plane->props.colorkey || in nv10_overlay_init()
318 !plane->props.contrast || in nv10_overlay_init()
319 !plane->props.brightness || in nv10_overlay_init()
320 !plane->props.hue || in nv10_overlay_init()
321 !plane->props.saturation) in nv10_overlay_init()
324 plane->colorkey = 0; in nv10_overlay_init()
325 drm_object_attach_property(&plane->base.base, in nv10_overlay_init()
326 plane->props.colorkey, plane->colorkey); in nv10_overlay_init()
328 plane->contrast = 0x1000; in nv10_overlay_init()
329 drm_object_attach_property(&plane->base.base, in nv10_overlay_init()
330 plane->props.contrast, plane->contrast); in nv10_overlay_init()
332 plane->brightness = 512; in nv10_overlay_init()
333 drm_object_attach_property(&plane->base.base, in nv10_overlay_init()
334 plane->props.brightness, plane->brightness); in nv10_overlay_init()
336 plane->hue = 0; in nv10_overlay_init()
337 drm_object_attach_property(&plane->base.base, in nv10_overlay_init()
338 plane->props.hue, plane->hue); in nv10_overlay_init()
340 plane->saturation = 0x1000; in nv10_overlay_init()
341 drm_object_attach_property(&plane->base.base, in nv10_overlay_init()
342 plane->props.saturation, plane->saturation); in nv10_overlay_init()
344 plane->color_encoding = DRM_COLOR_YCBCR_BT601; in nv10_overlay_init()
345 drm_plane_create_color_properties(&plane->base, in nv10_overlay_init()
352 plane->set_params = nv10_set_params; in nv10_overlay_init()
354 drm_plane_force_disable(&plane->base); in nv10_overlay_init()
357 drm_plane_cleanup(&plane->base); in nv10_overlay_init()
371 struct nvif_object *dev = &nouveau_drm(plane->dev)->client.device.object; in nv04_update_plane()
374 struct nouveau_bo *cur = nv_plane->cur; in nv04_update_plane()
377 int brightness = (nv_plane->brightness - 512) * 62 / 512; in nv04_update_plane()
390 nvbo = nouveau_gem_object(fb->obj[0]); in nv04_update_plane()
395 nv_plane->cur = nvbo; in nv04_update_plane()
403 nvbo->offset); in nv04_update_plane()
405 fb->pitches[0]); in nv04_update_plane()
411 …(uint32_t)(((src_h - 1) << 11) / (crtc_h - 1)) << 16 | (uint32_t)(((src_w - 1) << 11) / (crtc_w - in nv04_update_plane()
414 nvif_wr32(dev, NV_PVIDEO_RED_CSC_OFFSET, 0x69 - brightness); in nv04_update_plane()
416 nvif_wr32(dev, NV_PVIDEO_BLUE_CSC_OFFSET, 0x89 - brightness); in nv04_update_plane()
425 nvif_wr32(dev, NV_PVIDEO_KEY, nv_plane->colorkey); in nv04_update_plane()
427 if (nv_plane->colorkey & (1 << 24)) in nv04_update_plane()
429 if (fb->format->format == DRM_FORMAT_YUYV) in nv04_update_plane()
446 struct nvif_object *dev = &nouveau_drm(plane->dev)->client.device.object; in nv04_disable_plane()
454 if (nv_plane->cur) { in nv04_disable_plane()
455 nouveau_bo_unpin(nv_plane->cur); in nv04_disable_plane()
456 nv_plane->cur = NULL; in nv04_disable_plane()
479 ret = drm_universal_plane_init(device, &plane->base, 1 /* single crtc */, in nv04_overlay_init()
486 plane->props.colorkey = drm_property_create_range( in nv04_overlay_init()
488 plane->props.brightness = drm_property_create_range( in nv04_overlay_init()
490 if (!plane->props.colorkey || in nv04_overlay_init()
491 !plane->props.brightness) in nv04_overlay_init()
494 plane->colorkey = 0; in nv04_overlay_init()
495 drm_object_attach_property(&plane->base.base, in nv04_overlay_init()
496 plane->props.colorkey, plane->colorkey); in nv04_overlay_init()
498 plane->brightness = 512; in nv04_overlay_init()
499 drm_object_attach_property(&plane->base.base, in nv04_overlay_init()
500 plane->props.brightness, plane->brightness); in nv04_overlay_init()
502 drm_plane_force_disable(&plane->base); in nv04_overlay_init()
505 drm_plane_cleanup(&plane->base); in nv04_overlay_init()
514 struct nvif_device *dev = &nouveau_drm(device)->client.device; in nouveau_overlay_init()
515 if (dev->info.chipset < 0x10) in nouveau_overlay_init()
517 else if (dev->info.chipset <= 0x40) in nouveau_overlay_init()