1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2015 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 #ifndef __NV_KMS_PRIVATE_H__
25 #define __NV_KMS_PRIVATE_H__
26 
27 #include "nvkms-types.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 struct NvKmsPerOpenDev *nvAllocPerOpenDev(struct NvKmsPerOpen *pOpen,
34                                           NVDevEvoPtr pDevEvo, NvBool isPrivileged);
35 
36 void nvFreePerOpenDev(struct NvKmsPerOpen *pOpen,
37                       struct NvKmsPerOpenDev *pOpenDev);
38 
39 void nvSendDpyEventEvo(const NVDpyEvoRec *pDpyEvo, const NvU32 eventType);
40 
41 void nvSendDpyAttributeChangedEventEvo(const NVDpyEvoRec *pDpyEvo,
42                                        const enum NvKmsDpyAttribute attribute,
43                                        const NvS64 value);
44 
45 void nvSendFrameLockAttributeChangedEventEvo(
46     const NVFrameLockEvoRec *pFrameLockEvo,
47     const enum NvKmsFrameLockAttribute attribute,
48     const NvS64 value);
49 
50 void nvSendFlipOccurredEventEvo(const NVDispEvoRec *pDispEvo,
51                                 const NvU32 apiHead, const NvU32 layer);
52 
53 void nvSendUnicastEvent(struct NvKmsPerOpen *pOpen);
54 
55 void nvRemoveUnicastEvent(struct NvKmsPerOpen *pOpen);
56 
57 #if defined(DEBUG)
58 NvBool nvSurfaceEvoInAnyOpens(const NVSurfaceEvoRec *pSurfaceEvo);
59 #endif
60 
61 const struct NvKmsFlipPermissions *nvGetFlipPermissionsFromOpenDev(
62     const struct NvKmsPerOpenDev *pOpenDev);
63 
64 const struct NvKmsModesetPermissions *nvGetModesetPermissionsFromOpenDev(
65     const struct NvKmsPerOpenDev *pOpenDev);
66 
67 NVEvoApiHandlesRec *nvGetSurfaceHandlesFromOpenDev(
68     struct NvKmsPerOpenDev *pOpenDev);
69 const NVEvoApiHandlesRec *nvGetSurfaceHandlesFromOpenDevConst(
70     const struct NvKmsPerOpenDev *pOpenDev);
71 
72 void nvKmsServiceNonStallInterrupt(void *dataPtr, NvU32 dataU32);
73 
74 #ifdef __cplusplus
75 };
76 #endif
77 
78 #endif /* __NV_KMS_PRIVATE_H__ */
79