1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2007-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #pragma once
25 
26 #include <nvtypes.h>
27 
28 //
29 // This file was generated with FINN, an NVIDIA coding tool.
30 // Source file:      ctrl/ctrla0bd.finn
31 //
32 
33 #include "ctrl/ctrlxxxx.h"
34 /* NVFBC_SW_SESSION control commands and parameters */
35 #define NVA0BD_CTRL_CMD(cat,idx)                            NVXXXX_CTRL_CMD(0xA0BD, NVA0BD_CTRL_##cat, idx)
36 
37 /* Command categories (6bits) */
38 #define NVA0BD_CTRL_RESERVED                         (0x00)
39 #define NVA0BD_CTRL_NVFBC_SW_SESSION                 (0x01)
40 
41 #define NVA0BD_CTRL_CMD_NVFBC_MAX_TIMESTAMP_ENTRIES  60
42 
43 /*
44  * NVA0BD_CTRL_CMD_NVFBC_SW_SESSION_UPDATE_INFO
45  *
46  * This command is used to let RM know about runtime information about
47  * NVFBC session on given GPU.
48  *  *
49   *   hResolution
50  *     This parameter specifies the current horizontal resolution of NVFBC session.
51  *   vResolution
52  *     This parameter specifies the current vertical resolution of NVFBC session.
53  *   captureCallFlags
54  *     This field specifies the flags associated with the capture call and the session.
55  *     One of the flags specifies whether the user made the capture with wait or not.
56  *   totalGrabCalls
57  *     This field specifies the total number of grab calls made by the user.
58  *   averageLatency
59  *     This field specifies the average capture latency over last 1 second.
60  *   averageFPS
61  *     This field specifies the average frames captured.
62   *   timestampEntryCount
63  *     This field specifies the number of entries in the timestampEntry array.
64  *     It should not be greater than NVA0BD_CTRL_CMD_NVFBC_MAX_TIMESTAMP_ENTRIES.
65  *     When this field is zero, RM will assume that client has calculated averageFBCFps
66  *     and averageFBCLatency, thus ignore timestampEntry array.
67  *   timestampEntry
68  *     This field specifies a array holding capture timestamps in microseconds.
69  *
70  * Possible status values returned are:
71  *   NV_OK
72  *   NV_ERR_INVALID_ARGUMENT
73  */
74 
75 #define NVA0BD_CTRL_CMD_NVFBC_SW_SESSION_UPDATE_INFO (0xa0bd0101) /* finn: Evaluated from "(FINN_NVFBC_SW_SESSION_NVFBC_SW_SESSION_INTERFACE_ID << 8) | NVA0BD_CTRL_NVFBC_SW_SESSION_UPDATE_INFO_PARAMS_MESSAGE_ID" */
76 
77 typedef struct NVA0BD_CTRL_NVFBC_TIMESTAMP {
78     NV_DECLARE_ALIGNED(NvU64 startTime, 8);
79     NV_DECLARE_ALIGNED(NvU64 endTime, 8);
80 } NVA0BD_CTRL_NVFBC_TIMESTAMP;
81 
82 #define NVA0BD_CTRL_NVFBC_SW_SESSION_UPDATE_INFO_PARAMS_MESSAGE_ID (0x1U)
83 
84 typedef struct NVA0BD_CTRL_NVFBC_SW_SESSION_UPDATE_INFO_PARAMS {
85     NvU32 hResolution;
86     NvU32 vResolution;
87     NvU32 captureCallFlags;
88     NvU32 totalGrabCalls;
89     NvU32 averageLatency;
90     NvU32 averageFPS;
91     NvU32 timestampEntryCount;
92     NV_DECLARE_ALIGNED(NVA0BD_CTRL_NVFBC_TIMESTAMP timestampEntry[NVA0BD_CTRL_CMD_NVFBC_MAX_TIMESTAMP_ENTRIES], 8);
93 } NVA0BD_CTRL_NVFBC_SW_SESSION_UPDATE_INFO_PARAMS;
94 
95 #define NVA0BD_NVFBC_WITH_WAIT                    1:0
96 #define NVA0BD_NVFBC_WITH_WAIT_FALSE    (0x00000000)
97 #define NVA0BD_NVFBC_WITH_WAIT_INFINITE (0x00000001)
98 #define NVA0BD_NVFBC_WITH_WAIT_TIMEOUT  (0x00000010)
99 
100 /* _ctrla0bd_h_ */
101