summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorGeorge Sapountzis <[email protected]>2010-08-11 23:26:14 +0300
committerGeorge Sapountzis <[email protected]>2010-08-13 22:58:11 +0300
commitc14b4371ed58859d264b7b2581cfedc9cfd8401f (patch)
treeff36db7a41fe9febe5fe4f27169cf01f3d74f78c /src/gallium/state_trackers
parent5270deaab682c938e360f0d3b52f35b4027db858 (diff)
st/dri: move TFP code to dri_drawable.c
This is based on a patch by nobled <[email protected]> and allows the TFP extension to be enabled for DRISW also. This patch does not enable TFP for DRISW though, because testing on xephyr segfaults here (for both classic and gallium): Program received signal SIGSEGV, Segmentation fault. 0x00786a4a in _mesa_GenTextures (n=1, textures=0xbfffee4c) at main/texobj.c:788 788 ASSERT_OUTSIDE_BEGIN_END(ctx); (gdb) (gdb) where \#0 0x00786a4a in _mesa_GenTextures (n=1, textures=0xbfffee4c) at main/texobj.c:788 \#1 0x0817a004 in __glXDisp_GenTextures () \#2 0x08168498 in __glXDispatch () \#3 0x0808b6ce in Dispatch () \#4 0x08084435 in main () The TFP code is generic except for the teximage call. We need to verify that DRISW correclty implements whatever hook teximage finally calls.
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/dri/common/dri_drawable.c52
-rw-r--r--src/gallium/state_trackers/dri/common/dri_drawable.h2
-rw-r--r--src/gallium/state_trackers/dri/drm/dri2.c53
3 files changed, 55 insertions, 52 deletions
diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c
index c67ca2224d0..fb07b45a2b5 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
@@ -30,6 +30,7 @@
*/
#include "dri_screen.h"
+#include "dri_context.h"
#include "dri_drawable.h"
#include "pipe/p_screen.h"
@@ -185,6 +186,57 @@ dri_drawable_validate_att(struct dri_drawable *drawable,
}
/**
+ * These are used for GLX_EXT_texture_from_pixmap
+ */
+static void
+dri_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
+ GLint format, __DRIdrawable *dPriv)
+{
+ struct dri_context *ctx = dri_context(pDRICtx);
+ struct dri_drawable *drawable = dri_drawable(dPriv);
+ struct pipe_resource *pt;
+
+ dri_drawable_validate_att(drawable, 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, internal_format, pt, FALSE);
+ }
+}
+
+static void
+dri_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
+ __DRIdrawable *dPriv)
+{
+ dri_set_tex_buffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
+}
+
+const __DRItexBufferExtension driTexBufferExtension = {
+ { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
+ dri_set_tex_buffer,
+ dri_set_tex_buffer2,
+};
+
+/**
* Get the format and binding of an attachment.
*/
void
diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.h b/src/gallium/state_trackers/dri/common/dri_drawable.h
index 3f2e24fc158..8d108cc4155 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.h
@@ -93,6 +93,8 @@ void
dri_drawable_validate_att(struct dri_drawable *drawable,
enum st_attachment_type statt);
+extern const __DRItexBufferExtension driTexBufferExtension;
+
#endif
/* vim: set sw=3 ts=8 sts=3 expandtab: */
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 2e1c696c0f7..47005c17e2b 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -67,57 +67,6 @@ static const __DRI2flushExtension dri2FlushExtension = {
};
/**
- * These are used for GLX_EXT_texture_from_pixmap
- */
-static void
-dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target,
- GLint format, __DRIdrawable *dPriv)
-{
- struct dri_context *ctx = dri_context(pDRICtx);
- struct dri_drawable *drawable = dri_drawable(dPriv);
- struct pipe_resource *pt;
-
- dri_drawable_validate_att(drawable, 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, internal_format, pt, FALSE);
- }
-}
-
-static void
-dri2_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
- __DRIdrawable *dPriv)
-{
- dri2_set_tex_buffer2(pDRICtx, target, __DRI_TEXTURE_FORMAT_RGBA, dPriv);
-}
-
-static const __DRItexBufferExtension dri2TexBufferExtension = {
- { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
- dri2_set_tex_buffer,
- dri2_set_tex_buffer2,
-};
-
-/**
* Retrieve __DRIbuffer from the DRI loader.
*/
static __DRIbuffer *
@@ -454,7 +403,7 @@ static const __DRIextension *dri_screen_extensions[] = {
&driCopySubBufferExtension.base,
&driSwapControlExtension.base,
&driMediaStreamCounterExtension.base,
- &dri2TexBufferExtension.base,
+ &driTexBufferExtension.base,
&dri2FlushExtension.base,
&dri2ImageExtension.base,
&dri2ConfigQueryExtension.base,