summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin KAY <komadori@users.sourceforge.net>2004-04-16 12:16:50 +0000
committerRobin KAY <komadori@users.sourceforge.net>2004-04-16 12:16:50 +0000
commit44c0a772dc78cd298fd9c64db496179b6e2efdb6 (patch)
tree9d64a1671ad2ba4d0995dddb414648b072892bae
parentd3fe0c9eb2821ef9b1a70022eb5cebe3bd2251a1 (diff)
downloadxine-lib-44c0a772dc78cd298fd9c64db496179b6e2efdb6.tar.gz
xine-lib-44c0a772dc78cd298fd9c64db496179b6e2efdb6.tar.bz2
video_out_pgx32 now properly clips video output. video_out_pgx64 now disables overlay when fully occluded, fixed displaying some frames out of order when multi-buffering. Added missing X lock. Misc changes.
CVS patchset: 6409 CVS date: 2004/04/16 12:16:50
-rw-r--r--ChangeLog4
-rw-r--r--configure.ac25
-rw-r--r--src/video_out/Makefile.am10
-rw-r--r--src/video_out/video_out_pgx32.c183
-rw-r--r--src/video_out/video_out_pgx64.c115
5 files changed, 233 insertions, 104 deletions
diff --git a/ChangeLog b/ChangeLog
index 78b190cdd..275b8fb5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,10 @@ xine-lib (1-rc4)
* DXR3: fix menu highlight areas in letterboxed overlay mode with
pan&scan content
* DXR3: fix libavcodec encoder for frame widths not a multiple of 16
+ * mediaLib now used for bilinear scaling
+ * video_out_pgx32 now properly clips video output
+ * video_out_pgx64 now disables overlay when fully occluded, fixed displaying
+ some frames out of order when multi-buffering.
xine-lib (1-rc3c)
* fix the deadlock with non-seekable input plugins
diff --git a/configure.ac b/configure.ac
index ab2445cfb..be56c04d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -612,6 +612,27 @@ AM_CONDITIONAL(HAVE_SUNFB, [test x"$ac_have_sunfb" = "xyes"])
dnl ---------------------------------------------
+dnl Check for Sun DGA
+dnl ---------------------------------------------
+
+saved_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -I/usr/openwin/include"
+AC_CHECK_LIB(dga, XDgaGrabDrawable, [
+ AC_CHECK_HEADER(dga/dga.h, [
+ SUNDGA_CFLAGS="-I/usr/openwin/include"
+ SUNDGA_LIBS="-ldga"
+ AC_DEFINE(HAVE_SUNDGA,1,[Define this you have Sun DGA])
+ ac_have_sundga=yes
+ ],
+ )
+],)
+CPPFLAGS="$saved_CFLAGS"
+AM_CONDITIONAL(HAVE_SUNDGA, [test x"$ac_have_sundga" = "xyes"])
+AC_SUBST(SUNDGA_CFLAGS)
+AC_SUBST(SUNDGA_LIBS)
+
+
+dnl ---------------------------------------------
dnl Check linux framebuffer device support
dnl ---------------------------------------------
@@ -2219,7 +2240,9 @@ if test x"$no_x" != "xyes"; then
fi
if test x$ac_have_sunfb = "xyes"; then
echo " - PGX64 (for Sun PGX64/PGX24 cards)"
- echo " - PGX32 (for Sun PGX32 cards)"
+ if test x$ac_have_sundga = "xyes"; then
+ echo " - PGX32 (for Sun PGX32 cards)"
+ fi
fi
fi
if test x$no_aalib != "xyes"; then
diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am
index 51fec6024..2da6d0d46 100644
--- a/src/video_out/Makefile.am
+++ b/src/video_out/Makefile.am
@@ -7,8 +7,8 @@ EXTRA_DIST = video_out_directfb.c video_out_opengl.c video_out_directx.c
VIDIX_CFLAGS = -I$(top_builddir)/src/video_out/vidix \
-I$(top_srcdir)/src/video_out/vidix
-AM_CFLAGS = $(X_CFLAGS) \
- -DXINE_COMPILE $(SDL_CFLAGS) $(VIDIX_CFLAGS) \
+AM_CFLAGS = $(X_CFLAGS) -DXINE_COMPILE \
+ $(SUNDGA_CFLAGS) $(SDL_CFLAGS) $(VIDIX_CFLAGS) \
$(AALIB_CFLAGS) $(MLIB_CFLAGS) $(LIBSTK_CFLAGS) \
$(DIRECTFB_CFLAGS) $(DIRECTX_CFLAGS) $(CACA_CFLAGS)
@@ -32,9 +32,11 @@ syncfb_module = xineplug_vo_out_syncfb.la
endif
if HAVE_SUNFB
pgx64_module = xineplug_vo_out_pgx64.la
+if HAVE_SUNDGA
pgx32_module = xineplug_vo_out_pgx32.la
endif
endif
+endif
if HAVE_VIDIX
vidix_module = xineplug_vo_out_vidix.la
@@ -110,11 +112,11 @@ xineplug_vo_out_syncfb_la_LIBADD = $(X_LIBS) $(XINE_LIB)
xineplug_vo_out_syncfb_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@
xineplug_vo_out_pgx64_la_SOURCES = alphablend.c video_out_pgx64.c
-xineplug_vo_out_pgx64_la_LIBADD = $(X_LIBS)
+xineplug_vo_out_pgx64_la_LIBADD = $(X_LIBS) $(SUNDGA_LIBS)
xineplug_vo_out_pgx64_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@
xineplug_vo_out_pgx32_la_SOURCES = video_out_pgx32.c
-xineplug_vo_out_pgx32_la_LIBADD = $(X_LIBS)
+xineplug_vo_out_pgx32_la_LIBADD = $(X_LIBS) $(SUNDGA_LIBS)
xineplug_vo_out_pgx32_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@
xineplug_vo_out_vidix_la_SOURCES = alphablend.c video_out_vidix.c $(X11OSD)
diff --git a/src/video_out/video_out_pgx32.c b/src/video_out/video_out_pgx32.c
index 0c4f5eb36..b1f01d615 100644
--- a/src/video_out/video_out_pgx32.c
+++ b/src/video_out/video_out_pgx32.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_pgx32.c,v 1.3 2004/03/16 00:32:22 komadori Exp $
+ * $Id: video_out_pgx32.c,v 1.4 2004/04/16 12:17:03 komadori Exp $
*
* video_out_pgx32.c, Sun PGX32 output plugin for xine
*
@@ -42,6 +42,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
+#include <dga/dga.h>
#include "xine_internal.h"
#include "alphablend.h"
@@ -58,7 +59,6 @@
#define FIFO_SPACE 0x0003
#define RASTERISER_MODE 0x1014
-#define SCISSOR_MODE 0x1030
#define AREA_STIPPLE_MODE 0x1034
#define WINDOW_ORIGIN 0x1039
@@ -93,6 +93,10 @@
#define YUV_MODE 0x11E0
+#define SCISSOR_MODE 0x1030
+#define SCISSOR_MIN_XY 0x1031
+#define SCISSOR_MAX_XY 0x1032
+
#define RENDER 0x1007
#define RENDER_BEGIN 0x00000000006020C0L
@@ -165,10 +169,11 @@ typedef struct {
uint8_t *vbase;
Display *display;
- int screen, depth;
+ int screen, depth, dgavis;
+ Visual *visual;
Drawable drawable;
GC gc;
- Visual *visual;
+ Dga_drawable dgadraw;
int delivered_format, deinterlace_en;
} pgx32_driver_t;
@@ -429,6 +434,7 @@ static void pgx32_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen)
pgx32_driver_t *this = (pgx32_driver_t *)(void *)this_gen;
pgx32_frame_t *frame = (pgx32_frame_t *)frame_gen;
volatile uint64_t *vregs = (void *)(this->vbase+GFXP_REGSBASE);
+ short int *cliprects;
if ((frame->width != this->vo_scale.delivered_width) ||
(frame->height != this->vo_scale.delivered_height) ||
@@ -458,60 +464,94 @@ static void pgx32_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen)
memcpy((this->vbase+GFXP_VRAM_MMAPLEN)-frame->packedlen, frame->packedbuf, frame->packedlen);
- XLockDisplay(this->display);
- XGrabServer(this->display);
- XSync(this->display, False);
-
- while(le2me_64(vregs[FIFO_SPACE]) < 34) {}
-
- vregs[RASTERISER_MODE] = 0;
- vregs[SCISSOR_MODE] = 0;
- vregs[AREA_STIPPLE_MODE] = 0;
- vregs[WINDOW_ORIGIN] = 0;
-
- vregs[RECT_ORIGIN] = le2me_64((this->vo_scale.gui_win_x + this->vo_scale.output_xoffset) | ((this->vo_scale.gui_win_y + this->vo_scale.output_yoffset) << 16));
- vregs[RECT_SIZE] = le2me_64(this->vo_scale.output_width | (this->vo_scale.output_height << 16));
-
- vregs[DY] = le2me_64(1 << 16);
-
- vregs[TEXTURE_ADDR_MODE] = le2me_64(1);
- vregs[SSTART] = 0;
- vregs[DSDX] = le2me_64((frame->width << 20) / this->vo_scale.output_width);
- vregs[DSDY_DOM] = 0;
- vregs[TSTART] = 0;
- vregs[DTDX] = 0;
- vregs[DTDY_DOM] = le2me_64((frame->height << 20) / this->vo_scale.output_height);
-
- vregs[TEXTURE_BASE_ADDR] = le2me_64((GFXP_VRAM_MMAPLEN-frame->packedlen) >> 1);
- vregs[TEXTURE_MAP_FORMAT] = le2me_64((1 << 19) | frame->pitch_code);
-
- vregs[TEXTURE_DATA_FORMAT] = le2me_64(0x63);
- vregs[TEXTURE_READ_MODE] = le2me_64((1 << 17) | (11 << 13) | (11 << 9) | 1);
- vregs[TEXTURE_COLOUR_MODE] = le2me_64((0 << 4) | (3 << 1) | 1);
-
- vregs[SHADING_MODE] = 0;
- vregs[ALPHA_BLENDING_MODE] = 0;
- vregs[DITHERING_MODE] = le2me_64((1 << 10) | 1);
- vregs[LOGICAL_OP_MODE] = 0;
- vregs[STENCIL_MODE] = 0;
-
- vregs[READ_MODE] = le2me_64(this->screen_pitch_code);
- vregs[WRITE_MODE] = le2me_64(1);
- vregs[WRITE_MASK] = le2me_64(0x00ffffff);
+ DGA_DRAW_LOCK(this->dgadraw, -1);
+ if (DGA_DRAW_MODIF(this->dgadraw)) {
+ this->dgavis = dga_draw_visibility(this->dgadraw);
+ }
+ cliprects = dga_draw_clipinfo(this->dgadraw);
+ DGA_DRAW_UNLOCK(this->dgadraw);
- vregs[YUV_MODE] = le2me_64(1);
+ /* There is a small window between unlocking the DGA drawable and locking
+ * the X server during which the status of the drawable could change, but
+ * this is unavoidable as my testing shows that having both locked at the
+ * same time causes the X server to become unresponsive. (Solaris 9 12/03)
+ */
- vregs[RENDER] = le2me_64(RENDER_BEGIN);
+ if (this->dgavis != DGA_VIS_FULLY_OBSCURED) {
+ XLockDisplay(this->display);
+ XGrabServer(this->display);
+ XSync(this->display, False);
+
+ while(le2me_64(vregs[FIFO_SPACE]) < 28) {}
+
+ vregs[RASTERISER_MODE] = 0;
+ vregs[AREA_STIPPLE_MODE] = 0;
+ vregs[WINDOW_ORIGIN] = 0;
+
+ vregs[RECT_ORIGIN] = le2me_64((this->vo_scale.gui_win_x + this->vo_scale.output_xoffset) | ((this->vo_scale.gui_win_y + this->vo_scale.output_yoffset) << 16));
+ vregs[RECT_SIZE] = le2me_64(this->vo_scale.output_width | (this->vo_scale.output_height << 16));
+
+ vregs[DY] = le2me_64(1 << 16);
+
+ vregs[TEXTURE_ADDR_MODE] = le2me_64(1);
+ vregs[SSTART] = 0;
+ vregs[DSDX] = le2me_64((frame->width << 20) / this->vo_scale.output_width);
+ vregs[DSDY_DOM] = 0;
+ vregs[TSTART] = 0;
+ vregs[DTDX] = 0;
+ vregs[DTDY_DOM] = le2me_64((frame->height << 20) / this->vo_scale.output_height);
+
+ vregs[TEXTURE_BASE_ADDR] = le2me_64((GFXP_VRAM_MMAPLEN-frame->packedlen) >> 1);
+ vregs[TEXTURE_MAP_FORMAT] = le2me_64((1 << 19) | frame->pitch_code);
+
+ vregs[TEXTURE_DATA_FORMAT] = le2me_64(0x63);
+ vregs[TEXTURE_READ_MODE] = le2me_64((1 << 17) | (11 << 13) | (11 << 9) | 1);
+ vregs[TEXTURE_COLOUR_MODE] = le2me_64((0 << 4) | (3 << 1) | 1);
+
+ vregs[SHADING_MODE] = 0;
+ vregs[ALPHA_BLENDING_MODE] = 0;
+ vregs[DITHERING_MODE] = le2me_64((1 << 10) | 1);
+ vregs[LOGICAL_OP_MODE] = 0;
+ vregs[STENCIL_MODE] = 0;
+
+ vregs[READ_MODE] = le2me_64(this->screen_pitch_code);
+ vregs[WRITE_MODE] = le2me_64(1);
+ vregs[WRITE_MASK] = le2me_64(0x00ffffff);
+
+ vregs[YUV_MODE] = le2me_64(1);
+
+ if (this->dgavis == DGA_VIS_PARTIALLY_OBSCURED) {
+ short int x0, y0, x1, y1;
+ vregs[SCISSOR_MODE] = le2me_64(1);
+ while ((y0 = *cliprects++) != DGA_Y_EOL) {
+ y1 = *cliprects++;
+ while ((x0 = *cliprects++) != DGA_X_EOL) {
+ x1 = *cliprects++;
+ while(le2me_64(vregs[FIFO_SPACE]) < 3) {}
+ vregs[SCISSOR_MIN_XY] = le2me_64((y0 << 16) | x0);
+ vregs[SCISSOR_MAX_XY] = le2me_64((y1 << 16) | x1);
+ vregs[RENDER] = le2me_64(RENDER_BEGIN);
+ }
+ }
+ while(le2me_64(vregs[FIFO_SPACE]) < 6) {}
+ vregs[SCISSOR_MODE] = 0;
+ }
+ else {
+ vregs[SCISSOR_MODE] = 0;
+ while(le2me_64(vregs[FIFO_SPACE]) < 6) {}
+ vregs[RENDER] = le2me_64(RENDER_BEGIN);
+ }
- vregs[TEXTURE_READ_MODE] = 0;
- vregs[TEXTURE_ADDR_MODE] = 0;
- vregs[DITHERING_MODE] = 0;
- vregs[TEXTURE_COLOUR_MODE] = 0;
- vregs[YUV_MODE] = 0;
+ vregs[TEXTURE_ADDR_MODE] = 0;
+ vregs[TEXTURE_READ_MODE] = 0;
+ vregs[TEXTURE_COLOUR_MODE] = 0;
+ vregs[DITHERING_MODE] = 0;
+ vregs[YUV_MODE] = 0;
- XUngrabServer(this->display);
- XFlush(this->display);
- XUnlockDisplay(this->display);
+ XUngrabServer(this->display);
+ XFlush(this->display);
+ XUnlockDisplay(this->display);
+ }
if (this->current != NULL) {
this->current->vo_frame.free(&this->current->vo_frame);
@@ -657,12 +697,14 @@ static int pgx32_gui_data_exchange(vo_driver_t *this_gen, int data_type, void *d
XWindowAttributes win_attrs;
XLockDisplay(this->display);
- this->drawable = (Drawable)data;
- XGetWindowAttributes(this->display, this->drawable, &win_attrs);
- this->depth = win_attrs.depth;
- this->visual = win_attrs.visual;
+ XDgaUnGrabDrawable(this->dgadraw);
XFreeGC(this->display, this->gc);
- this->gc = XCreateGC(this->display, this->drawable, 0, NULL);
+ XGetWindowAttributes(this->display, this->drawable, &win_attrs);
+ this->depth = win_attrs.depth;
+ this->visual = win_attrs.visual;
+ this->drawable = (Drawable)data;
+ this->gc = XCreateGC(this->display, this->drawable, 0, NULL);
+ this->dgadraw = XDgaGrabDrawable(this->display, this->drawable);
XUnlockDisplay(this->display);
}
break;
@@ -707,6 +749,7 @@ static void pgx32_dispose(vo_driver_t *this_gen)
pgx32_driver_t *this = (pgx32_driver_t *)(void *)this_gen;
XLockDisplay (this->display);
+ XDgaUnGrabDrawable(this->dgadraw);
XFreeGC(this->display, this->gc);
XUnlockDisplay (this->display);
@@ -764,13 +807,13 @@ static vo_driver_t *pgx32_init_driver(video_driver_class_t *class_gen, const voi
}
if (ioctl(fbfd, VIS_GETIDENTIFIER, &ident) < 0) {
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_sunfb: Error: ioctl failed, unable to determine framebuffer type\n");
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx32: Error: ioctl failed, unable to determine framebuffer type\n");
close(fbfd);
return NULL;
}
if (strcmp("TSIgfxp", ident.name) != 0) {
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx64: Error: '%s' is not a gfxp framebuffer device\n", devname);
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx32: Error: '%s' is not a gfxp framebuffer device\n", devname);
close(fbfd);
return NULL;
}
@@ -816,11 +859,11 @@ static vo_driver_t *pgx32_init_driver(video_driver_class_t *class_gen, const voi
this->class = class;
- this->fbfd = fbfd;
- this->fb_width = attr.fbtype.fb_width;
- this->fb_height = attr.fbtype.fb_height;
- this->fb_depth = attr.fbtype.fb_depth;
- this->vbase = vbase;
+ this->fbfd = fbfd;
+ this->fb_width = attr.fbtype.fb_width;
+ this->fb_height = attr.fbtype.fb_height;
+ this->fb_depth = attr.fbtype.fb_depth;
+ this->vbase = vbase;
for (i=0; i<sizeof(pitch_code_table)/sizeof(pitch_code_table[0]); i++) {
if (pitch_code_table[i][0] == this->fb_width) {
@@ -831,11 +874,15 @@ static vo_driver_t *pgx32_init_driver(video_driver_class_t *class_gen, const voi
this->display = ((x11_visual_t *)visual_gen)->display;
this->screen = ((x11_visual_t *)visual_gen)->screen;
this->drawable = ((x11_visual_t *)visual_gen)->d;
- this->gc = XCreateGC(this->display, this->drawable, 0, NULL);
+
+ XLockDisplay(this->display);
+ this->gc = XCreateGC(this->display, this->drawable, 0, NULL);
+ this->dgadraw = XDgaGrabDrawable(this->display, this->drawable);
XGetWindowAttributes(this->display, this->drawable, &win_attrs);
this->depth = win_attrs.depth;
this->visual = win_attrs.visual;
+ XUnlockDisplay(this->display);
return (vo_driver_t *)this;
}
@@ -859,6 +906,8 @@ static void *pgx32_init_class(xine_t *xine, void *visual_gen)
return NULL;
}
+ DGA_INIT();
+
class->vo_driver_class.open_plugin = pgx32_init_driver;
class->vo_driver_class.get_identifier = pgx32_get_identifier;
class->vo_driver_class.get_description = pgx32_get_description;
diff --git a/src/video_out/video_out_pgx64.c b/src/video_out/video_out_pgx64.c
index 7de9fe733..a1dade76d 100644
--- a/src/video_out/video_out_pgx64.c
+++ b/src/video_out/video_out_pgx64.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2000-2004 the xine project
*
* This file is part of xine, a free video player.
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_pgx64.c,v 1.54 2004/03/16 00:32:22 komadori Exp $
+ * $Id: video_out_pgx64.c,v 1.55 2004/04/16 12:17:03 komadori Exp $
*
* video_out_pgx64.c, Sun PGX64/PGX24 output plugin for xine
*
@@ -42,6 +42,10 @@
#include <X11/Xutil.h>
#include <X11/Xatom.h>
+#ifdef HAVE_SUNDGA
+#include <dga/dga.h>
+#endif
+
#include "xine_internal.h"
#include "alphablend.h"
#include "bswap.h"
@@ -49,6 +53,12 @@
#include "xineutils.h"
/*
+ * The maximum number of frames that can be used in multi-buffering
+ * configuration.
+ */
+#define MAX_MULTIBUF_FRAMES 15
+
+/*
* The maximum number of frames that can be safely taken out of circulation.
*/
#define MAX_DETAINED_FRAMES 10
@@ -155,19 +165,24 @@ typedef struct {
pgx64_driver_class_t *class;
- pgx64_frame_t *current, *detained[MAX_DETAINED_FRAMES];
- int detained_frames;
+ pgx64_frame_t *current;
+ pgx64_frame_t *multibuf[MAX_MULTIBUF_FRAMES];
+ pgx64_frame_t *detained[MAX_DETAINED_FRAMES];
+ int multibuf_frames, detained_frames;
int fbfd, fb_width, fb_height, fb_depth;
uint32_t free_top, free_bottom, free_mark, buffers[2][3];
uint8_t *vbase, *buffer_ptrs[2][3];
Display *display;
- int screen, depth;
- Drawable drawable;
- GC gc;
+ int screen, depth, dgavis;
Visual *visual;
+ Drawable drawable;
Colormap cmap;
+ GC gc;
+#ifdef HAVE_SUNDGA
+ Dga_drawable dgadraw;
+#endif
int ovl_mode, ovl_changed, ovl_regen_needed;
pthread_mutex_t ovl_mutex;
@@ -253,7 +268,13 @@ static void vram_reset(pgx64_driver_t * this)
this->free_mark = this->free_top;
- for (i=0;i<this->detained_frames;i++) {
+ for (i=0; i<this->multibuf_frames; i++) {
+ this->multibuf[i]->vo_frame.proc_frame = NULL;
+ this->multibuf[i]->vo_frame.proc_slice = NULL;
+ }
+ this->multibuf_frames = 0;
+
+ for (i=0; i<this->detained_frames; i++) {
this->detained[i]->vo_frame.free(&this->detained[i]->vo_frame);
}
this->detained_frames = 0;
@@ -461,18 +482,23 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen)
vregs[OVERLAY_SCALE_INC] = le2me_32((((frame->width << 12) / this->vo_scale.output_width) << 16) | (((this->deinterlace_en ? frame->height/2 : frame->height) << 12) / this->vo_scale.output_height));
vregs[SCALER_HEIGHT_WIDTH] = le2me_32((frame->width << 16) | (this->deinterlace_en ? frame->height/2 : frame->height));
- if (this->ovl_mode == OVL_MODE_EXCLUSIVE) {
- int horz_start = (this->vo_scale.gui_win_x + this->vo_scale.output_xoffset + 7) / 8;
- int horz_end = (this->vo_scale.gui_win_x + this->vo_scale.output_xoffset + this->vo_scale.output_width) / 8;
+#ifdef HAVE_SUNDGA
+ DGA_DRAW_LOCK(this->dgadraw, -1);
+ this->dgavis = dga_draw_visibility(this->dgadraw);
+ DGA_DRAW_UNLOCK(this->dgadraw);
+#endif
- vregs[OVERLAY_EXCLUSIVE_VERT] = le2me_32((this->vo_scale.gui_win_y + this->vo_scale.output_yoffset - 1) | ((this->vo_scale.gui_win_y + this->vo_scale.output_yoffset + this->vo_scale.output_height - 1) << 16));
- vregs[OVERLAY_EXCLUSIVE_HORZ] = le2me_32(horz_start | (horz_end << 8) | ((this->fb_width/8 - horz_end) << 16) | OVERLAY_EXCLUSIVE_EN);
- }
- else {
- vregs[OVERLAY_EXCLUSIVE_HORZ] = 0;
- }
+ if (this->dgavis != DGA_VIS_FULLY_OBSCURED) {
+ if (this->ovl_mode == OVL_MODE_EXCLUSIVE) {
+ int horz_start = (this->vo_scale.gui_win_x + this->vo_scale.output_xoffset + 7) / 8;
+ int horz_end = (this->vo_scale.gui_win_x + this->vo_scale.output_xoffset + this->vo_scale.output_width) / 8;
- vregs[OVERLAY_SCALE_CNTL] = le2me_32(OVERLAY_SCALE_EN);
+ vregs[OVERLAY_EXCLUSIVE_VERT] = le2me_32((this->vo_scale.gui_win_y + this->vo_scale.output_yoffset - 1) | ((this->vo_scale.gui_win_y + this->vo_scale.output_yoffset + this->vo_scale.output_height - 1) << 16));
+ vregs[OVERLAY_EXCLUSIVE_HORZ] = le2me_32(horz_start | (horz_end << 8) | ((this->fb_width/8 - horz_end) << 16) | OVERLAY_EXCLUSIVE_EN);
+ }
+
+ vregs[OVERLAY_SCALE_CNTL] = le2me_32(OVERLAY_SCALE_EN);
+ }
}
if (this->buf_mode == BUF_MODE_MULTI) {
@@ -500,6 +526,8 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen)
frame->vo_frame.proc_frame = pgx64_frame_proc_frame;
frame->vo_frame.proc_slice = pgx64_frame_proc_slice;
+ _x_assert(this->multibuf_frames < MAX_MULTIBUF_FRAMES);
+ this->multibuf[this->multibuf_frames++] = frame;
}
for (i=0;i<frame->planes;i++) {
@@ -524,7 +552,9 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen)
this->buf_mode = BUF_MODE_DOUBLE;
for (i=0;i<frame->planes;i++) {
if ((this->buffers[1][i] = vram_alloc(this, frame->lengths[i])) < 0) {
- this->buf_mode = BUF_MODE_SINGLE;
+ xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx64: Warning: low video memory, double-buffering disabled\n"));
+ this->buf_mode = BUF_MODE_SINGLE;
+ break;
}
else {
this->buffer_ptrs[1][i] = this->vbase + this->buffers[1][i];
@@ -532,7 +562,6 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen)
}
if (this->buf_mode == BUF_MODE_SINGLE) {
- xprintf(this->class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx64: Warning: low video memory, double-buffering disabled\n"));
for (i=0;i<frame->planes;i++) {
this->buffers[1][i] = this->buffers[0][i];
this->buffer_ptrs[1][i] = this->vbase + this->buffers[1][i];
@@ -549,9 +578,6 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen)
for (i=0;i<frame->planes;i++) {
memcpy(this->buffer_ptrs[this->dblbuf_select][i], frame->vo_frame.base[i], frame->lengths[i]);
}
-
- frame->vo_frame.proc_slice = NULL;
- frame->vo_frame.proc_frame = NULL;
}
vregs[CAPTURE_CONFIG] = this->dblbuf_select ? le2me_32(CAPTURE_CONFIG_BUF1) : le2me_32(CAPTURE_CONFIG_BUF0);
@@ -889,15 +915,20 @@ static int pgx64_gui_data_exchange(vo_driver_t *this_gen, int data_type, void *d
XWindowAttributes win_attrs;
XLockDisplay(this->display);
- this->drawable = (Drawable)data;
+#ifdef HAVE_SUNDGA
+ XDgaUnGrabDrawable(this->dgadraw);
+#endif
+ XFreeGC(this->display, this->gc);
XGetWindowAttributes(this->display, this->drawable, &win_attrs);
- this->depth = win_attrs.depth;
- this->visual = win_attrs.visual;
- XFreeColormap(this->display, this->cmap);
- this->cmap = XCreateColormap(this->display, this->drawable, this->visual, AllocNone);
+ this->depth = win_attrs.depth;
+ this->visual = win_attrs.visual;
+ this->drawable = (Drawable)data;
+ this->cmap = XCreateColormap(this->display, this->drawable, this->visual, AllocNone);
XSetWindowColormap(this->display, this->drawable, this->cmap);
- XFreeGC(this->display, this->gc);
- this->gc = XCreateGC(this->display, this->drawable, 0, NULL);
+ this->gc = XCreateGC(this->display, this->drawable, 0, NULL);
+#ifdef HAVE_SUNDGA
+ this->dgadraw = XDgaGrabDrawable(this->display, this->drawable);
+#endif
XUnlockDisplay(this->display);
}
break;
@@ -928,8 +959,15 @@ static int pgx64_gui_data_exchange(vo_driver_t *this_gen, int data_type, void *d
static int pgx64_redraw_needed(vo_driver_t *this_gen)
{
pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen;
+ int modif = 0;
- if (_x_vo_scale_redraw_needed(&this->vo_scale)) {
+#ifdef HAVE_SUNDGA
+ DGA_DRAW_LOCK(this->dgadraw, -1);
+ modif = DGA_DRAW_MODIF(this->dgadraw);
+ DGA_DRAW_UNLOCK(this->dgadraw);
+#endif
+
+ if (modif || _x_vo_scale_redraw_needed(&this->vo_scale)) {
this->vo_scale.force_redraw = 1;
this->ovl_regen_needed = 1;
return 1;
@@ -948,6 +986,9 @@ static void pgx64_dispose(vo_driver_t *this_gen)
XLockDisplay (this->display);
XFreeColormap(this->display, this->cmap);
+#ifdef HAVE_SUNDGA
+ XDgaUnGrabDrawable(this->dgadraw);
+#endif
XFreeGC(this->display, this->gc);
XUnlockDisplay (this->display);
@@ -1080,13 +1121,19 @@ static vo_driver_t *pgx64_init_driver(video_driver_class_t *class_gen, const voi
this->display = ((x11_visual_t *)visual_gen)->display;
this->screen = ((x11_visual_t *)visual_gen)->screen;
this->drawable = ((x11_visual_t *)visual_gen)->d;
- this->gc = XCreateGC(this->display, this->drawable, 0, NULL);
+
+ XLockDisplay(this->display);
+ this->gc = XCreateGC(this->display, this->drawable, 0, NULL);
+#ifdef HAVE_SUNDGA
+ this->dgadraw = XDgaGrabDrawable(this->display, this->drawable);
+#endif
XGetWindowAttributes(this->display, this->drawable, &win_attrs);
this->depth = win_attrs.depth;
this->visual = win_attrs.visual;
this->cmap = XCreateColormap(this->display, this->drawable, this->visual, AllocNone);
XSetWindowColormap(this->display, this->drawable, this->cmap);
+ XUnlockDisplay(this->display);
this->colour_key = class->config->register_num(this->class->config, "video.pgx64_colour_key", 1, "video overlay colour key", NULL, 10, pgx64_config_changed, this);
this->brightness = class->config->register_range(this->class->config, "video.pgx64_brightness", 0, -64, 63, "video overlay brightness", NULL, 10, pgx64_config_changed, this);
@@ -1118,6 +1165,10 @@ static void *pgx64_init_class(xine_t *xine, void *visual_gen)
return NULL;
}
+#ifdef HAVE_SUNDGA
+ DGA_INIT();
+#endif
+
class->vo_driver_class.open_plugin = pgx64_init_driver;
class->vo_driver_class.get_identifier = pgx64_get_identifier;
class->vo_driver_class.get_description = pgx64_get_description;