diff options
Diffstat (limited to 'src/gallium/state_trackers/dri')
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri1_helper.c | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri1_helper.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri_drawable.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri_screen.c | 28 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri_st_api.c | 43 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/common/dri_st_api.h | 20 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/drm/SConscript | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/drm/dri1.c | 24 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/drm/dri2.c | 136 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/drm/dri2.h | 3 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/sw/drisw.c | 22 |
11 files changed, 226 insertions, 60 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri1_helper.c b/src/gallium/state_trackers/dri/common/dri1_helper.c index 7eeb868d42..b0dd974a96 100644 --- a/src/gallium/state_trackers/dri/common/dri1_helper.c +++ b/src/gallium/state_trackers/dri/common/dri1_helper.c @@ -84,7 +84,7 @@ dri1_swap_fences_clear(struct dri_drawable *drawable) } struct pipe_surface * -dri1_get_pipe_surface(struct dri_drawable *drawable, struct pipe_texture *ptex) +dri1_get_pipe_surface(struct dri_drawable *drawable, struct pipe_resource *ptex) { struct pipe_screen *pipe_screen = dri_screen(drawable->sPriv)->pipe_screen; struct pipe_surface *psurf = drawable->dri1_surface; @@ -93,7 +93,7 @@ dri1_get_pipe_surface(struct dri_drawable *drawable, struct pipe_texture *ptex) pipe_surface_reference(&drawable->dri1_surface, NULL); drawable->dri1_surface = pipe_screen->get_tex_surface(pipe_screen, - ptex, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ); + ptex, 0, 0, 0, PIPE_BIND_BLIT_SOURCE); psurf = drawable->dri1_surface; } diff --git a/src/gallium/state_trackers/dri/common/dri1_helper.h b/src/gallium/state_trackers/dri/common/dri1_helper.h index 3254b7ff87..c98adf2df2 100644 --- a/src/gallium/state_trackers/dri/common/dri1_helper.h +++ b/src/gallium/state_trackers/dri/common/dri1_helper.h @@ -47,7 +47,7 @@ void dri1_swap_fences_clear(struct dri_drawable *drawable); struct pipe_surface * -dri1_get_pipe_surface(struct dri_drawable *drawable, struct pipe_texture *ptex); +dri1_get_pipe_surface(struct dri_drawable *drawable, struct pipe_resource *ptex); void dri1_destroy_pipe_surface(struct dri_drawable *drawable); diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.h b/src/gallium/state_trackers/dri/common/dri_drawable.h index 98abeb9ec0..315b778165 100644 --- a/src/gallium/state_trackers/dri/common/dri_drawable.h +++ b/src/gallium/state_trackers/dri/common/dri_drawable.h @@ -55,7 +55,7 @@ struct dri_drawable unsigned old_w; unsigned old_h; - struct pipe_texture *textures[ST_ATTACHMENT_COUNT]; + struct pipe_resource *textures[ST_ATTACHMENT_COUNT]; unsigned int texture_mask, texture_stamp; struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX]; diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c index 6fc7487071..83616744ad 100644 --- a/src/gallium/state_trackers/dri/common/dri_screen.c +++ b/src/gallium/state_trackers/dri/common/dri_screen.c @@ -93,34 +93,34 @@ dri_fill_in_modes(struct dri_screen *screen, pf_x8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24X8_UNORM, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL, 0); pf_z24x8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_X8Z24_UNORM, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL, 0); pf_s8z24 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL, 0); pf_z24s8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_S8_USCALED_Z24_UNORM, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL, 0); pf_a8r8g8b8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8A8_UNORM, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET, 0); + PIPE_BIND_RENDER_TARGET, 0); pf_x8r8g8b8 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B8G8R8X8_UNORM, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET, 0); + PIPE_BIND_RENDER_TARGET, 0); pf_r5g6b5 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_B5G6R5_UNORM, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET, 0); + PIPE_BIND_RENDER_TARGET, 0); /* We can only get a 16 or 32 bit depth buffer with getBuffersWithFormat */ if (dri_with_format(screen->sPriv)) { pf_z16 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z16_UNORM, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL, 0); pf_z32 = p_screen->is_format_supported(p_screen, PIPE_FORMAT_Z32_UNORM, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0); + PIPE_BIND_DEPTH_STENCIL, 0); } else { pf_z16 = FALSE; pf_z32 = FALSE; @@ -288,12 +288,14 @@ dri_destroy_option_cache(struct dri_screen * screen) { int i; - for (i = 0; i < (1 << screen->optionCache.tableSize); ++i) { - FREE(screen->optionCache.info[i].name); - FREE(screen->optionCache.info[i].ranges); + if (screen->optionCache.info) { + for (i = 0; i < (1 << screen->optionCache.tableSize); ++i) { + FREE(screen->optionCache.info[i].name); + FREE(screen->optionCache.info[i].ranges); + } + FREE(screen->optionCache.info); } - FREE(screen->optionCache.info); FREE(screen->optionCache.values); } diff --git a/src/gallium/state_trackers/dri/common/dri_st_api.c b/src/gallium/state_trackers/dri/common/dri_st_api.c index 1a5259c68b..261bae75a2 100644 --- a/src/gallium/state_trackers/dri/common/dri_st_api.c +++ b/src/gallium/state_trackers/dri/common/dri_st_api.c @@ -14,12 +14,13 @@ * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. * * Authors: * Chia-I Wu <olv@lunarg.com> @@ -46,7 +47,7 @@ static boolean dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, const enum st_attachment_type *statts, unsigned count, - struct pipe_texture **out) + struct pipe_resource **out) { struct dri_drawable *drawable = (struct dri_drawable *) stfbi->st_manager_private; @@ -99,7 +100,7 @@ dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, for (i = 0; i < count; i++) { out[i] = NULL; - pipe_texture_reference(&out[i], drawable->textures[statts[i]]); + pipe_resource_reference(&out[i], drawable->textures[statts[i]]); } return TRUE; @@ -156,7 +157,7 @@ dri_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi) int i; for (i = 0; i < ST_ATTACHMENT_COUNT; i++) - pipe_texture_reference(&drawable->textures[i], NULL); + pipe_resource_reference(&drawable->textures[i], NULL); FREE(stfbi); } @@ -224,6 +225,31 @@ _dri_put_st_api(void) } } +static boolean +dri_st_manager_get_egl_image(struct st_manager *smapi, + struct st_egl_image *stimg) +{ + __DRIimage *img = NULL; + +#ifndef __NOT_HAVE_DRM_H + if (!__dri1_api_hooks) { + struct dri_context *ctx = (struct dri_context *) + stimg->stctxi->st_manager_private; + img = dri2_lookup_egl_image(ctx, stimg->egl_image); + } +#endif + if (!img) + return FALSE; + + stimg->texture = NULL; + pipe_resource_reference(&stimg->texture, img->texture); + stimg->face = img->face; + stimg->level = img->level; + stimg->zslice = img->zslice; + + return TRUE; +} + /** * Create a state tracker manager from the given screen. */ @@ -235,6 +261,7 @@ dri_create_st_manager(struct dri_screen *screen) smapi = CALLOC_STRUCT(st_manager); if (smapi) { smapi->screen = screen->pipe_screen; + smapi->get_egl_image = dri_st_manager_get_egl_image; _dri_get_st_api(); } diff --git a/src/gallium/state_trackers/dri/common/dri_st_api.h b/src/gallium/state_trackers/dri/common/dri_st_api.h index 99a217bfa7..11d86cfbdf 100644 --- a/src/gallium/state_trackers/dri/common/dri_st_api.h +++ b/src/gallium/state_trackers/dri/common/dri_st_api.h @@ -14,12 +14,13 @@ * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. * * Authors: * Chia-I Wu <olv@lunarg.com> @@ -33,6 +34,15 @@ struct dri_screen; struct dri_drawable; +struct __DRIimageRec { + struct pipe_resource *texture; + unsigned face; + unsigned level; + unsigned zslice; + + void *loader_private; +}; + struct st_api * dri_get_st_api(void); diff --git a/src/gallium/state_trackers/dri/drm/SConscript b/src/gallium/state_trackers/dri/drm/SConscript index b9726ee311..1dfaa402f2 100644 --- a/src/gallium/state_trackers/dri/drm/SConscript +++ b/src/gallium/state_trackers/dri/drm/SConscript @@ -7,6 +7,8 @@ if env['dri']: env = env.Clone() + env.ParseConfig('pkg-config --cflags --libs libdrm') + env.Append(CPPPATH = [ '#/src/mesa', '#/src/gallium/state_trackers/dri/common', diff --git a/src/gallium/state_trackers/dri/drm/dri1.c b/src/gallium/state_trackers/dri/drm/dri1.c index cca7cd8f0c..3cac1557ca 100644 --- a/src/gallium/state_trackers/dri/drm/dri1.c +++ b/src/gallium/state_trackers/dri/drm/dri1.c @@ -172,7 +172,7 @@ dri1_swap_copy(struct pipe_context *pipe, static void dri1_present_texture_locked(__DRIdrawable * dPriv, - struct pipe_texture *ptex, + struct pipe_resource *ptex, const struct drm_clip_rect *sub_box, struct pipe_fence_handle **fence) { @@ -216,7 +216,7 @@ dri1_present_texture_locked(__DRIdrawable * dPriv, static void dri1_copy_to_front(struct dri_context *ctx, - struct pipe_texture *ptex, + struct pipe_resource *ptex, __DRIdrawable * dPriv, const struct drm_clip_rect *sub_box, struct pipe_fence_handle **fence) @@ -254,7 +254,7 @@ dri1_flush_frontbuffer(struct dri_drawable *draw, struct dri_screen *screen = dri_screen(draw->sPriv); struct pipe_screen *pipe_screen = screen->pipe_screen; struct pipe_fence_handle *dummy_fence; - struct pipe_texture *ptex; + struct pipe_resource *ptex; if (!ctx) return; /* For now */ @@ -278,7 +278,7 @@ dri1_swap_buffers(__DRIdrawable * dPriv) struct dri_screen *screen = dri_screen(draw->sPriv); struct pipe_screen *pipe_screen = screen->pipe_screen; struct pipe_fence_handle *fence; - struct pipe_texture *ptex; + struct pipe_resource *ptex; assert(__dri1_api_hooks != NULL); @@ -308,7 +308,7 @@ dri1_copy_sub_buffer(__DRIdrawable * dPriv, int x, int y, int w, int h) struct drm_clip_rect sub_bbox; struct dri_drawable *draw = dri_drawable(dPriv); struct pipe_fence_handle *dummy_fence; - struct pipe_texture *ptex; + struct pipe_resource *ptex; assert(__dri1_api_hooks != NULL); @@ -340,7 +340,7 @@ dri1_allocate_textures(struct dri_drawable *drawable, unsigned mask) { struct dri_screen *screen = dri_screen(drawable->sPriv); - struct pipe_texture templ; + struct pipe_resource templ; unsigned width, height; boolean resized; int i; @@ -354,7 +354,7 @@ dri1_allocate_textures(struct dri_drawable *drawable, /* remove outdated textures */ if (resized) { for (i = 0; i < ST_ATTACHMENT_COUNT; i++) - pipe_texture_reference(&drawable->textures[i], NULL); + pipe_resource_reference(&drawable->textures[i], NULL); } memset(&templ, 0, sizeof(templ)); @@ -379,12 +379,12 @@ dri1_allocate_textures(struct dri_drawable *drawable, case ST_ATTACHMENT_FRONT_RIGHT: case ST_ATTACHMENT_BACK_RIGHT: format = drawable->stvis.color_format; - tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET | - PIPE_TEXTURE_USAGE_RENDER_TARGET; + tex_usage = PIPE_BIND_DISPLAY_TARGET | + PIPE_BIND_RENDER_TARGET; break; case ST_ATTACHMENT_DEPTH_STENCIL: format = drawable->stvis.depth_stencil_format; - tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; + tex_usage = PIPE_BIND_DEPTH_STENCIL; break; default: format = PIPE_FORMAT_NONE; @@ -393,10 +393,10 @@ dri1_allocate_textures(struct dri_drawable *drawable, if (format != PIPE_FORMAT_NONE) { templ.format = format; - templ.tex_usage = tex_usage; + templ.bind = tex_usage; drawable->textures[i] = - screen->pipe_screen->texture_create(screen->pipe_screen, &templ); + screen->pipe_screen->resource_create(screen->pipe_screen, &templ); } } diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c index c632f0fe4f..c6655847e9 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.c +++ b/src/gallium/state_trackers/dri/drm/dri2.c @@ -77,16 +77,32 @@ dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target, { struct dri_context *ctx = dri_context(pDRICtx); struct dri_drawable *drawable = dri_drawable(dPriv); - struct pipe_texture *pt; + struct pipe_resource *pt; dri_st_framebuffer_validate_att(drawable->stfb, ST_ATTACHMENT_FRONT_LEFT); pt = drawable->textures[ST_ATTACHMENT_FRONT_LEFT]; if (pt) { + enum pipe_format internal_format = pt->format; + + if (format == __DRI_TEXTURE_FORMAT_RGB) { + /* only need to cover the formats recognized by dri_fill_st_visual */ + switch (internal_format) { + case PIPE_FORMAT_B8G8R8A8_UNORM: + internal_format = PIPE_FORMAT_B8G8R8X8_UNORM; + break; + case PIPE_FORMAT_A8R8G8B8_UNORM: + internal_format = PIPE_FORMAT_X8R8G8B8_UNORM; + break; + default: + break; + } + } + ctx->st->teximage(ctx->st, (target == GL_TEXTURE_2D) ? ST_TEXTURE_2D : ST_TEXTURE_RECT, - 0, drawable->stvis.color_format, pt, FALSE); + 0, internal_format, pt, FALSE); } } @@ -130,6 +146,7 @@ dri2_drawable_get_format(struct dri_drawable *drawable, return format; } + /** * Retrieve __DRIbuffer from the DRI loader. */ @@ -235,7 +252,7 @@ dri2_drawable_get_buffers(struct dri_drawable *drawable, } /** - * Process __DRIbuffer and convert them into pipe_textures. + * Process __DRIbuffer and convert them into pipe_resources. */ static void dri2_drawable_process_buffers(struct dri_drawable *drawable, @@ -243,7 +260,7 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable, { struct dri_screen *screen = dri_screen(drawable->sPriv); __DRIdrawable *dri_drawable = drawable->dPriv; - struct pipe_texture templ; + struct pipe_resource templ; struct winsys_handle whandle; boolean have_depth = FALSE; unsigned i; @@ -255,10 +272,10 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable, return; for (i = 0; i < ST_ATTACHMENT_COUNT; i++) - pipe_texture_reference(&drawable->textures[i], NULL); + pipe_resource_reference(&drawable->textures[i], NULL); memset(&templ, 0, sizeof(templ)); - templ.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET; + templ.bind = PIPE_BIND_RENDER_TARGET; templ.target = PIPE_TEXTURE_2D; templ.last_level = 0; templ.width0 = dri_drawable->w; @@ -311,7 +328,7 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable, whandle.stride = buf->pitch; drawable->textures[statt] = - screen->pipe_screen->texture_from_handle(screen->pipe_screen, + screen->pipe_screen->resource_from_handle(screen->pipe_screen, &templ, &whandle); } @@ -352,6 +369,110 @@ dri2_flush_frontbuffer(struct dri_drawable *drawable, } } +__DRIimage * +dri2_lookup_egl_image(struct dri_context *ctx, void *handle) +{ + __DRIimageLookupExtension *loader = ctx->sPriv->dri2.image; + __DRIimage *img; + + if (!loader->lookupEGLImage) + return NULL; + + img = loader->lookupEGLImage(ctx->cPriv, handle, ctx->cPriv->loaderPrivate); + + return img; +} + +static __DRIimage * +dri2_create_image_from_name(__DRIcontext *context, + int width, int height, int format, + int name, int pitch, void *loaderPrivate) +{ + struct dri_screen *screen = dri_screen(context->driScreenPriv); + __DRIimage *img; + struct pipe_resource templ; + struct winsys_handle whandle; + unsigned tex_usage; + enum pipe_format pf; + + tex_usage = PIPE_BIND_RENDER_TARGET | PIPE_BIND_SAMPLER_VIEW; + + switch (format) { + case __DRI_IMAGE_FORMAT_RGB565: + pf = PIPE_FORMAT_B5G6R5_UNORM; + break; + case __DRI_IMAGE_FORMAT_XRGB8888: + pf = PIPE_FORMAT_B8G8R8X8_UNORM; + break; + case __DRI_IMAGE_FORMAT_ARGB8888: + pf = PIPE_FORMAT_B8G8R8A8_UNORM; + break; + default: + pf = PIPE_FORMAT_NONE; + break; + } + if (pf == PIPE_FORMAT_NONE) + return NULL; + + img = CALLOC_STRUCT(__DRIimageRec); + if (!img) + return NULL; + + memset(&templ, 0, sizeof(templ)); + templ.bind = tex_usage; + templ.format = pf; + templ.target = PIPE_TEXTURE_2D; + templ.last_level = 0; + templ.width0 = width; + templ.height0 = height; + templ.depth0 = 1; + + memset(&whandle, 0, sizeof(whandle)); + whandle.handle = name; + whandle.stride = pitch * util_format_get_blocksize(pf); + + img->texture = screen->pipe_screen->resource_from_handle(screen->pipe_screen, + &templ, &whandle); + if (!img->texture) { + FREE(img); + return NULL; + } + + img->face = 0; + img->level = 0; + img->zslice = 0; + img->loader_private = loaderPrivate; + + return img; +} + +static __DRIimage * +dri2_create_image_from_renderbuffer(__DRIcontext *context, + int renderbuffer, void *loaderPrivate) +{ + struct dri_context *ctx = dri_context(context->driverPrivate); + + if (!ctx->st->get_resource_for_egl_image) + return NULL; + + /* TODO */ + return NULL; +} + +static void +dri2_destroy_image(__DRIimage *img) +{ + pipe_resource_reference(&img->texture, NULL); + FREE(img); +} + +static struct __DRIimageExtensionRec dri2ImageExtension = { + { __DRI_IMAGE, __DRI_IMAGE_VERSION }, + dri2_create_image_from_name, + dri2_create_image_from_renderbuffer, + dri2_destroy_image, +}; + /* * Backend function init_screen. */ @@ -364,6 +485,7 @@ static const __DRIextension *dri_screen_extensions[] = { &driMediaStreamCounterExtension.base, &dri2TexBufferExtension.base, &dri2FlushExtension.base, + &dri2ImageExtension.base, NULL }; diff --git a/src/gallium/state_trackers/dri/drm/dri2.h b/src/gallium/state_trackers/dri/drm/dri2.h index 379963431f..5b28850000 100644 --- a/src/gallium/state_trackers/dri/drm/dri2.h +++ b/src/gallium/state_trackers/dri/drm/dri2.h @@ -43,4 +43,7 @@ dri2_allocate_textures(struct dri_drawable *drawable, const enum st_attachment_type *statts, unsigned count); +__DRIimage * +dri2_lookup_egl_image(struct dri_context *ctx, void *handle); + #endif /* DRI2_H */ diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c index 42fa789aaf..9106f0d5eb 100644 --- a/src/gallium/state_trackers/dri/sw/drisw.c +++ b/src/gallium/state_trackers/dri/sw/drisw.c @@ -89,7 +89,7 @@ drisw_put_image(struct dri_drawable *drawable, static INLINE void drisw_present_texture(__DRIdrawable *dPriv, - struct pipe_texture *ptex) + struct pipe_resource *ptex) { struct dri_drawable *drawable = dri_drawable(dPriv); struct dri_screen *screen = dri_screen(drawable->sPriv); @@ -117,7 +117,7 @@ drisw_invalidate_drawable(__DRIdrawable *dPriv) static INLINE void drisw_copy_to_front(__DRIdrawable * dPriv, - struct pipe_texture *ptex) + struct pipe_resource *ptex) { drisw_present_texture(dPriv, ptex); @@ -133,7 +133,7 @@ drisw_swap_buffers(__DRIdrawable *dPriv) { struct dri_context *ctx = dri_get_current(); struct dri_drawable *drawable = dri_drawable(dPriv); - struct pipe_texture *ptex; + struct pipe_resource *ptex; if (!ctx) return; @@ -152,7 +152,7 @@ drisw_flush_frontbuffer(struct dri_drawable *drawable, enum st_attachment_type statt) { struct dri_context *ctx = dri_get_current(); - struct pipe_texture *ptex; + struct pipe_resource *ptex; if (!ctx) return; @@ -180,7 +180,7 @@ drisw_allocate_textures(struct dri_drawable *drawable, unsigned mask) { struct dri_screen *screen = dri_screen(drawable->sPriv); - struct pipe_texture templ; + struct pipe_resource templ; unsigned width, height; boolean resized; int i; @@ -194,7 +194,7 @@ drisw_allocate_textures(struct dri_drawable *drawable, /* remove outdated textures */ if (resized) { for (i = 0; i < ST_ATTACHMENT_COUNT; i++) - pipe_texture_reference(&drawable->textures[i], NULL); + pipe_resource_reference(&drawable->textures[i], NULL); } memset(&templ, 0, sizeof(templ)); @@ -219,12 +219,12 @@ drisw_allocate_textures(struct dri_drawable *drawable, case ST_ATTACHMENT_FRONT_RIGHT: case ST_ATTACHMENT_BACK_RIGHT: format = drawable->stvis.color_format; - tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET | - PIPE_TEXTURE_USAGE_RENDER_TARGET; + tex_usage = PIPE_BIND_DISPLAY_TARGET | + PIPE_BIND_RENDER_TARGET; break; case ST_ATTACHMENT_DEPTH_STENCIL: format = drawable->stvis.depth_stencil_format; - tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; + tex_usage = PIPE_BIND_DEPTH_STENCIL; break; default: format = PIPE_FORMAT_NONE; @@ -233,10 +233,10 @@ drisw_allocate_textures(struct dri_drawable *drawable, if (format != PIPE_FORMAT_NONE) { templ.format = format; - templ.tex_usage = tex_usage; + templ.bind = tex_usage; drawable->textures[i] = - screen->pipe_screen->texture_create(screen->pipe_screen, &templ); + screen->pipe_screen->resource_create(screen->pipe_screen, &templ); } } |