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

Commit 10ac3200 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents 6bddf4a8 02199c25
Loading
Loading
Loading
Loading

libs/vr/libdvr/build_sdk.py

deleted100755 → 0
+0 −47
Original line number Original line 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 Original line Diff line number Diff line
@@ -4,12 +4,15 @@
#include <stdbool.h>
#include <stdbool.h>
#include <stddef.h>
#include <stddef.h>
#include <stdint.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include <cstdio>
#include <unistd.h>


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


__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif


typedef struct ANativeWindow ANativeWindow;
typedef struct ANativeWindow ANativeWindow;


@@ -38,6 +41,11 @@ typedef int32_t DvrGlobalBufferKey;
typedef struct DvrSurfaceAttributeValue DvrSurfaceAttributeValue;
typedef struct DvrSurfaceAttributeValue DvrSurfaceAttributeValue;
typedef struct DvrSurfaceAttribute DvrSurfaceAttribute;
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;
struct native_handle;


// Device metrics data type enums.
// Device metrics data type enums.
@@ -181,7 +189,7 @@ typedef int (*DvrSurfaceCreateWriteBufferQueuePtr)(
    uint32_t layer_count, uint64_t usage, size_t capacity,
    uint32_t layer_count, uint64_t usage, size_t capacity,
    DvrWriteBufferQueue** queue_out);
    DvrWriteBufferQueue** queue_out);


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


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


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


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


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


__END_DECLS
__END_DECLS


#endif  // DVR_DISPLAY_MANAGER_CLIENT_H_
#endif  // ANDROID_DVR_DISPLAY_MANAGER_H_