xref: /aosp_15_r20/external/intel-media-driver/media_driver/linux/Xe_M/ddi/media_libva_caps_xehp_sdv.cpp (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2021, 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_xehp_sdv.cpp
25 //! \brief    This file implements the C++ class/interface for Xe_XPM media capbilities.
26 //!
27 
28 #include "codec_def_encode_hevc_g12.h"
29 #include "media_libva.h"
30 #include "media_libva_util.h"
31 #include "media_libva_caps_xehp_sdv.h"
32 #include "media_libva_caps_factory.h"
33 #include "media_ddi_encode_const.h"
34 
CheckEncodeResolution(VAProfile profile,uint32_t width,uint32_t height)35 VAStatus MediaLibvaCapsXeHP::CheckEncodeResolution(
36         VAProfile profile,
37         uint32_t width,
38         uint32_t height)
39 {
40     VAStatus status = MediaLibvaCapsG12::CheckEncodeResolution(profile, width, height);
41 
42     if (!m_vdencActive && (profile == VAProfileHEVCMain || profile == VAProfileHEVCMain10))
43     {
44         if (width > m_maxHevcEncWidth
45              || width < m_encMinWidth
46              || height > m_hevcDPEncMaxHeight
47              || height < m_encMinHeight)
48         {
49              return VA_STATUS_ERROR_RESOLUTION_NOT_SUPPORTED;
50         }
51     }
52     return status;
53 }
54 
GetPlatformSpecificAttrib(VAProfile profile,VAEntrypoint entrypoint,VAConfigAttribType type,uint32_t * value)55 VAStatus MediaLibvaCapsXeHP::GetPlatformSpecificAttrib(VAProfile profile,
56         VAEntrypoint entrypoint,
57         VAConfigAttribType type,
58         uint32_t *value)
59 {
60     VAStatus status = MediaLibvaCapsG12::GetPlatformSpecificAttrib(profile, entrypoint, type, value);
61 
62     if (entrypoint == VAEntrypointEncSlice || entrypoint == VAEntrypointFEI)
63     {
64         if (profile == VAProfileHEVCMain || profile == VAProfileHEVCMain10)
65         {
66             if ((int)type == VAConfigAttribMaxPictureHeight)
67             {
68                 *value = m_hevcDPEncMaxHeight;
69             }
70         }
71     }
72 
73     return status;
74 }
75 
76 extern template class MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>;
77 
78 static bool xehpRegistered = MediaLibvaCapsFactory<MediaLibvaCaps, DDI_MEDIA_CONTEXT>::
79     RegisterCaps<MediaLibvaCapsXeHP>((uint32_t)IGFX_XE_HP_SDV);
80