Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8c6860e authored by Stephen Kiazyk's avatar Stephen Kiazyk
Browse files

Expose display manager client event fd

This will allow the display manager client to use epoll to wait and
respond to changes in the current set of VR display surfaces.

Bug: None
Test: Compiled and ran with simple standalone binary application.
Change-Id: I7680f5a56348abfb686e78d13e0e737466735ac6
parent 08a27389
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -41,6 +41,23 @@ void dvrDisplayManagerClientDestroy(DvrDisplayManagerClient* client) {
  delete client;
}

int dvrDisplayManagerClientGetEventFd(DvrDisplayManagerClient* client) {
  return client->client->event_fd();
}

int dvrDisplayManagerClientTranslateEpollEventMask(
    DvrDisplayManagerClient* client, int in_events, int* out_events) {
  auto result = client->client->GetChannel()->GetEventMask(in_events);

  if (!result) {
    return -EIO;
  }

  *out_events = result.get();

  return 0;
}

int dvrDisplayManagerClientGetSurfaceList(
    DvrDisplayManagerClient* client,
    DvrDisplayManagerClientSurfaceList** surface_list) {
+15 −0
Original line number Diff line number Diff line
@@ -19,6 +19,21 @@ DvrDisplayManagerClient* dvrDisplayManagerClientCreate();

void dvrDisplayManagerClientDestroy(DvrDisplayManagerClient* client);

// Return an event fd for checking if there was an event on the server
// Note that the only event which will be flagged is POLLIN. You must use
// dvrDisplayManagerClientTranslateEpollEventMask in order to get the real
// event flags.
// @return the fd
int dvrDisplayManagerClientGetEventFd(DvrDisplayManagerClient* client);

// Once you have received an epoll event, you must translate it to its true
// flags. This is a workaround for working with UDS.
// @param in_events pass in the epoll revents that were initially returned
// @param on success, this value will be overwritten with the true epoll values
// @return 0 on success, non-zero otherwise
int dvrDisplayManagerClientTranslateEpollEventMask(
    DvrDisplayManagerClient* client, int in_events, int* out_events);

// If successful, populates |surface_list| with a list of application
// surfaces the display is currently using.
//
+3 −0
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@ class DisplayManagerClient : public pdx::ClientBase<DisplayManagerClient> {
  int GetSurfaceBuffers(
      int surface_id, std::vector<std::unique_ptr<BufferConsumer>>* consumers);

  using Client::event_fd;
  using Client::GetChannel;

 private:
  friend BASE;