Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
anbox
提交
fce7466f
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,发现更多精彩内容 >>
提交
fce7466f
编写于
6月 30, 2016
作者:
S
Simon Fels
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extend shared compositor to return primary display config
上级
506998cf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
74 addition
and
6 deletion
+74
-6
android/shared_compositor/surface_composer.cpp
android/shared_compositor/surface_composer.cpp
+67
-6
android/shared_compositor/surface_composer.h
android/shared_compositor/surface_composer.h
+7
-0
未找到文件。
android/shared_compositor/surface_composer.cpp
浏览文件 @
fce7466f
...
...
@@ -25,8 +25,12 @@
#include <gui/DisplayEventReceiver.h>
#include <gui/IDisplayEventConnection.h>
#include <gui/BitTube.h>
#include <gui/BufferQueue.h>
#include <hardware/hwcomposer_defs.h>
#include <hardware/hardware.h>
#include <cutils/properties.h>
namespace
{
class
DisplayDevice
{
...
...
@@ -68,6 +72,16 @@ private:
sp
<
BitTube
>
const
mChannel
;
};
class
Surface
{
public:
Surface
()
{
BufferQueue
::
createBufferQueue
(
&
producer
,
&
consumer
);
}
sp
<
IGraphicBufferProducer
>
producer
;
sp
<
IGraphicBufferConsumer
>
consumer
;
};
class
Client
:
public
BnSurfaceComposerClient
{
public:
Client
()
{
}
...
...
@@ -108,6 +122,19 @@ namespace anbox {
namespace
android
{
SurfaceComposer
::
SurfaceComposer
()
:
mPrimaryDisplay
(
new
BBinder
)
{
hw_module_t
const
*
module
;
int
err
=
hw_get_module
(
GRALLOC_HARDWARE_MODULE_ID
,
&
module
);
if
(
err
!=
0
)
{
ALOGE
(
"%s module not found"
,
GRALLOC_HARDWARE_MODULE_ID
);
return
;
}
framebuffer_open
(
module
,
&
mFbDev
);
}
SurfaceComposer
::~
SurfaceComposer
()
{
if
(
mFbDev
)
framebuffer_close
(
mFbDev
);
}
void
SurfaceComposer
::
binderDied
(
const
wp
<
IBinder
>&
)
{
...
...
@@ -158,6 +185,18 @@ void SurfaceComposer::setTransactionState(const Vector<ComposerState>& state,
void
SurfaceComposer
::
bootFinished
()
{
ALOGI
(
"%s"
,
__PRETTY_FUNCTION__
);
// wait patiently for the window manager death
const
String16
name
(
"window"
);
sp
<
IBinder
>
window
(
defaultServiceManager
()
->
getService
(
name
));
if
(
window
!=
0
)
{
window
->
linkToDeath
(
static_cast
<
IBinder
::
DeathRecipient
*>
(
this
));
}
// stop boot animation
// formerly we would just kill the process, but we now ask it to exit so it
// can choose where to stop the animation.
property_set
(
"service.bootanim.exit"
,
"1"
);
}
bool
SurfaceComposer
::
authenticateSurfaceTexture
(
const
sp
<
IGraphicBufferProducer
>&
surface
)
const
{
...
...
@@ -174,12 +213,32 @@ status_t SurfaceComposer::getDisplayConfigs(const sp<IBinder>& display, Vector<D
configs
->
clear
();
class
Density
{
static
int
getDensityFromProperty
(
char
const
*
propName
)
{
char
property
[
PROPERTY_VALUE_MAX
];
int
density
=
0
;
if
(
property_get
(
propName
,
property
,
NULL
)
>
0
)
{
density
=
atoi
(
property
);
}
return
density
;
}
public:
static
int
getBuildDensity
()
{
return
getDensityFromProperty
(
"ro.sf.lcd_density"
);
}
};
float
density
=
Density
::
getBuildDensity
()
/
160.0
f
;
// We will provide a single display configuration element here which is
// the framebuffer we're based on. No further display configurations
// are needed in our case.
DisplayInfo
info
=
DisplayInfo
();
info
.
w
=
0
;
info
.
h
=
0
;
info
.
xdpi
=
0
;
info
.
ydpi
=
0
;
info
.
fps
=
60
;
info
.
density
=
density
;
info
.
w
=
mFbDev
->
width
;
info
.
h
=
mFbDev
->
height
;
info
.
xdpi
=
mFbDev
->
xdpi
;
info
.
ydpi
=
mFbDev
->
ydpi
;
info
.
fps
=
mFbDev
->
fps
;
info
.
secure
=
true
;
configs
->
push_back
(
info
);
...
...
@@ -188,11 +247,13 @@ status_t SurfaceComposer::getDisplayConfigs(const sp<IBinder>& display, Vector<D
status_t
SurfaceComposer
::
getDisplayStats
(
const
sp
<
IBinder
>&
display
,
DisplayStatInfo
*
stats
)
{
ALOGI
(
"%s"
,
__PRETTY_FUNCTION__
);
return
OK
;
return
NO_ERROR
;
}
int
SurfaceComposer
::
getActiveConfig
(
const
sp
<
IBinder
>&
display
)
{
ALOGI
(
"%s"
,
__PRETTY_FUNCTION__
);
// We only provide one so it will be always our default
return
0
;
}
...
...
android/shared_compositor/surface_composer.h
浏览文件 @
fce7466f
...
...
@@ -18,14 +18,19 @@
#ifndef ANBOX_ANDROID_SURFACE_COMPOSER_H_
#define ANBOX_ANDROID_SURFACE_COMPOSER_H_
#include <gui/IGraphicBufferProducer.h>
#include <gui/IGraphicBufferConsumer.h>
#include <gui/ISurfaceComposer.h>
#include <ui/Rect.h>
#include <binder/BinderService.h>
using
namespace
android
;
struct
framebuffer_device_t
;
namespace
anbox
{
namespace
android
{
class
Framebuffer
;
class
SurfaceComposer
:
public
BinderService
<
SurfaceComposer
>
,
public
BnSurfaceComposer
,
public
IBinder
::
DeathRecipient
{
...
...
@@ -33,6 +38,7 @@ public:
static
char
const
*
getServiceName
()
{
return
"SurfaceFlinger"
;
}
SurfaceComposer
();
virtual
~
SurfaceComposer
();
void
binderDied
(
const
wp
<
IBinder
>&
who
)
override
;
...
...
@@ -62,6 +68,7 @@ public:
private:
sp
<
IBinder
>
mPrimaryDisplay
;
framebuffer_device_t
*
mFbDev
;
};
}
// namespace android
}
// namespace anbox
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录