-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
kodi-999.99-PR13552.patch
349 lines (332 loc) · 11.2 KB
/
kodi-999.99-PR13552.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
From ec9e4d1fe085d585b6107fb0bb27645506b540f3 Mon Sep 17 00:00:00 2001
From: Alex Deryskyba <alex@wetek.com>
Date: Thu, 15 Feb 2018 21:48:16 +0200
Subject: [PATCH] amlcodec: cleanup and simplify 3D handling code
---
.../cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp | 178 ++++-----------------
xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h | 7 +-
xbmc/utils/AMLUtils.cpp | 20 ---
xbmc/utils/AMLUtils.h | 1 -
4 files changed, 30 insertions(+), 176 deletions(-)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
index d83fbda65bd4..d8a14fed1a25 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
@@ -55,8 +55,7 @@
// amcodec include
extern "C" {
-#include <codec.h>
-#include <amports/amstream.h>
+#include <amcodec/codec.h>
} // extern "C"
CEvent g_aml_sync_event;
@@ -346,44 +345,6 @@ typedef struct vframe_states
int buf_avail_num;
} vframe_states_t;
-static int aml_ioctl_get(CODEC_HANDLE h, int subcmd, unsigned long paramter)
-{
- struct am_ioctl_parm parm;
- memset(&parm, 0, sizeof(parm));
- parm.cmd = subcmd;
- parm.data_32 = *(unsigned int *)paramter;
- if (ioctl(h, AMSTREAM_IOC_GET, (unsigned long)&parm) < 0)
- {
- CLog::Log(LOGERROR, "aml_ioctl_get failed: subcmd=%x, errno=%d", subcmd, errno);
- return -1;
- }
- *(unsigned int *)paramter = parm.data_32;
- return 0;
-}
-
-
-#ifndef AMSTREAM_IOC_MAGIC
-#define AMSTREAM_IOC_MAGIC 'S'
-#endif
-
-#ifndef AMSTREAM_IOC_VF_STATUS
-#define AMSTREAM_IOC_VF_STATUS _IOR(AMSTREAM_IOC_MAGIC, 0x60, unsigned long)
-#endif
-
-#ifndef AMSTREAM_IOC_GET_3D_TYPE
-#define AMSTREAM_IOC_GET_3D_TYPE _IOW((AMSTREAM_IOC_MAGIC), 0x3d, unsigned int)
-#endif
-
-
-enum
-{
- VPP_3D_MODE_NULL = 0,
- VPP_3D_MODE_LR,
- VPP_3D_MODE_TB,
- VPP_3D_MODE_LA,
- VPP_3D_MODE_FA
-};
-
/*************************************************************************/
/*************************************************************************/
void dumpfile_open(am_private_t *para)
@@ -2264,53 +2225,21 @@ void CAMLCodec::SetVideoSaturation(const int saturation)
SysfsUtils::SetInt("/sys/class/video/saturation", saturation);
}
-bool CAMLCodec::SetVideo3dMode(const int mode3d)
-{
- bool result = true;
- if (SysfsUtils::Has("/sys/class/ppmgr/ppmgr_3d_mode"))
- {
- CLog::Log(LOGDEBUG, "CAMLCodec::SetVideo3dMode:mode3d(0x%x)", mode3d);
- SysfsUtils::SetInt("/sys/class/ppmgr/ppmgr_3d_mode", mode3d);
- }
- else
- {
- CLog::Log(LOGINFO, "CAMLCodec::SetVideo3dMode: ppmgr_3d support not found in kernel.");
- result = false;
- }
- return result;
-}
-
-std::string CAMLCodec::GetStereoMode()
+std::string CAMLCodec::GetVideoStereoMode()
{
std::string stereoMode;
- //Get Decoder Stereo mode
- int decoder_sm(VPP_3D_MODE_NULL);
- aml_ioctl_get(am_private->vcodec.handle, AMSTREAM_IOC_GET_3D_TYPE, (unsigned long)&decoder_sm);
-
- switch (decoder_sm)
+ switch (m_processInfo.GetVideoSettings().m_StereoMode)
{
- case VPP_3D_MODE_LR:
+ case RENDER_STEREO_MODE_SPLIT_VERTICAL:
stereoMode = "left_right";
break;
- case VPP_3D_MODE_TB:
+ case RENDER_STEREO_MODE_SPLIT_HORIZONTAL:
stereoMode = "top_bottom";
break;
- case VPP_3D_MODE_LA:
- case VPP_3D_MODE_FA:
default:
- switch(m_processInfo.GetVideoSettings().m_StereoMode)
- {
- case RENDER_STEREO_MODE_SPLIT_VERTICAL:
- stereoMode = "left_right";
- break;
- case RENDER_STEREO_MODE_SPLIT_HORIZONTAL:
- stereoMode = "top_bottom";
- break;
- default:
- stereoMode = m_hints.stereo_mode;
- break;
- }
+ stereoMode = m_hints.stereo_mode;
+ break;
}
if (m_processInfo.GetVideoSettings().m_StereoInvert)
@@ -2320,6 +2249,7 @@ std::string CAMLCodec::GetStereoMode()
else if (stereoMode == "left_right")
stereoMode = "right_left";
}
+
return stereoMode;
}
@@ -2359,20 +2289,20 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
update = true;
}
- // video stereo mode/view.
- RENDER_STEREO_MODE stereo_mode = g_graphicsContext.GetStereoMode();
- if (m_stereo_mode != stereo_mode)
+ // GUI stereo mode/view.
+ RENDER_STEREO_MODE guiStereoMode = g_graphicsContext.GetStereoMode();
+ if (m_guiStereoMode != guiStereoMode)
{
- m_stereo_mode = stereo_mode;
+ m_guiStereoMode = guiStereoMode;
update = true;
}
- RENDER_STEREO_VIEW stereo_view = g_graphicsContext.GetStereoView();
- if (m_stereo_view != stereo_view)
+ RENDER_STEREO_VIEW guiStereoView = g_graphicsContext.GetStereoView();
+ if (m_guiStereoView != guiStereoView)
{
// left/right/top/bottom eye,
// this might change every other frame.
// we do not care but just track it.
- m_stereo_view = stereo_view;
+ m_guiStereoView = guiStereoView;
}
// dest_rect
@@ -2424,9 +2354,9 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
{
float xscale = display.Width() / gui.Width();
float yscale = display.Height() / gui.Height();
- if (m_stereo_mode == RENDER_STEREO_MODE_SPLIT_VERTICAL)
+ if (m_guiStereoMode == RENDER_STEREO_MODE_SPLIT_VERTICAL)
xscale /= 2.0;
- else if (m_stereo_mode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL)
+ else if (m_guiStereoMode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL)
yscale /= 2.0;
dst_rect.x1 *= xscale;
dst_rect.x2 *= xscale;
@@ -2434,75 +2364,21 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
dst_rect.y2 *= yscale;
}
- if (m_stereo_mode == RENDER_STEREO_MODE_MONO)
+ if (m_guiStereoMode == RENDER_STEREO_MODE_MONO)
{
- std::string mode = GetStereoMode();
- if (mode == "left_right")
- {
- if (!SetVideo3dMode(MODE_3D_TO_2D_L))
- {
- // fall back to software scaling if no hw support
- // was found
- dst_rect.x2 *= 2.0;
- }
- }
- else if (mode == "right_left")
- {
- if (!SetVideo3dMode(MODE_3D_TO_2D_R))
- {
- // fall back to software scaling if no hw support
- // was found
- dst_rect.x2 *= 2.0;
- }
- }
- else if (mode == "top_bottom")
- {
- if (!SetVideo3dMode(MODE_3D_TO_2D_T))
- {
- // fall back to software scaling if no hw support
- // was found
- dst_rect.y2 *= 2.0;
- }
- }
- else if (mode == "bottom_top")
- {
- if (!SetVideo3dMode(MODE_3D_TO_2D_B))
- {
- // fall back to software scaling if no hw support
- // was found
- dst_rect.y2 *= 2.0;
- }
- }
- else
- SetVideo3dMode(MODE_3D_DISABLE);
+ std::string videoStereoMode = GetVideoStereoMode();
+ if (videoStereoMode == "left_right" || videoStereoMode == "righ_left")
+ dst_rect.x2 *= 2.0;
+ else if (videoStereoMode == "top_bottom" || videoStereoMode == "bottom_top")
+ dst_rect.y2 *= 2.0;
}
- else if (m_stereo_mode == RENDER_STEREO_MODE_SPLIT_VERTICAL)
+ else if (m_guiStereoMode == RENDER_STEREO_MODE_SPLIT_VERTICAL)
{
dst_rect.x2 *= 2.0;
- SetVideo3dMode(MODE_3D_DISABLE);
}
- else if (m_stereo_mode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL)
+ else if (m_guiStereoMode == RENDER_STEREO_MODE_SPLIT_HORIZONTAL)
{
dst_rect.y2 *= 2.0;
- SetVideo3dMode(MODE_3D_DISABLE);
- }
- else if (m_stereo_mode == RENDER_STEREO_MODE_INTERLACED)
- {
- std::string mode = GetStereoMode();
- if (mode == "left_right")
- SetVideo3dMode(MODE_3D_LR);
- else if (mode == "right_left")
- SetVideo3dMode(MODE_3D_LR_SWITCH);
- else if (mode == "row_interleaved_lr")
- SetVideo3dMode(MODE_3D_LR);
- else if (mode == "row_interleaved_rl")
- SetVideo3dMode(MODE_3D_LR_SWITCH);
- else
- SetVideo3dMode(MODE_3D_DISABLE);
- }
- else
- {
- SetVideo3dMode(MODE_3D_DISABLE);
}
#if 1
@@ -2522,8 +2398,8 @@ void CAMLCodec::SetVideoRect(const CRect &SrcRect, const CRect &DestRect)
CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:gui(%s)", s_gui.c_str());
CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_dst_rect(%s)", s_m_dst_rect.c_str());
CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:dst_rect(%s)", s_dst_rect.c_str());
- CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_stereo_mode(%d)", m_stereo_mode);
- CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_stereo_view(%d)", m_stereo_view);
+ CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_guiStereoMode(%d)", m_guiStereoMode);
+ CLog::Log(LOGDEBUG, "CAMLCodec::SetVideoRect:m_guiStereoView(%d)", m_guiStereoView);
#endif
// goofy 0/1 based difference in aml axis coordinates.
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h
index 378c237c3b38..fdb1b63fffe1 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.h
@@ -71,8 +71,7 @@ class CAMLCodec
void SetVideoContrast(const int contrast);
void SetVideoBrightness(const int brightness);
void SetVideoSaturation(const int saturation);
- bool SetVideo3dMode(const int mode3d);
- std::string GetStereoMode();
+ std::string GetVideoStereoMode();
bool OpenAmlVideo(const CDVDStreamInfo &hints);
void CloseAmlVideo();
std::string GetVfmMap(const std::string &name);
@@ -96,8 +95,8 @@ class CAMLCodec
CRect m_display_rect;
int m_view_mode = -1;
- RENDER_STEREO_MODE m_stereo_mode = RENDER_STEREO_MODE_OFF;
- RENDER_STEREO_VIEW m_stereo_view = RENDER_STEREO_VIEW_OFF;
+ RENDER_STEREO_MODE m_guiStereoMode = RENDER_STEREO_MODE_OFF;
+ RENDER_STEREO_VIEW m_guiStereoView = RENDER_STEREO_VIEW_OFF;
float m_zoom = -1.0f;
int m_contrast = -1;
int m_brightness = -1;
diff --git a/xbmc/utils/AMLUtils.cpp b/xbmc/utils/AMLUtils.cpp
index 5666236e93a5..9ba833838ff4 100644
--- a/xbmc/utils/AMLUtils.cpp
+++ b/xbmc/utils/AMLUtils.cpp
@@ -54,22 +54,6 @@ bool aml_present()
return has_aml == 1;
}
-bool aml_hw3d_present()
-{
- static int has_hw3d = -1;
- if (has_hw3d == -1)
- {
- if (SysfsUtils::Has("/sys/class/ppmgr/ppmgr_3d_mode") ||
- SysfsUtils::Has("/sys/class/amhdmitx/amhdmitx0/config"))
- has_hw3d = 1;
- else
- has_hw3d = 0;
- if (has_hw3d)
- CLog::Log(LOGNOTICE, "AML 3D support detected");
- }
- return has_hw3d == 1;
-}
-
bool aml_wired_present()
{
static int has_wired = -1;
@@ -138,10 +122,6 @@ bool aml_permissions()
{
CLog::Log(LOGERROR, "AML: no rw on /sys/class/audiodsp/digital_raw");
}
- if (!SysfsUtils::HasRW("/sys/class/ppmgr/ppmgr_3d_mode"))
- {
- CLog::Log(LOGERROR, "AML: no rw on /sys/class/ppmgr/ppmgr_3d_mode");
- }
if (!SysfsUtils::HasRW("/sys/class/amhdmitx/amhdmitx0/config"))
{
CLog::Log(LOGERROR, "AML: no rw on /sys/class/amhdmitx/amhdmitx0/config");
diff --git a/xbmc/utils/AMLUtils.h b/xbmc/utils/AMLUtils.h
index a012d1b0aedc..1fc7dab3e3b3 100644
--- a/xbmc/utils/AMLUtils.h
+++ b/xbmc/utils/AMLUtils.h
@@ -54,7 +54,6 @@ enum AML_SUPPORT_H264_4K2K
bool aml_present();
bool aml_permissions();
-bool aml_hw3d_present();
bool aml_wired_present();
bool aml_support_hevc();
bool aml_support_hevc_4k2k();