summaryrefslogtreecommitdiff
path: root/src/gallium
diff options
context:
space:
mode:
authorJakob Bornecrantz <jakob@vmware.com>2009-08-18 19:54:41 +0100
committerJakob Bornecrantz <wallbraker@gmail.com>2009-08-18 18:51:41 +0100
commit657109bbc659c77b41d929a1585fc251fb1caba3 (patch)
treeea3eeba354c5df9f8c387fa7776664cbaeb5b020 /src/gallium
parentcaae3f1e8d6e49567c2e26ac2eef1bdd535f4e19 (diff)
egl: Create the front texture the properly
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/egl/egl_surface.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c
index c66c48f848..ed8738e404 100644
--- a/src/gallium/state_trackers/egl/egl_surface.c
+++ b/src/gallium/state_trackers/egl/egl_surface.c
@@ -76,26 +76,8 @@ drm_create_texture(_EGLDriver *drv,
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 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));
templat.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
@@ -108,13 +90,16 @@ drm_create_texture(_EGLDriver *drv,
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;
+ dev->api->buffer_from_texture(dev->api, texture, &buf, &pitch);
+ if (!buf)
+ goto err_buf;
+
surface = screen->get_tex_surface(screen,
texture,
0,
@@ -125,7 +110,6 @@ drm_create_texture(_EGLDriver *drv,
if (!surface)
goto err_surf;
-
scrn->tex = texture;
scrn->surface = surface;
scrn->buffer = buf;
@@ -142,9 +126,9 @@ err_handle:
pipe_surface_reference(&surface, NULL);
err_surf:
pipe_texture_reference(&texture, NULL);
+err_buf:
err_tex:
pipe_buffer_reference(&buf, NULL);
-err_buf:
return;
}