Lines Matching refs:frame
92 struct sna_video_frame *frame)
95 if (video->buf && __kgem_bo_size(video->buf) < frame->size)
99 if (frame->width != video->width ||
100 frame->height != video->height ||
101 frame->id != video->format)
108 frame->width, frame->height, 32,
111 video->buf = kgem_create_linear(&video->sna->kgem, frame->size,
116 video->width = frame->width;
117 video->height = frame->height;
118 video->format = frame->id;
135 struct sna_video_frame *frame,
176 crtc_region, frame->width, frame->height);
180 frame->src.x1 = x1 >> 16;
181 frame->src.y1 = y1 >> 16;
182 frame->src.x2 = (x2 + 0xffff) >> 16;
183 frame->src.y2 = (y2 + 0xffff) >> 16;
185 frame->image.x1 = frame->src.x1 & ~1;
186 frame->image.x2 = ALIGN(frame->src.x2, 2);
187 if (is_planar_fourcc(frame->id)) {
188 frame->image.y1 = frame->src.y1 & ~1;
189 frame->image.y2 = ALIGN(frame->src.y2, 2);
191 frame->image.y1 = frame->src.y1;
192 frame->image.y2 = frame->src.y2;
201 struct sna_video_frame *frame)
207 frame->bo = NULL;
208 frame->id = id;
209 frame->width = width;
210 frame->height = height;
211 frame->rotation = 0;
216 struct sna_video_frame *frame,
219 unsigned width = frame->width;
220 unsigned height = frame->height;
224 frame->rotation = rotation;
229 if (frame->id == FOURCC_XVMC && video->sna->kgem.gen < 040 && align < 1024)
236 if (is_planar_fourcc(frame->id)) {
240 frame->pitch[0] = ALIGN((height / 2), align);
241 frame->pitch[1] = ALIGN(height, align);
242 frame->size = width;
244 frame->pitch[0] = ALIGN((width / 2), align);
245 frame->pitch[1] = ALIGN(width, align);
246 frame->size = height;
248 frame->size *= frame->pitch[0] + frame->pitch[1];
251 frame->UBufOffset = (int)frame->pitch[1] * width;
252 frame->VBufOffset =
253 frame->UBufOffset + (int)frame->pitch[0] * width / 2;
255 frame->UBufOffset = (int)frame->pitch[1] * height;
256 frame->VBufOffset =
257 frame->UBufOffset + (int)frame->pitch[0] * height / 2;
260 switch (frame->id) {
263 frame->pitch[0] = ALIGN((height << 2), align);
264 frame->size = (int)frame->pitch[0] * width;
266 frame->pitch[0] = ALIGN((width << 2), align);
267 frame->size = (int)frame->pitch[0] * height;
269 frame->UBufOffset = frame->VBufOffset = 0;
273 frame->pitch[0] = ALIGN((height << 1), align);
274 frame->size = (int)frame->pitch[0] * width;
276 frame->pitch[0] = ALIGN((width << 1), align);
277 frame->size = (int)frame->pitch[0] * height;
279 frame->UBufOffset = frame->VBufOffset = 0;
284 frame->pitch[0] = ALIGN((height << 1), align);
285 frame->size = (int)frame->pitch[0] * width;
287 frame->pitch[0] = ALIGN((width << 1), align);
288 frame->size = (int)frame->pitch[0] * height;
292 frame->pitch[1] = 0;
293 frame->UBufOffset = 0;
294 frame->VBufOffset = 0;
297 assert(frame->size);
302 const struct sna_video_frame *frame, int sub)
304 int dstPitch = frame->pitch[!sub], srcPitch;
309 x = frame->image.x1;
310 y = frame->image.y1;
311 w = frame->image.x2 - frame->image.x1;
312 h = frame->image.y2 - frame->image.y1;
316 srcPitch = ALIGN((frame->width >> 1), 4);
318 srcPitch = ALIGN(frame->width, 4);
324 switch (frame->rotation) {
367 const struct sna_video_frame *frame,
372 sna_memcpy_plane(video, dst, src, frame, 0);
373 src += frame->height * ALIGN(frame->width, 4);
375 if (frame->id == FOURCC_I420)
376 d = dst + frame->UBufOffset;
378 d = dst + frame->VBufOffset;
379 sna_memcpy_plane(video, d, src, frame, 1);
380 src += (frame->height >> 1) * ALIGN(frame->width >> 1, 4);
382 if (frame->id == FOURCC_I420)
383 d = dst + frame->VBufOffset;
385 d = dst + frame->UBufOffset;
386 sna_memcpy_plane(video, d, src, frame, 1);
391 const struct sna_video_frame *frame,
395 int pitch = frame->width << 1;
403 w = frame->width;
404 h = frame->height;
406 x = frame->image.x1;
407 y = frame->image.y1;
408 w = frame->image.x2 - frame->image.x1;
409 h = frame->image.y2 - frame->image.y1;
414 switch (frame->rotation) {
420 dst += frame->pitch[0];
429 dst[(i + 0) + ((w - j - 1) * frame->pitch[0])] = *s;
439 dst[((i * 2) + 1) + ((w - j - 1) * frame->pitch[0])] = src[(j * 2) + 1 + (i * pitch)];
440 dst[((i * 2) + 1) + ((w - j - 2) * frame->pitch[0])] = src[(j * 2) + 1 + ((i + 1) * pitch)];
441 /* Copy V */ dst[((i * 2) + 3) + ((w - j - 1) * frame->pitch[0])] = src[(j * 2) + 3 + (i * pitch)];
442 dst[((i * 2) + 3) + ((w - j - 2) * frame->pitch[0])] = src[(j * 2) + 3 + ((i + 1) * pitch)];
451 dst[(w - j - 4) + ((h - i - 1) * frame->pitch[0])] = *s++;
452 dst[(w - j - 3) + ((h - i - 1) * frame->pitch[0])] = *s++;
453 dst[(w - j - 2) + ((h - i - 1) * frame->pitch[0])] = *s++;
454 dst[(w - j - 1) + ((h - i - 1) * frame->pitch[0])] = *s++;
465 dst[(h - i - 2) + (j * frame->pitch[0])] = *s;
475 dst[(((h - i) * 2) - 3) + (j * frame->pitch[0])] = src[(j * 2) + 1 + (i * pitch)];
476 dst[(((h - i) * 2) - 3) + ((j + 1) * frame->pitch[0])] = src[(j * 2) + 1 + ((i + 1) * pitch)];
478 dst[(((h - i) * 2) - 1) + (j * frame->pitch[0])] = src[(j * 2) + 3 + (i * pitch)];
479 dst[(((h - i) * 2) - 1) + ((j + 1) * frame->pitch[0])] = src[(j * 2) + 3 + ((i + 1) * pitch)];
488 struct sna_video_frame *frame,
494 __FUNCTION__, frame->bo ? frame->bo->handle : 0,
495 frame->width, frame->height, frame->size, frame->pitch[0], frame->pitch[1],
496 frame->rotation, video->textured));
499 frame->image.x1, frame->image.y1, frame->image.x2, frame->image.y2,
500 frame->src.x1, frame->src.y1, frame->src.x2, frame->src.y2));
501 assert(frame->width && frame->height);
502 assert(frame->rotation);
503 assert(frame->size);
506 if (frame->rotation == RR_Rotate_0 && !video->tiled) {
508 __FUNCTION__, is_planar_fourcc(frame->id)));
509 if (is_planar_fourcc(frame->id)) {
510 int w = frame->image.x2 - frame->image.x1;
511 int h = frame->image.y2 - frame->image.y1;
512 if (ALIGN(h, 2) == frame->height &&
513 ALIGN(w >> 1, 4) == frame->pitch[0] &&
514 ALIGN(w, 4) == frame->pitch[1]) {
515 if (frame->bo) {
516 if (!kgem_bo_write(&video->sna->kgem, frame->bo,
517 buf, frame->size))
520 frame->bo = kgem_create_buffer(&video->sna->kgem, frame->size,
523 if (frame->bo == NULL)
526 memcpy(dst, buf, frame->size);
528 if (frame->id != FOURCC_I420) {
530 tmp = frame->VBufOffset;
531 frame->VBufOffset = frame->UBufOffset;
532 frame->UBufOffset = tmp;
542 w = frame->width;
543 h = frame->height;
545 x = frame->image.x1;
546 y = frame->image.y1;
547 w = frame->image.x2 - frame->image.x1;
548 h = frame->image.y2 - frame->image.y1;
551 if (w*2 == frame->pitch[0]) {
552 buf += (2U*y * frame->width) + (x << 1);
553 if (frame->bo) {
554 if (!kgem_bo_write(&video->sna->kgem, frame->bo,
555 buf, 2U*h*frame->width))
558 frame->bo = kgem_create_buffer(&video->sna->kgem, frame->size,
561 if (frame->bo == NULL)
564 memcpy(dst, buf, 2U*h*frame->width);
574 if (frame->bo) {
575 dst = kgem_bo_map__gtt(&video->sna->kgem, frame->bo);
579 frame->bo = kgem_create_buffer(&video->sna->kgem, frame->size,
582 if (frame->bo == NULL)
586 if (is_planar_fourcc(frame->id))
587 sna_copy_planar_data(video, frame, buf, dst);
589 sna_copy_packed_data(video, frame, buf, dst);