1 /*
2 * Copyright (c) 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 //!
24 //! \file media_libva_caps_mtl.cpp
25 //! \brief This file implements the C++ class/interface for mtl media capbilities.
26 //!
27
28 #include "media_libva.h"
29 #include "media_libva_util.h"
30 #include "media_libva_caps_mtl.h"
31 #include "media_libva_caps_factory.h"
32 #define VA_COPY_MODE_BALANCE 3
33
GetDisplayAttributes(VADisplayAttribute * attribList,int32_t numAttribs)34 VAStatus MediaLibvaCapsMtl::GetDisplayAttributes(
35 VADisplayAttribute* attribList,
36 int32_t numAttribs)
37 {
38 DDI_CHK_NULL(attribList, "Null attribList", VA_STATUS_ERROR_INVALID_PARAMETER);
39 for (auto i = 0; i < numAttribs; i++)
40 {
41 switch (attribList->type)
42 {
43 #if VA_CHECK_VERSION(1, 15, 0)
44 case VADisplayPCIID:
45 attribList->min_value = attribList->value = attribList->max_value = (m_mediaCtx->iDeviceId & 0xffff) | 0x80860000;
46 attribList->flags = VA_DISPLAY_ATTRIB_GETTABLE;
47 break;
48 #endif
49 case VADisplayAttribCopy:
50 attribList->min_value = attribList->value = attribList->max_value =
51 (1 << VA_EXEC_MODE_POWER_SAVING) | (1 << VA_EXEC_MODE_PERFORMANCE) | (1 << VA_EXEC_MODE_DEFAULT) | (1 << VA_COPY_MODE_BALANCE);
52 // 1000:balance mode: Vebox Copy
53 // 100: perfromance : Render copy
54 // 10: POWER_SAVING: BLT copy
55 // 1: default model
56 // 0: don't support media copy.
57 attribList->flags = VA_DISPLAY_ATTRIB_GETTABLE;
58 break;
59 default:
60 attribList->min_value = VA_ATTRIB_NOT_SUPPORTED;
61 attribList->max_value = VA_ATTRIB_NOT_SUPPORTED;
62 attribList->value = VA_ATTRIB_NOT_SUPPORTED;
63 attribList->flags = VA_DISPLAY_ATTRIB_NOT_SUPPORTED;
64 break;
65 }
66 attribList++;
67 }
68 return VA_STATUS_SUCCESS;
69 }
70
71 static bool mtlRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>::
72 RegisterCaps<MediaLibvaCapsMtl>((uint32_t)IGFX_METEORLAKE);
73
74 static bool arlRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>::
75 RegisterCaps<MediaLibvaCapsMtl>((uint32_t)IGFX_ARROWLAKE);
76