projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
egl: Create the front texture the properly
[mesa.git]
/
src
/
gallium
/
state_trackers
/
egl
/
egl_surface.c
diff --git
a/src/gallium/state_trackers/egl/egl_surface.c
b/src/gallium/state_trackers/egl/egl_surface.c
index aa3c32d41c9f9253747af0fed82ea4a62bdddd6c..ed8738e4049562aaa5b47926e08bc1fc1e3b8e84 100644
(file)
--- a/
src/gallium/state_trackers/egl/egl_surface.c
+++ b/
src/gallium/state_trackers/egl/egl_surface.c
@@
-76,30
+76,12
@@
drm_create_texture(_EGLDriver *drv,
struct pipe_surface *surface;
struct pipe_texture *texture;
struct pipe_texture templat;
struct pipe_surface *surface;
struct pipe_texture *texture;
struct pipe_texture templat;
- struct pipe_buffer *buf;
- unsigned stride = 1024;
+ struct pipe_buffer *buf = NULL;
unsigned pitch = 0;
unsigned pitch = 0;
- unsigned size = 0;
-
- /* ugly */
- if (stride < w)
- stride = 2048;
-
- pitch = stride * 4;
- size = h * 2 * pitch;
-
- buf = pipe_buffer_create(screen,
- 0, /* alignment */
- PIPE_BUFFER_USAGE_GPU_READ_WRITE |
- PIPE_BUFFER_USAGE_CPU_READ_WRITE,
- size);
-
- if (!buf)
- goto err_buf;
memset(&templat, 0, sizeof(templat));
memset(&templat, 0, sizeof(templat));
- templat.tex_usage
|= PIPE_TEXTURE_USAGE_DISPLAY
_TARGET;
- templat.tex_usage |= PIPE_TEXTURE_USAGE_
RENDER_TARGET
;
+ templat.tex_usage
= PIPE_TEXTURE_USAGE_RENDER
_TARGET;
+ templat.tex_usage |= PIPE_TEXTURE_USAGE_
PRIMARY
;
templat.target = PIPE_TEXTURE_2D;
templat.last_level = 0;
templat.depth[0] = 1;
templat.target = PIPE_TEXTURE_2D;
templat.last_level = 0;
templat.depth[0] = 1;
@@
-108,13
+90,16
@@
drm_create_texture(_EGLDriver *drv,
templat.height[0] = h;
pf_get_block(templat.format, &templat.block);
templat.height[0] = h;
pf_get_block(templat.format, &templat.block);
- texture = screen->texture_blanket(dev->screen,
- &templat,
- &pitch,
- buf);
+ texture = screen->texture_create(dev->screen,
+ &templat);
+
if (!texture)
goto err_tex;
if (!texture)
goto err_tex;
+ dev->api->buffer_from_texture(dev->api, texture, &buf, &pitch);
+ if (!buf)
+ goto err_buf;
+
surface = screen->get_tex_surface(screen,
texture,
0,
surface = screen->get_tex_surface(screen,
texture,
0,
@@
-125,14
+110,13
@@
drm_create_texture(_EGLDriver *drv,
if (!surface)
goto err_surf;
if (!surface)
goto err_surf;
-
scrn->tex = texture;
scrn->surface = surface;
scrn->buffer = buf;
scrn->front.width = w;
scrn->front.height = h;
scrn->front.pitch = pitch;
scrn->tex = texture;
scrn->surface = surface;
scrn->buffer = buf;
scrn->front.width = w;
scrn->front.height = h;
scrn->front.pitch = pitch;
- d
rm_api_hocks.handle_from_buffer(dev->winsys
, scrn->buffer, &scrn->front.handle);
+ d
ev->api->handle_from_buffer(dev->api, screen
, scrn->buffer, &scrn->front.handle);
if (0)
goto err_handle;
if (0)
goto err_handle;
@@
-142,9
+126,9
@@
err_handle:
pipe_surface_reference(&surface, NULL);
err_surf:
pipe_texture_reference(&texture, NULL);
pipe_surface_reference(&surface, NULL);
err_surf:
pipe_texture_reference(&texture, NULL);
-err_tex:
- pipe_buffer_reference(screen, &buf, NULL);
err_buf:
err_buf:
+err_tex:
+ pipe_buffer_reference(&buf, NULL);
return;
}
return;
}
@@
-173,27
+157,27
@@
drm_takedown_shown_screen(_EGLDriver *drv, struct drm_screen *screen)
pipe_surface_reference(&screen->surface, NULL);
pipe_texture_reference(&screen->tex, NULL);
pipe_surface_reference(&screen->surface, NULL);
pipe_texture_reference(&screen->tex, NULL);
- pipe_buffer_reference(
dev->screen,
&screen->buffer, NULL);
+ pipe_buffer_reference(&screen->buffer, NULL);
screen->shown = 0;
}
screen->shown = 0;
}
-EGLSurface
-drm_create_window_surface(_EGLDriver *drv,
EGLDisplay dpy, EGLConfig config
, NativeWindowType window, const EGLint *attrib_list)
+_EGLSurface *
+drm_create_window_surface(_EGLDriver *drv,
_EGLDisplay *dpy, _EGLConfig *conf
, NativeWindowType window, const EGLint *attrib_list)
{
{
- return
EGL_NO_SURFACE
;
+ return
NULL
;
}
}
-EGLSurface
-drm_create_pixmap_surface(_EGLDriver *drv,
EGLDisplay dpy, EGLConfig config
, NativePixmapType pixmap, const EGLint *attrib_list)
+_EGLSurface *
+drm_create_pixmap_surface(_EGLDriver *drv,
_EGLDisplay *dpy, _EGLConfig *conf
, NativePixmapType pixmap, const EGLint *attrib_list)
{
{
- return
EGL_NO_SURFACE
;
+ return
NULL
;
}
}
-EGLSurface
-drm_create_pbuffer_surface(_EGLDriver *drv,
EGLDisplay dpy, EGLConfig config
,
+_EGLSurface *
+drm_create_pbuffer_surface(_EGLDriver *drv,
_EGLDisplay *dpy, _EGLConfig *conf
,
const EGLint *attrib_list)
{
int i;
const EGLint *attrib_list)
{
int i;
@@
-201,13
+185,6
@@
drm_create_pbuffer_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
int height = -1;
struct drm_surface *surf = NULL;
__GLcontextModes *visual;
int height = -1;
struct drm_surface *surf = NULL;
__GLcontextModes *visual;
- _EGLConfig *conf;
-
- conf = _eglLookupConfig(drv, dpy, config);
- if (!conf) {
- _eglError(EGL_BAD_CONFIG, "eglCreatePbufferSurface");
- return EGL_NO_CONTEXT;
- }
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) {
switch (attrib_list[i]) {
@@
-225,14
+202,14
@@
drm_create_pbuffer_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
if (width < 1 || height < 1) {
_eglError(EGL_BAD_ATTRIBUTE, "eglCreatePbufferSurface");
if (width < 1 || height < 1) {
_eglError(EGL_BAD_ATTRIBUTE, "eglCreatePbufferSurface");
- return
EGL_NO_SURFACE
;
+ return
NULL
;
}
surf = (struct drm_surface *) calloc(1, sizeof(struct drm_surface));
if (!surf)
goto err;
}
surf = (struct drm_surface *) calloc(1, sizeof(struct drm_surface));
if (!surf)
goto err;
- if (!_eglInitSurface(drv,
dpy, &surf->base, EGL_PBUFFER_BIT, config
, attrib_list))
+ if (!_eglInitSurface(drv,
&surf->base, EGL_PBUFFER_BIT, conf
, attrib_list))
goto err_surf;
surf->w = width;
goto err_surf;
surf->w = width;
@@
-245,17
+222,16
@@
drm_create_pbuffer_surface(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
(void*)surf);
drm_visual_modes_destroy(visual);
(void*)surf);
drm_visual_modes_destroy(visual);
- _eglSaveSurface(&surf->base);
- return surf->base.Handle;
+ return &surf->base;
err_surf:
free(surf);
err:
err_surf:
free(surf);
err:
- return
EGL_NO_SURFACE
;
+ return
NULL
;
}
}
-EGLSurface
-drm_create_screen_surface_mesa(_EGLDriver *drv,
EGLDisplay dpy, EGLConfig
cfg,
+_EGLSurface *
+drm_create_screen_surface_mesa(_EGLDriver *drv,
_EGLDisplay *dpy, _EGLConfig *
cfg,
const EGLint *attrib_list)
{
EGLSurface surf = drm_create_pbuffer_surface(drv, dpy, cfg, attrib_list);
const EGLint *attrib_list)
{
EGLSurface surf = drm_create_pbuffer_surface(drv, dpy, cfg, attrib_list);
@@
-264,15
+240,13
@@
drm_create_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg,
}
EGLBoolean
}
EGLBoolean
-drm_show_screen_surface_mesa(_EGLDriver *drv,
EGLDisplay
dpy,
-
EGLScreenMESA
screen,
-
EGLSurface surface, EGLModeMESA m
)
+drm_show_screen_surface_mesa(_EGLDriver *drv,
_EGLDisplay *
dpy,
+
_EGLScreen *
screen,
+
_EGLSurface *surface, _EGLMode *mode
)
{
struct drm_device *dev = (struct drm_device *)drv;
struct drm_surface *surf = lookup_drm_surface(surface);
{
struct drm_device *dev = (struct drm_device *)drv;
struct drm_surface *surf = lookup_drm_surface(surface);
- struct drm_screen *scrn = lookup_drm_screen(dpy, screen);
- struct pipe_context *pipe;
- _EGLMode *mode = _eglLookupMode(dpy, m);
+ struct drm_screen *scrn = lookup_drm_screen(screen);
int ret;
unsigned int i, k;
int ret;
unsigned int i, k;
@@
-331,6
+305,13
@@
drm_show_screen_surface_mesa(_EGLDriver *drv, EGLDisplay dpy,
if (ret)
goto err_crtc;
if (ret)
goto err_crtc;
+
+ if (scrn->dpms)
+ drmModeConnectorSetProperty(dev->drmFD,
+ scrn->connectorID,
+ scrn->dpms->prop_id,
+ DRM_MODE_DPMS_ON);
+
surf->screen = scrn;
scrn->surf = surf;
surf->screen = scrn;
scrn->surf = surf;
@@
-349,19
+330,16
@@
err_fb:
err_bo:
pipe_surface_reference(&scrn->surface, NULL);
pipe_texture_reference(&scrn->tex, NULL);
err_bo:
pipe_surface_reference(&scrn->surface, NULL);
pipe_texture_reference(&scrn->tex, NULL);
- pipe_buffer_reference(
dev->screen,
&scrn->buffer, NULL);
+ pipe_buffer_reference(&scrn->buffer, NULL);
return EGL_FALSE;
}
EGLBoolean
return EGL_FALSE;
}
EGLBoolean
-drm_destroy_surface(_EGLDriver *drv,
EGLDisplay dpy, EGLSurface
surface)
+drm_destroy_surface(_EGLDriver *drv,
_EGLDisplay *dpy, _EGLSurface *
surface)
{
struct drm_surface *surf = lookup_drm_surface(surface);
{
struct drm_surface *surf = lookup_drm_surface(surface);
- _eglRemoveSurface(&surf->base);
- if (surf->base.IsBound) {
- surf->base.DeletePending = EGL_TRUE;
- } else {
+ if (!_eglIsSurfaceBound(&surf->base)) {
if (surf->screen)
drm_takedown_shown_screen(drv, surf->screen);
st_unreference_framebuffer(surf->stfb);
if (surf->screen)
drm_takedown_shown_screen(drv, surf->screen);
st_unreference_framebuffer(surf->stfb);
@@
-371,7
+349,7
@@
drm_destroy_surface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
}
EGLBoolean
}
EGLBoolean
-drm_swap_buffers(_EGLDriver *drv,
EGLDisplay dpy, EGLSurface
draw)
+drm_swap_buffers(_EGLDriver *drv,
_EGLDisplay *dpy, _EGLSurface *
draw)
{
struct drm_surface *surf = lookup_drm_surface(draw);
struct pipe_surface *back_surf;
{
struct drm_surface *surf = lookup_drm_surface(draw);
struct pipe_surface *back_surf;
@@
-392,7
+370,6
@@
drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
if (surf->screen) {
surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
surf->user->pipe->surface_copy(surf->user->pipe,
if (surf->screen) {
surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
surf->user->pipe->surface_copy(surf->user->pipe,
- 0,
surf->screen->surface,
0, 0,
back_surf,
surf->screen->surface,
0, 0,
back_surf,
@@
-401,8
+378,6
@@
drm_swap_buffers(_EGLDriver *drv, EGLDisplay dpy, EGLSurface draw)
surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
/* TODO stuff here */
}
surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL);
/* TODO stuff here */
}
-
- st_notify_swapbuffers_complete(surf->stfb);
}
return EGL_TRUE;
}
return EGL_TRUE;