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

Commit 02199c25 authored by John Bates's avatar John Bates
Browse files

Cleanup dvr_api.h to make it closer to the exported SDK version

Also fixed include guards on dvr_display_manager.h to avoid
collision with display_manager_client.h.

build_sdk.py has been moved to vendor/google_daydream/build.

Bug: b/38379392
Test: Built libdvr, surfaceflinger, ran libdvr/tests
Change-Id: I2807be6d2fd5c2814e86e5d8fae8de181397e4a6
parent bce1dead
Loading
Loading
Loading
Loading

libs/vr/libdvr/build_sdk.py

deleted100755 → 0
+0 −47
Original line number Diff line number Diff line
#!/usr/bin/python
import sys
import os
import argparse

# Run this script to generate dvr_api.h in the current directory.

def make_argument_parser():
  parser = argparse.ArgumentParser(
      description='Process DVR API headers into exportable SDK files.')
  return parser

parser = make_argument_parser()

in_file = open("include/dvr/dvr_api.h", "r")
out_file = open("./dvr_api.h", "w")

h_filename = ""
for line in in_file:
  if line.startswith("// dvr_") and line.endswith(".h\n"):
    h_filename = "include/dvr/" + line[3:].strip()
  if line.startswith("typedef ") and "(*Dvr" in line:
    start = line.find("(*Dvr") + 5
    end = line.find("Ptr)")
    if end != -1:
      name = "dvr" + line[start:end]
      # Find the comments for this function and insert into output.
      with open(h_filename, 'r') as h_file:
        h_lines = h_file.readlines()
        i = 1
        while i < len(h_lines):
          if name in h_lines[i]:
            end_i = i
            while h_lines[i - 1].startswith("//"): i -= 1
            while i < end_i:
              out_file.write(h_lines[i])
              i += 1
            break
          i += 1
  if line.startswith('#include "dvr_api_entries.h"'):
    with open("include/dvr/dvr_api_entries.h") as f:
      out_file.write(f.read())
  else:
    out_file.write(line)

in_file.close()
out_file.close()
+15 −5
Original line number Diff line number Diff line
@@ -4,12 +4,15 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include <unistd.h>
#include <cstdio>

#include <dvr/dvr_display_types.h>
#include <dvr/dvr_hardware_composer_defs.h>
#include <dvr/dvr_pose.h>

__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif

typedef struct ANativeWindow ANativeWindow;

@@ -38,6 +41,11 @@ typedef int32_t DvrGlobalBufferKey;
typedef struct DvrSurfaceAttributeValue DvrSurfaceAttributeValue;
typedef struct DvrSurfaceAttribute DvrSurfaceAttribute;

// native_handle contains the fds for the underlying ION allocations inside
// the gralloc buffer. This is needed temporarily while GPU vendors work on
// better support for AHardwareBuffer via glBindSharedBuffer APIs. See
// b/37207909. For now we can declare the native_handle struct where it is
// used for GPU late latching. See cutils/native_handle.h for the struct layout.
struct native_handle;

// dvr_display_manager.h
@@ -173,7 +181,7 @@ typedef int (*DvrSurfaceCreateWriteBufferQueuePtr)(
    uint32_t layer_count, uint64_t usage, size_t capacity,
    DvrWriteBufferQueue** queue_out);

// vsync_client_api.h
// dvr_vsync.h
typedef int (*DvrVSyncClientCreatePtr)(DvrVSyncClient** client_out);
typedef void (*DvrVSyncClientDestroyPtr)(DvrVSyncClient* client);
typedef int (*DvrVSyncClientGetSchedInfoPtr)(DvrVSyncClient* client,
@@ -316,6 +324,8 @@ struct DvrApi_v1 {

int dvrGetApi(void* api, size_t struct_size, int version);

__END_DECLS
#ifdef __cplusplus
}  // extern "C"
#endif

#endif  // ANDROID_DVR_API_H_
+3 −3
Original line number Diff line number Diff line
#ifndef DVR_DISPLAY_MANAGER_CLIENT_H_
#define DVR_DISPLAY_MANAGER_CLIENT_H_
#ifndef ANDROID_DVR_DISPLAY_MANAGER_H_
#define ANDROID_DVR_DISPLAY_MANAGER_H_

#include <stdbool.h>
#include <stddef.h>
@@ -160,4 +160,4 @@ ssize_t dvrSurfaceStateGetAttributes(DvrSurfaceState* surface_state,

__END_DECLS

#endif  // DVR_DISPLAY_MANAGER_CLIENT_H_
#endif  // ANDROID_DVR_DISPLAY_MANAGER_H_