mirror of OpenBSD xenocara tree github.com/openbsd/xenocara
openbsd
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge libdrm 2.4.120

jsg e07bf2bd 8e87338e

+332 -60
+1 -1
lib/libdrm/amdgpu/amdgpu_bo.c
··· 551 551 if (!bo || !bo->cpu_ptr || size > bo->alloc_size) 552 552 continue; 553 553 if (cpu >= bo->cpu_ptr && 554 - cpu < (void*)((uintptr_t)bo->cpu_ptr + bo->alloc_size)) 554 + cpu < (void*)((uintptr_t)bo->cpu_ptr + (size_t)bo->alloc_size)) 555 555 break; 556 556 } 557 557
+3
lib/libdrm/generated/generated_static_table_fourcc.h
··· 15 15 { DRM_MODIFIER_INTEL(4_TILED_DG2_RC_CCS, 4_TILED_DG2_RC_CCS) }, 16 16 { DRM_MODIFIER_INTEL(4_TILED_DG2_MC_CCS, 4_TILED_DG2_MC_CCS) }, 17 17 { DRM_MODIFIER_INTEL(4_TILED_DG2_RC_CCS_CC, 4_TILED_DG2_RC_CCS_CC) }, 18 + { DRM_MODIFIER_INTEL(4_TILED_MTL_RC_CCS, 4_TILED_MTL_RC_CCS) }, 19 + { DRM_MODIFIER_INTEL(4_TILED_MTL_MC_CCS, 4_TILED_MTL_MC_CCS) }, 20 + { DRM_MODIFIER_INTEL(4_TILED_MTL_RC_CCS_CC, 4_TILED_MTL_RC_CCS_CC) }, 18 21 { DRM_MODIFIER(SAMSUNG, 64_32_TILE, 64_32_TILE) }, 19 22 { DRM_MODIFIER(SAMSUNG, 16_16_TILE, 16_16_TILE) }, 20 23 { DRM_MODIFIER(QCOM, COMPRESSED, COMPRESSED) },
+243 -18
lib/libdrm/include/drm/drm.h
··· 629 629 /** 630 630 * DRM_CAP_VBLANK_HIGH_CRTC 631 631 * 632 - * If set to 1, the kernel supports specifying a CRTC index in the high bits of 633 - * &drm_wait_vblank_request.type. 632 + * If set to 1, the kernel supports specifying a :ref:`CRTC index<crtc_index>` 633 + * in the high bits of &drm_wait_vblank_request.type. 634 634 * 635 635 * Starting kernel version 2.6.39, this capability is always set to 1. 636 636 */ ··· 667 667 * Bitfield of supported PRIME sharing capabilities. See &DRM_PRIME_CAP_IMPORT 668 668 * and &DRM_PRIME_CAP_EXPORT. 669 669 * 670 - * PRIME buffers are exposed as dma-buf file descriptors. See 671 - * Documentation/gpu/drm-mm.rst, section "PRIME Buffer Sharing". 670 + * Starting from kernel version 6.6, both &DRM_PRIME_CAP_IMPORT and 671 + * &DRM_PRIME_CAP_EXPORT are always advertised. 672 + * 673 + * PRIME buffers are exposed as dma-buf file descriptors. 674 + * See :ref:`prime_buffer_sharing`. 672 675 */ 673 676 #define DRM_CAP_PRIME 0x5 674 677 /** ··· 676 679 * 677 680 * If this bit is set in &DRM_CAP_PRIME, the driver supports importing PRIME 678 681 * buffers via the &DRM_IOCTL_PRIME_FD_TO_HANDLE ioctl. 682 + * 683 + * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME. 679 684 */ 680 685 #define DRM_PRIME_CAP_IMPORT 0x1 681 686 /** ··· 683 688 * 684 689 * If this bit is set in &DRM_CAP_PRIME, the driver supports exporting PRIME 685 690 * buffers via the &DRM_IOCTL_PRIME_HANDLE_TO_FD ioctl. 691 + * 692 + * Starting from kernel version 6.6, this bit is always set in &DRM_CAP_PRIME. 686 693 */ 687 694 #define DRM_PRIME_CAP_EXPORT 0x2 688 695 /** ··· 700 707 /** 701 708 * DRM_CAP_ASYNC_PAGE_FLIP 702 709 * 703 - * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC. 710 + * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for legacy 711 + * page-flips. 704 712 */ 705 713 #define DRM_CAP_ASYNC_PAGE_FLIP 0x7 706 714 /** ··· 750 758 /** 751 759 * DRM_CAP_SYNCOBJ 752 760 * 753 - * If set to 1, the driver supports sync objects. See 754 - * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects". 761 + * If set to 1, the driver supports sync objects. See :ref:`drm_sync_objects`. 755 762 */ 756 763 #define DRM_CAP_SYNCOBJ 0x13 757 764 /** 758 765 * DRM_CAP_SYNCOBJ_TIMELINE 759 766 * 760 767 * If set to 1, the driver supports timeline operations on sync objects. See 761 - * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects". 768 + * :ref:`drm_sync_objects`. 762 769 */ 763 770 #define DRM_CAP_SYNCOBJ_TIMELINE 0x14 771 + /** 772 + * DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 773 + * 774 + * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for atomic 775 + * commits. 776 + */ 777 + #define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15 764 778 765 779 /* DRM_IOCTL_GET_CAP ioctl argument type */ 766 780 struct drm_get_cap { ··· 830 844 */ 831 845 #define DRM_CLIENT_CAP_WRITEBACK_CONNECTORS 5 832 846 847 + /** 848 + * DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 849 + * 850 + * Drivers for para-virtualized hardware (e.g. vmwgfx, qxl, virtio and 851 + * virtualbox) have additional restrictions for cursor planes (thus 852 + * making cursor planes on those drivers not truly universal,) e.g. 853 + * they need cursor planes to act like one would expect from a mouse 854 + * cursor and have correctly set hotspot properties. 855 + * If this client cap is not set the DRM core will hide cursor plane on 856 + * those virtualized drivers because not setting it implies that the 857 + * client is not capable of dealing with those extra restictions. 858 + * Clients which do set cursor hotspot and treat the cursor plane 859 + * like a mouse cursor should set this property. 860 + * The client must enable &DRM_CLIENT_CAP_ATOMIC first. 861 + * 862 + * Setting this property on drivers which do not special case 863 + * cursor planes (i.e. non-virtualized drivers) will return 864 + * EOPNOTSUPP, which can be used by userspace to gauge 865 + * requirements of the hardware/drivers they're running on. 866 + * 867 + * This capability is always supported for atomic-capable virtualized 868 + * drivers starting from kernel version 6.6. 869 + */ 870 + #define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 871 + 833 872 /* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ 834 873 struct drm_set_client_cap { 835 874 __u64 capability; ··· 881 920 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL (1 << 0) 882 921 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT (1 << 1) 883 922 #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE (1 << 2) /* wait for time point to become available */ 923 + #define DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE (1 << 3) /* set fence deadline to deadline_nsec */ 884 924 struct drm_syncobj_wait { 885 925 __u64 handles; 886 926 /* absolute timeout */ ··· 889 929 __u32 flags; 890 930 __u32 first_signaled; /* only valid when not waiting all */ 891 931 __u32 pad; 932 + /** 933 + * @deadline_nsec - fence deadline hint 934 + * 935 + * Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing 936 + * fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is 937 + * set. 938 + */ 939 + __u64 deadline_nsec; 892 940 }; 893 941 894 942 struct drm_syncobj_timeline_wait { ··· 901 949 __u32 flags; 902 950 __u32 first_signaled; /* only valid when not waiting all */ 903 951 __u32 pad; 952 + /** 953 + * @deadline_nsec - fence deadline hint 954 + * 955 + * Deadline hint, in absolute CLOCK_MONOTONIC, to set on backing 956 + * fence(s) if the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE flag is 957 + * set. 958 + */ 959 + __u64 deadline_nsec; 960 + }; 961 + 962 + /** 963 + * struct drm_syncobj_eventfd 964 + * @handle: syncobj handle. 965 + * @flags: Zero to wait for the point to be signalled, or 966 + * &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE to wait for a fence to be 967 + * available for the point. 968 + * @point: syncobj timeline point (set to zero for binary syncobjs). 969 + * @fd: Existing eventfd to sent events to. 970 + * @pad: Must be zero. 971 + * 972 + * Register an eventfd to be signalled by a syncobj. The eventfd counter will 973 + * be incremented by one. 974 + */ 975 + struct drm_syncobj_eventfd { 976 + __u32 handle; 977 + __u32 flags; 978 + __u64 point; 979 + __s32 fd; 980 + __u32 pad; 904 981 }; 905 982 906 983 ··· 966 1043 #define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, struct drm_stats) 967 1044 #define DRM_IOCTL_SET_VERSION DRM_IOWR(0x07, struct drm_set_version) 968 1045 #define DRM_IOCTL_MODESET_CTL DRM_IOW(0x08, struct drm_modeset_ctl) 1046 + /** 1047 + * DRM_IOCTL_GEM_CLOSE - Close a GEM handle. 1048 + * 1049 + * GEM handles are not reference-counted by the kernel. User-space is 1050 + * responsible for managing their lifetime. For example, if user-space imports 1051 + * the same memory object twice on the same DRM file description, the same GEM 1052 + * handle is returned by both imports, and user-space needs to ensure 1053 + * &DRM_IOCTL_GEM_CLOSE is performed once only. The same situation can happen 1054 + * when a memory object is allocated, then exported and imported again on the 1055 + * same DRM file description. The &DRM_IOCTL_MODE_GETFB2 IOCTL is an exception 1056 + * and always returns fresh new GEM handles even if an existing GEM handle 1057 + * already refers to the same memory object before the IOCTL is performed. 1058 + */ 969 1059 #define DRM_IOCTL_GEM_CLOSE DRM_IOW (0x09, struct drm_gem_close) 970 1060 #define DRM_IOCTL_GEM_FLINK DRM_IOWR(0x0a, struct drm_gem_flink) 971 1061 #define DRM_IOCTL_GEM_OPEN DRM_IOWR(0x0b, struct drm_gem_open) ··· 1006 1096 #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, struct drm_lock) 1007 1097 #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, struct drm_lock) 1008 1098 1099 + /** 1100 + * DRM_IOCTL_PRIME_HANDLE_TO_FD - Convert a GEM handle to a DMA-BUF FD. 1101 + * 1102 + * User-space sets &drm_prime_handle.handle with the GEM handle to export and 1103 + * &drm_prime_handle.flags, and gets back a DMA-BUF file descriptor in 1104 + * &drm_prime_handle.fd. 1105 + * 1106 + * The export can fail for any driver-specific reason, e.g. because export is 1107 + * not supported for this specific GEM handle (but might be for others). 1108 + * 1109 + * Support for exporting DMA-BUFs is advertised via &DRM_PRIME_CAP_EXPORT. 1110 + */ 1009 1111 #define DRM_IOCTL_PRIME_HANDLE_TO_FD DRM_IOWR(0x2d, struct drm_prime_handle) 1112 + /** 1113 + * DRM_IOCTL_PRIME_FD_TO_HANDLE - Convert a DMA-BUF FD to a GEM handle. 1114 + * 1115 + * User-space sets &drm_prime_handle.fd with a DMA-BUF file descriptor to 1116 + * import, and gets back a GEM handle in &drm_prime_handle.handle. 1117 + * &drm_prime_handle.flags is unused. 1118 + * 1119 + * If an existing GEM handle refers to the memory object backing the DMA-BUF, 1120 + * that GEM handle is returned. Therefore user-space which needs to handle 1121 + * arbitrary DMA-BUFs must have a user-space lookup data structure to manually 1122 + * reference-count duplicated GEM handles. For more information see 1123 + * &DRM_IOCTL_GEM_CLOSE. 1124 + * 1125 + * The import can fail for any driver-specific reason, e.g. because import is 1126 + * only supported for DMA-BUFs allocated on this DRM device. 1127 + * 1128 + * Support for importing DMA-BUFs is advertised via &DRM_PRIME_CAP_IMPORT. 1129 + */ 1010 1130 #define DRM_IOCTL_PRIME_FD_TO_HANDLE DRM_IOWR(0x2e, struct drm_prime_handle) 1011 1131 1012 1132 #define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) ··· 1044 1164 #define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) 1045 1165 #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) 1046 1166 #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) 1167 + /** 1168 + * DRM_IOCTL_MODE_RMFB - Remove a framebuffer. 1169 + * 1170 + * This removes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL 1171 + * argument is a framebuffer object ID. 1172 + * 1173 + * Warning: removing a framebuffer currently in-use on an enabled plane will 1174 + * disable that plane. The CRTC the plane is linked to may also be disabled 1175 + * (depending on driver capabilities). 1176 + */ 1047 1177 #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) 1048 1178 #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) 1049 1179 #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd) 1050 1180 1181 + /** 1182 + * DRM_IOCTL_MODE_CREATE_DUMB - Create a new dumb buffer object. 1183 + * 1184 + * KMS dumb buffers provide a very primitive way to allocate a buffer object 1185 + * suitable for scanout and map it for software rendering. KMS dumb buffers are 1186 + * not suitable for hardware-accelerated rendering nor video decoding. KMS dumb 1187 + * buffers are not suitable to be displayed on any other device than the KMS 1188 + * device where they were allocated from. Also see 1189 + * :ref:`kms_dumb_buffer_objects`. 1190 + * 1191 + * The IOCTL argument is a struct drm_mode_create_dumb. 1192 + * 1193 + * User-space is expected to create a KMS dumb buffer via this IOCTL, then add 1194 + * it as a KMS framebuffer via &DRM_IOCTL_MODE_ADDFB and map it via 1195 + * &DRM_IOCTL_MODE_MAP_DUMB. 1196 + * 1197 + * &DRM_CAP_DUMB_BUFFER indicates whether this IOCTL is supported. 1198 + * &DRM_CAP_DUMB_PREFERRED_DEPTH and &DRM_CAP_DUMB_PREFER_SHADOW indicate 1199 + * driver preferences for dumb buffers. 1200 + */ 1051 1201 #define DRM_IOCTL_MODE_CREATE_DUMB DRM_IOWR(0xB2, struct drm_mode_create_dumb) 1052 1202 #define DRM_IOCTL_MODE_MAP_DUMB DRM_IOWR(0xB3, struct drm_mode_map_dumb) 1053 1203 #define DRM_IOCTL_MODE_DESTROY_DUMB DRM_IOWR(0xB4, struct drm_mode_destroy_dumb) ··· 1080 1230 #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer) 1081 1231 #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array) 1082 1232 1233 + /** 1234 + * DRM_IOCTL_MODE_GETFB2 - Get framebuffer metadata. 1235 + * 1236 + * This queries metadata about a framebuffer. User-space fills 1237 + * &drm_mode_fb_cmd2.fb_id as the input, and the kernels fills the rest of the 1238 + * struct as the output. 1239 + * 1240 + * If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles 1241 + * will be filled with GEM buffer handles. Fresh new GEM handles are always 1242 + * returned, even if another GEM handle referring to the same memory object 1243 + * already exists on the DRM file description. The caller is responsible for 1244 + * removing the new handles, e.g. via the &DRM_IOCTL_GEM_CLOSE IOCTL. The same 1245 + * new handle will be returned for multiple planes in case they use the same 1246 + * memory object. Planes are valid until one has a zero handle -- this can be 1247 + * used to compute the number of planes. 1248 + * 1249 + * Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid 1250 + * until one has a zero &drm_mode_fb_cmd2.pitches. 1251 + * 1252 + * If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set 1253 + * in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the 1254 + * modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier. 1255 + * 1256 + * To obtain DMA-BUF FDs for each plane without leaking GEM handles, user-space 1257 + * can export each handle via &DRM_IOCTL_PRIME_HANDLE_TO_FD, then immediately 1258 + * close each unique handle via &DRM_IOCTL_GEM_CLOSE, making sure to not 1259 + * double-close handles which are specified multiple times in the array. 1260 + */ 1083 1261 #define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2) 1084 1262 1263 + #define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd) 1264 + 1265 + /** 1266 + * DRM_IOCTL_MODE_CLOSEFB - Close a framebuffer. 1267 + * 1268 + * This closes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL 1269 + * argument is a framebuffer object ID. 1270 + * 1271 + * This IOCTL is similar to &DRM_IOCTL_MODE_RMFB, except it doesn't disable 1272 + * planes and CRTCs. As long as the framebuffer is used by a plane, it's kept 1273 + * alive. When the plane no longer uses the framebuffer (because the 1274 + * framebuffer is replaced with another one, or the plane is disabled), the 1275 + * framebuffer is cleaned up. 1276 + * 1277 + * This is useful to implement flicker-free transitions between two processes. 1278 + * 1279 + * Depending on the threat model, user-space may want to ensure that the 1280 + * framebuffer doesn't expose any sensitive user information: closed 1281 + * framebuffers attached to a plane can be read back by the next DRM master. 1282 + */ 1283 + #define DRM_IOCTL_MODE_CLOSEFB DRM_IOWR(0xD0, struct drm_mode_closefb) 1284 + 1085 1285 /* 1086 1286 * Device specific ioctls should only be in their respective headers 1087 1287 * The device specific ioctl range is from 0x40 to 0x9f. ··· 1093 1293 #define DRM_COMMAND_BASE 0x40 1094 1294 #define DRM_COMMAND_END 0xA0 1095 1295 1096 - /* 1097 - * Header for events written back to userspace on the drm fd. The 1098 - * type defines the type of event, the length specifies the total 1099 - * length of the event (including the header), and user_data is 1100 - * typically a 64 bit value passed with the ioctl that triggered the 1101 - * event. A read on the drm fd will always only return complete 1102 - * events, that is, if for example the read buffer is 100 bytes, and 1103 - * there are two 64 byte events pending, only one will be returned. 1296 + /** 1297 + * struct drm_event - Header for DRM events 1298 + * @type: event type. 1299 + * @length: total number of payload bytes (including header). 1300 + * 1301 + * This struct is a header for events written back to user-space on the DRM FD. 1302 + * A read on the DRM FD will always only return complete events: e.g. if the 1303 + * read buffer is 100 bytes large and there are two 64 byte events pending, 1304 + * only one will be returned. 1104 1305 * 1105 - * Event types 0 - 0x7fffffff are generic drm events, 0x80000000 and 1106 - * up are chipset specific. 1306 + * Event types 0 - 0x7fffffff are generic DRM events, 0x80000000 and 1307 + * up are chipset specific. Generic DRM events include &DRM_EVENT_VBLANK, 1308 + * &DRM_EVENT_FLIP_COMPLETE and &DRM_EVENT_CRTC_SEQUENCE. 1107 1309 */ 1108 1310 struct drm_event { 1109 1311 __u32 type; 1110 1312 __u32 length; 1111 1313 }; 1112 1314 1315 + /** 1316 + * DRM_EVENT_VBLANK - vertical blanking event 1317 + * 1318 + * This event is sent in response to &DRM_IOCTL_WAIT_VBLANK with the 1319 + * &_DRM_VBLANK_EVENT flag set. 1320 + * 1321 + * The event payload is a struct drm_event_vblank. 1322 + */ 1113 1323 #define DRM_EVENT_VBLANK 0x01 1324 + /** 1325 + * DRM_EVENT_FLIP_COMPLETE - page-flip completion event 1326 + * 1327 + * This event is sent in response to an atomic commit or legacy page-flip with 1328 + * the &DRM_MODE_PAGE_FLIP_EVENT flag set. 1329 + * 1330 + * The event payload is a struct drm_event_vblank. 1331 + */ 1114 1332 #define DRM_EVENT_FLIP_COMPLETE 0x02 1333 + /** 1334 + * DRM_EVENT_CRTC_SEQUENCE - CRTC sequence event 1335 + * 1336 + * This event is sent in response to &DRM_IOCTL_CRTC_QUEUE_SEQUENCE. 1337 + * 1338 + * The event payload is a struct drm_event_crtc_sequence. 1339 + */ 1115 1340 #define DRM_EVENT_CRTC_SEQUENCE 0x03 1116 1341 1117 1342 struct drm_event_vblank {
+1 -1
lib/libdrm/mk/libdrm/shlib_version
··· 1 1 major=7 2 - minor=12 2 + minor=13
+1 -1
lib/libdrm/mk/libdrm_amdgpu/shlib_version
··· 1 1 major=1 2 - minor=12 2 + minor=13
+1
lib/libdrm/radeon/radeon_surface.c
··· 2205 2205 break; 2206 2206 case RADEON_SURF_MODE_LINEAR_ALIGNED: 2207 2207 default: 2208 + *stencil_tile_mode = SI_TILE_MODE_COLOR_LINEAR_ALIGNED; 2208 2209 *tile_mode = SI_TILE_MODE_COLOR_LINEAR_ALIGNED; 2209 2210 } 2210 2211
+46 -29
lib/libdrm/xf86drm.c
··· 833 833 switch (type) { 834 834 case DRM_NODE_PRIMARY: 835 835 return DRM_DEV_NAME; 836 - case DRM_NODE_CONTROL: 837 - return DRM_CONTROL_DEV_NAME; 838 836 case DRM_NODE_RENDER: 839 837 return DRM_RENDER_DEV_NAME; 840 838 } ··· 1053 1051 switch (type) { 1054 1052 case DRM_NODE_PRIMARY: 1055 1053 return 0; 1056 - case DRM_NODE_CONTROL: 1057 - return 64; 1058 1054 case DRM_NODE_RENDER: 1059 1055 return 128; 1060 1056 default: ··· 1075 1071 // If not in /dev/drm/ we have the type in the name 1076 1072 if (sscanf(name, "dri/card%d\n", &id) >= 1) 1077 1073 return DRM_NODE_PRIMARY; 1078 - else if (sscanf(name, "dri/control%d\n", &id) >= 1) 1079 - return DRM_NODE_CONTROL; 1080 1074 else if (sscanf(name, "dri/renderD%d\n", &id) >= 1) 1081 1075 return DRM_NODE_RENDER; 1082 1076 return -1; ··· 1084 1078 1085 1079 minor = id; 1086 1080 #endif 1087 - int type = minor >> 6; 1081 + char path[DRM_NODE_NAME_MAX]; 1082 + const char *dev_name; 1083 + int i; 1088 1084 1089 - if (minor < 0) 1090 - return -1; 1085 + for (i = DRM_NODE_PRIMARY; i < DRM_NODE_MAX; i++) { 1086 + dev_name = drmGetDeviceName(i); 1087 + if (!dev_name) 1088 + continue; 1089 + snprintf(path, sizeof(path), dev_name, DRM_DIR_NAME, minor); 1090 + if (!access(path, F_OK)) 1091 + return i; 1092 + } 1091 1093 1092 - switch (type) { 1093 - case DRM_NODE_PRIMARY: 1094 - case DRM_NODE_CONTROL: 1095 - case DRM_NODE_RENDER: 1096 - return type; 1097 - default: 1098 - return -1; 1099 - } 1094 + return -1; 1100 1095 } 1101 1096 1102 1097 static const char *drmGetMinorName(int type) ··· 1104 1099 switch (type) { 1105 1100 case DRM_NODE_PRIMARY: 1106 1101 return DRM_PRIMARY_MINOR_NAME; 1107 - case DRM_NODE_CONTROL: 1108 - return DRM_CONTROL_MINOR_NAME; 1109 1102 case DRM_NODE_RENDER: 1110 1103 return DRM_RENDER_MINOR_NAME; 1111 1104 default: ··· 1292 1285 * 1293 1286 * \param name driver name. Not referenced if bus ID is supplied. 1294 1287 * \param busid bus ID. Zero if not known. 1295 - * \param type the device node type to open, PRIMARY, CONTROL or RENDER 1288 + * \param type the device node type to open, PRIMARY or RENDER 1296 1289 * 1297 1290 * \return a file descriptor on success, or a negative value on error. 1298 1291 * ··· 1325 1318 1326 1319 drm_public int drmOpenControl(int minor) 1327 1320 { 1328 - return drmOpenMinor(minor, 0, DRM_NODE_CONTROL); 1321 + return -EINVAL; 1329 1322 } 1330 1323 1331 1324 drm_public int drmOpenRender(int minor) ··· 3735 3728 switch (type) { 3736 3729 case DRM_NODE_PRIMARY: 3737 3730 break; 3738 - case DRM_NODE_CONTROL: 3739 - id -= 64; 3740 - break; 3741 3731 case DRM_NODE_RENDER: 3742 3732 id -= 128; 3743 - break; 3733 + break; 3744 3734 } 3745 3735 if (id < 0) 3746 3736 return -EINVAL; ··· 3852 3842 3853 3843 static int drmGetNodeType(const char *name) 3854 3844 { 3855 - if (strncmp(name, DRM_CONTROL_MINOR_NAME, 3856 - sizeof(DRM_CONTROL_MINOR_NAME ) - 1) == 0) 3857 - return DRM_NODE_CONTROL; 3858 - 3859 3845 if (strncmp(name, DRM_RENDER_MINOR_NAME, 3860 3846 sizeof(DRM_RENDER_MINOR_NAME) - 1) == 0) 3861 3847 return DRM_NODE_RENDER; ··· 4684 4670 return 0; 4685 4671 } 4686 4672 4673 + drm_public int drmGetNodeTypeFromDevId(dev_t devid) 4674 + { 4675 + int maj, min, node_type; 4676 + 4677 + maj = major(devid); 4678 + min = minor(devid); 4679 + 4680 + if (!drmNodeIsDRM(maj, min)) 4681 + return -EINVAL; 4682 + 4683 + node_type = drmGetMinorType(maj, min); 4684 + if (node_type == -1) 4685 + return -ENODEV; 4686 + 4687 + return node_type; 4688 + } 4689 + 4687 4690 /** 4688 4691 * Get information about the opened drm device 4689 4692 * ··· 5099 5102 ret = drmIoctl(fd, DRM_IOCTL_SYNCOBJ_TRANSFER, &args); 5100 5103 5101 5104 return ret; 5105 + } 5106 + 5107 + drm_public int drmSyncobjEventfd(int fd, uint32_t handle, uint64_t point, int ev_fd, 5108 + uint32_t flags) 5109 + { 5110 + struct drm_syncobj_eventfd args; 5111 + 5112 + memclear(args); 5113 + args.handle = handle; 5114 + args.point = point; 5115 + args.fd = ev_fd; 5116 + args.flags = flags; 5117 + 5118 + return drmIoctl(fd, DRM_IOCTL_SYNCOBJ_EVENTFD, &args); 5102 5119 } 5103 5120 5104 5121 static char *
+16 -7
lib/libdrm/xf86drm.h
··· 44 44 #endif 45 45 46 46 #ifndef DRM_MAX_MINOR 47 - #define DRM_MAX_MINOR 16 47 + #define DRM_MAX_MINOR 64 /* deprecated */ 48 48 #endif 49 49 50 50 #if defined(__linux__) ··· 78 78 79 79 #define DRM_DIR_NAME "/dev/dri" 80 80 #define DRM_PRIMARY_MINOR_NAME "card" 81 - #define DRM_CONTROL_MINOR_NAME "controlD" 81 + #define DRM_CONTROL_MINOR_NAME "controlD" /* deprecated */ 82 82 #define DRM_RENDER_MINOR_NAME "renderD" 83 83 #define DRM_PROC_NAME "/proc/dri/" /* For backward Linux compatibility */ 84 84 85 85 #define DRM_DEV_NAME "%s/" DRM_PRIMARY_MINOR_NAME "%d" 86 - #define DRM_CONTROL_DEV_NAME "%s/" DRM_CONTROL_MINOR_NAME "%d" 86 + #define DRM_CONTROL_DEV_NAME "%s/" DRM_CONTROL_MINOR_NAME "%d" /* deprecated */ 87 87 #define DRM_RENDER_DEV_NAME "%s/" DRM_RENDER_MINOR_NAME "%d" 88 88 89 89 #define DRM_NODE_NAME_MAX \ ··· 91 91 + MAX3(sizeof(DRM_PRIMARY_MINOR_NAME), \ 92 92 sizeof(DRM_CONTROL_MINOR_NAME), \ 93 93 sizeof(DRM_RENDER_MINOR_NAME)) \ 94 - + sizeof("144") /* highest possible node number */ \ 94 + + sizeof("1048575") /* highest possible node number 2^MINORBITS - 1 */ \ 95 95 + 1) /* NULL-terminator */ 96 96 97 97 #define DRM_ERR_NO_DEVICE (-1001) ··· 589 589 extern int drmOpen(const char *name, const char *busid); 590 590 591 591 #define DRM_NODE_PRIMARY 0 592 - #define DRM_NODE_CONTROL 1 592 + #define DRM_NODE_CONTROL 1 /* deprecated: never returned */ 593 593 #define DRM_NODE_RENDER 2 594 594 #define DRM_NODE_MAX 3 595 595 596 596 extern int drmOpenWithType(const char *name, const char *busid, 597 597 int type); 598 598 599 - extern int drmOpenControl(int minor); 599 + extern int drmOpenControl(int minor); /* deprecated: always fails */ 600 600 extern int drmOpenRender(int minor); 601 601 extern int drmClose(int fd); 602 602 extern drmVersionPtr drmGetVersion(int fd); ··· 801 801 extern char *drmGetDeviceNameFromFd(int fd); 802 802 803 803 /* Improved version of drmGetDeviceNameFromFd which attributes for any type of 804 - * device/node - card, control or renderD. 804 + * device/node - card or renderD. 805 805 */ 806 806 extern char *drmGetDeviceNameFromFd2(int fd); 807 807 extern int drmGetNodeTypeFromFd(int fd); ··· 912 912 913 913 extern int drmGetDeviceFromDevId(dev_t dev_id, uint32_t flags, drmDevicePtr *device); 914 914 915 + /** 916 + * Get the node type (DRM_NODE_PRIMARY or DRM_NODE_RENDER) from a device ID. 917 + * 918 + * Returns negative errno on error. 919 + */ 920 + extern int drmGetNodeTypeFromDevId(dev_t devid); 921 + 915 922 extern int drmDevicesEqual(drmDevicePtr a, drmDevicePtr b); 916 923 917 924 extern int drmSyncobjCreate(int fd, uint32_t flags, uint32_t *handle); ··· 940 947 uint32_t dst_handle, uint64_t dst_point, 941 948 uint32_t src_handle, uint64_t src_point, 942 949 uint32_t flags); 950 + extern int drmSyncobjEventfd(int fd, uint32_t handle, uint64_t point, int ev_fd, 951 + uint32_t flags); 943 952 944 953 extern char * 945 954 drmGetFormatModifierVendor(uint64_t modifier);
+12 -2
lib/libdrm/xf86drmMode.c
··· 320 320 return DRM_IOCTL(fd, DRM_IOCTL_MODE_RMFB, &bufferId); 321 321 } 322 322 323 + drm_public int drmModeCloseFB(int fd, uint32_t buffer_id) 324 + { 325 + struct drm_mode_closefb closefb; 326 + 327 + memclear(closefb); 328 + closefb.fb_id = buffer_id; 329 + 330 + return DRM_IOCTL(fd, DRM_IOCTL_MODE_CLOSEFB, &closefb); 331 + } 332 + 323 333 drm_public drmModeFBPtr drmModeGetFB(int fd, uint32_t buf) 324 334 { 325 335 struct drm_mode_fb_cmd info; ··· 1004 1014 } 1005 1015 1006 1016 drm_public int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size, 1007 - uint16_t *red, uint16_t *green, 1008 - uint16_t *blue) 1017 + const uint16_t *red, const uint16_t *green, 1018 + const uint16_t *blue) 1009 1019 { 1010 1020 struct drm_mode_crtc_lut l; 1011 1021
+8 -1
lib/libdrm/xf86drmMode.h
··· 315 315 extern int drmModeRmFB(int fd, uint32_t bufferId); 316 316 317 317 /** 318 + * Close a framebuffer. 319 + * 320 + * Same as drmModeRmFB(), except it doesn't implicitly disable planes and CRTCs. 321 + */ 322 + extern int drmModeCloseFB(int fd, uint32_t buffer_id); 323 + 324 + /** 318 325 * Mark a region of a framebuffer as dirty. 319 326 */ 320 327 extern int drmModeDirtyFB(int fd, uint32_t bufferId, ··· 416 423 extern int drmCheckModesettingSupported(const char *busid); 417 424 418 425 extern int drmModeCrtcSetGamma(int fd, uint32_t crtc_id, uint32_t size, 419 - uint16_t *red, uint16_t *green, uint16_t *blue); 426 + const uint16_t *red, const uint16_t *green, const uint16_t *blue); 420 427 extern int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size, 421 428 uint16_t *red, uint16_t *green, uint16_t *blue); 422 429 extern int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id,