Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
a89027af
A
anbox
项目概览
openeuler
/
anbox
通知
24
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
anbox
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a89027af
编写于
9月 27, 2016
作者:
S
Simon Fels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hwcomposer: actually post buffers received to the screen
上级
3ee86c6d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
82 addition
and
64 deletion
+82
-64
Android.mk
Android.mk
+9
-1
android/hwcomposer/hwcomposer.cpp
android/hwcomposer/hwcomposer.cpp
+73
-63
未找到文件。
Android.mk
浏览文件 @
a89027af
...
...
@@ -78,11 +78,19 @@ include $(BUILD_EXECUTABLE)
include
$(CLEAR_VARS)
LOCAL_MODULE_RELATIVE_PATH
:=
hw
LOCAL_SHARED_LIBRARIES
:=
liblog
LOCAL_SHARED_LIBRARIES
:=
\
liblog
\
lib_renderControl_enc
\
libOpenglSystemCommon
LOCAL_SRC_FILES
:=
\
android/hwcomposer/hwcomposer.cpp
LOCAL_MODULE
:=
hwcomposer.anbox
LOCAL_CFLAGS
:=
-DLOG_TAG
=
\"
hwcomposer
\"
LOCAL_C_INCLUDES
+=
\
$(LOCAL_PATH)
/../device/generic/goldfish/opengl/host/include/libOpenglRender
\
$(LOCAL_PATH)
/../device/generic/goldfish/opengl/shared/OpenglCodecCommon
\
$(LOCAL_PATH)
/../device/generic/goldfish/opengl/system/renderControl_enc
\
$(LOCAL_PATH)
/../device/generic/goldfish/opengl/system/OpenglSystemCommon
LOCAL_MODULE_TAGS
:=
optional
include
$(BUILD_SHARED_LIBRARY)
...
...
android/hwcomposer/hwcomposer.cpp
浏览文件 @
a89027af
...
...
@@ -21,6 +21,25 @@
#define LOG_NDEBUG 0
#include <cutils/log.h>
#include "HostConnection.h"
#include "gralloc_cb.h"
#define DEFINE_HOST_CONNECTION() \
HostConnection *hostCon = HostConnection::get(); \
renderControl_encoder_context_t *rcEnc = (hostCon ? hostCon->rcEncoder() : NULL)
#define DEFINE_AND_VALIDATE_HOST_CONNECTION() \
HostConnection *hostCon = HostConnection::get(); \
if (!hostCon) { \
ALOGE("hwcomposer.anbox: Failed to get host connection\n"); \
return -EIO; \
} \
renderControl_encoder_context_t *rcEnc = hostCon->rcEncoder(); \
if (!rcEnc) { \
ALOGE("hwcomposer.anbox: Failed to get renderControl encoder context\n"); \
return -EIO; \
}
struct
HwcContext
{
hwc_composer_device_1_t
device
;
...
...
@@ -82,6 +101,9 @@ static int hwc_prepare(hwc_composer_device_1_t* dev, size_t numDisplays,
// imply that the framebuffer target layer must be topmost.
for
(;
i
<
num_hw_layers
;
i
++
)
{
hwc_layer_1_t
*
layer
=
&
displays
[
0
]
->
hwLayers
[
num_hw_layers
-
1
-
i
];
dump_layer
(
layer
);
if
(
layer
->
flags
&
HWC_SKIP_LAYER
)
{
// All layers below and including this one will be drawn into the
// framebuffer. Stop marking further layers as HWC_OVERLAY.
...
...
@@ -110,6 +132,35 @@ static int hwc_prepare(hwc_composer_device_1_t* dev, size_t numDisplays,
return
0
;
}
/*
* We're using "implicit" synchronization, so make sure we aren't passing any
* sync object descriptors around.
*/
static
void
check_sync_fds
(
size_t
numDisplays
,
hwc_display_contents_1_t
**
displays
)
{
unsigned
int
i
,
j
;
for
(
i
=
0
;
i
<
numDisplays
;
i
++
)
{
hwc_display_contents_1_t
*
list
=
displays
[
i
];
if
(
list
->
retireFenceFd
>=
0
)
{
ALOGW
(
"retireFenceFd[%u] was %d"
,
i
,
list
->
retireFenceFd
);
list
->
retireFenceFd
=
-
1
;
}
for
(
j
=
0
;
j
<
list
->
numHwLayers
;
j
++
)
{
hwc_layer_1_t
*
layer
=
&
list
->
hwLayers
[
j
];
if
(
layer
->
acquireFenceFd
>=
0
)
{
ALOGW
(
"acquireFenceFd[%u][%u] was %d, closing"
,
i
,
j
,
layer
->
acquireFenceFd
);
close
(
layer
->
acquireFenceFd
);
layer
->
acquireFenceFd
=
-
1
;
}
if
(
layer
->
releaseFenceFd
>=
0
)
{
ALOGW
(
"releaseFenceFd[%u][%u] was %d"
,
i
,
j
,
layer
->
releaseFenceFd
);
layer
->
releaseFenceFd
=
-
1
;
}
}
}
}
static
int
hwc_set
(
hwc_composer_device_1_t
*
dev
,
size_t
numDisplays
,
hwc_display_contents_1_t
**
displays
)
{
auto
context
=
reinterpret_cast
<
HwcContext
*>
(
dev
);
...
...
@@ -119,13 +170,27 @@ static int hwc_set(hwc_composer_device_1_t* dev, size_t numDisplays,
if
(
displays
==
NULL
||
displays
[
0
]
==
NULL
)
return
-
EFAULT
;
// FIXME Here is the point where we have to collect all layers and sent
// them over to the Anbox rendering process
DEFINE_AND_VALIDATE_HOST_CONNECTION
();
for
(
size_t
i
=
0
;
i
<
displays
[
0
]
->
numHwLayers
;
i
++
)
dump_layer
(
&
displays
[
0
]
->
hwLayers
[
i
])
;
for
(
size_t
i
=
0
;
i
<
displays
[
0
]
->
numHwLayers
;
i
++
)
{
const
auto
layer
=
&
displays
[
0
]
->
hwLayers
[
i
]
;
displays
[
0
]
->
retireFenceFd
=
-
1
;
dump_layer
(
layer
);
// FIXME this is just dirty ... but layer->handle is a const native_handle_t and canBePosted
// can't be called with a const.
auto
cb
=
const_cast
<
cb_handle_t
*>
(
reinterpret_cast
<
const
cb_handle_t
*>
(
layer
->
handle
));
if
(
!
cb_handle_t
::
validate
(
cb
))
{
ALOGE
(
"Buffer handle is invalid
\n
"
);
return
-
EINVAL
;
}
ALOGI
(
"Posting buffer %p
\n
"
,
cb
->
hostHandle
);
rcEnc
->
rcFBPost
(
rcEnc
,
cb
->
hostHandle
);
hostCon
->
flush
();
}
check_sync_fds
(
numDisplays
,
displays
);
return
0
;
}
...
...
@@ -137,61 +202,6 @@ static int hwc_event_control(hwc_composer_device_1* dev, int disp,
return
-
EFAULT
;
}
static
int
hwc_get_display_configs
(
hwc_composer_device_1
*
dev
,
int
disp
,
uint32_t
*
configs
,
size_t
*
numConfigs
)
{
ALOGI
(
"%s"
,
__PRETTY_FUNCTION__
);
if
(
disp
!=
0
)
return
-
EINVAL
;
if
(
*
numConfigs
>
0
)
{
// Config[0] will be passed in to getDisplayAttributes as the disp
// parameter. The ARC display supports only 1 configuration.
configs
[
0
]
=
0
;
*
numConfigs
=
1
;
}
return
0
;
}
static
int
hwc_get_display_attributes
(
hwc_composer_device_1
*
dev
,
int
disp
,
uint32_t
config
,
const
uint32_t
*
attributes
,
int32_t
*
values
)
{
ALOGI
(
"%s"
,
__PRETTY_FUNCTION__
);
if
(
disp
!=
0
||
config
!=
0
)
return
-
EINVAL
;
auto
context
=
reinterpret_cast
<
HwcContext
*>
(
dev
);
while
(
*
attributes
!=
HWC_DISPLAY_NO_ATTRIBUTE
)
{
switch
(
*
attributes
)
{
case
HWC_DISPLAY_VSYNC_PERIOD
:
*
values
=
1
;
break
;
case
HWC_DISPLAY_WIDTH
:
*
values
=
1280
;
break
;
case
HWC_DISPLAY_HEIGHT
:
*
values
=
720
;
break
;
case
HWC_DISPLAY_DPI_X
:
*
values
=
1000
*
120
;
break
;
case
HWC_DISPLAY_DPI_Y
:
*
values
=
1000
*
120
;
break
;
default:
ALOGE
(
"Unknown attribute value 0x%02x"
,
*
attributes
);
}
++
attributes
;
++
values
;
}
return
0
;
}
static
void
hwc_register_procs
(
hwc_composer_device_1
*
dev
,
hwc_procs_t
const
*
procs
)
{
ALOGI
(
"%s"
,
__PRETTY_FUNCTION__
);
...
...
@@ -223,7 +233,7 @@ static int hwc_device_open(const hw_module_t* module, const char* name, hw_devic
auto
dev
=
new
HwcContext
;
dev
->
device
.
common
.
tag
=
HARDWARE_DEVICE_TAG
;
dev
->
device
.
common
.
version
=
HWC_DEVICE_API_VERSION_1_
3
;
dev
->
device
.
common
.
version
=
HWC_DEVICE_API_VERSION_1_
0
;
dev
->
device
.
common
.
module
=
const_cast
<
hw_module_t
*>
(
module
);
dev
->
device
.
common
.
close
=
hwc_device_close
;
dev
->
device
.
prepare
=
hwc_prepare
;
...
...
@@ -231,9 +241,9 @@ static int hwc_device_open(const hw_module_t* module, const char* name, hw_devic
dev
->
device
.
eventControl
=
hwc_event_control
;
dev
->
device
.
blank
=
hwc_blank
;
dev
->
device
.
query
=
hwc_query
;
dev
->
device
.
getDisplayConfigs
=
hwc_get_display_configs
;
dev
->
device
.
getDisplayAttributes
=
hwc_get_display_attributes
;
dev
->
device
.
registerProcs
=
hwc_register_procs
;
// FIXME: eventually implement to dump specific information
dev
->
device
.
dump
=
nullptr
;
*
device
=
&
dev
->
device
.
common
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录