This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] Linux/AM4379:Wayland 演示编译问题

Guru**** 2559950 points
Other Parts Discussed in Thread: AM4379

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/596838/linux-am4379-wayland-demo-compilation-issues

器件型号:AM4379

工具/软件:Linux

H 论坛、

我一直面临编译演示应用程序的问题。 请参阅以下来源和我所面临的问题。请向我建议解决此问题的任何解决方案。  SDK 版本 ti-processor-sdk-linux-am437x-evm-03.03.00.04-linux-x86。

#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include 

#include 
#include 
#include 
#include 
#include 

#include 
#include 

结构窗口;
结构座椅;

结构显示{
struct wL_display *显示;
struct wl_registry *注册表;
struct wl_compositor *compositor;
struct wl_shell *shell;
STRUT WL_SEAT *座椅;
struct wl_pointer *指针;
struct wl_keyboard *键盘;
struct wL_shm *shm;
struct wl_curse_theme * curse_theme;
struct wl_cursor * default_cursor;
struct wl_surface *光标_surface;
结构{
EGLDisplay dpy;
EGLContext ctx;
EGLConfig conf;
} EGL;
struct window *窗口;
};

struct geometry {
int 宽度、高度;
};

结构窗口{
结构显示*显示;
结构几何体、window_size;
结构{
GLUint rotation_uniform;
格吕恩波斯;
GLUint col;
} 总账;

结构 WL_EGL_Window *本机;
struct wl_surface *表面;
struct wl_shell_surface * shell_surface;
EGLSurface EGL_surface;
struct wl_callback *回调;
int fullscreen,已配置,不透明;
};

静态常量字符*vert_shader_text =
"均匀的 mat4旋转;\n"
"属性 vec4 pos;\n"
"属性矢量4颜色;\n"
"改变 vec4 v_color;\n"
"无效的 main(){\n"
" gl_position = rotation * pos;\n"
" v_color =颜色;\n"
"}\n";

静态常量字符* frag_shader_text =
"精密介质浮子;\n"
"改变 vec4 v_color;\n"
"无效的 main(){\n"
" gl_FragColor = v_color;\n"
"}\n";

静态 int 运行= 1;

静态 void
init_egl (struct display *显示、int 不透明)
{
静态常量 EGLint context_attribs[]={
EGL_context_client_version、2、
EGL_NONE
};

EGLint CONFIG_ATTRIBs[]={
EGL_surface_type、EGL_window_bit、
EGL_RED_SIZE、1、
EGL_GREEN_SIZE、1、
EGL_blue_size、1、
EGL_alpha_size、1、
EGL_RENDERABLE_TYPE、EGL_OpenGL_ES2_BIT、
EGL_NONE
};

EGLint major,minor,n;
EGLret 布尔;

IF (不透明)
CONFIG_ATTRIBS[9]= 0;

display->EGL.dpy = eglGetDisplay (display->display);
assert(display->EGL.dpy);

RET = eglInitialize (display->EGL.dpy、&major、&minor);
assert (ret == EGL_true);
RET = eglBindAPI (EGL_OpenGL_ES_API);
assert (ret == EGL_true);

RET = eglChoseConfig (display->EGL.dpy、config_attribs、
display->EGL.conf、1、&n);
断言(ret && n =1);

display->EGL.ctx = eglCreateContext (display->EGL.dpy、
Display->EGL.conf,
EGL_NO_Context、context_attribs);
assert (display->EGL.ctx);

}

静态 void
fini_EGL (struct display * display)
{
/*必需,否则 EGL_driv2.c 中的 segfault:driv2_make_current ()
*在 eglReleaseThread()上。 *
eglMakeCurrent (display->EGL.dpy、EGL_NO_surface、EGL_NO_surface、
EGL_NO_Context);

eglTerminate(display->EGL.dpy);
eglReleaseThread();
}

静态 GLUint
create_shader (struct window *窗口、const char *源代码、GLenum shader_type)
{
GLUINT 着色器;
Glint 状态;

Shader = glCreateShader (shader_type);
断言(shader!= 0);

glShaderSource (shader、1、(const char **)&source、NULL);
玻璃压实机(着色机);

glGetShaderiv (shader、gL_compile_status、&status);
如果(!status){
字符日志[1000];
GLsizeei len;
glGetShaderInfoLog (shader、1000、len、log);
fprintf (stderr、"错误:编译%s:%*s\n"、
着色器_type = GL_Fertex_Shader? "顶点":"碎片"、
len、log);
退出(1);
}

返回着色器
;}

静态空
init_gl (struct window *窗口)
{
GLUINT frag、vert;
GLUINT 计划;
Glint 状态;

FRAG = create_shader (窗口、frag_shader_text、gL_fragment_Shader);
vert = create_shader (窗口、vert_shader_text、gL_vertex_shader);

程序= glCreateProgram();
GlAttachShader (程序、frag);
GlAttachShader (程序、vert);
glLinkProgram (程序);

glGetProgramiv (程序、gL_link_status、&status);
如果(!status){
字符日志[1000];
GLsizeei len;
glGetProgramInfoLog (程序、1000、len、log);
fprintf (stderr、"错误:链接:\n%*s\n"、len、log);
退出(1);
}

glUseProgram(计划);

window->gl.pos = 0;
window->gl.col = 1;

glBindAttribLocation (程序、window->gl.pos、"pos");
glBindAttribLocation (程序、window->gl.col、"color");
glLinkProgram (程序);

window->gl.rotation_uniform =
glGetUniformLocation (程序、"旋转");
}

静态空
handle_ping (void *数据、struct wL_shell_surface * shell_surface、
uint32_t serial)
{
wl_shell_surface_pong (shell_surface、serial);
}

静态 void
handle_configure (void *数据、struct wl_shell_surface * shell_surface、
uint32_t 边沿、int32_t 宽度、int32_t 高度)
{
struct window *窗口= data;

if (窗口->本机)
WL_EGL_window_resize (window->native、width、height、0、0);

window->geometry.width = width;
window->geometry.height =高度;

如果(!window->fullscreen)
window->window_size = window->几何体;
}

静态空
handle_popup_done (void *数据、struct wL_shell_surface * shell_surface)
{
}

静态常量结构 wl_shell_surface_listener shell_surface_listener ={
Handle_ping、
Handle_configure、
handle_popup_done
};

静态空
重绘(void *数据、struct wl_callback *回调、uint32_t 时间);

静态空
CONFIG_callback (void *数据、struct wl_callback *回调、uint32_t 时间)
{
struct window *窗口= data;

wl_callback_destroy (回调);

Window->Configured = 1;

if (window->callback == NULL)
ReDraw (data、NULL、time);
}

静态结构 WL_callback_listener configure_callback_listener ={
configure_callback、
};

static void
toggle_fullscreen (struct window *窗口、int fullscreen)
{
struct wl_callback *回调;

window->fullscreen = fullscreen;
Window->Configured = 0;

if (全屏){
wl_shell_surface_set_fullscreen (window->shell_surface、
wl_shell_surface_fullscreen_method_default、
0、NULL);
} 否则{
wl_shell_surface_set_toplevel (window->shell_surface);
Handle_configure (Window、Window->shell_surface、0、
Window->Window_Size.width、
window->window_size.height);
}

回叫= WL_DISPLAY_SYNC (window->display->display);
wl_callback_add_listener (回调、Configure_callback_listener、
Window);
}

静态 void
create_surface (struct window *窗口)
{
struct display * display = window->display;
EGLret 布尔;

window->surface = wL_compositor_create_surface (display->compositor);
window->shell_surface = wL_shell_get_shell_surface (display->shell、
Window->surface);

wl_shell_surface_add_listener (window->shell_surface、
&shell_surface_listener、窗口);

Window->Native =
WL_EGL_WINDOW_CREATE (Window->Surface、
Window->Window_Size.width、
window->window_size.height);
window->EGL_surface =
eglCreateWindowSurface (display->EGL.dpy、
Display->EGL.conf,
Window->Native、NULL);

wl_shell_surface_set_title (window->shell_surface、"simple-EGL");

RET = eglMakeCurrent (window->display->EGL.dpy、window->EGL_surface、
window->EGL_surface,window->display->EGL.ctx);
assert (ret == EGL_true);

toggle_fullscreen (window、window->fullscreen);
}

静态 void
destroy_surface (struct window *窗口)
{
WL_EGL_window_destroy (window->native);

wl_shell_surface_destroy (window->shell_surface);
wl_surface_destroy (window->surface);

if (窗口->回调)
wl_callback_destroy (window->callback);
}

静态常量结构 wl_callback_listener frame_listener;

静态空
重绘(void *数据、struct wl_callback *回调、uint32_t 时间)
{
struct window *窗口= data;
静态 const GLfloat verts[3][2]={
{-0.5、-0.5}、
{0.5、-0.5}、
{0、0.5}
};
静态常量 GLfloat 颜色[3][3]={
{ 1、0、0}、
{ 0、1、0}、
{ 0、0、1}
};
GLfloat 角度;
GLfloat 旋转[4][4]={
{ 1、0、0、0}、
{ 0、1、0、0}、
{ 0、0、1、0}、
{ 0、0、0、1}
};
静态 const int32_t speed_div = 5;
静态 uint32_t start_time = 0;
struct wl_region *区;

assert (window->callback => callback = callback);
window->callback = NULL;

if (回调)
wl_callback_destroy (回调);

如果(!window->configured)
返回;

如果(START_TIME = 0)
START_TIME =时间;

角度=((time-start_time)/ speed_div)% 360 * M_PI / 180.0;
旋转[0][0]= cos (角度);
旋转[0][2]= sin (角度);
旋转[2][0]=-sin (角度);
旋转[2][2]= cos (角度);

glViewport (0、0、window->geometry.width、window->geometry.height);

glUniformMatrix4fv (window->gl.rotation_uniform、1、gL_false、
(GLfloat *)旋转);

glClearColor (0.0、0.0、0.0、0.5);
glClear (GL_color_buffer_bit);

glVertex AttribPointer (window->gl.pos、2、gL_float、gL_false、0、 动词);
glVertex AttribPointer (window->gl.col、3、gL_float、gL_false、0、 颜色);
glEnableVertexAttribArray (window->gl.pos);
glEnableVertexAttribArray (window->gl.col);

glDrawArrays (GL_triangles、0、3);

glDisableVertexAttribArray (window->gl.pos);
glDisableVertexAttribArray (window->gl.col);

if (window->不透明|| window->fullscreen){
区域= WL_COMPOTER_CREATE _REGION (window->display->compositor);
WL_REGION (REGION、0、0、
window->geometry.width、
window->geometry.height);
wl_surface_set_不透明 区域(window->surface, region);
wl_region_destroy (region);
} 否则{
WL_surface_set_不透明 区域(window->surface、NULL);
}

window->callback = wL_surface_frame (window->surface);
wl_callback_add_listener (window->callback、&frame_listener、Window);

eglSwapBuffers (window->display->EGL.dpy、window->EGL_surface);
}

静态常量结构 WL_callback_listener frame_listener ={
重绘
};

静态空
pointer_handle_enter (空*数据、结构 wl_pointer *指针、
uint32_t serial、struct wL_surface *曲面、
wl_fixed_t sx、wl_fixed_t sy)
{
struct display * display = data;
struct wl_buffer * buffer;
struct wl_cursor *光标= display->default_cursor;
struct wl_curser_image * image;

if (显示->窗口->全屏)
wl_pointer_set_cursor (指针、串行、NULL、0、0);
否则、如果(光标)为{
图像= DISPLAY->DEFAULT_CURSOR->Images[0];
Buffer = WL_curse_image_get_buffer (image);
wl_pointer_set_cursor (指针、串行、
display->curser_surface、
image->hotspot x,
image->hotspot (y);
wl_surface_attach (display->curse_surface、buffer、0、0);
wl_surface_Damage (display->curse_surface、0、0、
image->width、image->height);
WL_surface_commit (display->curse_surface);
}
}

静态空
POINTER_Handle_leave (空*数据、结构 WL_POINTER *指针、
uint32_t serial、struct wL_surface *曲面)
{
}

static void
pointer_handle_motion (void *数据、struct wl_pointer *指针、
uint32_t 时间、wL_fixed_t sx、wL_fixed_t sy)
{


}静态空
pointer_handle_button (空*数据、结构 wL_pointer * wL_pointer、
uint32_t serial、uint32_t time、uint32_t Button、
uint32_t state)
{
struct display * display = data;

if (Button =BTN_LEFT && state =WL_POINTER_Button_State_pressed)
wl_shell_surface_move(display->window->shell_surface,
display->seat、serial);
}

static void
pointer_handle_axis (void *数据、struct wl_pointer * wl_pointer、
uint32_t 时间、uint32_t 轴、wL_fixed_t 值)
{
}

静态常量结构 wL_pointer_listener pointer_listener ={
Pointer_handle_enter、
Pointer_Handle_leave、
Pointer_Handle_MOTION、
Pointer_Handle_Button、
pointer_handle_axis
,};

静态空
keyboard_handle_keymap (空*数据,结构 WL_keyboard *键盘,
uint32_t 格式、int fd、uint32_t 大小)
{
}

静态 void
keyboard_handle_enter (void *数据、struct wl_keyboard *键盘、
uint32_t serial、struct wL_surface *曲面、
struct wL_array *keys)
{
}

static void
keyboard_handle_leave (void *data、struct wL_keyboard *键盘,
uint32_t serial、struct wl_surface * surface)
{
}

static void
keyboard_handle_key (void *数据、struct wl_keyboard *键盘,
uint32_t serial、uint32_t time、uint32_t key、
uint32_t state)
{
struct display *d = data;

if (key =key_F11 && state)
toggle_fullscreen (d->window、d->window->fullscreen ^ 1);
否则、如果(KEY = KEY_ESC && STACDE")
运行= 0;
}

静态空
keyboard_handle_modifiers (空*数据、结构 WL_keyboard *键盘、
uint32_t serial、uint32_t mods_pressed_、
uint32_t mods_locked、uint32_t mods_locked、
uint32_t group)
{
}

静态常量结构 wL_keyboard_listener keyboard_listener ={
keyboard_handle_keymap、
键盘_handle_enter、
键盘_Handle_leave、
键盘_手柄_键、
keyboard_handle_modifiers
、};

静态空
seid_handle_Capabilities (空*数据、结构 WL_seat * seat、
enum WL_Seate_caps)
{
struct display *d = data;

if (((cap & wl_sed_capability 指针)&&!d->pointer){
d->pointer = WL_Seate_get_pointer (seat);
wl_pointer_add_listener(d->pointer、&pointer_listener、d);
} 如果(!(cap & wl_sed_capability 指针)& d->pointer){
wl_pointer_destroy (d->pointer);
d->pointer = NULL;
}

if (((cap & wL_seee_capability 键盘)&&!d->keyboard){
d->keyboard = WL_See_get_keyboard (seat);
wl_keyboard_add_listener(d->keyboard,&keyboard_listener, d);
} 如果(!(cap & wL_seee_capability 键盘)&& d->keyboard){
wl_keyboard_destroy (d->keyboard);
d->keyboard = NULL;
}
}

静态常量结构 WL_SEst_LISTENER SE_LISTENER ={
seid_handle_capabilities,
};

静态 void
registry_handle_global (void *数据,struct wL_registry * registry,
uint32_t name、const char *接口、uint32_t 版本)
{
struct display *d = data;

if (strcmp (interface、"wL_compositor")=0){
d->compositor=
wl_registry_bind (注册表、名称、
&WL_compositor_interface、1);
} 否则、如果(strcmp (interface、"wL_shell")=0){
d->shell = wL_registry_bind (registry、name、
&WL_shell_interface、1);
} 否则、如果(strcmp (interface、"wL_seat")=0){
d->seat = wL_registry_bind (注册表、名称、
WL_See_interface (&W)、1);
wl_seat 添加侦听器(d->seat、&seat 侦听器、d);
} 否则、如果(strcmp (interface、"wL_shm")=0){
d->shm = wL_registry_bind (registry、name、
&WL_shm_interface、1);
d->curse_theme = wl_curse_theme_load (NULL、32、d->shm);
d->default_cursor =
wl_curse_theme_get_cursor (d->curse_theme、"left_pter");
}
}

静态 void
registry_handle_global_remove (void *数据、struct wl_registry *注册表、
uint32_t name)
{
}

静态常量结构 wL_registry_listener registry_listener ={
注册表_handle_global、
registry_handle_global_remove
};

静态 void
signal_int (int signum)
{
运行= 0;
}

静态空
用法(int error_code)
{
fprintf (stderr、"用法:simple-EGL [选项]\n\n"
"-f\trun 处于全屏模式\n"
"-o\t 生成不透明的曲面\n"
"-h\tThis help text\n\n");

exit (error_code);
}

int
main (int argc、char ** argv)
{
struct sigaction SIGINT;
结构显示={0};
结构窗口={0};
int i、ret = 0;

window.display =显示(&D);
Display.Window =窗口(&W);
window.window_size.width = 250;
window.window_size.height = 250;

对于(i = 1;i < argc;i++){
if (strcmp ("-f"、argv[i])=0)
window.fullscreen = 1;
否则、如果(strcmp ("-o"、argv[i])=0)
window.不透明= 1;
否则、如果(strcmp ("-h"、argv[i])=0)
用法(EXIT_SUCCESS);
其他
用法(exit_failure);
}

display.display = wL_display_connect (NULL);
assert (display.display);

display.registry = wL_display_get_registry (display.display);
wl_registry_add_listener (display.registry、
注册表侦听器(&R)、显示(&D);

WL_DISPLAY_DELAY (DISPLAY.DISPLAY);

init_EGL (&display、window.不透明);
创建曲面(&Window);
init_gl (&window);

display.curse_surface =
wl_compositor_create_surface (display.compositor);

SIGINT.SA_handler = SIGNT_INT;
sigemutyset (&SIGINT.SA_MASK);
SIGINT.SA_FLAGS = SA_RESETHAND;
sigaction (SIGINT、&SIGINT、NULL);

while (正在运行&& ret!=-1)
RET = WL_DISPLAY_DELAY (DISPLAY.DISPLAY);

fprintf (stderr、"simple-EGL exiting \n");

销毁曲面(&Window);
Fini_EGL (显示);

wl_surface_destroy (display.curse_surface);
如果(display.curse_theme)
wl_curse_theme_destroy (display.curse_theme);

if (display.shell)
wl_shell_destroy (display.shell);

如果(display.compositor)
wl_compositor_destroy (display.compositor);

wl_registry_destroy (display.registry);
wl_display_flush (display.display);
WL_DISPLAY_DISCONNECT (DISPLAY.DISPLAY);

返回0;
}

问题

10





/home/alpha/workspace_v7/simple/Debug/../main.c
:12:30 ****增量配置构建用于项目 simple lm 的调试****使所有构建目标:简单调用:跨 GCC 链接器 arm-linux-gnueabihf-gcc -o "simple"./main.o -lGLES_CM -lEGL -lGLESv2 -cair-lwayland-Cursor -lwayland-gcc -lwile_client.23:`未定义的"main./makefine_out_ore.ti_lwlwlwl_ore_makefine.ti_ore.ti.com `-lwlwlwl_ore_target_main.out_ore_target_lwlwlwlwl_ore_target_ore.html:_
在函数`create_surface'中:
/home/alpha/workspace_v7/simple/Debug/../main.c:301:对`WL_EGL_window_create'的未定义引用
./main.o:在函数`destroy_surface'中:
/home/alpha/workspace_v7/simple/Debug/../main.c:321:对`WL_EGL_Window_Destiny '
集合的未定义引用2:错误:LD 返回1退出状态
make:***[simple]错误1 

欢迎提出任何建议。

此致

-Parker

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    软件团队已收到通知。 他们将在这里作出回应。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    能否将-lpvr_wlegl 添加到库列表并尝试
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    感谢您解决了问题
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    器件型号:AM4379

    工具/软件:Linux

    您好、论坛、

    在哪里可以下载文件系统中/usr/bin 文件夹中所有 Weston 演示的演示源代码?? 如何使用 Sitara SDK 和 CCS 编译和编译它们?

    此致

    -Parker

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好 Ramprasad、
    您对我的问题是否有更多信息??
    此致
    -Parker
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Parker、
    您需要为此构建 Yocto。 所有 Weston 客户端示例的源代码均可在此处找到。
    cgit.freedesktop.org/.../

    但构建它们有许多依赖项、因此 Yocto 构建工作正常。

    检查您是否可以使用进行构建
    wayland.freedesktop.org/building.html
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    因此、我无法使用 Code Composer Studio 使用 Sitara SDK 构建和运行 Weston 示例、并且无法在 Arago 上进行部署? 我的理解是否正确,或者我是否遗漏了什么??
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您无法使用 CCS 构建 Weston 示例。 如果您使用的是 SDK 3.02或3.03、请参阅此文档
    processors.wiki.ti.com/.../DRA7xx_GLSDK_Software_Developers_Guide

    Yocto 将使您能够访问所有组件的源代码、并且您可以修改任何组件并重新构建
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    我需要使用视频覆盖实现屏幕显示、为了实现这一点、我可以采取的最佳方法是什么。 这适用于视频应用、我需要在屏幕上显示以覆盖直播视频、欢迎您提出任何建议。

    此致
    -Parker
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    要进一步添加、我希望 OSD 可扩展。 我还想使用 PNG 图像来构建 OSD。 或者可以使用 PSD??
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好、Parker、
    我无法完全理解您的用例。 您能提供更多详细信息吗? 您是否计划仅使用 Weston/wayland 来覆盖视频?
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好 Ramprasad、

    我想运行 ui 使用 am437xgpevm 评估板上的按钮来控制此 ui。 此 ui 将在双摄像头应用中重叠。 UI 将允许用户选择实时摄像机源上的区域、用户可以在其中提供 hstart hend vstart vstart vend vend。 以便在实时摄像头馈送上覆盖矩形。 然后、我们对该选定区域进行一些图像处理。 这是示例用例。 我想使用一些极具吸引力的 ui 或用户界面套件来生成菜单。

    此致
    -Parker