Skip to content

Commit

Permalink
Indentation and other cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gpalsingh committed Jul 30, 2017
1 parent f4e26a9 commit 498e2e7
Show file tree
Hide file tree
Showing 20 changed files with 2,438 additions and 2,479 deletions.
196 changes: 97 additions & 99 deletions src/gallium/state_trackers/omx_tizonia/entrypoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
#include <tizvideoport.h>
#include <tizvideoport_decls.h>

#if defined(HAVE_X11_PLATFORM)
#include <X11/Xlib.h>
#else
#define XOpenDisplay(x) NULL
#define XCloseDisplay(x)
#define Display void
#endif

#include "os/os_thread.h"
#include "util/u_memory.h"
#include "loader/loader.h"
Expand All @@ -31,117 +23,123 @@
#include "h264einport.h"
#include "h264eoutport.h"

#if defined(HAVE_X11_PLATFORM)
#include <X11/Xlib.h>
#else
#define XOpenDisplay(x) NULL
#define XCloseDisplay(x)
#define Display void
#endif

static mtx_t omx_lock = _MTX_INITIALIZER_NP;
static Display *omx_display = NULL;
static struct vl_screen *omx_screen = NULL;
static unsigned omx_usecount = 0;
static const char *omx_render_node = NULL;
static int drm_fd;

DEBUG_GET_ONCE_BOOL_OPTION(mesa_enable_omx_eglimage, "MESA_ENABLE_OMX_EGLIMAGE", false)
DEBUG_GET_ONCE_BOOL_OPTION(mesa_enable_omx_eglimage,
"MESA_ENABLE_OMX_EGLIMAGE",
false)

static OMX_BOOL egl_image_validation_hook (const OMX_HANDLETYPE ap_hdl,
OMX_U32 pid, OMX_PTR ap_eglimage,
void *ap_args)
static OMX_BOOL egl_image_validation_hook(const OMX_HANDLETYPE ap_hdl,
OMX_U32 pid, OMX_PTR ap_eglimage,
void *ap_args)
{
const void * p_krn = NULL;
const tiz_port_t * p_port = NULL;
const tiz_videoport_t * p_videoport = NULL;
const void * p_krn = NULL;
const tiz_port_t * p_port = NULL;

/* TODO: */
// vp8d_prc_t * ap_prc = NULL;
assert(ap_hdl);
assert(ap_eglimage);
assert(!ap_args);

assert (ap_hdl);
assert (ap_eglimage);
assert (!ap_args);

if (!debug_get_option_mesa_enable_omx_eglimage()) {
return OMX_FALSE;
}

p_krn = tiz_get_krn (ap_hdl);
p_port = tiz_krn_get_port (p_krn, pid);
p_videoport = (tiz_videoport_t *) p_port;
if (!debug_get_option_mesa_enable_omx_eglimage()) {
return OMX_FALSE;
}

assert (p_videoport);
p_krn = tiz_get_krn(ap_hdl);
p_port = tiz_krn_get_port(p_krn, pid);

const OMX_VIDEO_PORTDEFINITIONTYPE * p_video_portdef
= &(p_port->portdef_.format.video);
const OMX_VIDEO_PORTDEFINITIONTYPE * p_video_portdef
= &(p_port->portdef_.format.video);

if (!p_video_portdef->pNativeWindow) {
return OMX_FALSE;
}
if (!p_video_portdef->pNativeWindow) {
return OMX_FALSE;
}

/* This function must return true or false */
return OMX_TRUE;
return OMX_TRUE;
}

OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE ap_hdl)
{
tiz_role_factory_t h264d_role;
tiz_role_factory_t h264e_role;
const tiz_role_factory_t * rf_list[] = {&h264e_role, &h264d_role};
tiz_type_factory_t h264dprc_type;
tiz_type_factory_t h264eprc_type;
tiz_type_factory_t h264e_inport_type;
tiz_type_factory_t h264e_outport_type;
const tiz_type_factory_t * tf_list[] = {&h264e_inport_type, &h264e_outport_type,
&h264eprc_type, &h264dprc_type};
const tiz_eglimage_hook_t egl_validation_hook = {
OMX_VID_DEC_AVC_OUTPUT_PORT_INDEX,
egl_image_validation_hook,
NULL
};

strcpy ((OMX_STRING) h264d_role.role, OMX_VID_DEC_AVC_ROLE);
h264d_role.pf_cport = instantiate_h264_config_port;
h264d_role.pf_port[0] = instantiate_h264_input_port;
h264d_role.pf_port[1] = instantiate_h264_output_port;
h264d_role.nports = 2;
h264d_role.pf_proc = instantiate_h264_processor;

strcpy ((OMX_STRING) h264e_role.role, OMX_VID_ENC_AVC_ROLE);
h264e_role.pf_cport = instantiate_h264e_config_port;
h264e_role.pf_port[0] = instantiate_h264e_input_port;
h264e_role.pf_port[1] = instantiate_h264e_output_port;
h264e_role.nports = 2;
h264e_role.pf_proc = instantiate_h264e_processor;

strcpy ((OMX_STRING) h264dprc_type.class_name, "h264dprc_class");
h264dprc_type.pf_class_init = h264d_prc_class_init;
strcpy ((OMX_STRING) h264dprc_type.object_name, "h264dprc");
h264dprc_type.pf_object_init = h264d_prc_init;

strcpy ((OMX_STRING) h264eprc_type.class_name, "h264eprc_class");
h264eprc_type.pf_class_init = h264e_prc_class_init;
strcpy ((OMX_STRING) h264eprc_type.object_name, "h264eprc");
h264eprc_type.pf_object_init = h264e_prc_init;

strcpy ((OMX_STRING) h264e_inport_type.class_name, "h264einport_class");
h264e_inport_type.pf_class_init = h264e_inport_class_init;
strcpy ((OMX_STRING) h264e_inport_type.object_name, "h264einport");
h264e_inport_type.pf_object_init = h264e_inport_init;

strcpy ((OMX_STRING) h264e_outport_type.class_name, "h264eoutport_class");
h264e_outport_type.pf_class_init = h264e_outport_class_init;
strcpy ((OMX_STRING) h264e_outport_type.object_name, "h264eoutport");
h264e_outport_type.pf_object_init = h264e_outport_init;

/* Initialize the component infrastructure */
tiz_comp_init (ap_hdl, OMX_VID_COMP_NAME);

/* Register the classes */
tiz_comp_register_types (ap_hdl, tf_list, 4);

/* Register the component roles */
tiz_comp_register_roles (ap_hdl, rf_list, 2);

/* Register egl image validation hook */
tiz_check_omx (tiz_comp_register_role_eglimage_hook
(ap_hdl, (const OMX_U8 *) OMX_VID_DEC_AVC_ROLE, &egl_validation_hook));

return OMX_ErrorNone;
tiz_role_factory_t h264d_role;
tiz_role_factory_t h264e_role;
const tiz_role_factory_t * rf_list[] = {&h264e_role, &h264d_role};
tiz_type_factory_t h264dprc_type;
tiz_type_factory_t h264eprc_type;
tiz_type_factory_t h264e_inport_type;
tiz_type_factory_t h264e_outport_type;
const tiz_type_factory_t * tf_list[] = {&h264e_inport_type, &h264e_outport_type,
&h264eprc_type, &h264dprc_type};
const tiz_eglimage_hook_t egl_validation_hook = {
OMX_VID_DEC_AVC_OUTPUT_PORT_INDEX,
egl_image_validation_hook,
NULL
};

/* Settings for roles */
strcpy ((OMX_STRING) h264d_role.role, OMX_VID_DEC_AVC_ROLE);
h264d_role.pf_cport = instantiate_h264d_config_port;
h264d_role.pf_port[0] = instantiate_h264d_input_port;
h264d_role.pf_port[1] = instantiate_h264d_output_port;
h264d_role.nports = 2;
h264d_role.pf_proc = instantiate_h264d_processor;

strcpy ((OMX_STRING) h264e_role.role, OMX_VID_ENC_AVC_ROLE);
h264e_role.pf_cport = instantiate_h264e_config_port;
h264e_role.pf_port[0] = instantiate_h264e_input_port;
h264e_role.pf_port[1] = instantiate_h264e_output_port;
h264e_role.nports = 2;
h264e_role.pf_proc = instantiate_h264e_processor;

/* Settings for classes */
strcpy ((OMX_STRING) h264dprc_type.class_name, "h264dprc_class");
h264dprc_type.pf_class_init = h264d_prc_class_init;
strcpy ((OMX_STRING) h264dprc_type.object_name, "h264dprc");
h264dprc_type.pf_object_init = h264d_prc_init;

strcpy ((OMX_STRING) h264eprc_type.class_name, "h264eprc_class");
h264eprc_type.pf_class_init = h264e_prc_class_init;
strcpy ((OMX_STRING) h264eprc_type.object_name, "h264eprc");
h264eprc_type.pf_object_init = h264e_prc_init;

strcpy ((OMX_STRING) h264e_inport_type.class_name, "h264einport_class");
h264e_inport_type.pf_class_init = h264e_inport_class_init;
strcpy ((OMX_STRING) h264e_inport_type.object_name, "h264einport");
h264e_inport_type.pf_object_init = h264e_inport_init;

strcpy ((OMX_STRING) h264e_outport_type.class_name, "h264eoutport_class");
h264e_outport_type.pf_class_init = h264e_outport_class_init;
strcpy ((OMX_STRING) h264e_outport_type.object_name, "h264eoutport");
h264e_outport_type.pf_object_init = h264e_outport_init;

/* Initialize the component infrastructure */
tiz_comp_init (ap_hdl, OMX_VID_COMP_NAME);

/* Classes need to be registered first */
tiz_comp_register_types (ap_hdl, tf_list, 4);

/* Register the component roles */
tiz_comp_register_roles (ap_hdl, rf_list, 2);

/* Register egl image validation hook for the decoder */
tiz_check_omx (tiz_comp_register_role_eglimage_hook
(ap_hdl, (const OMX_U8 *) OMX_VID_DEC_AVC_ROLE,
&egl_validation_hook));

return OMX_ErrorNone;
}

struct vl_screen *omx_get_screen(void)
{
static bool first_time = true;
Expand Down
2 changes: 1 addition & 1 deletion src/gallium/state_trackers/omx_tizonia/entrypoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "vl/vl_winsys.h"

PUBLIC OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE ap_hdl);
PUBLIC OMX_ERRORTYPE OMX_ComponentInit(OMX_HANDLETYPE ap_hdl);

struct vl_screen *omx_get_screen(void);
void omx_put_screen(void);
Expand Down
Loading

0 comments on commit 498e2e7

Please sign in to comment.