diff options
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/dri/dri2.c | 14 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_drawable.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/dri_screen.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/drisw.c | 55 |
4 files changed, 62 insertions, 11 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index 9ec069b..9b51936 100644 --- a/src/gallium/state_trackers/dri/dri2.c +++ b/src/gallium/state_trackers/dri/dri2.c @@ -765,7 +765,7 @@ dri2_update_tex_buffer(struct dri_drawable *drawable, /* no-op */ } -static __DRIimage * +__DRIimage * dri2_lookup_egl_image(struct dri_screen *screen, void *handle) { const __DRIimageLookupExtension *loader = screen->sPriv->dri2.image; @@ -780,7 +780,7 @@ dri2_lookup_egl_image(struct dri_screen *screen, void *handle) return img; } -static __DRIimage * +__DRIimage * dri2_create_image_from_winsys(__DRIscreen *_screen, int width, int height, int format, int num_handles, struct winsys_handle *whandle, @@ -1173,7 +1173,7 @@ dri2_from_planar(__DRIimage *image, int plane, void *loaderPrivate) return img; } -static __DRIimage * +__DRIimage * dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture, int depth, int level, unsigned *error, void *loaderPrivate) @@ -1374,7 +1374,7 @@ dri2_unmap_image(__DRIcontext *context, __DRIimage *image, void *data) pipe_transfer_unmap(pipe, (struct pipe_transfer *)data); } -static void +void dri2_destroy_image(__DRIimage *img) { pipe_resource_reference(&img->texture, NULL); @@ -1551,7 +1551,7 @@ dri2_server_wait_sync(__DRIcontext *_ctx, void *_fence, unsigned flags) /* AFAIK, no driver currently supports parallel context execution. */ } -static __DRI2fenceExtension dri2FenceExtension = { +__DRI2fenceExtension dri2FenceExtension = { .base = { __DRI2_FENCE, 1 }, .create_fence = dri2_create_fence, @@ -1881,9 +1881,7 @@ dri2_init_screen(__DRIscreen * sPriv) if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0) goto free_screen; - if (pipe_loader_drm_probe_fd(&screen->dev, fd)) - pscreen = pipe_loader_create_screen(screen->dev); - + pscreen = load_pipe_screen(&screen->dev, screen->fd); if (!pscreen) goto release_pipe; diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index edcd0e6..474c331 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -176,8 +176,6 @@ dri_destroy_buffer(__DRIdrawable * dPriv) pipe_resource_reference(&drawable->msaa_textures[i], NULL); swap_fences_unref(drawable); - - FREE(drawable); } /** diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index aa0ad09..a950f52 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -143,7 +143,7 @@ dri_fill_in_modes(struct dri_screen *screen) stencil_bits_array[0] = 0; depth_buffer_factor = 1; } - + msaa_samples_max = (screen->st_api->feature_mask & ST_API_FEATURE_MS_VISUALS_MASK) ? MSAA_VISUAL_MAX_SAMPLES : 1; diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c index b85a73c..3761dad 100644 --- a/src/gallium/state_trackers/dri/drisw.c +++ b/src/gallium/state_trackers/dri/drisw.c @@ -361,14 +361,66 @@ drisw_update_tex_buffer(struct dri_drawable *drawable, pipe_transfer_unmap(pipe, transfer); } +extern __DRIimage * +dri2_create_from_texture(__DRIcontext *context, int target, unsigned texture, + int depth, int level, unsigned *error, + void *loaderPrivate); + +extern __DRIimage *dri2_lookup_egl_image(struct dri_screen *screen, void *handle); + +extern __DRIimage *dri2_create_image_from_winsys(__DRIscreen *_screen, + int width, int height, int format, + int num_handles, struct winsys_handle *whandle, + void *loaderPrivate); + +extern void dri2_destroy_image(__DRIimage *img); + +extern __DRI2fenceExtension dri2FenceExtension; + +static GLboolean +drisw_query_image(__DRIimage *image, int attrib, int *value) +{ + switch (attrib) { + case __DRI_IMAGE_ATTRIB_FORMAT: + *value = image->dri_format; + return GL_TRUE; + case __DRI_IMAGE_ATTRIB_WIDTH: + *value = image->texture->width0; + return GL_TRUE; + case __DRI_IMAGE_ATTRIB_HEIGHT: + *value = image->texture->height0; + return GL_TRUE; + case __DRI_IMAGE_ATTRIB_COMPONENTS: + if (image->dri_components == 0) + return GL_FALSE; + *value = image->dri_components; + return GL_TRUE; + case __DRI_IMAGE_ATTRIB_NUM_PLANES: + *value = 1; + return GL_TRUE; + default: + return GL_FALSE; + } +} + /* * Backend function for init_screen. */ +static const __DRIimageExtension driswImageExtension = { + .base = { __DRI_IMAGE, 11 }, + + .createImageFromTexture = dri2_create_from_texture, + .destroyImage = dri2_destroy_image, + .queryImage = drisw_query_image, +}; + static const __DRIextension *drisw_screen_extensions[] = { &driTexBufferExtension.base, &dri2RendererQueryExtension.base, &dri2ConfigQueryExtension.base, + &driswImageExtension.base, + &dri2FenceExtension.base, NULL }; @@ -407,6 +459,9 @@ drisw_init_screen(__DRIscreen * sPriv) if (!configs) goto fail; + screen->lookup_egl_image = dri2_lookup_egl_image; + driSWRastExtension.createImageFromWinsys = dri2_create_image_from_winsys; + return configs; fail: dri_destroy_screen_helper(screen); |