From bb5e27fab6087a5c1528a5faf507acce700e883c Mon Sep 17 00:00:00 2001 From: Gurkirpal Singh Date: Sat, 20 Jan 2018 05:12:06 +0530 Subject: [PATCH] st/omx/bellagio: Rename st and target directories v2: Refactor out screen functions to st/omx Allows to keep all the code under st/omx (st/omx/tizonia and st/omx/bellagio). Reverts targets/omx_bellagio to omx as additions to existing files is enough to compile for both bellagio and tizonia. * autotools changes: --enable-omx -> --enable-omx-bellagio * meson changes: -Dgallium-omx=false -> -Dgallium-omx=disabled -Dgallium-omx=true -> -Dgallium-omx=bellagio Acked-by: Leo Liu Reviewed-by: Julien Isorce --- configure.ac | 5 +- meson.build | 19 ++++---- meson_options.txt | 6 +-- src/gallium/Makefile.am | 2 +- src/gallium/meson.build | 4 +- src/gallium/state_trackers/omx/Makefile.am | 39 ++++++++++++++++ .../state_trackers/omx/Makefile.sources | 1 + .../bellagio}/Makefile.am | 3 +- .../bellagio}/Makefile.sources | 0 .../bellagio}/entrypoint.c | 0 .../bellagio}/entrypoint.h | 0 .../{omx_bellagio => omx/bellagio}/vid_dec.c | 0 .../{omx_bellagio => omx/bellagio}/vid_dec.h | 0 .../bellagio}/vid_dec_h264.c | 0 .../bellagio}/vid_dec_h265.c | 0 .../bellagio}/vid_dec_mpeg12.c | 0 .../{omx_bellagio => omx/bellagio}/vid_enc.c | 2 +- .../{omx_bellagio => omx/bellagio}/vid_enc.h | 46 +++++++++---------- .../{omx_bellagio => omx}/meson.build | 16 +++++-- .../targets/{omx-bellagio => omx}/Makefile.am | 5 +- .../targets/{omx-bellagio => omx}/meson.build | 0 .../targets/{omx-bellagio => omx}/omx.sym | 0 .../targets/{omx-bellagio => omx}/target.c | 0 23 files changed, 98 insertions(+), 50 deletions(-) create mode 100644 src/gallium/state_trackers/omx/Makefile.am create mode 100644 src/gallium/state_trackers/omx/Makefile.sources rename src/gallium/state_trackers/{omx_bellagio => omx/bellagio}/Makefile.am (96%) rename src/gallium/state_trackers/{omx_bellagio => omx/bellagio}/Makefile.sources (100%) rename src/gallium/state_trackers/{omx_bellagio => omx/bellagio}/entrypoint.c (100%) rename src/gallium/state_trackers/{omx_bellagio => omx/bellagio}/entrypoint.h (100%) rename src/gallium/state_trackers/{omx_bellagio => omx/bellagio}/vid_dec.c (100%) rename src/gallium/state_trackers/{omx_bellagio => omx/bellagio}/vid_dec.h (100%) rename src/gallium/state_trackers/{omx_bellagio => omx/bellagio}/vid_dec_h264.c (100%) rename src/gallium/state_trackers/{omx_bellagio => omx/bellagio}/vid_dec_h265.c (100%) rename src/gallium/state_trackers/{omx_bellagio => omx/bellagio}/vid_dec_mpeg12.c (100%) rename src/gallium/state_trackers/{omx_bellagio => omx/bellagio}/vid_enc.c (99%) rename src/gallium/state_trackers/{omx_bellagio => omx/bellagio}/vid_enc.h (73%) rename src/gallium/state_trackers/{omx_bellagio => omx}/meson.build (84%) rename src/gallium/targets/{omx-bellagio => omx}/Makefile.am (89%) rename src/gallium/targets/{omx-bellagio => omx}/meson.build (100%) rename src/gallium/targets/{omx-bellagio => omx}/omx.sym (100%) rename src/gallium/targets/{omx-bellagio => omx}/target.c (100%) diff --git a/configure.ac b/configure.ac index d8093597dd0..241b3c0e582 100644 --- a/configure.ac +++ b/configure.ac @@ -2975,7 +2975,8 @@ AC_CONFIG_FILES([Makefile src/gallium/state_trackers/dri/Makefile src/gallium/state_trackers/glx/xlib/Makefile src/gallium/state_trackers/nine/Makefile - src/gallium/state_trackers/omx_bellagio/Makefile + src/gallium/state_trackers/omx/Makefile + src/gallium/state_trackers/omx/bellagio/Makefile src/gallium/state_trackers/osmesa/Makefile src/gallium/state_trackers/va/Makefile src/gallium/state_trackers/vdpau/Makefile @@ -2986,7 +2987,7 @@ AC_CONFIG_FILES([Makefile src/gallium/targets/d3dadapter9/d3d.pc src/gallium/targets/dri/Makefile src/gallium/targets/libgl-xlib/Makefile - src/gallium/targets/omx-bellagio/Makefile + src/gallium/targets/omx/Makefile src/gallium/targets/opencl/Makefile src/gallium/targets/opencl/mesa.icd src/gallium/targets/osmesa/Makefile diff --git a/meson.build b/meson.build index bb6a835084f..9bb114056b1 100644 --- a/meson.build +++ b/meson.build @@ -464,29 +464,28 @@ endif _omx = get_option('gallium-omx') if not system_has_kms_drm - if _omx == 'true' + if _omx != 'disabled' error('OMX state tracker can only be built on unix-like OSes.') else - _omx = 'false' + _omx = 'disabled' endif elif not (with_platform_x11 or with_platform_drm) - if _omx == 'true' + if _omx != 'disabled' error('OMX state tracker requires X11 or drm platform support.') else - _omx = 'false' + _omx = 'disabled' endif elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau) - if _omx == 'true' + if _omx != 'disabled' error('OMX state tracker requires at least one of the following gallium drivers: r600, radeonsi, nouveau.') else - _omx = 'false' + _omx = 'disabled' endif -elif _omx == 'auto' - _omx = 'true' endif -with_gallium_omx = _omx == 'true' +with_gallium_omx = _omx != 'disabled' +gallium_omx = _omx dep_omx = [] -if with_gallium_omx +if gallium_omx == 'bellagio' dep_omx = dependency('libomxil-bellagio') endif diff --git a/meson_options.txt b/meson_options.txt index 7fafe2deaac..f5705c2b3c2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -90,9 +90,9 @@ option( option( 'gallium-omx', type : 'combo', - value : 'auto', - choices : ['auto', 'true', 'false'], - description : 'enable gallium omx bellagio state tracker.', + value : 'bellagio', + choices : ['disabled', 'bellagio'], + description : 'enable gallium omx state tracker.', ) option( 'omx-libs-path', diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am index af010c89f8d..047fa12bf54 100644 --- a/src/gallium/Makefile.am +++ b/src/gallium/Makefile.am @@ -155,7 +155,7 @@ SUBDIRS += state_trackers/glx/xlib targets/libgl-xlib endif if HAVE_ST_OMX_BELLAGIO -SUBDIRS += state_trackers/omx_bellagio targets/omx-bellagio +SUBDIRS += state_trackers/omx targets/omx endif if HAVE_GALLIUM_OSMESA diff --git a/src/gallium/meson.build b/src/gallium/meson.build index 320fc0176e9..7f49c285992 100644 --- a/src/gallium/meson.build +++ b/src/gallium/meson.build @@ -145,7 +145,7 @@ if with_gallium_xvmc subdir('state_trackers/xvmc') endif if with_gallium_omx - subdir('state_trackers/omx_bellagio') + subdir('state_trackers/omx') endif if with_gallium_va subdir('state_trackers/va') @@ -190,7 +190,7 @@ if with_gallium_xvmc subdir('targets/xvmc') endif if with_gallium_omx - subdir('targets/omx-bellagio') + subdir('targets/omx') endif if with_gallium_va subdir('targets/va') diff --git a/src/gallium/state_trackers/omx/Makefile.am b/src/gallium/state_trackers/omx/Makefile.am new file mode 100644 index 00000000000..ea72787919c --- /dev/null +++ b/src/gallium/state_trackers/omx/Makefile.am @@ -0,0 +1,39 @@ +# Copyright © 2012 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +include Makefile.sources +include $(top_srcdir)/src/gallium/Automake.inc + +SUBDIRS = bellagio + +AM_CFLAGS = \ + $(GALLIUM_CFLAGS) \ + $(VISIBILITY_CFLAGS) \ + $(VL_CFLAGS) \ + $(XCB_DRI3_CFLAGS) \ + $(OMX_BELLAGIO_CFLAGS) + +noinst_LTLIBRARIES = libomxtracker_common.la + +libomxtracker_common_la_SOURCES = $(C_SOURCES) + +EXTRA_DIST = meson.build diff --git a/src/gallium/state_trackers/omx/Makefile.sources b/src/gallium/state_trackers/omx/Makefile.sources new file mode 100644 index 00000000000..9103ca899db --- /dev/null +++ b/src/gallium/state_trackers/omx/Makefile.sources @@ -0,0 +1 @@ +C_SOURCES := diff --git a/src/gallium/state_trackers/omx_bellagio/Makefile.am b/src/gallium/state_trackers/omx/bellagio/Makefile.am similarity index 96% rename from src/gallium/state_trackers/omx_bellagio/Makefile.am rename to src/gallium/state_trackers/omx/bellagio/Makefile.am index 66f0f1e5e31..3e542ab0f26 100644 --- a/src/gallium/state_trackers/omx_bellagio/Makefile.am +++ b/src/gallium/state_trackers/omx/bellagio/Makefile.am @@ -24,6 +24,7 @@ include Makefile.sources include $(top_srcdir)/src/gallium/Automake.inc AM_CFLAGS = \ + -I$(top_srcdir)/src/gallium/state_trackers/omx \ $(GALLIUM_CFLAGS) \ $(VISIBILITY_CFLAGS) \ $(VL_CFLAGS) \ @@ -33,5 +34,3 @@ AM_CFLAGS = \ noinst_LTLIBRARIES = libomxtracker.la libomxtracker_la_SOURCES = $(C_SOURCES) - -EXTRA_DIST = meson.build diff --git a/src/gallium/state_trackers/omx_bellagio/Makefile.sources b/src/gallium/state_trackers/omx/bellagio/Makefile.sources similarity index 100% rename from src/gallium/state_trackers/omx_bellagio/Makefile.sources rename to src/gallium/state_trackers/omx/bellagio/Makefile.sources diff --git a/src/gallium/state_trackers/omx_bellagio/entrypoint.c b/src/gallium/state_trackers/omx/bellagio/entrypoint.c similarity index 100% rename from src/gallium/state_trackers/omx_bellagio/entrypoint.c rename to src/gallium/state_trackers/omx/bellagio/entrypoint.c diff --git a/src/gallium/state_trackers/omx_bellagio/entrypoint.h b/src/gallium/state_trackers/omx/bellagio/entrypoint.h similarity index 100% rename from src/gallium/state_trackers/omx_bellagio/entrypoint.h rename to src/gallium/state_trackers/omx/bellagio/entrypoint.h diff --git a/src/gallium/state_trackers/omx_bellagio/vid_dec.c b/src/gallium/state_trackers/omx/bellagio/vid_dec.c similarity index 100% rename from src/gallium/state_trackers/omx_bellagio/vid_dec.c rename to src/gallium/state_trackers/omx/bellagio/vid_dec.c diff --git a/src/gallium/state_trackers/omx_bellagio/vid_dec.h b/src/gallium/state_trackers/omx/bellagio/vid_dec.h similarity index 100% rename from src/gallium/state_trackers/omx_bellagio/vid_dec.h rename to src/gallium/state_trackers/omx/bellagio/vid_dec.h diff --git a/src/gallium/state_trackers/omx_bellagio/vid_dec_h264.c b/src/gallium/state_trackers/omx/bellagio/vid_dec_h264.c similarity index 100% rename from src/gallium/state_trackers/omx_bellagio/vid_dec_h264.c rename to src/gallium/state_trackers/omx/bellagio/vid_dec_h264.c diff --git a/src/gallium/state_trackers/omx_bellagio/vid_dec_h265.c b/src/gallium/state_trackers/omx/bellagio/vid_dec_h265.c similarity index 100% rename from src/gallium/state_trackers/omx_bellagio/vid_dec_h265.c rename to src/gallium/state_trackers/omx/bellagio/vid_dec_h265.c diff --git a/src/gallium/state_trackers/omx_bellagio/vid_dec_mpeg12.c b/src/gallium/state_trackers/omx/bellagio/vid_dec_mpeg12.c similarity index 100% rename from src/gallium/state_trackers/omx_bellagio/vid_dec_mpeg12.c rename to src/gallium/state_trackers/omx/bellagio/vid_dec_mpeg12.c diff --git a/src/gallium/state_trackers/omx_bellagio/vid_enc.c b/src/gallium/state_trackers/omx/bellagio/vid_enc.c similarity index 99% rename from src/gallium/state_trackers/omx_bellagio/vid_enc.c rename to src/gallium/state_trackers/omx/bellagio/vid_enc.c index 162ec1f65ab..2a777bbb91b 100644 --- a/src/gallium/state_trackers/omx_bellagio/vid_enc.c +++ b/src/gallium/state_trackers/omx/bellagio/vid_enc.c @@ -159,7 +159,7 @@ static OMX_ERRORTYPE vid_enc_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam r = omx_base_filter_Constructor(comp, name); if (r) - return r; + return r; priv->BufferMgmtCallback = vid_enc_BufferEncoded; priv->messageHandler = vid_enc_MessageHandler; diff --git a/src/gallium/state_trackers/omx_bellagio/vid_enc.h b/src/gallium/state_trackers/omx/bellagio/vid_enc.h similarity index 73% rename from src/gallium/state_trackers/omx_bellagio/vid_enc.h rename to src/gallium/state_trackers/omx/bellagio/vid_enc.h index a83374450b5..0a215031c8b 100644 --- a/src/gallium/state_trackers/omx_bellagio/vid_enc.h +++ b/src/gallium/state_trackers/omx/bellagio/vid_enc.h @@ -66,29 +66,29 @@ DERIVEDCLASS(vid_enc_PrivateType, omx_base_filter_PrivateType) #define vid_enc_PrivateType_FIELDS omx_base_filter_PrivateType_FIELDS \ - struct vl_screen *screen; \ - struct pipe_context *s_pipe; \ - struct pipe_context *t_pipe; \ - struct pipe_video_codec *codec; \ - struct list_head free_tasks; \ - struct list_head used_tasks; \ - struct list_head b_frames; \ - struct list_head stacked_tasks; \ - OMX_U32 frame_rate; \ - OMX_U32 frame_num; \ - OMX_U32 pic_order_cnt; \ - OMX_U32 ref_idx_l0, ref_idx_l1; \ - OMX_BOOL restricted_b_frames; \ - OMX_VIDEO_PARAM_BITRATETYPE bitrate; \ - OMX_VIDEO_PARAM_QUANTIZATIONTYPE quant; \ - OMX_VIDEO_PARAM_PROFILELEVELTYPE profile_level; \ - OMX_CONFIG_INTRAREFRESHVOPTYPE force_pic_type; \ - struct vl_compositor compositor; \ - struct vl_compositor_state cstate; \ - struct pipe_video_buffer *scale_buffer[OMX_VID_ENC_NUM_SCALING_BUFFERS]; \ - OMX_CONFIG_SCALEFACTORTYPE scale; \ - OMX_U32 current_scale_buffer; \ - OMX_U32 stacked_frames_num; + struct vl_screen *screen; \ + struct pipe_context *s_pipe; \ + struct pipe_context *t_pipe; \ + struct pipe_video_codec *codec; \ + struct list_head free_tasks; \ + struct list_head used_tasks; \ + struct list_head b_frames; \ + struct list_head stacked_tasks; \ + OMX_U32 frame_rate; \ + OMX_U32 frame_num; \ + OMX_U32 pic_order_cnt; \ + OMX_U32 ref_idx_l0, ref_idx_l1; \ + OMX_BOOL restricted_b_frames; \ + OMX_VIDEO_PARAM_BITRATETYPE bitrate; \ + OMX_VIDEO_PARAM_QUANTIZATIONTYPE quant; \ + OMX_VIDEO_PARAM_PROFILELEVELTYPE profile_level; \ + OMX_CONFIG_INTRAREFRESHVOPTYPE force_pic_type; \ + struct vl_compositor compositor; \ + struct vl_compositor_state cstate; \ + struct pipe_video_buffer *scale_buffer[OMX_VID_ENC_NUM_SCALING_BUFFERS]; \ + OMX_CONFIG_SCALEFACTORTYPE scale; \ + OMX_U32 current_scale_buffer; \ + OMX_U32 stacked_frames_num; ENDCLASS(vid_enc_PrivateType) OMX_ERRORTYPE vid_enc_LoaderComponent(stLoaderComponentType *comp); diff --git a/src/gallium/state_trackers/omx_bellagio/meson.build b/src/gallium/state_trackers/omx/meson.build similarity index 84% rename from src/gallium/state_trackers/omx_bellagio/meson.build rename to src/gallium/state_trackers/omx/meson.build index a62a31149e2..d17332553ff 100644 --- a/src/gallium/state_trackers/omx_bellagio/meson.build +++ b/src/gallium/state_trackers/omx/meson.build @@ -18,12 +18,20 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +if gallium_omx == 'bellagio' +files_omx = files( + 'bellagio/entrypoint.c', + 'bellagio/vid_dec.c', + 'bellagio/vid_dec_mpeg12.c', + 'bellagio/vid_dec_h264.c', + 'bellagio/vid_dec_h265.c', + 'bellagio/vid_enc.c' +) +endif + libomx_st = static_library( 'omx_st', - files( - 'entrypoint.c', 'vid_dec.c', 'vid_dec_mpeg12.c', 'vid_dec_h264.c', - 'vid_dec_h265.c', 'vid_enc.c', - ), + files_omx, c_args : [c_vis_args], include_directories : [inc_common], dependencies : [dep_omx, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3], diff --git a/src/gallium/targets/omx-bellagio/Makefile.am b/src/gallium/targets/omx/Makefile.am similarity index 89% rename from src/gallium/targets/omx-bellagio/Makefile.am rename to src/gallium/targets/omx/Makefile.am index 471ed85cd2c..89ebcc045cb 100644 --- a/src/gallium/targets/omx-bellagio/Makefile.am +++ b/src/gallium/targets/omx/Makefile.am @@ -19,11 +19,12 @@ libomx_mesa_la_LDFLAGS = \ if HAVE_LD_VERSION_SCRIPT libomx_mesa_la_LDFLAGS += \ - -Wl,--version-script=$(top_srcdir)/src/gallium/targets/omx-bellagio/omx.sym + -Wl,--version-script=$(top_srcdir)/src/gallium/targets/omx/omx.sym endif # HAVE_LD_VERSION_SCRIPT libomx_mesa_la_LIBADD = \ - $(top_builddir)/src/gallium/state_trackers/omx_bellagio/libomxtracker.la \ + $(top_builddir)/src/gallium/state_trackers/omx/libomxtracker_common.la \ + $(top_builddir)/src/gallium/state_trackers/omx/bellagio/libomxtracker.la \ $(top_builddir)/src/gallium/auxiliary/libgalliumvlwinsys.la \ $(top_builddir)/src/gallium/auxiliary/libgalliumvl.la \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ diff --git a/src/gallium/targets/omx-bellagio/meson.build b/src/gallium/targets/omx/meson.build similarity index 100% rename from src/gallium/targets/omx-bellagio/meson.build rename to src/gallium/targets/omx/meson.build diff --git a/src/gallium/targets/omx-bellagio/omx.sym b/src/gallium/targets/omx/omx.sym similarity index 100% rename from src/gallium/targets/omx-bellagio/omx.sym rename to src/gallium/targets/omx/omx.sym diff --git a/src/gallium/targets/omx-bellagio/target.c b/src/gallium/targets/omx/target.c similarity index 100% rename from src/gallium/targets/omx-bellagio/target.c rename to src/gallium/targets/omx/target.c -- 2.30.2