diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-02-04 00:28:17 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-02-04 00:28:17 +0200 |
commit | 9790f4e6e72cdc8093be966d3d6e007c8f44a035 (patch) | |
tree | 3d4a19a910d34be6ee7cd4841876a4318d5c243d /libvo | |
parent | ccf4d9e96cd7aa8506e6632d2a7352ec89b2b9e3 (diff) | |
parent | 09bf506c34a73d587c999ce161a0714159e1e5b6 (diff) | |
download | mpv-9790f4e6e72cdc8093be966d3d6e007c8f44a035.tar.bz2 mpv-9790f4e6e72cdc8093be966d3d6e007c8f44a035.tar.xz |
Merge svn changes up to r28461
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/sub.c | 4 | ||||
-rw-r--r-- | libvo/sub.h | 2 | ||||
-rw-r--r-- | libvo/vo_direct3d.c | 46 | ||||
-rw-r--r-- | libvo/vo_gl.c | 13 |
4 files changed, 40 insertions, 25 deletions
diff --git a/libvo/sub.c b/libvo/sub.c index 369d1bbd50..d4efcb9a5c 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -8,16 +8,12 @@ #include <malloc.h> #endif -#ifdef CONFIG_DVDNAV #include "stream/stream.h" #include "stream/stream_dvdnav.h" #define OSD_NAV_BOX_ALPHA 0x7f -#endif -#ifdef CONFIG_TV_TELETEXT #include "stream/tv.h" #include "osdep/timer.h" -#endif #include "talloc.h" #include "mplayer.h" diff --git a/libvo/sub.h b/libvo/sub.h index 83a2f87dbd..9c4dc78525 100644 --- a/libvo/sub.h +++ b/libvo/sub.h @@ -50,7 +50,7 @@ typedef struct mp_osd_obj_s { } mp_osd_obj_t; struct osd_state { - unsigned char osd_text[64]; + unsigned char osd_text[128]; struct font_desc *sub_font; }; diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c index c86cc94c07..cafa6f2ceb 100644 --- a/libvo/vo_direct3d.c +++ b/libvo/vo_direct3d.c @@ -56,7 +56,7 @@ static struct global_priv { 0 = Movie is not paused */ int is_clear_needed; /**< 1 = Clear the backbuffer before StretchRect 0 = (default) Don't clear it */ - D3DLOCKED_RECT locked_rect; /**< The locked Offscreen surface */ + D3DLOCKED_RECT locked_rect; /**< The locked offscreen surface */ RECT fs_movie_rect; /**< Rect (upscaled) of the movie when displayed in fullscreen */ RECT fs_panscan_rect; /**< PanScan source surface cropping in @@ -273,10 +273,10 @@ static int create_d3d_surfaces(void) // make sure we respect the size limits without breaking aspect or pow2-requirements while (tex_width > priv->max_texture_width || tex_height > priv->max_texture_height) { - osd_width >>= 1; - osd_height >>= 1; - tex_width >>= 1; - tex_height >>= 1; + osd_width >>= 1; + osd_height >>= 1; + tex_width >>= 1; + tex_height >>= 1; } priv->osd_width = osd_width; @@ -437,7 +437,7 @@ static int configure_d3d(void) if (FAILED(IDirect3DDevice9_SetViewport(priv->d3d_device, &vp))) { mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Unable to set the viewport\n"); - return VO_ERROR; + return 0; } calc_fs_rect(); @@ -468,7 +468,7 @@ static int reconfigure_d3d(void) priv->d3d_handle = Direct3DCreate9(D3D_SDK_VERSION); if (!priv->d3d_handle) { mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Unable to initialize Direct3D\n"); - return -1; + return 0; } /* Configure Direct3D */ @@ -492,7 +492,8 @@ static int resize_d3d(void) if (vo_dwidth > priv->cur_backbuf_width || vo_dheight > priv->cur_backbuf_height) { - change_d3d_backbuffer (BACKBUFFER_RESET); + if (!change_d3d_backbuffer(BACKBUFFER_RESET)) + return 0; } /* Destroy the OSD textures. They should always match the new dimensions @@ -519,7 +520,7 @@ static int resize_d3d(void) if (FAILED(IDirect3DDevice9_SetViewport(priv->d3d_device, &vp))) { mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Unable to set the viewport\n"); - return VO_ERROR; + return 0; } calc_fs_rect(); @@ -565,6 +566,11 @@ static uint32_t render_d3d_frame(mp_image_t *mpi) * if (mpi->flags & MP_IMGFLAG_DIRECT) ... */ + /* If the D3D device is uncooperative (not initialized), return success. + The device will be probed for reinitialization in the next flip_page() */ + if (!priv->d3d_device) + return VO_TRUE; + if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) goto skip_upload; @@ -857,21 +863,16 @@ static int config(uint32_t width, uint32_t height, uint32_t d_width, static void flip_page(void) { RECT rect = {0, 0, vo_dwidth, vo_dheight}; - if (FAILED(IDirect3DDevice9_Present(priv->d3d_device, &rect, 0, 0, 0))) { + if (!priv->d3d_device || + FAILED(IDirect3DDevice9_Present(priv->d3d_device, &rect, 0, 0, 0))) { mp_msg(MSGT_VO, MSGL_V, - "<vo_direct3d>Video adapter became uncooperative.\n"); - mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Trying to reinitialize it...\n"); + "<vo_direct3d>Trying to reinitialize uncooperative video adapter.\n"); if (!reconfigure_d3d()) { - mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Reinitialization Failed.\n"); - return; - } - if (FAILED(IDirect3DDevice9_Present(priv->d3d_device, &rect, 0, 0, 0))) { - mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Reinitialization Failed.\n"); + mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Reinitialization failed.\n"); return; } else mp_msg(MSGT_VO, MSGL_V, "<vo_direct3d>Video adapter reinitialized.\n"); - } } @@ -914,6 +915,11 @@ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y ) char *dst; /**< Pointer to the destination image */ int uv_stride; /**< Stride of the U/V planes */ + /* If the D3D device is uncooperative (not initialized), return success. + The device will be probed for reinitialization in the next flip_page() */ + if (!priv->d3d_device) + return 0; + /* Lock the offscreen surface if it's not already locked. */ if (!priv->locked_rect.pBits) { if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface, @@ -1022,6 +1028,10 @@ static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, */ static void draw_osd(void) { + // we can not render OSD if we lost the device e.g. because it was uncooperative + if (!priv->d3d_device) + return; + if (vo_osd_changed(0)) { D3DLOCKED_RECT locked_rect; /**< Offscreen surface we lock in order to copy MPlayer's frame inside it.*/ diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 6d9c173f68..618b13e5f7 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -404,13 +404,22 @@ static void uninitGl(void) { static void autodetectGlExtensions(void) { const char *extensions = glGetString(GL_EXTENSIONS); const char *vendor = glGetString(GL_VENDOR); + const char *version = glGetString(GL_VERSION); int is_ati = strstr(vendor, "ATI") != NULL; - if (ati_hack == -1) ati_hack = is_ati; + int ati_broken_pbo = 0; + if (is_ati && strncmp(version, "2.1.", 4) == 0) { + int ver = atoi(version + 4); + mp_msg(MSGT_VO, MSGL_V, "[gl] Detected ATI driver version: %i\n", ver); + ati_broken_pbo = ver && ver < 8395; + } + if (ati_hack == -1) ati_hack = ati_broken_pbo; if (force_pbo == -1) force_pbo = strstr(extensions, "_pixel_buffer_object") ? is_ati : 0; if (use_rectangle == -1) use_rectangle = strstr(extensions, "_texture_non_power_of_two") ? 0 : 0; if (is_ati && (lscale == 1 || lscale == 2 || cscale == 1 || cscale == 2)) - mp_msg(MSGT_VO, MSGL_WARN, "Selected scaling mode may be broken on ATI cards.\n" + mp_msg(MSGT_VO, MSGL_WARN, "[gl] Selected scaling mode may be broken on ATI cards.\n" "Tell _them_ to fix GL_REPEAT if you have issues.\n"); + mp_msg(MSGT_VO, MSGL_V, "[gl] Settings after autodetection: ati-hack = %i, force-pbo = %i, rectangle = %i\n", + ati_hack, force_pbo, use_rectangle); } /** |