1 /**************************************************************************
3 * Copyright 2010 Thomas Balling Sørensen & Orasanu Lucian.
4 * Copyright 2014 Advanced Micro Devices, Inc.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
29 #include "pipe/p_screen.h"
30 #include "pipe/p_video_codec.h"
32 #include "state_tracker/drm_driver.h"
34 #include "util/u_memory.h"
35 #include "util/u_handle_table.h"
36 #include "util/u_rect.h"
37 #include "util/u_sampler.h"
38 #include "util/u_surface.h"
40 #include "vl/vl_compositor.h"
41 #include "vl/vl_video_buffer.h"
42 #include "vl/vl_winsys.h"
44 #include "va_private.h"
46 #include <va/va_drmcommon.h>
49 vlVaCreateSurfaces(VADriverContextP ctx
, int width
, int height
, int format
,
50 int num_surfaces
, VASurfaceID
*surfaces
)
52 return vlVaCreateSurfaces2(ctx
, format
, width
, height
, surfaces
, num_surfaces
,
57 vlVaDestroySurfaces(VADriverContextP ctx
, VASurfaceID
*surface_list
, int num_surfaces
)
63 return VA_STATUS_ERROR_INVALID_CONTEXT
;
65 drv
= VL_VA_DRIVER(ctx
);
66 for (i
= 0; i
< num_surfaces
; ++i
) {
67 vlVaSurface
*surf
= handle_table_get(drv
->htab
, surface_list
[i
]);
69 surf
->buffer
->destroy(surf
->buffer
);
71 drv
->pipe
->screen
->fence_reference(drv
->pipe
->screen
, &surf
->fence
, NULL
);
72 util_dynarray_fini(&surf
->subpics
);
74 handle_table_remove(drv
->htab
, surface_list
[i
]);
77 return VA_STATUS_SUCCESS
;
81 vlVaSyncSurface(VADriverContextP ctx
, VASurfaceID render_target
)
84 return VA_STATUS_ERROR_INVALID_CONTEXT
;
86 return VA_STATUS_SUCCESS
;
90 vlVaQuerySurfaceStatus(VADriverContextP ctx
, VASurfaceID render_target
, VASurfaceStatus
*status
)
93 return VA_STATUS_ERROR_INVALID_CONTEXT
;
95 return VA_STATUS_SUCCESS
;
99 vlVaQuerySurfaceError(VADriverContextP ctx
, VASurfaceID render_target
, VAStatus error_status
, void **error_info
)
102 return VA_STATUS_ERROR_INVALID_CONTEXT
;
104 return VA_STATUS_ERROR_UNIMPLEMENTED
;
108 upload_sampler(struct pipe_context
*pipe
, struct pipe_sampler_view
*dst
,
109 const struct pipe_box
*dst_box
, const void *src
, unsigned src_stride
,
110 unsigned src_x
, unsigned src_y
)
112 struct pipe_transfer
*transfer
;
115 map
= pipe
->transfer_map(pipe
, dst
->texture
, 0, PIPE_TRANSFER_WRITE
,
120 util_copy_rect(map
, dst
->texture
->format
, transfer
->stride
, 0, 0,
121 dst_box
->width
, dst_box
->height
,
122 src
, src_stride
, src_x
, src_y
);
124 pipe
->transfer_unmap(pipe
, transfer
);
128 vlVaPutSubpictures(vlVaSurface
*surf
, vlVaDriver
*drv
,
129 struct pipe_surface
*surf_draw
, struct u_rect
*dirty_area
,
130 struct u_rect
*src_rect
, struct u_rect
*dst_rect
)
135 if (!(surf
->subpics
.data
|| surf
->subpics
.size
))
136 return VA_STATUS_SUCCESS
;
138 for (i
= 0; i
< surf
->subpics
.size
/sizeof(vlVaSubpicture
*); i
++) {
139 struct pipe_blend_state blend
;
143 struct u_rect
*s
, *d
, sr
, dr
, c
;
146 sub
= ((vlVaSubpicture
**)surf
->subpics
.data
)[i
];
150 buf
= handle_table_get(drv
->htab
, sub
->image
->buf
);
152 return VA_STATUS_ERROR_INVALID_IMAGE
;
157 box
.width
= sub
->dst_rect
.x1
- sub
->dst_rect
.x0
;
158 box
.height
= sub
->dst_rect
.y1
- sub
->dst_rect
.y0
;
167 c
.x0
= MAX2(d
->x0
, s
->x0
);
168 c
.y0
= MAX2(d
->y0
, s
->y0
);
169 c
.x1
= MIN2(d
->x0
+ dw
, src_rect
->x1
);
170 c
.y1
= MIN2(d
->y0
+ dh
, src_rect
->y1
);
171 sr
.x0
= s
->x0
+ (c
.x0
- d
->x0
)*(sw
/(float)dw
);
172 sr
.y0
= s
->y0
+ (c
.y0
- d
->y0
)*(sh
/(float)dh
);
173 sr
.x1
= s
->x0
+ (c
.x1
- d
->x0
)*(sw
/(float)dw
);
174 sr
.y1
= s
->y0
+ (c
.y1
- d
->y0
)*(sh
/(float)dh
);
182 dr
.x0
= d
->x0
+ c
.x0
*(dw
/(float)sw
);
183 dr
.y0
= d
->y0
+ c
.y0
*(dh
/(float)sh
);
184 dr
.x1
= d
->x0
+ c
.x1
*(dw
/(float)sw
);
185 dr
.y1
= d
->y0
+ c
.y1
*(dh
/(float)sh
);
187 memset(&blend
, 0, sizeof(blend
));
188 blend
.independent_blend_enable
= 0;
189 blend
.rt
[0].blend_enable
= 1;
190 blend
.rt
[0].rgb_src_factor
= PIPE_BLENDFACTOR_SRC_ALPHA
;
191 blend
.rt
[0].rgb_dst_factor
= PIPE_BLENDFACTOR_INV_SRC_ALPHA
;
192 blend
.rt
[0].alpha_src_factor
= PIPE_BLENDFACTOR_ZERO
;
193 blend
.rt
[0].alpha_dst_factor
= PIPE_BLENDFACTOR_ZERO
;
194 blend
.rt
[0].rgb_func
= PIPE_BLEND_ADD
;
195 blend
.rt
[0].alpha_func
= PIPE_BLEND_ADD
;
196 blend
.rt
[0].colormask
= PIPE_MASK_RGBA
;
197 blend
.logicop_enable
= 0;
198 blend
.logicop_func
= PIPE_LOGICOP_CLEAR
;
200 blend_state
= drv
->pipe
->create_blend_state(drv
->pipe
, &blend
);
202 vl_compositor_clear_layers(&drv
->cstate
);
203 vl_compositor_set_layer_blend(&drv
->cstate
, 0, blend_state
, false);
204 upload_sampler(drv
->pipe
, sub
->sampler
, &box
, buf
->data
,
205 sub
->image
->pitches
[0], 0, 0);
206 vl_compositor_set_rgba_layer(&drv
->cstate
, &drv
->compositor
, 0, sub
->sampler
,
208 vl_compositor_set_layer_dst_area(&drv
->cstate
, 0, &dr
);
209 vl_compositor_render(&drv
->cstate
, &drv
->compositor
, surf_draw
, dirty_area
, false);
210 drv
->pipe
->delete_blend_state(drv
->pipe
, blend_state
);
213 return VA_STATUS_SUCCESS
;
217 vlVaPutSurface(VADriverContextP ctx
, VASurfaceID surface_id
, void* draw
, short srcx
, short srcy
,
218 unsigned short srcw
, unsigned short srch
, short destx
, short desty
,
219 unsigned short destw
, unsigned short desth
, VARectangle
*cliprects
,
220 unsigned int number_cliprects
, unsigned int flags
)
224 struct pipe_screen
*screen
;
225 struct pipe_resource
*tex
;
226 struct pipe_surface surf_templ
, *surf_draw
;
227 struct u_rect src_rect
, *dirty_area
;
228 struct u_rect dst_rect
= {destx
, destx
+ destw
, desty
, desty
+ desth
};
232 return VA_STATUS_ERROR_INVALID_CONTEXT
;
234 drv
= VL_VA_DRIVER(ctx
);
235 surf
= handle_table_get(drv
->htab
, surface_id
);
237 return VA_STATUS_ERROR_INVALID_SURFACE
;
239 screen
= drv
->pipe
->screen
;
242 screen
->fence_finish(screen
, surf
->fence
, PIPE_TIMEOUT_INFINITE
);
243 screen
->fence_reference(screen
, &surf
->fence
, NULL
);
246 tex
= vl_screen_texture_from_drawable(drv
->vscreen
, (Drawable
)draw
);
248 return VA_STATUS_ERROR_INVALID_DISPLAY
;
250 dirty_area
= vl_screen_get_dirty_area(drv
->vscreen
);
252 memset(&surf_templ
, 0, sizeof(surf_templ
));
253 surf_templ
.format
= tex
->format
;
254 surf_draw
= drv
->pipe
->create_surface(drv
->pipe
, tex
, &surf_templ
);
256 pipe_resource_reference(&tex
, NULL
);
257 return VA_STATUS_ERROR_INVALID_DISPLAY
;
262 src_rect
.x1
= srcw
+ srcx
;
263 src_rect
.y1
= srch
+ srcy
;
265 vl_compositor_clear_layers(&drv
->cstate
);
266 vl_compositor_set_buffer_layer(&drv
->cstate
, &drv
->compositor
, 0, surf
->buffer
, &src_rect
, NULL
, VL_COMPOSITOR_WEAVE
);
267 vl_compositor_set_layer_dst_area(&drv
->cstate
, 0, &dst_rect
);
268 vl_compositor_render(&drv
->cstate
, &drv
->compositor
, surf_draw
, dirty_area
, true);
270 status
= vlVaPutSubpictures(surf
, drv
, surf_draw
, dirty_area
, &src_rect
, &dst_rect
);
274 screen
->flush_frontbuffer
277 vl_screen_get_private(drv
->vscreen
), NULL
280 screen
->fence_reference(screen
, &surf
->fence
, NULL
);
281 drv
->pipe
->flush(drv
->pipe
, &surf
->fence
, 0);
283 pipe_resource_reference(&tex
, NULL
);
284 pipe_surface_reference(&surf_draw
, NULL
);
286 return VA_STATUS_SUCCESS
;
290 vlVaLockSurface(VADriverContextP ctx
, VASurfaceID surface
, unsigned int *fourcc
,
291 unsigned int *luma_stride
, unsigned int *chroma_u_stride
, unsigned int *chroma_v_stride
,
292 unsigned int *luma_offset
, unsigned int *chroma_u_offset
, unsigned int *chroma_v_offset
,
293 unsigned int *buffer_name
, void **buffer
)
296 return VA_STATUS_ERROR_INVALID_CONTEXT
;
298 return VA_STATUS_ERROR_UNIMPLEMENTED
;
302 vlVaUnlockSurface(VADriverContextP ctx
, VASurfaceID surface
)
305 return VA_STATUS_ERROR_INVALID_CONTEXT
;
307 return VA_STATUS_ERROR_UNIMPLEMENTED
;
311 vlVaQuerySurfaceAttributes(VADriverContextP ctx
, VAConfigID config
,
312 VASurfaceAttrib
*attrib_list
, unsigned int *num_attribs
)
315 VASurfaceAttrib
*attribs
;
316 struct pipe_screen
*pscreen
;
319 if (config
== VA_INVALID_ID
)
320 return VA_STATUS_ERROR_INVALID_CONFIG
;
322 if (!attrib_list
&& !num_attribs
)
323 return VA_STATUS_ERROR_INVALID_PARAMETER
;
326 *num_attribs
= VASurfaceAttribCount
;
327 return VA_STATUS_SUCCESS
;
331 return VA_STATUS_ERROR_INVALID_CONTEXT
;
333 drv
= VL_VA_DRIVER(ctx
);
336 return VA_STATUS_ERROR_INVALID_CONTEXT
;
338 pscreen
= VL_VA_PSCREEN(ctx
);
341 return VA_STATUS_ERROR_INVALID_CONTEXT
;
343 attribs
= CALLOC(VASurfaceAttribCount
, sizeof(VASurfaceAttrib
));
346 return VA_STATUS_ERROR_ALLOCATION_FAILED
;
350 if (config
== PIPE_VIDEO_PROFILE_UNKNOWN
) {
351 /* Assume VAEntrypointVideoProc for now. */
352 attribs
[i
].type
= VASurfaceAttribPixelFormat
;
353 attribs
[i
].value
.type
= VAGenericValueTypeInteger
;
354 attribs
[i
].flags
= VA_SURFACE_ATTRIB_GETTABLE
| VA_SURFACE_ATTRIB_SETTABLE
;
355 attribs
[i
].value
.value
.i
= VA_FOURCC_BGRA
;
358 attribs
[i
].type
= VASurfaceAttribPixelFormat
;
359 attribs
[i
].value
.type
= VAGenericValueTypeInteger
;
360 attribs
[i
].flags
= VA_SURFACE_ATTRIB_GETTABLE
| VA_SURFACE_ATTRIB_SETTABLE
;
361 attribs
[i
].value
.value
.i
= VA_FOURCC_RGBA
;
364 /* Assume VAEntrypointVLD for now. */
365 attribs
[i
].type
= VASurfaceAttribPixelFormat
;
366 attribs
[i
].value
.type
= VAGenericValueTypeInteger
;
367 attribs
[i
].flags
= VA_SURFACE_ATTRIB_GETTABLE
| VA_SURFACE_ATTRIB_SETTABLE
;
368 attribs
[i
].value
.value
.i
= VA_FOURCC_NV12
;
372 attribs
[i
].type
= VASurfaceAttribMemoryType
;
373 attribs
[i
].value
.type
= VAGenericValueTypeInteger
;
374 attribs
[i
].flags
= VA_SURFACE_ATTRIB_GETTABLE
| VA_SURFACE_ATTRIB_SETTABLE
;
375 attribs
[i
].value
.value
.i
= VA_SURFACE_ATTRIB_MEM_TYPE_VA
|
376 VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME
;
379 attribs
[i
].type
= VASurfaceAttribExternalBufferDescriptor
;
380 attribs
[i
].value
.type
= VAGenericValueTypePointer
;
381 attribs
[i
].flags
= VA_SURFACE_ATTRIB_SETTABLE
;
382 attribs
[i
].value
.value
.p
= NULL
; /* ignore */
385 attribs
[i
].type
= VASurfaceAttribMaxWidth
;
386 attribs
[i
].value
.type
= VAGenericValueTypeInteger
;
387 attribs
[i
].flags
= VA_SURFACE_ATTRIB_GETTABLE
;
388 attribs
[i
].value
.value
.i
= vl_video_buffer_max_size(pscreen
);
391 attribs
[i
].type
= VASurfaceAttribMaxHeight
;
392 attribs
[i
].value
.type
= VAGenericValueTypeInteger
;
393 attribs
[i
].flags
= VA_SURFACE_ATTRIB_GETTABLE
;
394 attribs
[i
].value
.value
.i
= vl_video_buffer_max_size(pscreen
);
397 if (i
> *num_attribs
) {
400 return VA_STATUS_ERROR_MAX_NUM_EXCEEDED
;
404 memcpy(attrib_list
, attribs
, i
* sizeof(VASurfaceAttrib
));
407 return VA_STATUS_SUCCESS
;
411 suface_from_external_memory(VADriverContextP ctx
, vlVaSurface
*surface
,
412 VASurfaceAttribExternalBuffers
*memory_attibute
,
413 int index
, VASurfaceID
*surfaces
,
414 struct pipe_video_buffer
*templat
)
417 struct pipe_screen
*pscreen
;
418 struct pipe_resource
*resource
;
419 struct pipe_resource res_templ
;
420 struct winsys_handle whandle
;
421 struct pipe_resource
*resources
[VL_NUM_COMPONENTS
];
424 return VA_STATUS_ERROR_INVALID_PARAMETER
;
426 pscreen
= VL_VA_PSCREEN(ctx
);
427 drv
= VL_VA_DRIVER(ctx
);
429 if (!memory_attibute
|| !memory_attibute
->buffers
||
430 index
> memory_attibute
->num_buffers
)
431 return VA_STATUS_ERROR_INVALID_PARAMETER
;
433 if (surface
->templat
.width
!= memory_attibute
->width
||
434 surface
->templat
.height
!= memory_attibute
->height
||
435 memory_attibute
->num_planes
< 1)
436 return VA_STATUS_ERROR_INVALID_PARAMETER
;
438 switch (memory_attibute
->pixel_format
) {
443 if (memory_attibute
->num_planes
!= 1)
444 return VA_STATUS_ERROR_INVALID_PARAMETER
;
447 return VA_STATUS_ERROR_INVALID_PARAMETER
;
450 memset(&res_templ
, 0, sizeof(res_templ
));
451 res_templ
.target
= PIPE_TEXTURE_2D
;
452 res_templ
.last_level
= 0;
453 res_templ
.depth0
= 1;
454 res_templ
.array_size
= 1;
455 res_templ
.width0
= memory_attibute
->width
;
456 res_templ
.height0
= memory_attibute
->height
;
457 res_templ
.format
= surface
->templat
.buffer_format
;
458 res_templ
.bind
= PIPE_BIND_SAMPLER_VIEW
;
459 res_templ
.usage
= PIPE_USAGE_DEFAULT
;
461 memset(&whandle
, 0, sizeof(struct winsys_handle
));
462 whandle
.type
= DRM_API_HANDLE_TYPE_FD
;
463 whandle
.handle
= memory_attibute
->buffers
[index
];
464 whandle
.stride
= memory_attibute
->pitches
[index
];
466 resource
= pscreen
->resource_from_handle(pscreen
, &res_templ
, &whandle
);
469 return VA_STATUS_ERROR_ALLOCATION_FAILED
;
471 memset(resources
, 0, sizeof resources
);
472 resources
[0] = resource
;
474 surface
->buffer
= vl_video_buffer_create_ex2(drv
->pipe
, templat
, resources
);
475 if (!surface
->buffer
)
476 return VA_STATUS_ERROR_ALLOCATION_FAILED
;
478 util_dynarray_init(&surface
->subpics
);
479 surfaces
[index
] = handle_table_add(drv
->htab
, surface
);
481 if (!surfaces
[index
])
482 return VA_STATUS_ERROR_ALLOCATION_FAILED
;
484 return VA_STATUS_SUCCESS
;
488 vlVaCreateSurfaces2(VADriverContextP ctx
, unsigned int format
,
489 unsigned int width
, unsigned int height
,
490 VASurfaceID
*surfaces
, unsigned int num_surfaces
,
491 VASurfaceAttrib
*attrib_list
, unsigned int num_attribs
)
494 VASurfaceAttribExternalBuffers
*memory_attibute
;
495 struct pipe_video_buffer templat
;
496 struct pipe_screen
*pscreen
;
503 return VA_STATUS_ERROR_INVALID_CONTEXT
;
505 if (!(width
&& height
))
506 return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT
;
508 drv
= VL_VA_DRIVER(ctx
);
511 return VA_STATUS_ERROR_INVALID_CONTEXT
;
513 pscreen
= VL_VA_PSCREEN(ctx
);
516 return VA_STATUS_ERROR_INVALID_CONTEXT
;
519 memory_attibute
= NULL
;
520 memory_type
= VA_SURFACE_ATTRIB_MEM_TYPE_VA
;
523 for (i
= 0; i
< num_attribs
&& attrib_list
; i
++) {
524 if ((attrib_list
[i
].type
== VASurfaceAttribPixelFormat
) &&
525 (attrib_list
[i
].flags
& VA_SURFACE_ATTRIB_SETTABLE
)) {
526 if (attrib_list
[i
].value
.type
!= VAGenericValueTypeInteger
)
527 return VA_STATUS_ERROR_INVALID_PARAMETER
;
528 expected_fourcc
= attrib_list
[i
].value
.value
.i
;
531 if ((attrib_list
[i
].type
== VASurfaceAttribMemoryType
) &&
532 (attrib_list
[i
].flags
& VA_SURFACE_ATTRIB_SETTABLE
)) {
534 if (attrib_list
[i
].value
.type
!= VAGenericValueTypeInteger
)
535 return VA_STATUS_ERROR_INVALID_PARAMETER
;
537 switch (attrib_list
[i
].value
.value
.i
) {
538 case VA_SURFACE_ATTRIB_MEM_TYPE_VA
:
539 case VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME
:
540 memory_type
= attrib_list
[i
].value
.value
.i
;
543 return VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE
;
547 if ((attrib_list
[i
].type
== VASurfaceAttribExternalBufferDescriptor
) &&
548 (attrib_list
[i
].flags
== VA_SURFACE_ATTRIB_SETTABLE
)) {
549 if (attrib_list
[i
].value
.type
!= VAGenericValueTypePointer
)
550 return VA_STATUS_ERROR_INVALID_PARAMETER
;
551 memory_attibute
= (VASurfaceAttribExternalBuffers
*)attrib_list
[i
].value
.value
.p
;
555 if (VA_RT_FORMAT_YUV420
!= format
&&
556 VA_RT_FORMAT_YUV422
!= format
&&
557 VA_RT_FORMAT_YUV444
!= format
&&
558 VA_RT_FORMAT_RGB32
!= format
) {
559 return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT
;
562 switch (memory_type
) {
563 case VA_SURFACE_ATTRIB_MEM_TYPE_VA
:
565 case VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME
:
566 if (!memory_attibute
)
567 return VA_STATUS_ERROR_INVALID_PARAMETER
;
569 expected_fourcc
= memory_attibute
->pixel_format
;
575 memset(&templat
, 0, sizeof(templat
));
577 if (expected_fourcc
) {
578 templat
.buffer_format
= VaFourccToPipeFormat(expected_fourcc
);
579 templat
.interlaced
= 0;
581 templat
.buffer_format
= pscreen
->get_video_param
584 PIPE_VIDEO_PROFILE_UNKNOWN
,
585 PIPE_VIDEO_ENTRYPOINT_BITSTREAM
,
586 PIPE_VIDEO_CAP_PREFERED_FORMAT
588 templat
.interlaced
= pscreen
->get_video_param
591 PIPE_VIDEO_PROFILE_UNKNOWN
,
592 PIPE_VIDEO_ENTRYPOINT_BITSTREAM
,
593 PIPE_VIDEO_CAP_PREFERS_INTERLACED
597 templat
.chroma_format
= ChromaToPipe(format
);
599 templat
.width
= width
;
600 templat
.height
= height
;
602 memset(surfaces
, VA_INVALID_ID
, num_surfaces
* sizeof(VASurfaceID
));
604 for (i
= 0; i
< num_surfaces
; i
++) {
605 vlVaSurface
*surf
= CALLOC(1, sizeof(vlVaSurface
));
609 surf
->templat
= templat
;
611 switch (memory_type
) {
612 case VA_SURFACE_ATTRIB_MEM_TYPE_VA
:
613 surf
->buffer
= drv
->pipe
->create_video_buffer(drv
->pipe
, &templat
);
616 util_dynarray_init(&surf
->subpics
);
617 surfaces
[i
] = handle_table_add(drv
->htab
, surf
);
619 case VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME
:
620 vaStatus
= suface_from_external_memory(ctx
, surf
, memory_attibute
, i
, surfaces
, &templat
);
621 if (vaStatus
!= VA_STATUS_SUCCESS
)
629 return VA_STATUS_SUCCESS
;
633 vlVaDestroySurfaces(ctx
, surfaces
, i
);
635 return VA_STATUS_ERROR_ALLOCATION_FAILED
;