diff options
author | WuZhen <wuzhen@jidemail.com> | 2016-06-18 21:57:23 +0800 |
---|---|---|
committer | Mauro Rossi <issor.oruam@gmail.com> | 2016-11-01 20:41:59 +0100 |
commit | 61025f0b269c8c31ec76dba5f72d98590d001949 (patch) | |
tree | 8fa72e679966ebc183b85be8360cabcdec2871db /src/gallium/state_trackers | |
parent | 74f550427c7fffe637917e2caa79a6bb6c378db4 (diff) | |
download | external_mesa3d-61025f0b269c8c31ec76dba5f72d98590d001949.zip external_mesa3d-61025f0b269c8c31ec76dba5f72d98590d001949.tar.gz external_mesa3d-61025f0b269c8c31ec76dba5f72d98590d001949.tar.bz2 |
android: support swrast
System boots up with gles_mesa/softpipe/llvmpipe.
NO_REF_TASK
Tested: local run
Change-Id: I629ed0ca9fad12e32270eb8e8bfa9f7681b68474
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/dri/dri2.c | 6 | ||||
-rw-r--r-- | src/gallium/state_trackers/dri/drisw.c | 46 |
2 files changed, 49 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c index db8f70e..8c058f7 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, @@ -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); diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c index b85a73c..9b62b96 100644 --- a/src/gallium/state_trackers/dri/drisw.c +++ b/src/gallium/state_trackers/dri/drisw.c @@ -361,14 +361,57 @@ drisw_update_tex_buffer(struct dri_drawable *drawable, pipe_transfer_unmap(pipe, transfer); } +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); + +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 }, + + .destroyImage = dri2_destroy_image, + .queryImage = drisw_query_image, +}; + static const __DRIextension *drisw_screen_extensions[] = { &driTexBufferExtension.base, &dri2RendererQueryExtension.base, &dri2ConfigQueryExtension.base, + &driswImageExtension.base, NULL }; @@ -407,6 +450,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); |