mesa: adjust i965 EGL backend for Gpu session

Issue #2507.
This commit is contained in:
Sebastian Sumpf 2017-08-17 18:17:30 +02:00 committed by Christian Helmuth
parent 947235ee34
commit dbeb7410f8
8 changed files with 23 additions and 84 deletions

View File

@ -1,5 +1,5 @@
SHARED_LIB = yes
LIBS = libc egl i965
LIBS = libc egl i965 pthread
include $(REP_DIR)/lib/mk/mesa-common.inc

View File

@ -14,24 +14,13 @@
/* needed since there exists a 'util/list.h' in mesa */
#include <../include/util/list.h>
#include <blit/blit.h>
#include <window.h>
#include <base/log.h>
extern "C" {
#include <platform.h>
}
void genode_framebuffer_refresh(Genode_egl_window *win, int x, int y, int w, int h)
{
Window *window = static_cast<Window *>(win);
window->framebuffer->refresh(x, y, w, h);
}
void genode_blit(void const *src, unsigned src_w, void *dst, unsigned dst_w, int w, int h)
{
blit(src, src_w, dst, dst_w, w, h);
}

View File

@ -80,7 +80,6 @@ _create_surface(_EGLDriver *drv, _EGLDisplay *disp,
dri2_surf->base.Width = window->width;;
dri2_surf->base.Height = window->height;
config = dri2_get_dri_config(dri2_conf, EGL_WINDOW_BIT,
dri2_surf->base.GLColorspace);

View File

@ -18,9 +18,17 @@ extern "C" {
#include <platform.h>
}
extern void drm_init(Genode::Env &env);
extern Genode::Entrypoint &genode_entrypoint();
extern void drm_init(Genode::Env &env, Genode::Entrypoint &ep);
void genode_drm_init()
{
drm_init(*genode_env);
drm_init(*genode_env, genode_entrypoint());
}
extern void drm_complete();
void genode_drm_complete()
{
drm_complete();
}

View File

@ -67,8 +67,6 @@ dri2_genode_put_image(__DRIdrawable * draw, int op,
(char *)dst, data,
dst_stride, src_stride,
false, 1, memcpy);
genode_framebuffer_refresh(window, x, y, w, h);
}
@ -77,6 +75,8 @@ dri2_genode_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
{
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
genode_drm_complete();
void *data = genode_map_image(dri2_surf->back_image);
dri2_genode_put_image(dri2_surf->dri_drawable, 0, 0, 0,
dri2_surf->base.Width, dri2_surf->base.Height,
@ -84,7 +84,6 @@ dri2_genode_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
genode_unmap_image(dri2_surf->back_image);
return EGL_TRUE;
}
@ -254,4 +253,3 @@ cleanup_dpy:
return EGL_FALSE;
}

View File

@ -15,15 +15,16 @@
#define _PLATFORM_H_
#ifdef __cplusplus
namespace Genode { class Env; }
extern Genode::Env *genode_env;
#endif
#include <EGL/egl.h>
struct Genode_egl_window;
void genode_framebuffer_refresh(struct Genode_egl_window *win, int x, int y, int w, int h);
void genode_blit(void const *src, unsigned src_w, void *dst, unsigned dst_w, int w, int h);
void genode_drm_init();
void genode_drm_complete();
struct _EGLSurface;
struct _EGLDriver;

View File

@ -1,59 +0,0 @@
/**
* \brief EGL window with framebuffer connection
* \author Sebastian Sumpf
* \date 2017-08-17
*/
/*
* Copyright (C) 2017 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU Affero General Public License version 3.
*/
#ifndef _WINDOW_H_
#define _WINDOW_H_
#include <base/debug.h>
#include <base/env.h>
#include <framebuffer_session/connection.h>
#include <util/reconstructible.h>
#include <EGL/eglplatform.h>
struct Window : Genode_egl_window
{
Genode::Constructible<Framebuffer::Connection> framebuffer;
Genode::Io_signal_handler<Window> sync_dispatcher;
Genode::Io_signal_handler<Window> mode_dispatcher;
Genode::Env &env;
Window(Genode::Env &env, int w, int h)
:
sync_dispatcher(env.ep(), *this, &Window::sync_handler),
mode_dispatcher(env.ep(), *this, &Window::mode_handler),
env(env)
{
width = w;
height = h;
framebuffer.construct(env, Framebuffer::Mode(width, height, Framebuffer::Mode::RGB565));
addr = env.rm().attach(framebuffer->dataspace());
framebuffer->sync_sigh(sync_dispatcher);
framebuffer->mode_sigh(mode_dispatcher);
mode_handler();
}
void sync_handler();
void mode_handler();
void update()
{
env.rm().detach(addr);
addr = env.rm().attach(framebuffer->dataspace());
}
};
#endif /* _WINDOW_H_ */

View File

@ -124,9 +124,6 @@ dri2_genode_swrast_put_image(__DRIdrawable * draw, int op,
/* copy to frame buffer and refresh */
genode_blit(data, src_stride, dst, dst_stride, copy_width, h);
if (window->type == WINDOW)
genode_framebuffer_refresh(window, x, y, w, h);
}
@ -138,10 +135,16 @@ dri2_genode_swrast_get_drawable_info(__DRIdrawable * draw,
struct dri2_egl_surface *dri2_surf = loaderPrivate;
//XXX: (void) swrast_update_buffers(dri2_surf);
struct Genode_egl_window *window = dri2_surf->g_win;
*x = 0;
*y = 0;
*w = dri2_surf->base.Width;
*h = dri2_surf->base.Height;
*w = window->width;
*h = window->height;
dri2_surf->base.Width = window->width;
dri2_surf->base.Height = window->height;
}