summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c2
-rw-r--r--src/gallium/drivers/nvfx/Makefile7
-rw-r--r--src/gallium/drivers/nvfx/nvfx_screen.c2
-rw-r--r--src/gallium/drivers/nvfx/nvfx_video_context.c48
-rw-r--r--src/gallium/drivers/nvfx/nvfx_video_context.h38
-rw-r--r--src/gallium/drivers/softpipe/sp_video_context.c3
-rw-r--r--src/gallium/targets/Makefile.xvmc2
-rw-r--r--src/gallium/targets/xvmc-nouveau/Makefile23
-rw-r--r--src/gallium/winsys/g3dvl/dri/dri_winsys.c67
9 files changed, 162 insertions, 30 deletions
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
index bafe4861fa5..fa7028b5d3b 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
@@ -385,7 +385,7 @@ xfer_buffers_map(struct vl_mpeg12_mc_renderer *r)
0, 0, 0,
r->textures.all[i]->width0,
r->textures.all[i]->height0,
- 0
+ 1
};
r->tex_transfer[i] = r->pipe->get_transfer
diff --git a/src/gallium/drivers/nvfx/Makefile b/src/gallium/drivers/nvfx/Makefile
index c1d57ca3969..e7ca6e6cb57 100644
--- a/src/gallium/drivers/nvfx/Makefile
+++ b/src/gallium/drivers/nvfx/Makefile
@@ -19,17 +19,18 @@ C_SOURCES = \
nvfx_screen.c \
nvfx_state.c \
nvfx_state_blend.c \
- nvfx_state_emit.c \
+ nvfx_state_emit.c \
nvfx_state_fb.c \
nvfx_state_rasterizer.c \
nvfx_state_scissor.c \
- nvfx_state_stipple.c \
+ nvfx_state_stipple.c \
nvfx_state_viewport.c \
nvfx_state_zsa.c \
nvfx_surface.c \
nvfx_transfer.c \
nvfx_vbo.c \
- nvfx_vertprog.c
+ nvfx_vertprog.c \
+ nvfx_video_context.c
LIBRARY_INCLUDES = \
-I$(TOP)/src/gallium/drivers/nouveau/include
diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c b/src/gallium/drivers/nvfx/nvfx_screen.c
index 9f03ab1833b..a4d5c61b7aa 100644
--- a/src/gallium/drivers/nvfx/nvfx_screen.c
+++ b/src/gallium/drivers/nvfx/nvfx_screen.c
@@ -5,6 +5,7 @@
#include "nouveau/nouveau_screen.h"
#include "nvfx_context.h"
+#include "nvfx_video_context.h"
#include "nvfx_screen.h"
#include "nvfx_resource.h"
@@ -341,6 +342,7 @@ nvfx_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
pscreen->get_paramf = nvfx_screen_get_paramf;
pscreen->is_format_supported = nvfx_screen_surface_format_supported;
pscreen->context_create = nvfx_create;
+ pscreen->video_context_create = nvfx_video_create;
switch (dev->chipset & 0xf0) {
case 0x30:
diff --git a/src/gallium/drivers/nvfx/nvfx_video_context.c b/src/gallium/drivers/nvfx/nvfx_video_context.c
new file mode 100644
index 00000000000..5b85b29e29b
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_video_context.c
@@ -0,0 +1,48 @@
+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) 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, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
+ *
+ **************************************************************************/
+
+#include "nvfx_video_context.h"
+#include <softpipe/sp_video_context.h>
+
+struct pipe_video_context *
+nvfx_video_create(struct pipe_screen *screen, enum pipe_video_profile profile,
+ enum pipe_video_chroma_format chroma_format,
+ unsigned width, unsigned height, void *priv)
+{
+ struct pipe_context *pipe;
+
+ assert(screen);
+
+ pipe = screen->context_create(screen, priv);
+ if (!pipe)
+ return NULL;
+
+ return sp_video_create_ex(pipe, profile, chroma_format, width, height,
+ VL_MPEG12_MC_RENDERER_BUFFER_PICTURE,
+ VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE,
+ true);
+}
diff --git a/src/gallium/drivers/nvfx/nvfx_video_context.h b/src/gallium/drivers/nvfx/nvfx_video_context.h
new file mode 100644
index 00000000000..6619427cc29
--- /dev/null
+++ b/src/gallium/drivers/nvfx/nvfx_video_context.h
@@ -0,0 +1,38 @@
+/**************************************************************************
+ *
+ * Copyright 2009 Younes Manton.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) 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, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS 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.
+ *
+ **************************************************************************/
+
+#ifndef __NVFX_VIDEO_CONTEXT_H__
+#define __NVFX_VIDEO_CONTEXT_H__
+
+#include <pipe/p_video_context.h>
+
+struct pipe_video_context *
+nvfx_video_create(struct pipe_screen *screen, enum pipe_video_profile profile,
+ enum pipe_video_chroma_format chroma_format,
+ unsigned width, unsigned height, void *priv);
+
+#endif
diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c
index 7024e653e3b..fcee9b66823 100644
--- a/src/gallium/drivers/softpipe/sp_video_context.c
+++ b/src/gallium/drivers/softpipe/sp_video_context.c
@@ -74,7 +74,8 @@ sp_mpeg12_get_param(struct pipe_video_context *vpipe, int param)
#endif
return FALSE;
case PIPE_CAP_DECODE_TARGET_PREFERRED_FORMAT:
- return PIPE_FORMAT_AYUV;
+ //return PIPE_FORMAT_AYUV;
+ return PIPE_FORMAT_VUYA;
default:
{
debug_printf("Softpipe: Unknown PIPE_CAP %d\n", param);
diff --git a/src/gallium/targets/Makefile.xvmc b/src/gallium/targets/Makefile.xvmc
index 53044342317..e48906a1345 100644
--- a/src/gallium/targets/Makefile.xvmc
+++ b/src/gallium/targets/Makefile.xvmc
@@ -30,7 +30,7 @@ OBJECTS = $(C_SOURCES:.c=.o) \
default: depend symlinks $(TOP)/$(LIB_DIR)/gallium/$(LIBNAME)
-$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) $(STATE_TRACKER-LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
+$(TOP)/$(LIB_DIR)/gallium/$(LIBNAME): $(OBJECTS) $(PIPE_DRIVERS) $(STATE_TRACKER_LIB) $(TOP)/$(LIB_DIR)/gallium Makefile
$(MKLIB) -o $(LIBBASENAME) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
-major $(XVMC_MAJOR) -minor $(XVMC_MINOR) $(MKLIB_OPTIONS) \
-install $(TOP)/$(LIB_DIR)/gallium \
diff --git a/src/gallium/targets/xvmc-nouveau/Makefile b/src/gallium/targets/xvmc-nouveau/Makefile
new file mode 100644
index 00000000000..045dbcbf97b
--- /dev/null
+++ b/src/gallium/targets/xvmc-nouveau/Makefile
@@ -0,0 +1,23 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+#LIBNAME =
+
+PIPE_DRIVERS = \
+ $(TOP)/src/gallium/winsys/g3dvl/dri/libvldri.a \
+ $(TOP)/src/gallium/winsys/nouveau/drm/libnouveaudrm.a \
+ $(TOP)/src/gallium/drivers/nvfx/libnvfx.a \
+ $(TOP)/src/gallium/drivers/nv50/libnv50.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/drivers/nouveau/libnouveau.a \
+ $(TOP)/src/gallium/auxiliary/libgallium.a
+
+C_SOURCES = \
+ $(COMMON_GALLIUM_SOURCES) \
+ $(DRIVER_SOURCES)
+
+DRIVER_LIBS = $(shell pkg-config libdrm_nouveau --libs)
+
+include ../Makefile.xvmc
+
+symlinks:
diff --git a/src/gallium/winsys/g3dvl/dri/dri_winsys.c b/src/gallium/winsys/g3dvl/dri/dri_winsys.c
index b86f546dd61..892f93df470 100644
--- a/src/gallium/winsys/g3dvl/dri/dri_winsys.c
+++ b/src/gallium/winsys/g3dvl/dri/dri_winsys.c
@@ -279,7 +279,7 @@ vl_dri2_get_front(struct vl_dri_screen *vl_dri_scrn, Drawable drawable)
unsigned int attachments[1] = {DRI_BUFFER_FRONT_LEFT};
int count;
DRI2Buffer *dri2_front;
- struct pipe_resource template, *front_tex;
+ struct pipe_resource *front_tex;
struct pipe_surface *front_surf = NULL;
assert(vl_dri_scrn);
@@ -293,6 +293,19 @@ vl_dri2_get_front(struct vl_dri_screen *vl_dri_scrn, Drawable drawable)
.handle = dri2_front->name,
.stride = dri2_front->pitch
};
+ struct pipe_resource template;
+
+ memset(&template, 0, sizeof(struct pipe_resource));
+ template.target = PIPE_TEXTURE_2D;
+ template.format = vl_dri_scrn->base.format;
+ template.last_level = 0;
+ template.width0 = w;
+ template.height0 = h;
+ template.depth0 = 1;
+ template.usage = PIPE_USAGE_STATIC;
+ template.bind = PIPE_BIND_RENDER_TARGET;
+ template.flags = 0;
+
front_tex = vl_dri_scrn->base.pscreen->resource_from_handle(vl_dri_scrn->base.pscreen, &template, &dri2_front_handle);
if (front_tex)
front_surf = vl_dri_scrn->base.pscreen->get_tex_surface(vl_dri_scrn->base.pscreen,
@@ -326,33 +339,31 @@ vl_dri2_flush_frontbuffer(struct pipe_screen *screen,
//st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, fence);
}
+/* XXX: Kill with fire */
+struct vl_dri_context *_vl_dri_ctx = NULL;
-Drawable
-vl_video_bind_drawable(struct vl_context *vctx, Drawable drawable)
+void*
+vl_displaytarget_get(struct vl_screen *vscreen, Drawable drawable,
+ unsigned *width, unsigned *height)
{
- struct vl_dri_context *vl_dri_ctx = (struct vl_dri_context*)vctx;
- struct vl_dri_screen *vl_dri_scrn;
- dri_drawable_t *dri_drawable;
- Drawable old_drawable = None;
-
- assert(vctx);
-
- if (vl_dri_ctx->drawable)
- old_drawable = vl_dri_ctx->drawable->x_drawable;
+ struct vl_dri_screen *vl_dri_scrn = (struct vl_dri_screen*)vscreen;
- if (drawable != old_drawable) {
- vl_dri_scrn = (struct vl_dri_screen*)vl_dri_ctx->base.vscreen;
- if (vl_dri_scrn->dri2) {
- /* XXX: Need dri2CreateDrawable()? */
- vl_dri_ctx->dri2_front = vl_dri2_get_front(vl_dri_scrn, drawable);
- }
- else {
- driCreateDrawable(vl_dri_scrn->dri_screen, drawable, &dri_drawable);
- vl_dri_ctx->drawable = dri_drawable;
+ assert(vscreen);
+ assert(width);
+ assert(height);
+
+ if (vl_dri_scrn->dri2 && _vl_dri_ctx) {
+ if (!_vl_dri_ctx->dri2_front) {
+ _vl_dri_ctx->dri2_front = vl_dri2_get_front((struct vl_dri_screen*)vscreen, drawable);
+ if (!_vl_dri_ctx->dri2_front)
+ return NULL;
+ *width = _vl_dri_ctx->dri2_front->width;
+ *height = _vl_dri_ctx->dri2_front->height;
}
+ return _vl_dri_ctx;
}
-
- return old_drawable;
+ else
+ return NULL;
}
struct vl_screen*
@@ -416,8 +427,12 @@ vl_screen_create(Display *display, int screen)
vl_dri_scrn->base.format = vl_dri_scrn->api_hooks->front_srf_locked(vl_dri_scrn->base.pscreen)->format;
vl_dri_scrn->base.pscreen->flush_frontbuffer = vl_dri_flush_frontbuffer;
}
- else
+ else {
+ /* XXX: Fuuuuu... Can't possibly get this right with current code.
+ * Need to rethink this in st/xvmc and winsys dri/xlib winsyses */
+ vl_dri_scrn->base.format = PIPE_FORMAT_B8G8R8X8_UNORM;
vl_dri_scrn->base.pscreen->flush_frontbuffer = vl_dri2_flush_frontbuffer;
+ }
return &vl_dri_scrn->base;
}
@@ -476,6 +491,8 @@ vl_video_create(struct vl_screen *vscreen,
vl_dri_ctx->fd = vl_dri_scrn->dri_screen->fd;
if (!vl_dri_scrn->dri2)
vl_dri_ctx->lock = (drmLock*)&vl_dri_scrn->dri_screen->sarea->lock;
+ else
+ _vl_dri_ctx = vl_dri_ctx;
return &vl_dri_ctx->base;
}
@@ -487,6 +504,8 @@ void vl_video_destroy(struct vl_context *vctx)
assert(vctx);
vl_dri_ctx->base.vpipe->destroy(vl_dri_ctx->base.vpipe);
+ if (vl_dri_ctx->dri2_front)
+ pipe_surface_reference(&vl_dri_ctx->dri2_front, NULL);
if (!((struct vl_dri_screen *)vctx->vscreen)->dri2)
driDestroyContext(vl_dri_ctx->dri_context);
FREE(vl_dri_ctx);