-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathnvkms-kapi.h
1601 lines (1416 loc) · 50.5 KB
/
nvkms-kapi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* SPDX-FileCopyrightText: Copyright (c) 2015-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#if !defined(__NVKMS_KAPI_H__)
#include "nvtypes.h"
#include "nv-gpu-info.h"
#include "nvkms-api-types.h"
#include "nvkms-format.h"
#define __NVKMS_KAPI_H__
#define NVKMS_KAPI_MAX_HEADS 4
#define NVKMS_KAPI_MAX_CONNECTORS 16
#define NVKMS_KAPI_MAX_CLONE_DISPLAYS 16
#define NVKMS_KAPI_EDID_BUFFER_SIZE 2048
#define NVKMS_KAPI_MODE_NAME_LEN 32
/**
* \defgroup Objects
* @{
*/
struct NvKmsKapiDevice;
struct NvKmsKapiMemory;
struct NvKmsKapiSurface;
struct NvKmsKapiChannelEvent;
struct NvKmsKapiSemaphoreSurface;
struct NvKmsKapiSemaphoreSurfaceCallback;
typedef NvU32 NvKmsKapiConnector;
typedef NvU32 NvKmsKapiDisplay;
/** @} */
/**
* \defgroup FuncPtrs
* @{
*/
/*
* Note: The channel event proc should not call back into NVKMS-KAPI driver.
* The callback into NVKMS-KAPI from the channel event proc, may cause
* deadlock.
*/
typedef void NvKmsChannelEventProc(void *dataPtr, NvU32 dataU32);
/*
* Note: Same as above, this function must not call back into NVKMS-KAPI, nor
* directly into RM. Doing so could cause deadlocks given the notification
* function will most likely be called from within RM's interrupt handler
* callchain.
*/
typedef void NvKmsSemaphoreSurfaceCallbackProc(void *pData);
/** @} */
/**
* \defgroup Structs
* @{
*/
struct NvKmsKapiDisplayModeTimings {
NvU32 refreshRate;
NvU32 pixelClockHz;
NvU32 hVisible;
NvU32 hSyncStart;
NvU32 hSyncEnd;
NvU32 hTotal;
NvU32 hSkew;
NvU32 vVisible;
NvU32 vSyncStart;
NvU32 vSyncEnd;
NvU32 vTotal;
struct {
NvU32 interlaced : 1;
NvU32 doubleScan : 1;
NvU32 hSyncPos : 1;
NvU32 hSyncNeg : 1;
NvU32 vSyncPos : 1;
NvU32 vSyncNeg : 1;
} flags;
NvU32 widthMM;
NvU32 heightMM;
};
struct NvKmsKapiDisplayMode {
struct NvKmsKapiDisplayModeTimings timings;
char name[NVKMS_KAPI_MODE_NAME_LEN];
};
#define NVKMS_KAPI_LAYER_MAX 8
#define NVKMS_KAPI_LAYER_INVALID_IDX 0xff
#define NVKMS_KAPI_LAYER_PRIMARY_IDX 0
struct NvKmsKapiLutCaps {
struct {
struct NvKmsLUTCaps ilut;
struct NvKmsLUTCaps tmo;
} layer[NVKMS_KAPI_LAYER_MAX];
struct NvKmsLUTCaps olut;
};
struct NvKmsKapiDeviceResourcesInfo {
NvU32 numHeads;
NvU32 numLayers[NVKMS_KAPI_MAX_HEADS];
NvU32 numConnectors;
NvKmsKapiConnector connectorHandles[NVKMS_KAPI_MAX_CONNECTORS];
struct {
NvU32 validCursorCompositionModes;
NvU64 supportedCursorSurfaceMemoryFormats;
struct {
NvU64 maxSubmittedOffset;
NvU64 stride;
} semsurf;
struct {
NvU16 validRRTransforms;
NvU32 validCompositionModes;
} layer[NVKMS_KAPI_LAYER_MAX];
NvU32 minWidthInPixels;
NvU32 maxWidthInPixels;
NvU32 minHeightInPixels;
NvU32 maxHeightInPixels;
NvU32 maxCursorSizeInPixels;
NvU32 pitchAlignment;
NvU32 hasVideoMemory;
NvU32 numDisplaySemaphores;
NvU8 genericPageKind;
NvBool supportsSyncpts;
NvBool requiresVrrSemaphores;
} caps;
NvU64 supportedSurfaceMemoryFormats[NVKMS_KAPI_LAYER_MAX];
NvBool supportsICtCp[NVKMS_KAPI_LAYER_MAX];
struct NvKmsKapiLutCaps lutCaps;
};
#define NVKMS_KAPI_LAYER_MASK(layerType) (1 << (layerType))
typedef enum NvKmsKapiMappingTypeRec {
NVKMS_KAPI_MAPPING_TYPE_USER = 1,
NVKMS_KAPI_MAPPING_TYPE_KERNEL = 2,
} NvKmsKapiMappingType;
struct NvKmsKapiConnectorInfo {
NvKmsKapiConnector handle;
NvU32 physicalIndex;
NvKmsConnectorSignalFormat signalFormat;
NvKmsConnectorType type;
/*
* List of connectors, not possible to serve together with this connector
* because they are competing for same resources.
*/
NvU32 numIncompatibleConnectors;
NvKmsKapiConnector incompatibleConnectorHandles[NVKMS_KAPI_MAX_CONNECTORS];
};
struct NvKmsKapiStaticDisplayInfo {
NvKmsKapiDisplay handle;
NvKmsKapiConnector connectorHandle;
/* Set for DisplayPort MST displays (dynamic displays) */
char dpAddress[NVKMS_DP_ADDRESS_STRING_LENGTH];
NvBool internal;
/* List of potential sibling display for cloning */
NvU32 numPossibleClones;
NvKmsKapiDisplay possibleCloneHandles[NVKMS_KAPI_MAX_CLONE_DISPLAYS];
NvU32 headMask;
};
struct NvKmsKapiSyncParams {
union {
struct {
/*!
* Possible syncpt use case in kapi.
* For pre-syncpt, use only id and value
* and for post-syncpt, use only fd.
*/
NvU32 preSyncptId;
NvU32 preSyncptValue;
} syncpt;
struct {
NvU32 index;
} semaphore;
} u;
NvBool preSyncptSpecified;
NvBool postSyncptRequested;
NvBool semaphoreSpecified;
};
struct NvKmsKapiLayerConfig {
struct NvKmsKapiSurface *surface;
struct {
enum NvKmsCompositionBlendingMode compMode;
NvU8 surfaceAlpha;
} compParams;
struct NvKmsRRParams rrParams;
struct NvKmsKapiSyncParams syncParams;
struct {
struct NvKmsHDRStaticMetadata val;
NvBool enabled;
} hdrMetadata;
enum NvKmsOutputTf tf;
NvU8 minPresentInterval;
NvBool tearing;
NvU16 srcX, srcY;
NvU16 srcWidth, srcHeight;
NvS16 dstX, dstY;
NvU16 dstWidth, dstHeight;
enum NvKmsInputColorSpace inputColorSpace;
struct {
NvBool enabled;
struct NvKmsKapiSurface *lutSurface;
NvU64 offset;
NvU32 vssSegments;
NvU32 lutEntries;
} ilut;
struct {
NvBool enabled;
struct NvKmsKapiSurface *lutSurface;
NvU64 offset;
NvU32 vssSegments;
NvU32 lutEntries;
} tmo;
struct NvKmsCscMatrix csc;
NvBool cscUseMain;
struct {
struct NvKmsCscMatrix lmsCtm;
struct NvKmsCscMatrix lmsToItpCtm;
struct NvKmsCscMatrix itpToLmsCtm;
struct NvKmsCscMatrix blendCtm;
struct {
NvBool lmsCtm : 1;
NvBool lmsToItpCtm : 1;
NvBool itpToLmsCtm : 1;
NvBool blendCtm : 1;
} enabled;
} matrixOverrides;
};
struct NvKmsKapiLayerRequestedConfig {
struct NvKmsKapiLayerConfig config;
struct {
NvBool surfaceChanged : 1;
NvBool srcXYChanged : 1;
NvBool srcWHChanged : 1;
NvBool dstXYChanged : 1;
NvBool dstWHChanged : 1;
NvBool cscChanged : 1;
NvBool tfChanged : 1;
NvBool hdrMetadataChanged : 1;
NvBool matrixOverridesChanged : 1;
NvBool ilutChanged : 1;
NvBool tmoChanged : 1;
} flags;
};
struct NvKmsKapiCursorRequestedConfig {
struct NvKmsKapiSurface *surface;
struct {
enum NvKmsCompositionBlendingMode compMode;
NvU8 surfaceAlpha;
} compParams;
NvS16 dstX, dstY;
struct {
NvBool surfaceChanged : 1;
NvBool dstXYChanged : 1;
} flags;
};
struct NvKmsKapiHeadModeSetConfig {
/*
* DRM distinguishes between the head state "enabled" (the specified
* configuration for the head is valid, its resources are allocated,
* etc, but the head may not necessarily be currently driving pixels
* to its output resource) and the head state "active" (the head is
* "enabled" _and_ the head is actively driving pixels to its output
* resource).
*
* This distinction is for DPMS:
*
* DPMS On : enabled=true, active=true
* DPMS Off : enabled=true, active=false
*
* "Enabled" state is indicated by numDisplays != 0.
* "Active" state is indicated by bActive == true.
*/
NvBool bActive;
NvU32 numDisplays;
NvKmsKapiDisplay displays[NVKMS_KAPI_MAX_CLONE_DISPLAYS];
struct NvKmsKapiDisplayMode mode;
NvBool vrrEnabled;
struct {
NvBool enabled;
enum NvKmsInfoFrameEOTF eotf;
struct NvKmsHDRStaticMetadata staticMetadata;
} hdrInfoFrame;
enum NvKmsOutputColorimetry colorimetry;
struct {
struct {
NvU32 depth;
NvU32 start;
NvU32 end;
struct NvKmsLutRamps *pRamps;
} input;
struct {
NvBool enabled;
struct NvKmsLutRamps *pRamps;
} output;
} lut;
struct {
NvBool enabled;
struct NvKmsKapiSurface *lutSurface;
NvU64 offset;
NvU32 vssSegments;
NvU32 lutEntries;
} olut;
NvU32 olutFpNormScale;
};
struct NvKmsKapiHeadRequestedConfig {
struct NvKmsKapiHeadModeSetConfig modeSetConfig;
struct {
NvBool activeChanged : 1;
NvBool displaysChanged : 1;
NvBool modeChanged : 1;
NvBool hdrInfoFrameChanged : 1;
NvBool colorimetryChanged : 1;
NvBool legacyIlutChanged : 1;
NvBool legacyOlutChanged : 1;
NvBool olutChanged : 1;
NvBool olutFpNormScaleChanged : 1;
} flags;
struct NvKmsKapiCursorRequestedConfig cursorRequestedConfig;
struct NvKmsKapiLayerRequestedConfig
layerRequestedConfig[NVKMS_KAPI_LAYER_MAX];
};
struct NvKmsKapiRequestedModeSetConfig {
NvU32 headsMask;
struct NvKmsKapiHeadRequestedConfig
headRequestedConfig[NVKMS_KAPI_MAX_HEADS];
};
struct NvKmsKapiLayerReplyConfig {
int postSyncptFd;
};
struct NvKmsKapiHeadReplyConfig {
struct NvKmsKapiLayerReplyConfig
layerReplyConfig[NVKMS_KAPI_LAYER_MAX];
};
struct NvKmsKapiModeSetReplyConfig {
enum NvKmsFlipResult flipResult;
NvBool vrrFlip;
NvS32 vrrSemaphoreIndex;
struct NvKmsKapiHeadReplyConfig
headReplyConfig[NVKMS_KAPI_MAX_HEADS];
};
struct NvKmsKapiEventDisplayChanged {
NvKmsKapiDisplay display;
};
struct NvKmsKapiEventDynamicDisplayConnected {
NvKmsKapiDisplay display;
};
struct NvKmsKapiEventFlipOccurred {
NvU32 head;
NvU32 layer;
};
struct NvKmsKapiDpyCRC32 {
NvU32 value;
NvBool supported;
};
struct NvKmsKapiCrcs {
struct NvKmsKapiDpyCRC32 compositorCrc32;
struct NvKmsKapiDpyCRC32 rasterGeneratorCrc32;
struct NvKmsKapiDpyCRC32 outputCrc32;
};
struct NvKmsKapiEvent {
enum NvKmsEventType type;
struct NvKmsKapiDevice *device;
void *privateData;
union {
struct NvKmsKapiEventDisplayChanged displayChanged;
struct NvKmsKapiEventDynamicDisplayConnected dynamicDisplayConnected;
struct NvKmsKapiEventFlipOccurred flipOccurred;
} u;
};
struct NvKmsKapiAllocateDeviceParams {
/* [IN] GPU ID obtained from enumerateGpus() */
NvU32 gpuId;
/* [IN] Private data of device allocator */
void *privateData;
/* [IN] Event callback */
void (*eventCallback)(const struct NvKmsKapiEvent *event);
};
struct NvKmsKapiDynamicDisplayParams {
/* [IN] Display Handle returned by getDisplays() */
NvKmsKapiDisplay handle;
/* [OUT] Connection status */
NvU32 connected;
/* [OUT] VRR status */
NvBool vrrSupported;
/* [IN/OUT] EDID of connected monitor/ Input to override EDID */
struct {
NvU16 bufferSize;
NvU8 buffer[NVKMS_KAPI_EDID_BUFFER_SIZE];
} edid;
/* [IN] Set true to override EDID */
NvBool overrideEdid;
/* [IN] Set true to force connected status */
NvBool forceConnected;
/* [IN] Set true to force disconnect status */
NvBool forceDisconnected;
};
struct NvKmsKapiCreateSurfaceParams {
/* [IN] Parameter of each plane */
struct {
/* [IN] Memory allocated for plane, using allocateMemory() */
struct NvKmsKapiMemory *memory;
/* [IN] Offsets within the memory object */
NvU32 offset;
/* [IN] Byte pitch of plane */
NvU32 pitch;
} planes[NVKMS_MAX_PLANES_PER_SURFACE];
/* [IN] Width of the surface, in pixels */
NvU32 width;
/* [IN] Height of the surface, in pixels */
NvU32 height;
/* [IN] The format describing number of planes and their content */
enum NvKmsSurfaceMemoryFormat format;
/* [IN] Whether to override the surface objects memory layout parameters
* with those provided here. */
NvBool explicit_layout;
/* [IN] Whether the surface layout is block-linear or pitch. Used only
* if explicit_layout is NV_TRUE */
enum NvKmsSurfaceMemoryLayout layout;
/* [IN] block-linear block height of surface. Used only when
* explicit_layout is NV_TRUE and layout is
* NvKmsSurfaceMemoryLayoutBlockLinear */
NvU8 log2GobsPerBlockY;
/* [IN] Whether a surface can be updated directly on the screen */
NvBool noDisplayCaching;
};
enum NvKmsKapiAllocationType {
NVKMS_KAPI_ALLOCATION_TYPE_SCANOUT = 0,
NVKMS_KAPI_ALLOCATION_TYPE_NOTIFIER = 1,
NVKMS_KAPI_ALLOCATION_TYPE_OFFSCREEN = 2,
};
typedef enum NvKmsKapiRegisterWaiterResultRec {
NVKMS_KAPI_REG_WAITER_FAILED,
NVKMS_KAPI_REG_WAITER_SUCCESS,
NVKMS_KAPI_REG_WAITER_ALREADY_SIGNALLED,
} NvKmsKapiRegisterWaiterResult;
typedef void NvKmsKapiSuspendResumeCallbackFunc(NvBool suspend);
struct NvKmsKapiFunctionsTable {
/*!
* NVIDIA Driver version string.
*/
const char *versionString;
/*!
* System Information.
*/
struct {
/* Availability of write combining support for video memory */
NvBool bAllowWriteCombining;
} systemInfo;
/*!
* Enumerate the available physical GPUs that can be used with NVKMS.
*
* \param [out] gpuInfo The information of the enumerated GPUs.
* It is an array of NVIDIA_MAX_GPUS elements.
*
* \return Count of enumerated gpus.
*/
NvU32 (*enumerateGpus)(nv_gpu_info_t *gpuInfo);
/*!
* Allocate an NVK device using which you can query/allocate resources on
* GPU and do modeset.
*
* \param [in] params Parameters required for device allocation.
*
* \return An valid device handle on success, NULL on failure.
*/
struct NvKmsKapiDevice* (*allocateDevice)
(
const struct NvKmsKapiAllocateDeviceParams *params
);
/*!
* Frees a device allocated by allocateDevice() and all its resources.
*
* \param [in] device A device returned by allocateDevice().
* This function is a no-op if device is not valid.
*/
void (*freeDevice)(struct NvKmsKapiDevice *device);
/*!
* Grab ownership of device, ownership is required to do modeset.
*
* \param [in] device A device returned by allocateDevice().
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*grabOwnership)(struct NvKmsKapiDevice *device);
/*!
* Release ownership of device.
*
* \param [in] device A device returned by allocateDevice().
*/
void (*releaseOwnership)(struct NvKmsKapiDevice *device);
/*!
* Grant modeset permissions for a display to fd. Only one (dispIndex, head,
* display) is currently supported.
*
* \param [in] fd fd from opening /dev/nvidia-modeset.
*
* \param [in] device A device returned by allocateDevice().
*
* \param [in] head head of display.
*
* \param [in] display The display to grant.
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*grantPermissions)
(
NvS32 fd,
struct NvKmsKapiDevice *device,
NvU32 head,
NvKmsKapiDisplay display
);
/*!
* Revoke modeset permissions previously granted. Only one (dispIndex,
* head, display) is currently supported.
*
* \param [in] device A device returned by allocateDevice().
*
* \param [in] head head of display.
*
* \param [in] display The display to revoke.
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*revokePermissions)
(
struct NvKmsKapiDevice *device,
NvU32 head,
NvKmsKapiDisplay display
);
/*!
* Grant modeset sub-owner permissions to fd. This is used by clients to
* convert drm 'master' permissions into nvkms sub-owner permission.
*
* \param [in] fd fd from opening /dev/nvidia-modeset.
*
* \param [in] device A device returned by allocateDevice().
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*grantSubOwnership)
(
NvS32 fd,
struct NvKmsKapiDevice *device
);
/*!
* Revoke sub-owner permissions previously granted.
*
* \param [in] device A device returned by allocateDevice().
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*revokeSubOwnership)
(
struct NvKmsKapiDevice *device
);
/*!
* Registers for notification, via
* NvKmsKapiAllocateDeviceParams::eventCallback, of the events specified
* in interestMask.
*
* This call does nothing if eventCallback is NULL when NvKmsKapiDevice
* is allocated.
*
* Supported events are DPY_CHANGED and DYNAMIC_DPY_CONNECTED.
*
* \param [in] device A device returned by allocateDevice().
*
* \param [in] interestMask A mask of events requested to listen.
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*declareEventInterest)
(
const struct NvKmsKapiDevice *device,
const NvU32 interestMask
);
/*!
* Retrieve various static resources like connector, head etc. present on
* device and capacities.
*
* \param [in] device A device allocated using allocateDevice().
*
* \param [in/out] info A pointer to an NvKmsKapiDeviceResourcesInfo
* struct that the call will fill out with number
* of resources and their handles.
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*getDeviceResourcesInfo)
(
struct NvKmsKapiDevice *device,
struct NvKmsKapiDeviceResourcesInfo *info
);
/*!
* Retrieve the number of displays on a device and an array of handles to
* those displays.
*
* \param [in] device A device allocated using
* allocateDevice().
*
* \param [in/out] displayCount The caller should set this to the size
* of the displayHandles array it passed
* in. The function will set it to the
* number of displays returned, or the
* total number of displays on the device
* if displayHandles is NULL or array size
* of less than number of number of displays.
*
* \param [out] displayHandles An array of display handles with
* displayCount entries.
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*getDisplays)
(
struct NvKmsKapiDevice *device,
NvU32 *numDisplays, NvKmsKapiDisplay *displayHandles
);
/*!
* Retrieve information about a specified connector.
*
* \param [in] device A device allocated using allocateDevice().
*
* \param [in] connector Which connector to query, handle return by
* getDeviceResourcesInfo().
*
* \param [out] info A pointer to an NvKmsKapiConnectorInfo struct
* that the call will fill out with information
* about connector.
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*getConnectorInfo)
(
struct NvKmsKapiDevice *device,
NvKmsKapiConnector connector, struct NvKmsKapiConnectorInfo *info
);
/*!
* Retrieve information about a specified display.
*
* \param [in] device A device allocated using allocateDevice().
*
* \param [in] display Which connector to query, handle return by
* getDisplays().
*
* \param [out] info A pointer to an NvKmsKapiStaticDisplayInfo struct
* that the call will fill out with information
* about display.
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*getStaticDisplayInfo)
(
struct NvKmsKapiDevice *device,
NvKmsKapiDisplay display, struct NvKmsKapiStaticDisplayInfo *info
);
/*!
* Detect/force connection status/EDID of display.
*
* \param [in/out] params Parameters containing display
* handle, EDID and flags to force connection
* status.
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*getDynamicDisplayInfo)
(
struct NvKmsKapiDevice *device,
struct NvKmsKapiDynamicDisplayParams *params
);
/*!
* Allocate some unformatted video memory of the specified size.
*
* This function allocates video memory on the specified GPU.
* It should be suitable for mapping on the CPU as a pitch
* linear or block-linear surface.
*
* \param [in] device A device allocated using allocateDevice().
*
* \param [in] layout BlockLinear or Pitch.
*
* \param [in] type Allocation type.
*
* \param [in] size Size, in bytes, of the memory to allocate.
*
* \param [in/out] compressible For input, non-zero if compression
* backing store should be allocated for
* the memory, for output, non-zero if
* compression backing store was
* allocated for the memory.
*
* \return An valid memory handle on success, NULL on failure.
*/
struct NvKmsKapiMemory* (*allocateVideoMemory)
(
struct NvKmsKapiDevice *device,
enum NvKmsSurfaceMemoryLayout layout,
enum NvKmsKapiAllocationType type,
NvU64 size,
NvU8 *compressible
);
/*!
* Allocate some unformatted system memory of the specified size.
*
* This function allocates system memory . It should be suitable
* for mapping on the CPU as a pitch linear or block-linear surface.
*
* \param [in] device A device allocated using allocateDevice().
*
* \param [in] layout BlockLinear or Pitch.
*
* \param [in] type Allocation type.
*
* \param [in] size Size, in bytes, of the memory to allocate.
*
* \param [in/out] compressible For input, non-zero if compression
* backing store should be allocated for
* the memory, for output, non-zero if
* compression backing store was
* allocated for the memory.
*
* \return An valid memory handle on success, NULL on failure.
*/
struct NvKmsKapiMemory* (*allocateSystemMemory)
(
struct NvKmsKapiDevice *device,
enum NvKmsSurfaceMemoryLayout layout,
enum NvKmsKapiAllocationType type,
NvU64 size,
NvU8 *compressible
);
/*!
* Import some unformatted memory of the specified size.
*
* This function accepts a driver-specific parameter structure representing
* memory allocated elsewhere and imports it to a NVKMS KAPI memory object
* of the specified size.
*
* \param [in] device A device allocated using allocateDevice(). The
* memory being imported must have been allocated
* against the same physical device this device object
* represents.
*
* \param [in] size Size, in bytes, of the memory being imported.
*
* \param [in] nvKmsParamsUser Userspace pointer to driver-specific
* parameters describing the memory object being
* imported.
*
* \param [in] nvKmsParamsSize Size of the driver-specific parameter struct.
*
* \return A valid memory handle on success, NULL on failure.
*/
struct NvKmsKapiMemory* (*importMemory)
(
struct NvKmsKapiDevice *device, NvU64 size,
NvU64 nvKmsParamsUser,
NvU64 nvKmsParamsSize
);
/*!
* Duplicate an existing NVKMS KAPI memory object, taking a reference on the
* underlying memory.
*
* \param [in] device A device allocated using allocateDevice(). The
* memory being imported need not have been allocated
* against the same physical device this device object
* represents.
*
* \param [in] srcDevice The device associated with srcMemory.
*
* \param [in] srcMemory The memory object to duplicate.
*
* \return A valid memory handle on success, NULL on failure.
*/
struct NvKmsKapiMemory* (*dupMemory)
(
struct NvKmsKapiDevice *device,
const struct NvKmsKapiDevice *srcDevice,
const struct NvKmsKapiMemory *srcMemory
);
/*!
* Export the specified memory object to a userspace object handle.
*
* This function accepts a driver-specific parameter structure representing
* a new handle to be assigned to an existing NVKMS KAPI memory object.
*
* \param [in] device A device allocated using allocateDevice(). The
* memory being exported must have been created against
* or imported to the same device object, and the
* destination object handle must be valid for this
* device as well.
*
* \param [in] memory The memory object to export.
*
* \param [in] nvKmsParamsUser Userspace pointer to driver-specific
* parameters specifying a handle to add to the
* memory object being exported.
*
* \param [in] nvKmsParamsSize Size of the driver-specific parameter struct.
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*exportMemory)
(
const struct NvKmsKapiDevice *device,
const struct NvKmsKapiMemory *memory,
NvU64 nvKmsParamsUser,
NvU64 nvKmsParamsSize
);
/*!
* Free memory allocated using allocateMemory()
*
* \param [in] device A device allocated using allocateDevice().
*
* \param [in] memory Memory allocated using allocateMemory().
*
* \return NV_TRUE on success, NV_FALSE if memory is in use.
*/
void (*freeMemory)
(
struct NvKmsKapiDevice *device, struct NvKmsKapiMemory *memory
);
/*!
* Create MMIO mappings for a memory object allocated using
* allocateMemory().
*
* \param [in] device A device allocated using allocateDevice().
*
* \param [in] memory Memory allocated using allocateMemory()
*
* \param [in] type Userspace or kernelspace mapping
*
* \param [out] ppLinearAddress The MMIO address where memory object is
* mapped.
*
* \return NV_TRUE on success, NV_FALSE on failure.
*/
NvBool (*mapMemory)
(
const struct NvKmsKapiDevice *device,
const struct NvKmsKapiMemory *memory, NvKmsKapiMappingType type,
void **ppLinearAddress
);
/*!
* Destroy MMIO mappings created for a memory object allocated using
* allocateMemory().