summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/vdpau
diff options
context:
space:
mode:
authorThomas Balling Sørensen <tball@tball-laptop.(none)>2010-10-07 00:26:46 +0200
committerThomas Balling Sørensen <tball@tball-laptop.(none)>2010-10-07 00:26:46 +0200
commitbff1ac875c2c62ba5045bb953f800253c49361cb (patch)
treee0a23c862fe2e4f9bef96ec30efd5f9f87bd0917 /src/gallium/state_trackers/vdpau
parent65fe0866aec7b5608419f6d184cb1fa4fe1dc45a (diff)
vl: some more fixes and addition to the decoder handling
Diffstat (limited to 'src/gallium/state_trackers/vdpau')
-rw-r--r--src/gallium/state_trackers/vdpau/decode.c27
-rw-r--r--src/gallium/state_trackers/vdpau/device.c10
-rw-r--r--src/gallium/state_trackers/vdpau/mixer.c5
-rw-r--r--src/gallium/state_trackers/vdpau/vdpau_private.h8
4 files changed, 36 insertions, 14 deletions
diff --git a/src/gallium/state_trackers/vdpau/decode.c b/src/gallium/state_trackers/vdpau/decode.c
index f6003304668..1b49b4b2520 100644
--- a/src/gallium/state_trackers/vdpau/decode.c
+++ b/src/gallium/state_trackers/vdpau/decode.c
@@ -74,7 +74,10 @@ vlVdpDecoderCreate ( VdpDevice device,
// TODO: Define max_references. Used mainly for H264
vldecoder->profile = p_profile;
+ vldecoder->height = height;
+ vldecoder->width = width;
vldecoder->device = dev;
+ vldecoder->vctx = NULL;
*decoder = vlAddDataHTAB(vldecoder);
if (*decoder == 0) {
@@ -127,27 +130,27 @@ vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder,
{
struct pipe_resource tmplt;
struct pipe_resource *surf_tex;
- struct pipe_video_context *vpipe;
+ struct pipe_video_context *vctx;
debug_printf("[VDPAU] Creating surface\n");
if(!(vldecoder && vlsurf))
return VDP_STATUS_INVALID_POINTER;
- vpipe = vldecoder->vctx;
+ vctx = vldecoder->vctx;
memset(&tmplt, 0, sizeof(struct pipe_resource));
tmplt.target = PIPE_TEXTURE_2D;
tmplt.format = vlsurf->format;
tmplt.last_level = 0;
- if (vpipe->is_format_supported(vpipe, tmplt.format,
+ if (vctx->is_format_supported(vctx, tmplt.format,
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET,
PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO)) {
tmplt.width0 = vlsurf->width;
tmplt.height0 = vlsurf->height;
}
else {
- assert(vpipe->is_format_supported(vpipe, tmplt.format,
+ assert(vctx->is_format_supported(vctx, tmplt.format,
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET,
PIPE_TEXTURE_GEOM_NON_SQUARE));
tmplt.width0 = util_next_power_of_two(vlsurf->width);
@@ -158,9 +161,9 @@ vlVdpCreateSurfaceTarget (vlVdpDecoder *vldecoder,
tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
tmplt.flags = 0;
- surf_tex = vpipe->screen->resource_create(vpipe->screen, &tmplt);
+ surf_tex = vctx->screen->resource_create(vctx->screen, &tmplt);
- vlsurf->psurface = vpipe->screen->get_tex_surface(vpipe->screen, surf_tex, 0, 0, 0,
+ vlsurf->psurface = vctx->screen->get_tex_surface(vctx->screen, surf_tex, 0, 0, 0,
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET);
pipe_resource_reference(&surf_tex, NULL);
@@ -193,7 +196,6 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder,
debug_printf("[VDPAU] Decoding MPEG2\n");
- vpipe = vldecoder->vctx->vpipe;
t_vdp_surf = vlsurf;
/* if surfaces equals VDP_STATUS_INVALID_HANDLE, they are not used */
@@ -218,6 +220,8 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder,
ret = vlVdpCreateSurfaceTarget(vldecoder,t_vdp_surf);
+ vpipe = vldecoder->vctx->vpipe;
+
if (vlVdpMPEG2BitstreamToMacroblock(vpipe->screen, bitstream_buffers, bitstream_buffer_count,
&num_macroblocks, &pipe_macroblocks))
{
@@ -228,7 +232,7 @@ vlVdpDecoderRenderMpeg2 (vlVdpDecoder *vldecoder,
}
vpipe->set_decode_target(vpipe,t_surf);
- //vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, (struct pipe_macroblock *)pipe_macroblocks, NULL);
+ vpipe->decode_macroblocks(vpipe, p_surf, f_surf, num_macroblocks, (struct pipe_macroblock *)pipe_macroblocks, NULL);
skip_frame:
return ret;
@@ -263,14 +267,15 @@ vlVdpDecoderRender (VdpDecoder decoder,
if (vlsurf->device != vldecoder->device)
return VDP_STATUS_HANDLE_DEVICE_MISMATCH;
- if (vlsurf->chroma_format != vldecoder->chroma_format)
- return VDP_STATUS_INVALID_CHROMA_TYPE;
+ /* Test doesn't make sence */
+ /*if (vlsurf->chroma_format != vldecoder->chroma_format)
+ return VDP_STATUS_INVALID_CHROMA_TYPE;*/
vscreen = vl_screen_create(vldecoder->device->display, vldecoder->device->screen);
if (!vscreen)
return VDP_STATUS_RESOURCES;
- vldecoder->vctx = vl_video_create(vscreen, vldecoder->profile, vlsurf->format, vlsurf->width, vlsurf->height);
+ vldecoder->vctx = vl_video_create(vscreen, vldecoder->profile, vlsurf->format, vldecoder->width, vldecoder->height);
if (!vldecoder->vctx)
return VDP_STATUS_RESOURCES;
diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c
index 4ca198e874d..496e2b8def0 100644
--- a/src/gallium/state_trackers/vdpau/device.c
+++ b/src/gallium/state_trackers/vdpau/device.c
@@ -26,6 +26,7 @@
**************************************************************************/
#include <pipe/p_compiler.h>
+#include <pipe/p_video_context.h>
#include <vl_winsys.h>
#include <util/u_memory.h>
#include <util/u_debug.h>
@@ -51,8 +52,15 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGe
ret = VDP_STATUS_RESOURCES;
goto no_dev;
}
+
dev->display = display;
dev->screen = screen;
+ dev->vscreen = vl_screen_create(display, screen);
+ if (!dev->vscreen)
+ {
+ ret = VDP_STATUS_RESOURCES;
+ goto no_vscreen;
+ }
*device = vlAddDataHTAB(dev);
if (*device == 0) {
@@ -66,6 +74,8 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device, VdpGe
return VDP_STATUS_OK;
no_handle:
+ /* Destroy vscreen */
+no_vscreen:
FREE(dev);
no_dev:
vlDestroyHTAB();
diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c
index 8bf42f53ff2..124125ebaad 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -130,6 +130,11 @@ vlVdpVideoMixerSetAttributeValues (
vlVdpVideoMixer *vmixer = vlGetDataHTAB(mixer);
if (!vmixer)
return VDP_STATUS_INVALID_HANDLE;
+
+ /*
+ * TODO: Implement the function
+ *
+ * */
return VDP_STATUS_OK;
} \ No newline at end of file
diff --git a/src/gallium/state_trackers/vdpau/vdpau_private.h b/src/gallium/state_trackers/vdpau/vdpau_private.h
index 36ef124c13d..de206365ce2 100644
--- a/src/gallium/state_trackers/vdpau/vdpau_private.h
+++ b/src/gallium/state_trackers/vdpau/vdpau_private.h
@@ -163,8 +163,9 @@ static enum pipe_video_profile ProfileToPipe(VdpDecoderProfile vdpau_profile)
typedef struct
{
- void *display;
+ Display *display;
int screen;
+ struct vl_screen *vscreen;
} vlVdpDevice;
typedef struct
@@ -207,10 +208,11 @@ typedef struct
typedef struct
{
vlVdpDevice *device;
- struct vl_screen *vlscreen;
- struct vl_context *vctx;
+ struct vl_context *vctx;
enum pipe_video_chroma_format chroma_format;
enum pipe_video_profile profile;
+ uint32_t width;
+ uint32_t height;
} vlVdpDecoder;
typedef uint32_t vlHandle;