aboutsummaryrefslogtreecommitdiff
path: root/kms/client
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-05-12 03:49:29 +0200
committerdec05eba <dec05eba@protonmail.com>2023-05-12 03:49:29 +0200
commit99dbbd07ab9e8c9a899fd8ccb042b74f336dd026 (patch)
tree8a731ada9f5a44e982fc384bee9a6ca8960a4a32 /kms/client
parent25af1c81d08d0512cf53746efaccd2e5f690aa94 (diff)
kms_vaapi: support multiple drm planes (fixes capture on some multi monitor systems)
Diffstat (limited to 'kms/client')
-rw-r--r--kms/client/kms_client.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/kms/client/kms_client.c b/kms/client/kms_client.c
index 2d1cd0f..bdc556b 100644
--- a/kms/client/kms_client.c
+++ b/kms/client/kms_client.c
@@ -55,7 +55,7 @@ static int recv_msg_from_server(int server_fd, gsr_kms_response *response) {
response_message.msg_iov = &iov;
response_message.msg_iovlen = 1;
- char cmsgbuf[CMSG_SPACE(sizeof(int))];
+ char cmsgbuf[CMSG_SPACE(sizeof(int) * GSR_KMS_MAX_PLANES)];
memset(cmsgbuf, 0, sizeof(cmsgbuf));
response_message.msg_control = cmsgbuf;
response_message.msg_controllen = sizeof(cmsgbuf);
@@ -64,15 +64,17 @@ static int recv_msg_from_server(int server_fd, gsr_kms_response *response) {
if(res <= 0)
return res;
- if(response->result == KMS_RESULT_OK)
- response->data.fd.fd = 0;
-
- struct cmsghdr *cmsg = CMSG_FIRSTHDR(&response_message);
- if(cmsg) {
- if(cmsg->cmsg_type == SCM_RIGHTS) {
- int kms_fd = 0;
- memcpy(&kms_fd, CMSG_DATA(cmsg), sizeof(int));
- response->data.fd.fd = kms_fd;
+ if(response->num_fds > 0) {
+ struct cmsghdr *cmsg = CMSG_FIRSTHDR(&response_message);
+ if(cmsg) {
+ int *fds = (int*)CMSG_DATA(cmsg);
+ for(int i = 0; i < response->num_fds; ++i) {
+ response->fds[i].fd = fds[i];
+ }
+ } else {
+ for(int i = 0; i < response->num_fds; ++i) {
+ response->fds[i].fd = 0;
+ }
}
}
@@ -246,7 +248,7 @@ void gsr_kms_client_deinit(gsr_kms_client *self) {
int gsr_kms_client_get_kms(gsr_kms_client *self, gsr_kms_response *response) {
response->result = KMS_RESULT_FAILED_TO_SEND;
- strcpy(response->data.err_msg, "failed to send");
+ strcpy(response->err_msg, "failed to send");
gsr_kms_request request;
request.type = KMS_REQUEST_TYPE_GET_KMS;