vl: Get nouveau building again.

Still some DRI2 bits to sort out.
This commit is contained in:
Younes Manton 2010-05-29 19:22:14 -04:00
parent 62074f44bb
commit ea3a01ae4d
10 changed files with 181 additions and 32 deletions

View file

@ -1255,6 +1255,13 @@ yes)
# mesa/es is required to build es state tracker
CORE_DIRS="$CORE_DIRS mesa/es"
;;
xorg/xvmc)
# Check for libXvMC?
if test "x$enable_gallium_g3dvl" != xyes; then
AC_MSG_ERROR([cannot build XvMC state tracker without --enable-gallium-g3dvl])
fi
HAVE_ST_XVMC="yes"
;;
esac
done
GALLIUM_STATE_TRACKERS_DIRS="$state_trackers"
@ -1358,7 +1365,7 @@ dnl
dnl Gallium helper functions
dnl
gallium_check_st() {
if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_EGL" = xyes || test "x$HAVE_ST_XORG" = xyes; then
if test "x$HAVE_ST_DRI" = xyes || test "x$HAVE_ST_EGL" = xyes || test "x$HAVE_ST_XORG" = xyes || test "x$HAVE_ST_XVMC" = xyes; then
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS $1"
fi
if test "x$HAVE_ST_DRI" = xyes && test "x$2" != x; then
@ -1370,6 +1377,9 @@ gallium_check_st() {
if test "x$HAVE_ST_XORG" = xyes && test "x$4" != x; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $4"
fi
if test "x$HAVE_ST_XVMC" = xyes && test "x$5" != x; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS $5"
fi
}
@ -1430,7 +1440,7 @@ AC_ARG_ENABLE([gallium-nouveau],
[enable_gallium_nouveau=no])
if test "x$enable_gallium_nouveau" = xyes; then
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nvfx nv50"
gallium_check_st "nouveau/drm" "dri-nouveau" "egl-nouveau" "xorg-nouveau"
gallium_check_st "nouveau/drm" "dri-nouveau" "egl-nouveau" "xorg-nouveau" "xvmc-nouveau"
fi
dnl
@ -1442,7 +1452,14 @@ AC_ARG_ENABLE([gallium-g3dvl],
[enable_gallium_g3dvl="$enableval"],
[enable_gallium_g3dvl=no])
if test "x$enable_gallium_g3dvl" = xyes; then
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS xvmc-softpipe"
case "$mesa_driver" in
xlib)
GALLIUM_TARGET_DIRS="$GALLIUM_TARGET_DIRS xvmc-softpipe"
;;
dri)
GALLIUM_WINSYS_DIRS="$GALLIUM_WINSYS_DIRS g3dvl/dri"
;;
esac
fi
dnl

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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);
}

View file

@ -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

View file

@ -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);

View file

@ -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 \

View file

@ -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:

View file

@ -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;
struct vl_dri_screen *vl_dri_scrn = (struct vl_dri_screen*)vscreen;
assert(vctx);
assert(vscreen);
assert(width);
assert(height);
if (vl_dri_ctx->drawable)
old_drawable = vl_dri_ctx->drawable->x_drawable;
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;
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);