102f4aeb0Sopenharmony_ciName 202f4aeb0Sopenharmony_ci 302f4aeb0Sopenharmony_ci NV_stream_socket 402f4aeb0Sopenharmony_ci NV_stream_socket_unix 502f4aeb0Sopenharmony_ci NV_stream_socket_inet 602f4aeb0Sopenharmony_ci 702f4aeb0Sopenharmony_ciName Strings 802f4aeb0Sopenharmony_ci 902f4aeb0Sopenharmony_ci EGL_NV_stream_socket 1002f4aeb0Sopenharmony_ci EGL_NV_stream_socket_unix 1102f4aeb0Sopenharmony_ci EGL_NV_stream_socket_inet 1202f4aeb0Sopenharmony_ci 1302f4aeb0Sopenharmony_ciContributors 1402f4aeb0Sopenharmony_ci 1502f4aeb0Sopenharmony_ci Daniel Kartch 1602f4aeb0Sopenharmony_ci Bogdan Naodovic 1702f4aeb0Sopenharmony_ci James Jones 1802f4aeb0Sopenharmony_ci Zander Clucas 1902f4aeb0Sopenharmony_ci Tarun Bansal 2002f4aeb0Sopenharmony_ci 2102f4aeb0Sopenharmony_ciContacts 2202f4aeb0Sopenharmony_ci 2302f4aeb0Sopenharmony_ci Daniel Kartch, NVIDIA (dkartch 'at' nvidia.com) 2402f4aeb0Sopenharmony_ci 2502f4aeb0Sopenharmony_ciStatus 2602f4aeb0Sopenharmony_ci 2702f4aeb0Sopenharmony_ci Draft 2802f4aeb0Sopenharmony_ci 2902f4aeb0Sopenharmony_ciVersion 3002f4aeb0Sopenharmony_ci 3102f4aeb0Sopenharmony_ci Version 6 - October 27, 2016 3202f4aeb0Sopenharmony_ci 3302f4aeb0Sopenharmony_ciNumber 3402f4aeb0Sopenharmony_ci 3502f4aeb0Sopenharmony_ci EGL Extension #115 3602f4aeb0Sopenharmony_ci 3702f4aeb0Sopenharmony_ciExtension Type 3802f4aeb0Sopenharmony_ci 3902f4aeb0Sopenharmony_ci EGL display extension 4002f4aeb0Sopenharmony_ci 4102f4aeb0Sopenharmony_ciDependencies 4202f4aeb0Sopenharmony_ci 4302f4aeb0Sopenharmony_ci EGL_NV_stream_socket requires EGL_NV_stream_remote. 4402f4aeb0Sopenharmony_ci 4502f4aeb0Sopenharmony_ci EGL_NV_stream_socket_unix requires EGL_NV_stream_socket. 4602f4aeb0Sopenharmony_ci 4702f4aeb0Sopenharmony_ci EGL_NV_stream_socket_inet requires EGL_NV_stream_socket. 4802f4aeb0Sopenharmony_ci 4902f4aeb0Sopenharmony_ciOverview 5002f4aeb0Sopenharmony_ci 5102f4aeb0Sopenharmony_ci These extensions build on the framework for remote streams provided 5202f4aeb0Sopenharmony_ci in EGL_NV_stream_remote to define a means for two EGLStream objects 5302f4aeb0Sopenharmony_ci representing opposite ends of a single stream to establish 5402f4aeb0Sopenharmony_ci communication using a socket. The application is expected to create 5502f4aeb0Sopenharmony_ci and connnect both ends of the socket before creating the stream 5602f4aeb0Sopenharmony_ci objects. 5702f4aeb0Sopenharmony_ci 5802f4aeb0Sopenharmony_ci The base EGL_NV_stream_socket extension defines most of the 5902f4aeb0Sopenharmony_ci attributes required to initialize the stream objects. The 6002f4aeb0Sopenharmony_ci EGL_NV_stream_socket_unix and EGL_NV_stream_socket_inet extensions 6102f4aeb0Sopenharmony_ci indicate support for UNIX domain and internet protocol socket types, 6202f4aeb0Sopenharmony_ci respectively. Additional extensions may provide support for other 6302f4aeb0Sopenharmony_ci socket types. The type of socket is important, as certain operations 6402f4aeb0Sopenharmony_ci are only available with certain types, which may influence how the 6502f4aeb0Sopenharmony_ci streams are implemented. For instance, UNIX domain sockets allow 6602f4aeb0Sopenharmony_ci file descriptors to be passed between processes, while internet 6702f4aeb0Sopenharmony_ci protocol sockets do not. This ability may allow more efficient 6802f4aeb0Sopenharmony_ci sharing of resources between the socket endpoints. 6902f4aeb0Sopenharmony_ci 7002f4aeb0Sopenharmony_ci An application using this extension will bear some similarity to the 7102f4aeb0Sopenharmony_ci example code from the EGL_KHR_stream_cross_process_fd extension, 7202f4aeb0Sopenharmony_ci which also uses sockets to establish the communication between two 7302f4aeb0Sopenharmony_ci processes and then create a pair of EGLStream objects. The key 7402f4aeb0Sopenharmony_ci difference is that in that case, the sockets are merely a temporary 7502f4aeb0Sopenharmony_ci means to an end to pass a file descriptor between the processes. 7602f4aeb0Sopenharmony_ci Once that is accomplished, the sockets are discarded. 7702f4aeb0Sopenharmony_ci 7802f4aeb0Sopenharmony_ci The file descriptor used by that extension may represent an 7902f4aeb0Sopenharmony_ci underlying object such as shared memory which allows more efficient 8002f4aeb0Sopenharmony_ci communication than the sockets themselves. However, there is nothing 8102f4aeb0Sopenharmony_ci preventing an implementation of EGL_NV_stream_socket from creating 8202f4aeb0Sopenharmony_ci and passing such a file descriptor as well, gaining the same 8302f4aeb0Sopenharmony_ci efficiency. Therefore, a protocol based on sockets will work at 8402f4aeb0Sopenharmony_ci least as well as one based on file descriptors, with the added 8502f4aeb0Sopenharmony_ci benefit of being more portable. 8602f4aeb0Sopenharmony_ci 8702f4aeb0Sopenharmony_ciNew Types 8802f4aeb0Sopenharmony_ci 8902f4aeb0Sopenharmony_ci None 9002f4aeb0Sopenharmony_ci 9102f4aeb0Sopenharmony_ciNew Functions 9202f4aeb0Sopenharmony_ci 9302f4aeb0Sopenharmony_ci None 9402f4aeb0Sopenharmony_ci 9502f4aeb0Sopenharmony_ciNew Tokens for EGL_NV_stream_socket 9602f4aeb0Sopenharmony_ci 9702f4aeb0Sopenharmony_ci Accepted by eglCreateStreamKHR and returned by eglQueryStreamKHR 9802f4aeb0Sopenharmony_ci when attribute is EGL_STREAM_PROTOCOL_NV: 9902f4aeb0Sopenharmony_ci 10002f4aeb0Sopenharmony_ci EGL_STREAM_PROTOCOL_SOCKET_NV 0x324B 10102f4aeb0Sopenharmony_ci 10202f4aeb0Sopenharmony_ci Accepted as attribute names by eglCreateStreamKHR and 10302f4aeb0Sopenharmony_ci eglQueryStreamKHR functions 10402f4aeb0Sopenharmony_ci 10502f4aeb0Sopenharmony_ci EGL_SOCKET_HANDLE_NV 0x324C 10602f4aeb0Sopenharmony_ci EGL_SOCKET_TYPE_NV 0x324D 10702f4aeb0Sopenharmony_ci 10802f4aeb0Sopenharmony_ciNew Tokens for EGL_NV_stream_socket_unix 10902f4aeb0Sopenharmony_ci 11002f4aeb0Sopenharmony_ci Accepted by eglCreateStreamKHR and returned by eglQueryStreamKHR 11102f4aeb0Sopenharmony_ci when attribute is EGL_SOCKET_TYPE_NV: 11202f4aeb0Sopenharmony_ci 11302f4aeb0Sopenharmony_ci EGL_SOCKET_TYPE_UNIX_NV 0x324E 11402f4aeb0Sopenharmony_ci 11502f4aeb0Sopenharmony_ciNew Tokens for EGL_NV_stream_socket_inet 11602f4aeb0Sopenharmony_ci 11702f4aeb0Sopenharmony_ci Accepted by eglCreateStreamKHR and returned by eglQueryStreamKHR 11802f4aeb0Sopenharmony_ci when attribute is EGL_SOCKET_TYPE_NV: 11902f4aeb0Sopenharmony_ci 12002f4aeb0Sopenharmony_ci EGL_SOCKET_TYPE_INET_NV 0x324F 12102f4aeb0Sopenharmony_ci 12202f4aeb0Sopenharmony_ciAdd to list of failures in section "3.10.1 Creating an EGLStream" in EGL_KHR stream: 12302f4aeb0Sopenharmony_ci 12402f4aeb0Sopenharmony_ci - EGL_BAD_MATCH is generated if the value of EGL_STREAM_PROTOCOL_NV 12502f4aeb0Sopenharmony_ci is EGL_STREAM_PROTOCOL_SOCKET_NV and values are not provided for 12602f4aeb0Sopenharmony_ci EGL_SOCKET_HANDLE_NV and EGL_SOCKET_TYPE_NV. 12702f4aeb0Sopenharmony_ci 12802f4aeb0Sopenharmony_ciAdd to "Table 3.10.4.4 EGLStream Attributes" in EGL_KHR_stream: 12902f4aeb0Sopenharmony_ci 13002f4aeb0Sopenharmony_ci Attribute Read/Write Type Section 13102f4aeb0Sopenharmony_ci -------------------------- ---------- ------ ---------- 13202f4aeb0Sopenharmony_ci EGL_SOCKET_HANDLE_NV io EGLint 3.10.4.y 13302f4aeb0Sopenharmony_ci EGL_SOCKET_TYPE_NV io EGLint 3.10.4.y+1 13402f4aeb0Sopenharmony_ci 13502f4aeb0Sopenharmony_ciIn section "3.10.4.x+1 EGL_STREAM_PROTOCOL_NV Attribute" of 13602f4aeb0Sopenharmony_ciEGL_NV_stream_remote, add EGL_STREAM_PROTOCOL_SOCKET_NV to the list of 13702f4aeb0Sopenharmony_cilegal values and add 13802f4aeb0Sopenharmony_ci 13902f4aeb0Sopenharmony_ci A value of EGL_STREAM_PROTOCOL_SOCKET_NV indicates that the stream 14002f4aeb0Sopenharmony_ci is a remote stream whose communication is established using a socket 14102f4aeb0Sopenharmony_ci connection provided by the application. The details of the messages 14202f4aeb0Sopenharmony_ci passed through the socket are implementation dependent, and may be 14302f4aeb0Sopenharmony_ci influenced by the stream and socket types. This value for the 14402f4aeb0Sopenharmony_ci EGL_STREAM_PROTOCOL_NV attribute is compatible with values of 14502f4aeb0Sopenharmony_ci EGL_STREAM_CROSS_OBJECT_NV, EGL_STREAM_CROSS_DISPLAY_NV, 14602f4aeb0Sopenharmony_ci EGL_STREAM_CROSS_PROCESS_NV, and EGL_STREAM_CROSS_PARTITION_NV for 14702f4aeb0Sopenharmony_ci the EGL_STREAM_TYPE_NV attribute. 14802f4aeb0Sopenharmony_ci 14902f4aeb0Sopenharmony_ciAdd new subsections to the end of section "3.10.4 EGLStream Attributes" 15002f4aeb0Sopenharmony_ciin EGL_KHR_stream: 15102f4aeb0Sopenharmony_ci 15202f4aeb0Sopenharmony_ci 3.10.4.y EGL_SOCKET_HANDLE_NV Attribute 15302f4aeb0Sopenharmony_ci 15402f4aeb0Sopenharmony_ci The EGL_SOCKET_HANDLE_NV attribute may be set when the stream 15502f4aeb0Sopenharmony_ci is created, and provides the handle to a blocking socket which will 15602f4aeb0Sopenharmony_ci be used to communicate with the other endpoint of the stream. If the 15702f4aeb0Sopenharmony_ci value of EGL_STREAM_PROTOCOL_NV is not EGL_STREAM_PROTOCOL_SOCKET_NV, 15802f4aeb0Sopenharmony_ci this attribute is ignored. 15902f4aeb0Sopenharmony_ci 16002f4aeb0Sopenharmony_ci The type of this value is operating system dependent, and the 16102f4aeb0Sopenharmony_ci default value will be an invalid socket handle for the operating 16202f4aeb0Sopenharmony_ci system. In particular, for unix-like operating systems, the value is 16302f4aeb0Sopenharmony_ci a socket file descriptor as returned by socket() and related 16402f4aeb0Sopenharmony_ci functions, and the default value is -1. 16502f4aeb0Sopenharmony_ci 16602f4aeb0Sopenharmony_ci Prior to creating the EGLStream object, the application may use the 16702f4aeb0Sopenharmony_ci socket handle as it wishes. But once the EGLStream object has been 16802f4aeb0Sopenharmony_ci successfully created, it assumes full ownership of this socket. If 16902f4aeb0Sopenharmony_ci the application subsequently writes to, reads from, or closes the 17002f4aeb0Sopenharmony_ci socket, undefined behavior will result. Furthermore, if any data 17102f4aeb0Sopenharmony_ci sent over the socket prior to creating the EGLStream object is not 17202f4aeb0Sopenharmony_ci consumed before the opposite EGLStream object is created, undefined 17302f4aeb0Sopenharmony_ci behavior will result. 17402f4aeb0Sopenharmony_ci 17502f4aeb0Sopenharmony_ci When the EGLStream object is deleted, the socket handle will be 17602f4aeb0Sopenharmony_ci closed by the stream. 17702f4aeb0Sopenharmony_ci 17802f4aeb0Sopenharmony_ci 3.10.4.y+1 EGL_SOCKET_TYPE_NV Attribute 17902f4aeb0Sopenharmony_ci 18002f4aeb0Sopenharmony_ci The EGL_SOCKET_TYPE_NV attribute may be set when the stream is 18102f4aeb0Sopenharmony_ci created, and indicates the type of the socket provided by the 18202f4aeb0Sopenharmony_ci EGL_STREAM_SOCKET_HANDLE_NV attribute. If the value of 18302f4aeb0Sopenharmony_ci EGL_STREAM_PROTOCOL_NV is not EGL_STREAM_PROTOCOL_SOCKET_NV this 18402f4aeb0Sopenharmony_ci attribute is ignored. 18502f4aeb0Sopenharmony_ci 18602f4aeb0Sopenharmony_ci The default value is EGL_NONE. 18702f4aeb0Sopenharmony_ci 18802f4aeb0Sopenharmony_ciIf EGL_NV_stream_socket_unix is present, add to section "3.10.4.y+1 18902f4aeb0Sopenharmony_ciEGL_SOCKET_TYPE_NV Attribute" above: 19002f4aeb0Sopenharmony_ci 19102f4aeb0Sopenharmony_ci A value of EGL_SOCKET_TYPE_UNIX_NV indicates that the socket handle 19202f4aeb0Sopenharmony_ci represents a Unix domain socket, created with SOCK_STREAM type. 19302f4aeb0Sopenharmony_ci 19402f4aeb0Sopenharmony_ciIf EGL_NV_stream_socket_inet is present, add to section "3.10.4.y+1 19502f4aeb0Sopenharmony_ciEGL_SOCKET_TYPE_NV Attribute" above: 19602f4aeb0Sopenharmony_ci 19702f4aeb0Sopenharmony_ci A value of EGL_SOCKET_TYPE_INET_NV indicates that the socket handle 19802f4aeb0Sopenharmony_ci represents an internet protocol socket, created with SOCK_STREAM 19902f4aeb0Sopenharmony_ci type. 20002f4aeb0Sopenharmony_ci 20102f4aeb0Sopenharmony_ciIssues 20202f4aeb0Sopenharmony_ci 20302f4aeb0Sopenharmony_ci None 20402f4aeb0Sopenharmony_ci 20502f4aeb0Sopenharmony_ciRevision History 20602f4aeb0Sopenharmony_ci 20702f4aeb0Sopenharmony_ci #6 (October 27, 2016) Daniel Kartch 20802f4aeb0Sopenharmony_ci - Indicate that the socket handle provided should represent 20902f4aeb0Sopenharmony_ci a blocking socket. 21002f4aeb0Sopenharmony_ci 21102f4aeb0Sopenharmony_ci #5 (June 7, 2016) Daniel Kartch 21202f4aeb0Sopenharmony_ci - Add contact and clean up in preparation for publication. 21302f4aeb0Sopenharmony_ci 21402f4aeb0Sopenharmony_ci #4 (September 16, 2015) Zander Clucas 21502f4aeb0Sopenharmony_ci - Indicated STREAM_SOCKET_PROTOCOL as compatible with socket 21602f4aeb0Sopenharmony_ci type CROSS_PROCESS. 21702f4aeb0Sopenharmony_ci 21802f4aeb0Sopenharmony_ci #3 (December 16, 2014) Daniel Kartch 21902f4aeb0Sopenharmony_ci - Refined overview to clarify comparison with 22002f4aeb0Sopenharmony_ci EGL_KHR_cross_process_fd. 22102f4aeb0Sopenharmony_ci - Indicated SOCK_STREAM as a requirement for the socket types. 22202f4aeb0Sopenharmony_ci 22302f4aeb0Sopenharmony_ci #2 (December 11, 2014) Daniel Kartch 22402f4aeb0Sopenharmony_ci - Rewrote as NV draft for earlier release. 22502f4aeb0Sopenharmony_ci - Reserved enum values. 22602f4aeb0Sopenharmony_ci 22702f4aeb0Sopenharmony_ci #1 (October 10, 2014) Daniel Kartch 22802f4aeb0Sopenharmony_ci - Initial EXT draft 22902f4aeb0Sopenharmony_ci 230