1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
|
/*
* Copyright (c) 2011 Intel Corporation. All Rights Reserved.
* Copyright (c) Imagination Technologies Limited, UK
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Zhaohan Ren <zhaohan.ren@intel.com>
* Shengquan Yuan <shengquan.yuan@intel.com>
*
*/
#include <stdio.h>
#include <math.h>
#include <psb_drm.h>
#include <va/va_backend.h>
#include <va/va_dricommon.h>
#include <wsbm/wsbm_manager.h>
#include <X11/Xlib.h>
#include <X11/X.h>
#include "psb_drv_video.h"
#include "psb_x11.h"
#include "psb_output.h"
#include "psb_xrandr.h"
#include "psb_surface_ext.h"
#include "psb_texture.h"
#define INIT_DRIVER_DATA psb_driver_data_p driver_data = (psb_driver_data_p) ctx->pDriverData;
#define INIT_OUTPUT_PRIV psb_x11_output_p output = (psb_x11_output_p)(((psb_driver_data_p)ctx->pDriverData)->ws_priv)
#define SURFACE(id) ((object_surface_p) object_heap_lookup( &driver_data->surface_heap, id ))
#define BUFFER(id) ((object_buffer_p) object_heap_lookup( &driver_data->buffer_heap, id ))
#define IMAGE(id) ((object_image_p) object_heap_lookup( &driver_data->image_heap, id ))
#define SUBPIC(id) ((object_subpic_p) object_heap_lookup( &driver_data->subpic_heap, id ))
#define CONTEXT(id) ((object_context_p) object_heap_lookup( &driver_data->context_heap, id ))
static VAStatus psb_extend_dri_init(VADriverContextP ctx, unsigned int destx, unsigned desty, unsigned destw, unsigned desth)
{
INIT_DRIVER_DATA;
INIT_OUTPUT_PRIV;
int i, ret;
union dri_buffer *extend_dri_buffer;
PPVR2DMEMINFO dri2_bb_export_meminfo;
struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
output->extend_drawable = (Window)psb_xrandr_create_full_screen_window(destx, desty, destw, desth);
if (!output->extend_drawable) {
psb__error_message("%s: Failed to create drawable for extend display # %d\n", __func__, output->extend_drawable);
}
if (texture_priv->extend_dri_drawable) {
free_drawable(ctx, texture_priv->extend_dri_drawable);
texture_priv->extend_dri_drawable = NULL;
}
texture_priv->extend_dri_drawable = dri_get_drawable(ctx, output->extend_drawable);
if (!texture_priv->extend_dri_drawable) {
psb__error_message("%s(): Failed to get extend_dri_drawable\n", __func__);
return VA_STATUS_ERROR_UNKNOWN;
}
extend_dri_buffer = dri_get_rendering_buffer(ctx, texture_priv->extend_dri_drawable);
if (!extend_dri_buffer) {
psb__error_message("%s(): Failed to get extend_dri_buffer\n", __func__);
return VA_STATUS_ERROR_UNKNOWN;
}
ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, (PVR2D_HANDLE)extend_dri_buffer->dri2.name, &dri2_bb_export_meminfo);
if (ret != PVR2D_OK) {
psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
}
memcpy(&texture_priv->extend_dri2_bb_export, dri2_bb_export_meminfo->pBase, sizeof(PVRDRI2BackBuffersExport));
for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) {
ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, texture_priv->extend_dri2_bb_export.hBuffers[i], &texture_priv->extend_blt_meminfo[i]);
if (ret != PVR2D_OK) {
psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
}
}
texture_priv->extend_dri_init_flag = 1;
return VA_STATUS_SUCCESS;
}
/* reset buffer to prevent non-video area distorting when rendering into part of a drawable */
static void psb_dri_reset_mem(VADriverContextP ctx)
{
INIT_DRIVER_DATA;
unsigned int i, size;
struct dri_drawable *tmp_drawable;
struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
tmp_drawable = (struct dri_drawable *)texture_priv->dri_drawable;
size = tmp_drawable->width * tmp_drawable->height * 4;
if (!tmp_drawable->is_window) {
memset(texture_priv->blt_meminfo_pixmap->pBase, 0x0, size);
return;
} else {
if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS)
for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++)
memset(texture_priv->blt_meminfo[i]->pBase, 0x0, size);
if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN)
for (i = 0; i < DRI2_FLIP_BUFFERS_NUM; i++)
memset(texture_priv->blt_meminfo[i]->pBase, 0x0, size);
}
return;
}
static VAStatus psb_dri_init(VADriverContextP ctx, Drawable draw)
{
INIT_DRIVER_DATA;
union dri_buffer *dri_buffer;
PPVR2DMEMINFO dri2_bb_export_meminfo;
struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
struct dri_drawable *tmp_drawable;
int i, ret;
/* free the previous drawable buffer */
if (texture_priv->dri_drawable) {
free_drawable(ctx, texture_priv->dri_drawable);
texture_priv->dri_drawable = NULL;
}
texture_priv->dri_drawable = dri_get_drawable(ctx, draw);
if (!texture_priv->dri_drawable) {
psb__error_message("%s(): Failed to get dri_drawable\n", __func__);
return VA_STATUS_ERROR_UNKNOWN;
}
tmp_drawable = (struct dri_drawable *)texture_priv->dri_drawable;
dri_buffer = dri_get_rendering_buffer(ctx, texture_priv->dri_drawable);
if (!dri_buffer) {
psb__error_message("%s(): Failed to get dri_buffer\n", __func__);
return VA_STATUS_ERROR_UNKNOWN;
}
/* pixmap */
if (!tmp_drawable->is_window) {
if (texture_priv->blt_meminfo_pixmap)
PVR2DMemFree(driver_data->hPVR2DContext, texture_priv->blt_meminfo_pixmap);
ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, (PVR2D_HANDLE)(dri_buffer->dri2.name & 0x00FFFFFF), &texture_priv->blt_meminfo_pixmap);
if (ret != PVR2D_OK) {
psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
}
/* window */
} else {
ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, (PVR2D_HANDLE)(dri_buffer->dri2.name & 0x00FFFFFF), &dri2_bb_export_meminfo);
if (ret != PVR2D_OK) {
psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
}
memcpy(&texture_priv->dri2_bb_export, dri2_bb_export_meminfo->pBase, sizeof(PVRDRI2BackBuffersExport));
if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS) {
psb__information_message("psb_dri_init: Now map buffer, DRI2 back buffer export type: DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS\n");
for (i = 0; i < DRI2_BLIT_BUFFERS_NUM; i++) {
ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, texture_priv->dri2_bb_export.hBuffers[i], &texture_priv->blt_meminfo[i]);
if (ret != PVR2D_OK) {
psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
}
}
} else if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN) {
psb__information_message("psb_dri_init: Now map buffer, DRI2 back buffer export type: DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN\n");
for (i = 0; i < DRI2_FLIP_BUFFERS_NUM; i++) {
ret = PVR2DMemMap(driver_data->hPVR2DContext, 0, texture_priv->dri2_bb_export.hBuffers[i], &texture_priv->flip_meminfo[i]);
if (ret != PVR2D_OK) {
psb__error_message("%s(): PVR2DMemMap failed, ret = %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
}
}
}
PVR2DMemFree(driver_data->hPVR2DContext, dri2_bb_export_meminfo);
}
texture_priv->dri_init_flag = 1;
psb_dri_reset_mem(ctx);
return VA_STATUS_SUCCESS;
}
VAStatus psb_putsurface_ctexture(
VADriverContextP ctx,
VASurfaceID surface,
Drawable draw,
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
unsigned int flags /* de-interlacing flags */
)
{
INIT_DRIVER_DATA;
INIT_OUTPUT_PRIV;
int ret;
int local_crtc_x, local_crtc_y, extend_crtc_x, extend_crtc_y;
int display_width = 0, display_height = 0, extend_display_width = 0, extend_display_height = 0;
int surface_width, surface_height;
psb_xrandr_location extend_location = NORMAL;
psb_extvideo_subtitle subtitle = NOSUBTITLE;
object_surface_p obj_surface = SURFACE(surface);
psb_surface_p psb_surface;
Rotation local_rotation, extend_rotation;
psb_output_device local_device, extend_device;
unsigned short tmp;
struct psb_texture_s *texture_priv = &driver_data->ctexture_priv;
struct dri_drawable *tmp_drawable;
obj_surface = SURFACE(surface);
if (NULL == obj_surface) {
psb__error_message("%s: Invalid surface ID 0x%08x.\n", __func__, surface);
return VA_STATUS_ERROR_INVALID_SURFACE;
}
if (driver_data->va_rotate == VA_ROTATION_NONE) {
psb_surface = obj_surface->psb_surface;
surface_width = obj_surface->width;
surface_height = obj_surface->height;
} else {
psb_surface = obj_surface->psb_surface_rotate;
if (driver_data->va_rotate != VA_ROTATION_180) {
tmp = srcw;
srcw = srch;
srch = tmp;
}
surface_width = obj_surface->width_r;
surface_height = obj_surface->height_r;
}
if (!psb_surface)
psb_surface = obj_surface->psb_surface;
if (output->output_drawable != draw) {
output->output_drawable = draw;
if (texture_priv->dri_init_flag)
texture_priv->drawable_update_flag = 1;
}
if (driver_data->use_xrandr_thread && !driver_data->xrandr_thread_id) {
ret = psb_xrandr_thread_create(ctx);
if (ret != 0) {
psb__error_message("%s: Failed to create psb xrandr thread error # %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
}
}
if (!texture_priv->dri_init_flag) {
texture_priv->destw_save = destw;
texture_priv->desth_save = desth;
} else {
if (texture_priv->destw_save != destw || texture_priv->desth_save != desth) {
texture_priv->destw_save = destw;
texture_priv->desth_save = desth;
texture_priv->drawable_update_flag = 1;
}
}
ret = psb_xrandr_local_crtc_coordinate(&local_device, &local_crtc_x, &local_crtc_y, &display_width, &display_height, &local_rotation);
if (ret != VA_STATUS_SUCCESS) {
psb__error_message("%s: Failed to get local crtc coordinates error # %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
}
if (!psb_xrandr_single_mode() && IS_MFLD(driver_data)) {
ret = psb_xrandr_extend_crtc_coordinate(&extend_device, &extend_crtc_x, &extend_crtc_y, &extend_display_width, &extend_display_height, &extend_location, &extend_rotation);
if (ret != VA_STATUS_SUCCESS) {
psb__error_message("%s: Failed to get extend crtc coordinates error # %d\n", __func__, ret);
return VA_STATUS_ERROR_UNKNOWN;
}
}
//Reinit DRI if screen rotates
if (texture_priv->local_rotation_save != local_rotation) {
texture_priv->local_rotation_save = local_rotation;
texture_priv->dri_init_flag = 0;
}
if (texture_priv->extend_rotation_save != extend_rotation) {
texture_priv->extend_rotation_save = extend_rotation;
texture_priv->extend_dri_init_flag = 0;
}
if (!psb_xrandr_extvideo_mode()) {
if (!texture_priv->dri_init_flag || texture_priv->drawable_update_flag) {
if (texture_priv->drawable_update_flag) {
psb__information_message("Drawable update, reinit DRI\n");
texture_priv->drawable_update_flag = 0;
}
ret = psb_dri_init(ctx, output->output_drawable);
if (ret != VA_STATUS_SUCCESS)
return VA_STATUS_ERROR_UNKNOWN;
}
}
/* Extend video */
if (psb_xrandr_clone_mode() && local_rotation == extend_rotation) {
if (output->extend_drawable) {
XDestroyWindow(ctx->native_dpy, output->extend_drawable);
output->extend_drawable = 0;
texture_priv->extend_dri_init_flag = 0;
}
psb__information_message("psb_putsurface_ctexture: Clone Mode\n");
} else if (psb_xrandr_extend_mode()) {
if (output->extend_drawable) {
XDestroyWindow(ctx->native_dpy, output->extend_drawable);
output->extend_drawable = 0;
texture_priv->extend_dri_init_flag = 0;
}
switch (extend_location) {
case LEFT_OF:
display_height = display_height > extend_display_height ? display_height : extend_display_height;
if (destw > display_width + extend_display_width)
destw = display_width + extend_display_width;
if (desth > display_height)
desth = display_height;
break;
case RIGHT_OF:
display_height = display_height > extend_display_height ? display_height : extend_display_height;
if (destw > display_width + extend_display_width)
destw = display_width + extend_display_width;
if (desth > display_height)
desth = display_height;
break;
case BELOW:
display_width = display_width > extend_display_width ? display_width : extend_display_width;
if (destw > display_width)
destw = display_width;
if (desth > display_height + extend_display_height)
desth = display_height + extend_display_height;
break;
case ABOVE:
display_width = display_width > extend_display_width ? display_width : extend_display_width;
if (destw > display_width)
destw = display_width;
if (desth > display_height + extend_display_height)
desth = display_height + extend_display_height;
break;
case NORMAL:
default:
break;
}
psb__information_message("psb_putsurface_ctexture: Extend Mode, Location: %08x\n", extend_location);
} else if (psb_xrandr_extvideo_mode()) {
unsigned int xres, yres, xoffset, yoffset, overscanmode, pannelfitting;
psb_extvideo_center center;
psb_xrandr_extvideo_prop(&xres, &yres, &xoffset, &yoffset, ¢er, &subtitle, &overscanmode, &pannelfitting);
xres = extend_display_width - xoffset;
yres = extend_display_height - yoffset;
//Init DRI for extend display
if (!texture_priv->extend_dri_init_flag) {
ret = psb_extend_dri_init(ctx, xoffset, yoffset, xres, yres);
if (ret != VA_STATUS_SUCCESS)
return VA_STATUS_ERROR_UNKNOWN;
}
psb__information_message("psb_putsurface_ctexture: ExtendVideo Mode, Location: %08x\n", extend_location);
psb__information_message("psb_putsurface_ctexture: ExtVideo coordinate srcx= %d, srcy=%d, \
srcw=%d, srch=%d, destx=%d, desty=%d, destw=%d, desth=%d, cur_buffer=%d\n",
srcx, srcy, srcw, srch, xoffset, yoffset, xres, yres, texture_priv->extend_current_blt_buffer);
if (subtitle == BOTH || subtitle == ONLY_HDMI)
psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->extend_blt_meminfo[texture_priv->extend_current_blt_buffer], surface, srcx, srcy, srcw, srch, 0, 0,
xres, yres, 1,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
else
psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->extend_blt_meminfo[texture_priv->extend_current_blt_buffer], surface, srcx, srcy, srcw, srch, 0, 0,
xres, yres, 0,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
dri_swap_buffer(ctx, texture_priv->extend_dri_drawable);
texture_priv->extend_current_blt_buffer = (texture_priv->extend_current_blt_buffer + 1) & 0x01;
/* int this mode, destination retangle may be larger than MIPI resolution, if so setting it to MIPI resolution */
if (destw > display_width)
destw = display_width;
if (desth > display_height)
desth = display_height;
/* adjust local window on MIPI, make sure it is not covered by HDMI image */
if (!texture_priv->adjust_window_flag) {
switch (extend_location) {
case ABOVE:
XMoveResizeWindow(ctx->native_dpy, output->output_drawable, 0, extend_display_height, destw, desth);
break;
case LEFT_OF:
XMoveResizeWindow(ctx->native_dpy, output->output_drawable, extend_display_width, 0, destw, desth);
break;
case BELOW:
case RIGHT_OF:
case NORMAL:
default:
break;
}
XFlush(ctx->native_dpy);
texture_priv->adjust_window_flag = 1;
}
if (!texture_priv->dri_init_flag || texture_priv->drawable_update_flag) {
if (texture_priv->drawable_update_flag) {
psb__information_message("Drawable update, reinit DRI\n");
texture_priv->drawable_update_flag = 0;
}
ret = psb_dri_init(ctx, output->output_drawable);
if (ret != VA_STATUS_SUCCESS)
return VA_STATUS_ERROR_UNKNOWN;
}
}
/* Main Video for pixmap*/
tmp_drawable = (struct dri_drawable *)texture_priv->dri_drawable;
if (!tmp_drawable->is_window) {
psb__information_message("psb_putsurface_ctexture: Main video Pixmap, coordinate: srcx= %d, srcy=%d, srcw=%d, srch=%d, destx=%d, desty=%d, destw=%d, desth=%d, cur_buffer=%d\n",
srcx, srcy, srcw, srch, destx, desty, destw, desth, texture_priv->current_blt_buffer);
if (subtitle == BOTH || (subtitle == NOSUBTITLE && obj_surface->subpic_count))
psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo_pixmap, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 1,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
else
psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo_pixmap, surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 0,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
return VA_STATUS_SUCCESS;
}
/* Main Video for window*/
if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_BUFFERS) {
psb__information_message("psb_putsurface_ctexture: Main video, swap buffer, coordinate: srcx= %d, srcy=%d, srcw=%d, srch=%d, destx=%d, desty=%d, destw=%d, desth=%d, cur_buffer=%d\n",
srcx, srcy, srcw, srch, destx, desty, destw, desth, texture_priv->current_blt_buffer);
if (subtitle == BOTH || (subtitle == NOSUBTITLE && obj_surface->subpic_count))
psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 1,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
else
psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->blt_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty, destw, desth, 0,
surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
dri_swap_buffer(ctx, texture_priv->dri_drawable);
texture_priv->current_blt_buffer = (texture_priv->current_blt_buffer + 1) & 0x01;
} else if (texture_priv->dri2_bb_export.ui32Type == DRI2_BACK_BUFFER_EXPORT_TYPE_SWAPCHAIN) {
psb__information_message("psb_putsurface_ctexture: Main video, flip chain, coordinate: srcx= %d, srcy=%d, srcw=%d, srch=%d, destx=%d, desty=%d, destw=%d, desth=%d, cur_buffer=%d\n",
srcx, srcy, srcw, srch, destx, desty, display_width, display_height, texture_priv->current_blt_buffer);
if (subtitle == BOTH || (subtitle == NOSUBTITLE && obj_surface->subpic_count))
psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->flip_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty,
display_width, display_height, 1, surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
else
psb_putsurface_textureblit(ctx, (unsigned char *)texture_priv->flip_meminfo[texture_priv->current_blt_buffer], surface, srcx, srcy, srcw, srch, destx, desty,
display_width, display_height, 0, surface_width, surface_height,
psb_surface->stride, psb_surface->buf.drm_buf,
psb_surface->buf.pl_flags, 0 /* no wrap for dst */);
dri_swap_buffer(ctx, texture_priv->dri_drawable);
texture_priv->current_blt_buffer++;
if (texture_priv->current_blt_buffer == DRI2_FLIP_BUFFERS_NUM)
texture_priv->current_blt_buffer = 0;
}
return VA_STATUS_SUCCESS;
}
|