Debian Codegraph @

media_softlet/linux/common/ddi/media_libva_caps_next.cpp

raw
1 /*
2 * Copyright (c) 2021-2022, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 //! \file media_libva_caps_next.cpp
24 //! \brief This file implements the base C++ class/interface for media capbilities.
25 //!
26
27 #include "media_libva_caps_next.h"
28
29 MediaLibvaCapsNext::MediaLibvaCapsNext(DDI_MEDIA_CONTEXT *mediaCtx)
30 {
31 DDI_FUNC_ENTER;
32 DDI_CHK_NULL(mediaCtx, "Media context is null", );
33 m_mediaCtx = mediaCtx;
34
35 m_capsTable = MOS_New(MediaCapsTableSpecific, mediaCtx->m_hwInfo->GetDeviceInfo());
36 DDI_CHK_NULL(m_capsTable, "Caps table is null", );
37 }
38
39 MediaLibvaCapsNext::~MediaLibvaCapsNext()
40 {
41 DDI_FUNC_ENTER;
42 MOS_Delete(m_capsTable);
43 m_capsTable = nullptr;
44 }
45
46 MediaLibvaCapsNext* MediaLibvaCapsNext::CreateCaps(DDI_MEDIA_CONTEXT *mediaCtx)
47 {
48 DDI_FUNC_ENTER;
49
50 if(mediaCtx != nullptr)
51 {
52 MediaLibvaCapsNext *caps = MOS_New(MediaLibvaCapsNext, mediaCtx);
53 return caps;
54 }
55 else
56 {
57 return nullptr;
58 }
59 }
60
61 VAStatus MediaLibvaCapsNext::Init()
62 {
63 DDI_FUNC_ENTER;
64
65 return m_capsTable->Init(m_mediaCtx);
66 }
67
68 ConfigList* MediaLibvaCapsNext::GetConfigList()
69 {
70 return m_capsTable->GetConfigList();
71 }
72
73 VAStatus MediaLibvaCapsNext::GetAttribValue(
74 VAProfile profile,
75 VAEntrypoint entrypoint,
76 VAConfigAttribType type,
77 uint32_t *value)
78 {
79 DDI_FUNC_ENTER;
80
81 DDI_CHK_NULL(m_capsTable, "Caps table is null", VA_STATUS_ERROR_INVALID_PARAMETER);
82 DDI_CHK_NULL(value, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
83
84 AttribList *attribList = nullptr;
85 attribList = m_capsTable->QuerySupportedAttrib(profile, entrypoint);
86 DDI_CHK_NULL(attribList, "AttribList in null, not supported attribute", VA_STATUS_ERROR_INVALID_PARAMETER);
87
88 for (int i = 0; i < attribList->size(); i++)
89 {
90 if(attribList->at(i).type == type)
91 {
92 *value = attribList->at(i).value;
93 return VA_STATUS_SUCCESS;
94 }
95 }
96 return VA_STATUS_ERROR_INVALID_CONFIG;
97 }
98
99 uint32_t MediaLibvaCapsNext::GetImageFormatsMaxNum()
100 {
101 DDI_FUNC_ENTER;
102 DDI_CHK_NULL(m_capsTable, "Caps table is null", 0);
103
104 return m_capsTable->GetImageFormatsMaxNum();
105 }
106
107 VAStatus MediaLibvaCapsNext::QueryConfigProfiles(
108 VAProfile *profileList,
109 int32_t *profilesNum)
110 {
111 DDI_FUNC_ENTER;
112
113 DDI_CHK_NULL(m_capsTable, "Caps table is null", VA_STATUS_ERROR_INVALID_PARAMETER);
114 DDI_CHK_NULL(profileList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
115 DDI_CHK_NULL(profilesNum, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
116
117 return m_capsTable->QueryConfigProfiles(profileList, profilesNum);
118 }
119
120 VAStatus MediaLibvaCapsNext::QueryConfigAttributes(
121 VAConfigID configId,
122 VAProfile *profile,
123 VAEntrypoint *entrypoint,
124 VAConfigAttrib *attribList,
125 int32_t *numAttribs)
126 {
127 DDI_FUNC_ENTER;
128
129 DDI_CHK_NULL(m_capsTable, "Caps table is null", VA_STATUS_ERROR_INVALID_PARAMETER);
130 DDI_CHK_NULL(profile, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
131 DDI_CHK_NULL(entrypoint, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
132 DDI_CHK_NULL(attribList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
133 DDI_CHK_NULL(numAttribs, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
134
135 VAStatus status = VA_STATUS_SUCCESS;
136 ConfigLinux *configItem = nullptr;
137 configItem = m_capsTable->QueryConfigItemFromIndex(configId);
138 DDI_CHK_NULL(configItem, "QueryConfigItemFromIndex failed", VA_STATUS_ERROR_INVALID_PARAMETER);
139
140 *profile = configItem->profile;
141 *entrypoint = configItem->entrypoint;
142 *numAttribs = configItem->numAttribs;
143 for (int i = 0; i < configItem->numAttribs; ++i)
144 {
145 if (configItem->attribList[i].value != VA_ATTRIB_NOT_SUPPORTED)
146 {
147 attribList[i] = configItem->attribList[i];
148 }
149 }
150 return VA_STATUS_SUCCESS;
151 }
152
153 VAStatus MediaLibvaCapsNext::CheckAttribList(
154 VAProfile profile,
155 VAEntrypoint entrypoint,
156 VAConfigAttrib *attrib,
157 int32_t numAttribs)
158 {
159 DDI_FUNC_ENTER;
160
161 VAStatus status = VA_STATUS_SUCCESS;
162 AttribList *supportedAttribList = nullptr;
163 supportedAttribList = m_capsTable->QuerySupportedAttrib(profile, entrypoint);
164 DDI_CHK_NULL(supportedAttribList, "AttribList in null, not supported attribute", VA_STATUS_ERROR_INVALID_PARAMETER);
165
166 for(int32_t j = 0; j < numAttribs; j ++)
167 {
168 bool isValidAttrib = false;
169
170 // temp solution for MV tools, after tool change, it should be removed
171 if(attrib[j].type == VAConfigAttribEncDynamicScaling ||
172 attrib[j].type == VAConfigAttribEncRateControlExt ||
173 attrib[j].type == VAConfigAttribEncTileSupport)
174 {
175 if(attrib[j].value == VA_ATTRIB_NOT_SUPPORTED)
176 {
177 isValidAttrib = true;
178 continue;
179 }
180 }
181
182 bool findSameType = false;
183 for(int i = 0; i < supportedAttribList->size(); i++)
184 {
185 // Same attribute type
186 findSameType = true;
187 if(supportedAttribList->at(i).type == attrib[j].type)
188 {
189 if(attrib[j].value == CONFIG_ATTRIB_NONE)
190 {
191 isValidAttrib = true;
192 continue;
193 }
194
195 if(attrib[j].type == VAConfigAttribRTFormat ||
196 attrib[j].type == VAConfigAttribDecSliceMode ||
197 attrib[j].type == VAConfigAttribDecJPEG ||
198 attrib[j].type == VAConfigAttribRateControl ||
199 attrib[j].type == VAConfigAttribEncPackedHeaders ||
200 attrib[j].type == VAConfigAttribEncIntraRefresh ||
201 attrib[j].type == VAConfigAttribFEIFunctionType ||
202 attrib[j].type == VAConfigAttribEncryption)
203 {
204 if((supportedAttribList->at(i).value & attrib[j].value) == attrib[j].value)
205 {
206 isValidAttrib = true;
207 continue;
208 }
209 else if(attrib[j].type == VAConfigAttribRTFormat)
210 {
211 return VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT;
212 }
213 }
214 else if(supportedAttribList->at(i).value == attrib[j].value)
215 {
216 isValidAttrib = true;
217 continue;
218 }
219 else if(attrib[j].type == VAConfigAttribEncSliceStructure)
220 {
221 if((supportedAttribList->at(i).value & attrib[j].value) == attrib[j].value)
222 {
223 isValidAttrib = true;
224 continue;
225 }
226
227 if(supportedAttribList->at(i).value & VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS)
228 {
229 if( (attrib[j].value & VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS) ||
230 (attrib[j].value & VA_ENC_SLICE_STRUCTURE_EQUAL_MULTI_ROWS) ||
231 (attrib[j].value & VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS) ||
232 (attrib[j].value & VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS))
233 {
234 isValidAttrib = true;
235 continue;
236 }
237 }
238 else if (supportedAttribList->at(i).value &
239 (VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS | VA_ENC_SLICE_STRUCTURE_MAX_SLICE_SIZE))
240 {
241 if((attrib[j].value & VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS) ||
242 (attrib[j].value & VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS) ||
243 (attrib[j].value & VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS))
244 {
245 isValidAttrib = true;
246 continue;
247 }
248 }
249 }
250 else if((attrib[j].type == VAConfigAttribMaxPictureWidth) ||
251 (attrib[j].type == VAConfigAttribMaxPictureHeight) ||
252 (attrib[j].type == VAConfigAttribEncROI) ||
253 (attrib[j].type == VAConfigAttribEncDirtyRect))
254 {
255 if(attrib[j].value <= supportedAttribList->at(i).value)
256 {
257 isValidAttrib = true;
258 continue;
259 }
260 }
261 else if(attrib[j].type == VAConfigAttribEncMaxRefFrames)
262 {
263 if( ((attrib[j].value & 0xffff) <= (supportedAttribList->at(i).value & 0xffff)) &&
264 (attrib[j].value <= supportedAttribList->at(i).value)) //high16 bit can compare with this way
265 {
266 isValidAttrib = true;
267 continue;
268 }
269 }
270 else if(attrib[j].type == VAConfigAttribEncJPEG)
271 {
272 VAConfigAttribValEncJPEG jpegValue, jpegSetValue;
273 jpegValue.value = attrib[j].value;
274 jpegSetValue.value = supportedAttribList->at(i).value;
275
276 if( (jpegValue.bits.max_num_quantization_tables <= jpegSetValue.bits.max_num_quantization_tables) &&
277 (jpegValue.bits.max_num_huffman_tables <= jpegSetValue.bits.max_num_huffman_tables) &&
278 (jpegValue.bits.max_num_scans <= jpegSetValue.bits.max_num_scans) &&
279 (jpegValue.bits.max_num_components <= jpegSetValue.bits.max_num_components))
280 {
281 isValidAttrib = true;
282 continue;
283 }
284 }
285 }
286 }
287
288 // should be removed after msdk remove VAConfigAttribSpatialResidual attributes for VPP
289 if(!findSameType)
290 {
291 if((profile == VAProfileNone) &&
292 (entrypoint == VAEntrypointVideoProc) &&
293 (attrib[j].type == VAConfigAttribSpatialClipping))
294 {
295 isValidAttrib = true;
296 continue;
297 }
298 else if((profile == VAProfileNone) &&
299 (attrib[j].type == VAConfigAttribStats))
300 {
301 isValidAttrib = true;
302 continue;
303 }
304 }
305
306 if(!isValidAttrib)
307 {
308 return VA_STATUS_ERROR_INVALID_VALUE;
309 }
310 }
311
312 return VA_STATUS_SUCCESS;
313 }
314
315 VAStatus MediaLibvaCapsNext::CreateConfig(
316 VAProfile profile,
317 VAEntrypoint entrypoint,
318 VAConfigAttrib *attribList,
319 int32_t numAttribs,
320 VAConfigID *configId)
321 {
322 VAStatus status = VA_STATUS_SUCCESS;
323 DDI_FUNC_ENTER;
324
325 DDI_CHK_NULL(m_capsTable, "Caps table is null", VA_STATUS_ERROR_INVALID_PARAMETER);
326 DDI_CHK_NULL(configId, "nullptr configId", VA_STATUS_ERROR_INVALID_PARAMETER);
327
328 status = m_capsTable->CreateConfig(profile, entrypoint, attribList, numAttribs, configId);
329 if(status != VA_STATUS_SUCCESS)
330 {
331 DDI_ASSERTMESSAGE("Query Supported Attrib Failed");
332 return status;
333 }
334
335 return CheckAttribList(profile, entrypoint, attribList, numAttribs);
336 }
337
338 VAStatus MediaLibvaCapsNext::DestroyConfig(VAConfigID configId)
339 {
340 DDI_FUNC_ENTER;
341
342 DDI_CHK_NULL(m_capsTable, "Caps table is null", VA_STATUS_ERROR_INVALID_PARAMETER);
343
344 return m_capsTable->DestroyConfig(configId);
345 }
346
347 VAStatus MediaLibvaCapsNext::GetConfigAttributes(
348 VAProfile profile,
349 VAEntrypoint entrypoint,
350 VAConfigAttrib *attribList,
351 int32_t numAttribs)
352 {
353 DDI_FUNC_ENTER;
354
355 DDI_CHK_NULL(m_capsTable, "Caps table is null", VA_STATUS_ERROR_INVALID_PARAMETER);
356 DDI_CHK_NULL(attribList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
357
358 if (!(m_capsTable->IsProfileSupported(profile)))
359 {
360 return VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
361 }
362 else if (!(m_capsTable->IsEntrypointSupported(profile, entrypoint)))
363 {
364 return VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
365 }
366
367 AttribList *supportedAttribList = nullptr;
368 supportedAttribList = m_capsTable->QuerySupportedAttrib(profile, entrypoint);
369 DDI_CHK_NULL(supportedAttribList, "AttribList in null, not supported attribute", VA_STATUS_ERROR_INVALID_PARAMETER);
370
371 for (int32_t j = 0; j < numAttribs; j++)
372 {
373 //For unknown attribute, set to VA_ATTRIB_NOT_SUPPORTED
374 attribList[j].value = VA_ATTRIB_NOT_SUPPORTED;
375
376 for(int32_t i = 0; i < supportedAttribList->size(); i++)
377 {
378 if(attribList[j].type == supportedAttribList->at(i).type)
379 {
380 attribList[j].value = supportedAttribList->at(i).value;
381 break;
382 }
383 else
384 {
385 GetGeneralConfigAttrib(&attribList[j]);
386 }
387 }
388 }
389 return VA_STATUS_SUCCESS;
390 }
391
392 VAStatus MediaLibvaCapsNext::GetGeneralConfigAttrib(VAConfigAttrib *attrib)
393 {
394 static const std::map<VAConfigAttribType, uint32_t> generalAttribMap = {
395 #if VA_CHECK_VERSION(1, 10, 0)
396 {VAConfigAttribContextPriority, CONTEXT_PRIORITY_MAX},
397 #endif
398 };
399
400 DDI_CHK_NULL(attrib, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
401 if (generalAttribMap.find(attrib->type) != generalAttribMap.end())
402 {
403 attrib->value = CONTEXT_PRIORITY_MAX;
404 }
405
406 return VA_STATUS_SUCCESS;
407 }
408
409 VAStatus MediaLibvaCapsNext::QueryConfigEntrypoints(
410 VAProfile profile,
411 VAEntrypoint *entrypointList,
412 int32_t *entrypointNum)
413 {
414 DDI_FUNC_ENTER;
415
416 DDI_CHK_NULL(m_capsTable, "Caps table is null", VA_STATUS_ERROR_INVALID_PARAMETER);
417 DDI_CHK_NULL(entrypointList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
418 DDI_CHK_NULL(entrypointNum, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
419
420 EntrypointMap *entryMap = nullptr;
421 VAStatus status = VA_STATUS_SUCCESS;
422
423 entryMap = m_capsTable->QueryConfigEntrypointsMap(profile);
424 DDI_CHK_NULL(entryMap, "QueryConfigEntrypointsMap failed", VA_STATUS_ERROR_UNSUPPORTED_PROFILE);
425
426 int i = 0;
427 for (auto it = entryMap->begin(); it!=entryMap->end(); ++it)
428 {
429 entrypointList[i] = (VAEntrypoint)(it->first);
430 i++;
431 }
432
433 *entrypointNum = entryMap->size();
434 return VA_STATUS_SUCCESS;
435 }
436
437 VAStatus MediaLibvaCapsNext::QuerySurfaceAttributes(
438 VAConfigID configId,
439 VASurfaceAttrib *attribList,
440 uint32_t *numAttribs)
441 {
442 DDI_FUNC_ENTER;
443
444 DDI_CHK_NULL(m_capsTable, "Caps table is null", VA_STATUS_ERROR_INVALID_PARAMETER);
445 DDI_CHK_NULL(numAttribs, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
446
447 if (attribList == nullptr)
448 {
449 *numAttribs = DDI_CODEC_GEN_MAX_SURFACE_ATTRIBUTES;
450 return VA_STATUS_SUCCESS;
451 }
452
453 ProfileSurfaceAttribInfo *surfaceAttribInfo = nullptr;
454 VAStatus status = VA_STATUS_SUCCESS;
455
456 surfaceAttribInfo = m_capsTable->QuerySurfaceAttributesFromConfigId(configId);
457 DDI_CHK_NULL(surfaceAttribInfo, "QuerySurfaceAttributesFromConfigId failed", VA_STATUS_ERROR_INVALID_PARAMETER);
458
459 VASurfaceAttrib *attribs = (VASurfaceAttrib *)MOS_AllocAndZeroMemory(DDI_CODEC_GEN_MAX_SURFACE_ATTRIBUTES * sizeof(*attribs));
460 if (attribs == nullptr)
461 {
462 return VA_STATUS_ERROR_ALLOCATION_FAILED;
463 }
464
465 int i = 0;
466 for (uint32_t j = 0; j < surfaceAttribInfo->size(); j++)
467 {
468 attribs[i].type = surfaceAttribInfo->at(j).type1;
469 attribs[i].flags = surfaceAttribInfo->at(j).flags;
470 attribs[i].value.type = surfaceAttribInfo->at(j).value.type;
471 if(attribs[i].value.type == VAGenericValueTypeInteger)
472 {
473 attribs[i].value.value.i = surfaceAttribInfo->at(j).value.value.i;
474 }
475 else if(attribs[i].value.type == VAGenericValueTypePointer)
476 {
477 attribs[i].value.value.p = surfaceAttribInfo->at(j).value.value.p;
478 }
479 else
480 {
481 DDI_ASSERTMESSAGE("Invalid VAGenericValueType");
482 MOS_FreeMemory(attribs);
483 return VA_STATUS_ERROR_UNIMPLEMENTED;
484 }
485 ++i;
486 }
487
488 if (i > *numAttribs)
489 {
490 *numAttribs = i;
491 MOS_FreeMemory(attribs);
492 return VA_STATUS_ERROR_MAX_NUM_EXCEEDED;
493 }
494
495 *numAttribs = i;
496 MOS_SecureMemcpy(attribList, i * sizeof(*attribs), attribs, i * sizeof(*attribs));
497 MOS_FreeMemory(attribs);
498
499 return status;
500 }
501
502 VAStatus MediaLibvaCapsNext::QueryImageFormats(
503 VAImageFormat *formatList,
504 int32_t *numFormats)
505 {
506 DDI_FUNC_ENTER;
507
508 DDI_CHK_NULL(m_capsTable, "Caps table is null", VA_STATUS_ERROR_INVALID_PARAMETER);
509 DDI_CHK_NULL(formatList, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
510 DDI_CHK_NULL(numFormats, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
511
512 int num = 0;
513 auto imgTbl = m_capsTable->GetImgTable();
514 MOS_ZeroMemory(formatList, sizeof(VAImageFormat) * imgTbl->size());
515
516 for(auto imgTblIter : *imgTbl)
517 {
518 formatList[num].fourcc = imgTblIter.first;
519 auto imageFormatInfo = imgTblIter.second;
520 DDI_CHK_NULL(imageFormatInfo, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
521
522 formatList[num].byte_order = imageFormatInfo->byte_order;
523 formatList[num].bits_per_pixel = imageFormatInfo->bits_per_pixel;
524 formatList[num].depth = imageFormatInfo->depth;
525 formatList[num].red_mask = imageFormatInfo->red_mask;
526 formatList[num].green_mask = imageFormatInfo->green_mask;
527 formatList[num].blue_mask = imageFormatInfo->blue_mask;
528 formatList[num].alpha_mask = imageFormatInfo->alpha_mask;
529
530 num++;
531 }
532
533 *numFormats = num;
534 return VA_STATUS_SUCCESS;
535 }
536
537 VAStatus MediaLibvaCapsNext::PopulateColorMaskInfo(VAImageFormat *vaImgFmt)
538 {
539 DDI_FUNC_ENTER;
540
541 DDI_CHK_NULL(m_capsTable, "Caps table is null", VA_STATUS_ERROR_INVALID_PARAMETER);
542 DDI_CHK_NULL(vaImgFmt, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
543
544 auto imgTbl = m_capsTable->GetImgTable();
545
546 if(imgTbl->find(vaImgFmt->fourcc) == imgTbl->end())
547 {
548 return VA_STATUS_ERROR_INVALID_IMAGE_FORMAT;
549 }
550
551 auto imageFormatInfo = imgTbl->at(vaImgFmt->fourcc);
552 DDI_CHK_NULL(imageFormatInfo, "Null pointer", VA_STATUS_ERROR_INVALID_PARAMETER);
553
554 vaImgFmt->red_mask = imageFormatInfo->red_mask;
555 vaImgFmt->green_mask = imageFormatInfo->green_mask;
556 vaImgFmt->blue_mask = imageFormatInfo->blue_mask;
557 vaImgFmt->alpha_mask = imageFormatInfo->alpha_mask;
558
559 return VA_STATUS_SUCCESS;
560 }
561
562
563 VAStatus MediaLibvaCapsNext::QueryDisplayAttributes(
564 VADisplayAttribute *attribList,
565 int32_t *attributesNum)
566 {
567 DDI_FUNC_ENTER;
568
569 DDI_CHK_NULL(attribList, "Null attribList", VA_STATUS_ERROR_INVALID_PARAMETER);
570 DDI_CHK_NULL(attributesNum, "Null attribs", VA_STATUS_ERROR_INVALID_PARAMETER);
571 VADisplayAttribute * attrib = attribList;
572 *attributesNum = 0;
573
574 attrib->type = VADisplayAttribCopy;
575 (*attributesNum) ++;
576
577 #if VA_CHECK_VERSION(1, 15, 0)
578 attrib ++;
579
580 attrib->type = VADisplayPCIID;
581 (*attributesNum) ++;
582 #endif
583
584 return GetDisplayAttributes(attribList, *attributesNum);
585 }
586
587 VAStatus MediaLibvaCapsNext::GetDisplayAttributes(
588 VADisplayAttribute *attribList,
589 int32_t attributesNum)
590 {
591 DDI_FUNC_ENTER;
592 DDI_CHK_NULL(attribList, "Null attribList", VA_STATUS_ERROR_INVALID_PARAMETER);
593
594 for(auto i = 0; i < attributesNum; i ++)
595 {
596 switch(attribList->type)
597 {
598 case VADisplayAttribCopy:
599 attribList->min_value = attribList->value = attribList->max_value = 0;
600 attribList->flags = VA_DISPLAY_ATTRIB_GETTABLE;
601 break;
602 #if VA_CHECK_VERSION(1, 15, 0)
603 case VADisplayPCIID:
604 attribList->min_value = attribList->value = attribList->max_value = (m_mediaCtx->iDeviceId & 0xffff) | 0x80860000;
605 attribList->flags = VA_DISPLAY_ATTRIB_GETTABLE;
606 break;
607 #endif
608 default:
609 attribList->min_value = VA_ATTRIB_NOT_SUPPORTED;
610 attribList->max_value = VA_ATTRIB_NOT_SUPPORTED;
611 attribList->value = VA_ATTRIB_NOT_SUPPORTED;
612 attribList->flags = VA_DISPLAY_ATTRIB_NOT_SUPPORTED;
613 break;
614 }
615 attribList ++;
616 }
617 return VA_STATUS_SUCCESS;
618 }