summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Balling Sørensen <tball@tball-laptop.(none)>2010-10-26 13:01:40 +0200
committerThomas Balling Sørensen <tball@tball-laptop.(none)>2010-10-26 13:01:40 +0200
commit4926c5748028d33da4808f8a5473aa7b2f2bdc62 (patch)
treecc899247d6a3435ce56535cffd6a4a4190eb98d8 /src
parentdbf3a15313eed930a3d8fdde12e457259c43651b (diff)
parent97a7cf230a70c64fff300931ae7c00aa00449c97 (diff)
Merge branch 'pipe-video' of git://anongit.freedesktop.org/~deathsimple/xvmc-r600 into pipe-video
Conflicts: configure.ac src/gallium/auxiliary/vl/vl_compositor.c src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c src/gallium/drivers/softpipe/sp_video_context.c src/gallium/include/pipe/p_defines.h src/gallium/include/pipe/p_screen.h
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/vl/vl_compositor.c5
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c16
-rw-r--r--src/gallium/drivers/r600/Makefile1
-rw-r--r--src/gallium/drivers/r600/r600_pipe.c2
-rw-r--r--src/gallium/drivers/r600/r600_video_context.c22
-rw-r--r--src/gallium/drivers/r600/r600_video_context.h11
-rw-r--r--src/gallium/drivers/softpipe/sp_video_context.c38
-rw-r--r--src/gallium/include/pipe/p_defines.h9
-rw-r--r--src/gallium/include/pipe/p_screen.h8
-rw-r--r--src/gallium/targets/Makefile.xvmc1
-rw-r--r--src/gallium/targets/xvmc-r600/Makefile23
-rw-r--r--src/gallium/targets/xvmc-r600/target.c24
-rw-r--r--src/gallium/winsys/g3dvl/dri/dri_winsys.c18
13 files changed, 156 insertions, 22 deletions
diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
index 1dbf14ee7b9..c4be9c05a3e 100644
--- a/src/gallium/auxiliary/vl/vl_compositor.c
+++ b/src/gallium/auxiliary/vl/vl_compositor.c
@@ -26,6 +26,7 @@
**************************************************************************/
#include "vl_compositor.h"
+#include "util/u_draw.h"
#include <assert.h>
#include <pipe/p_context.h>
#include <util/u_inlines.h>
@@ -177,6 +178,7 @@ init_pipe_state(struct vl_compositor *c)
c->fb_state.nr_cbufs = 1;
c->fb_state.zsbuf = NULL;
+ memset(&sampler, 0, sizeof(sampler));
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
@@ -556,9 +558,8 @@ static void draw_layers(struct vl_compositor *c,
c->pipe->bind_fs_state(c->pipe, frag_shaders[i]);
c->pipe->set_fragment_sampler_views(c->pipe, 1, &surface_view);
-
- util_draw_arrays(c->pipe,PIPE_PRIM_TRIANGLES,i * 6,6);
+ util_draw_arrays(c->pipe, PIPE_PRIM_TRIANGLES, i * 6, 6);
if (delete_view) {
pipe_sampler_view_reference(&surface_view, NULL);
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
index 264ab3d4566..75e09deabc4 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c
@@ -26,6 +26,7 @@
**************************************************************************/
#include "vl_mpeg12_mc_renderer.h"
+#include "util/u_draw.h"
#include <assert.h>
#include <pipe/p_context.h>
#include <util/u_inlines.h>
@@ -278,6 +279,7 @@ create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r)
for (i = 0; i < 4; ++i)
vtex[i] = ureg_DECL_vs_input(shader, i + 1);
/* Skip input 5 */
+ ureg_DECL_vs_input(shader, 5);
vtex[4] = ureg_DECL_vs_input(shader, 6);
o_vpos = ureg_DECL_output(shader, TGSI_SEMANTIC_POSITION, 0);
for (i = 0; i < 5; ++i)
@@ -458,6 +460,7 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r)
filters[4] = PIPE_TEX_FILTER_LINEAR;
for (i = 0; i < 5; ++i) {
+ memset(&sampler, 0, sizeof(sampler));
sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
@@ -604,6 +607,8 @@ init_buffers(struct vl_mpeg12_mc_renderer *r)
);
}
+ memset(&vertex_elems, 0, sizeof(vertex_elems));
+
/* Position element */
vertex_elems[0].src_offset = 0;
vertex_elems[0].instance_divisor = 0;
@@ -1077,8 +1082,8 @@ flush(struct vl_mpeg12_mc_renderer *r)
r->pipe->bind_vs_state(r->pipe, r->i_vs);
r->pipe->bind_fs_state(r->pipe, r->i_fs);
- util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_INTRA] * 24);
-
+ util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_INTRA] * 24);
+
vb_start += num_macroblocks[MACROBLOCK_TYPE_INTRA] * 24;
}
@@ -1092,7 +1097,8 @@ flush(struct vl_mpeg12_mc_renderer *r)
r->pipe->bind_vs_state(r->pipe, r->p_vs[0]);
r->pipe->bind_fs_state(r->pipe, r->p_fs[0]);
- util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 24);
+ util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 24);
+
vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 24;
}
@@ -1107,7 +1113,8 @@ flush(struct vl_mpeg12_mc_renderer *r)
r->pipe->bind_vs_state(r->pipe, r->p_vs[1]);
r->pipe->bind_fs_state(r->pipe, r->p_fs[1]);
- util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 24);
+ util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 24);
+
vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 24;
}
@@ -1154,6 +1161,7 @@ flush(struct vl_mpeg12_mc_renderer *r)
r->pipe->bind_vs_state(r->pipe, r->b_vs[0]);
r->pipe->bind_fs_state(r->pipe, r->b_fs[0]);
+
util_draw_arrays(r->pipe,PIPE_PRIM_TRIANGLES,vb_start,num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] * 24);
vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] * 24;
diff --git a/src/gallium/drivers/r600/Makefile b/src/gallium/drivers/r600/Makefile
index a484f38e9f1..436de9c4dbd 100644
--- a/src/gallium/drivers/r600/Makefile
+++ b/src/gallium/drivers/r600/Makefile
@@ -17,6 +17,7 @@ C_SOURCES = \
r600_shader.c \
r600_state.c \
r600_texture.c \
+ r600_video_context.c \
r700_asm.c \
evergreen_state.c \
eg_asm.c \
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index bea7ef5df84..e1a5b2b49f8 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -43,6 +43,7 @@
#include "r600_shader.h"
#include "r600_pipe.h"
#include "r600_state_inlines.h"
+#include "r600_video_context.h"
/*
* pipe_context
@@ -449,6 +450,7 @@ struct pipe_screen *r600_screen_create(struct radeon *radeon)
rscreen->screen.get_paramf = r600_get_paramf;
rscreen->screen.is_format_supported = r600_is_format_supported;
rscreen->screen.context_create = r600_create_context;
+ rscreen->screen.video_context_create = r600_video_create;
r600_init_screen_texture_functions(&rscreen->screen);
r600_init_screen_resource_functions(&rscreen->screen);
diff --git a/src/gallium/drivers/r600/r600_video_context.c b/src/gallium/drivers/r600/r600_video_context.c
new file mode 100644
index 00000000000..2bbf622052b
--- /dev/null
+++ b/src/gallium/drivers/r600/r600_video_context.c
@@ -0,0 +1,22 @@
+#include "r600_video_context.h"
+#include <softpipe/sp_video_context.h>
+
+struct pipe_video_context *
+r600_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,
+ PIPE_FORMAT_VUYX);
+}
diff --git a/src/gallium/drivers/r600/r600_video_context.h b/src/gallium/drivers/r600/r600_video_context.h
new file mode 100644
index 00000000000..bda33a00d44
--- /dev/null
+++ b/src/gallium/drivers/r600/r600_video_context.h
@@ -0,0 +1,11 @@
+#ifndef __R600_VIDEO_CONTEXT_H__
+#define __R600_VIDEO_CONTEXT_H__
+
+#include <pipe/p_video_context.h>
+
+struct pipe_video_context *
+r600_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 a8c1b14428f..f39c46e596c 100644
--- a/src/gallium/drivers/softpipe/sp_video_context.c
+++ b/src/gallium/drivers/softpipe/sp_video_context.c
@@ -98,8 +98,13 @@ sp_mpeg12_is_format_supported(struct pipe_video_context *vpipe,
if (geom & PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO)
return FALSE;
+<<<<<<< HEAD
return ctx->pipe->screen->is_format_supported(ctx->pipe->screen, format, PIPE_TEXTURE_2D, 1,
usage, geom);
+=======
+ return ctx->pipe->screen->is_format_supported(ctx->pipe->screen, format, PIPE_TEXTURE_2D,
+ 0, usage, geom);
+>>>>>>> 97a7cf230a70c64fff300931ae7c00aa00449c97
}
static void
@@ -133,6 +138,7 @@ sp_mpeg12_clear_render_target(struct pipe_video_context *vpipe,
unsigned width, unsigned height)
{
struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe;
+ float rgba[4] = { 0, 0, 0, 0 };
assert(vpipe);
assert(dst);
@@ -158,10 +164,27 @@ sp_mpeg12_resource_copy_region(struct pipe_video_context *vpipe,
assert(vpipe);
assert(dst);
+<<<<<<< HEAD
if (ctx->pipe->resource_copy_region)
ctx->pipe->resource_copy_region(ctx->pipe, dst, subdst, dstx, dsty, dstz, src, subsrc, srcx, srcy, srcz, width, height);
else
util_resource_copy_region(ctx->pipe, dst, subdst, dstx, dsty, dstz, src, subsrc, srcx, srcy, srcz, width, height);
+=======
+ struct pipe_subresource subdst, subsrc;
+ subdst.face = dst->face;
+ subdst.level = dst->level;
+ subsrc.face = src->face;
+ subsrc.level = src->level;
+
+ if (ctx->pipe->resource_copy_region)
+ ctx->pipe->resource_copy_region(ctx->pipe, dst->texture, subdst, dstx, dsty, dst->zslice,
+ src->texture, subsrc, srcx, srcy, src->zslice,
+ width, height);
+ else
+ util_resource_copy_region(ctx->pipe, dst->texture, subdst, dstx, dsty, dst->zslice,
+ src->texture, subsrc, srcx, srcy, src->zslice,
+ width, height);
+>>>>>>> 97a7cf230a70c64fff300931ae7c00aa00449c97
}
static struct pipe_transfer*
@@ -339,12 +362,22 @@ init_pipe_state(struct sp_mpeg12_context *ctx)
assert(ctx);
+ memset(&rast, 0, sizeof rast);
rast.flatshade = 1;
rast.flatshade_first = 0;
rast.light_twoside = 0;
+<<<<<<< HEAD
rast.cull_face = PIPE_FACE_FRONT;
rast.fill_front = PIPE_POLYGON_MODE_FILL;
rast.fill_back = PIPE_POLYGON_MODE_FILL;
+=======
+ rast.front_ccw = 1;
+ rast.cull_face = PIPE_FACE_NONE;
+ rast.fill_back = PIPE_POLYGON_MODE_FILL;
+ rast.fill_front = PIPE_POLYGON_MODE_FILL;
+ rast.offset_point = 0;
+ rast.offset_line = 0;
+>>>>>>> 97a7cf230a70c64fff300931ae7c00aa00449c97
rast.scissor = 0;
rast.poly_smooth = 0;
rast.poly_stipple_enable = 0;
@@ -367,7 +400,11 @@ init_pipe_state(struct sp_mpeg12_context *ctx)
ctx->rast = ctx->pipe->create_rasterizer_state(ctx->pipe, &rast);
ctx->pipe->bind_rasterizer_state(ctx->pipe, ctx->rast);
+<<<<<<< HEAD
+=======
+ memset(&blend, 0, sizeof blend);
+>>>>>>> 97a7cf230a70c64fff300931ae7c00aa00449c97
blend.independent_blend_enable = 0;
blend.rt[0].blend_enable = 0;
blend.rt[0].rgb_func = PIPE_BLEND_ADD;
@@ -384,6 +421,7 @@ init_pipe_state(struct sp_mpeg12_context *ctx)
ctx->blend = ctx->pipe->create_blend_state(ctx->pipe, &blend);
ctx->pipe->bind_blend_state(ctx->pipe, ctx->blend);
+ memset(&dsa, 0, sizeof dsa);
dsa.depth.enabled = 0;
dsa.depth.writemask = 0;
dsa.depth.func = PIPE_FUNC_ALWAYS;
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index e30b9904fa5..f8eeebf6a71 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -494,7 +494,10 @@ enum pipe_shader_cap
#define PIPE_REFERENCED_FOR_READ (1 << 0)
#define PIPE_REFERENCED_FOR_WRITE (1 << 1)
+<<<<<<< HEAD
+=======
+>>>>>>> 97a7cf230a70c64fff300931ae7c00aa00449c97
enum pipe_video_codec
{
PIPE_VIDEO_CODEC_UNKNOWN = 0,
@@ -520,7 +523,10 @@ enum pipe_video_profile
PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH
};
+<<<<<<< HEAD
+=======
+>>>>>>> 97a7cf230a70c64fff300931ae7c00aa00449c97
/**
* Composite query types
*/
@@ -534,7 +540,10 @@ struct pipe_query_data_timestamp_disjoint
uint64_t frequency;
boolean disjoint;
};
+<<<<<<< HEAD
+=======
+>>>>>>> 97a7cf230a70c64fff300931ae7c00aa00449c97
#ifdef __cplusplus
}
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 75eeaeba1f7..0303c5b2ea9 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -92,13 +92,21 @@ struct pipe_screen {
*/
int (*get_shader_param)( struct pipe_screen *, unsigned shader, enum pipe_shader_cap param );
+<<<<<<< HEAD
struct pipe_context * (*context_create)( struct pipe_screen *, void *priv );
+=======
+ struct pipe_context * (*context_create)( struct pipe_screen *,
+ void *priv );
+>>>>>>> 97a7cf230a70c64fff300931ae7c00aa00449c97
struct pipe_video_context * (*video_context_create)( struct pipe_screen *screen,
enum pipe_video_profile profile,
enum pipe_video_chroma_format chroma_format,
unsigned width, unsigned height, void *priv );
+<<<<<<< HEAD
+=======
+>>>>>>> 97a7cf230a70c64fff300931ae7c00aa00449c97
/**
* Check if the given pipe_format is supported as a texture or
diff --git a/src/gallium/targets/Makefile.xvmc b/src/gallium/targets/Makefile.xvmc
index e48906a1345..08529b38b70 100644
--- a/src/gallium/targets/Makefile.xvmc
+++ b/src/gallium/targets/Makefile.xvmc
@@ -7,6 +7,7 @@ XVMC_MINOR = 0
INCLUDES = -I$(TOP)/src/gallium/include \
-I$(TOP)/src/gallium/drivers \
-I$(TOP)/src/gallium/auxiliary \
+ -I$(TOP)/src/gallium/winsys \
-I$(TOP)/src/gallium/winsys/g3dvl \
$(DRIVER_INCLUDES)
DEFINES = -DGALLIUM_TRACE $(DRIVER_DEFINES)
diff --git a/src/gallium/targets/xvmc-r600/Makefile b/src/gallium/targets/xvmc-r600/Makefile
new file mode 100644
index 00000000000..25aeb65059f
--- /dev/null
+++ b/src/gallium/targets/xvmc-r600/Makefile
@@ -0,0 +1,23 @@
+TOP = ../../../..
+include $(TOP)/configs/current
+
+#LIBNAME =
+
+PIPE_DRIVERS = \
+ $(TOP)/src/gallium/drivers/r600/libr600.a \
+ $(TOP)/src/gallium/winsys/g3dvl/dri/libvldri.a \
+ $(TOP)/src/gallium/winsys/r600/drm/libr600winsys.a \
+ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \
+ $(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/auxiliary/libgallium.a
+
+C_SOURCES = \
+ target.c \
+ $(COMMON_GALLIUM_SOURCES) \
+ $(DRIVER_SOURCES)
+
+DRIVER_LIBS = $(shell pkg-config libdrm_radeon --libs) -lXfixes
+
+include ../Makefile.xvmc
+
+symlinks:
diff --git a/src/gallium/targets/xvmc-r600/target.c b/src/gallium/targets/xvmc-r600/target.c
new file mode 100644
index 00000000000..8753e2bab17
--- /dev/null
+++ b/src/gallium/targets/xvmc-r600/target.c
@@ -0,0 +1,24 @@
+#include "state_tracker/drm_driver.h"
+#include "target-helpers/inline_debug_helper.h"
+#include "r600/drm/r600_drm_public.h"
+#include "r600/r600_public.h"
+
+static struct pipe_screen *create_screen(int fd)
+{
+ struct radeon *radeon;
+ struct pipe_screen *screen;
+
+ radeon = r600_drm_winsys_create(fd);
+ if (!radeon)
+ return NULL;
+
+ screen = r600_screen_create(radeon);
+ if (!screen)
+ return NULL;
+
+ screen = debug_screen_wrap(screen);
+
+ return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("r600", "radeon", create_screen)
diff --git a/src/gallium/winsys/g3dvl/dri/dri_winsys.c b/src/gallium/winsys/g3dvl/dri/dri_winsys.c
index 06631840f78..4d10e27c580 100644
--- a/src/gallium/winsys/g3dvl/dri/dri_winsys.c
+++ b/src/gallium/winsys/g3dvl/dri/dri_winsys.c
@@ -32,13 +32,12 @@
#include <util/u_memory.h>
#include <util/u_hash.h>
#include <util/u_hash_table.h>
-#include <state_tracker/drm_api.h>
+#include <state_tracker/drm_driver.h>
#include <X11/Xlibint.h>
struct vl_dri_screen
{
struct vl_screen base;
- struct drm_api *api;
dri_screen_t *dri_screen;
struct util_hash_table *drawable_table;
Drawable last_seen_drawable;
@@ -176,7 +175,6 @@ struct vl_screen*
vl_screen_create(Display *display, int screen)
{
struct vl_dri_screen *vl_dri_scrn;
- struct drm_create_screen_arg arg;
assert(display);
@@ -187,15 +185,7 @@ vl_screen_create(Display *display, int screen)
if (dri2CreateScreen(display, screen, &vl_dri_scrn->dri_screen))
goto no_dri2screen;
- vl_dri_scrn->api = drm_api_create();
- if (!vl_dri_scrn->api)
- goto no_drmapi;
-
- arg.mode = DRM_CREATE_NORMAL;
-
- vl_dri_scrn->base.pscreen = vl_dri_scrn->api->create_screen(vl_dri_scrn->api,
- vl_dri_scrn->dri_screen->fd,
- &arg);
+ vl_dri_scrn->base.pscreen = driver_descriptor.create_screen(vl_dri_scrn->dri_screen->fd);
if (!vl_dri_scrn->base.pscreen)
goto no_pscreen;
@@ -212,8 +202,6 @@ vl_screen_create(Display *display, int screen)
no_hash:
vl_dri_scrn->base.pscreen->destroy(vl_dri_scrn->base.pscreen);
no_pscreen:
- vl_dri_scrn->api->destroy(vl_dri_scrn->api);
-no_drmapi:
dri2DestroyScreen(vl_dri_scrn->dri_screen);
no_dri2screen:
FREE(vl_dri_scrn);
@@ -230,8 +218,6 @@ void vl_screen_destroy(struct vl_screen *vscreen)
util_hash_table_foreach(vl_dri_scrn->drawable_table, drawable_destroy, vl_dri_scrn);
util_hash_table_destroy(vl_dri_scrn->drawable_table);
vl_dri_scrn->base.pscreen->destroy(vl_dri_scrn->base.pscreen);
- if (vl_dri_scrn->api->destroy)
- vl_dri_scrn->api->destroy(vl_dri_scrn->api);
dri2DestroyScreen(vl_dri_scrn->dri_screen);
FREE(vl_dri_scrn);
}