summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin KAY <komadori@users.sourceforge.net>2004-04-25 15:05:22 +0000
committerRobin KAY <komadori@users.sourceforge.net>2004-04-25 15:05:22 +0000
commiteaf081a7cc1985b4a062b1f42a79e15dd741ec92 (patch)
tree9a085975d2e1343e8187b5ad804a32a8f39dbbf8
parent38590f702bed212d251851ccc63369050340e9ae (diff)
downloadxine-lib-eaf081a7cc1985b4a062b1f42a79e15dd741ec92.tar.gz
xine-lib-eaf081a7cc1985b4a062b1f42a79e15dd741ec92.tar.bz2
Improved clipping performance in video_out_pgx32. video_out_pgx64 now uses the appropriate overlay type automatically. Misc changes.
CVS patchset: 6434 CVS date: 2004/04/25 15:05:22
-rw-r--r--ChangeLog6
-rw-r--r--configure.ac3
-rw-r--r--src/video_out/Makefile.am2
-rw-r--r--src/video_out/video_out_pgx32.c343
-rw-r--r--src/video_out/video_out_pgx64.c152
5 files changed, 224 insertions, 282 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c436f6ff..b23fe8c94 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -22,9 +22,9 @@ xine-lib (1-rc4)
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.
+ * video_out_pgx32: properly clips video output
+ * video_out_pgx64: fixed displaying frames out of order when multi-buffering,
+ automatically manages overlay mode based on degree of occlusion.
* DXR3: option to use Pan & Scan information embedded in MPEG and DVB streams
* disable AUD content detection because of false positives
* fix Real pnm/rtsp streaming on big endian platforms
diff --git a/configure.ac b/configure.ac
index be56c04d3..6ae201efb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -621,7 +621,6 @@ 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
],
)
@@ -2239,8 +2238,8 @@ if test x"$no_x" != "xyes"; then
echo " - OpenGL"
fi
if test x$ac_have_sunfb = "xyes"; then
- echo " - PGX64 (for Sun PGX64/PGX24 cards)"
if test x$ac_have_sundga = "xyes"; then
+ echo " - PGX64 (for Sun PGX64/PGX24 cards)"
echo " - PGX32 (for Sun PGX32 cards)"
fi
fi
diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am
index 2da6d0d46..c96119314 100644
--- a/src/video_out/Makefile.am
+++ b/src/video_out/Makefile.am
@@ -31,8 +31,8 @@ if HAVE_SYNCFB
syncfb_module = xineplug_vo_out_syncfb.la
endif
if HAVE_SUNFB
-pgx64_module = xineplug_vo_out_pgx64.la
if HAVE_SUNDGA
+pgx64_module = xineplug_vo_out_pgx64.la
pgx32_module = xineplug_vo_out_pgx32.la
endif
endif
diff --git a/src/video_out/video_out_pgx32.c b/src/video_out/video_out_pgx32.c
index b1f01d615..05588980e 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.4 2004/04/16 12:17:03 komadori Exp $
+ * $Id: video_out_pgx32.c,v 1.5 2004/04/25 15:05:31 komadori Exp $
*
* video_out_pgx32.c, Sun PGX32 output plugin for xine
*
@@ -59,12 +59,16 @@
#define FIFO_SPACE 0x0003
#define RASTERISER_MODE 0x1014
-#define AREA_STIPPLE_MODE 0x1034
-#define WINDOW_ORIGIN 0x1039
#define RECT_ORIGIN 0x101A
#define RECT_SIZE 0x101B
+#define SCISSOR_MODE 0x1030
+#define SCISSOR_MIN_XY 0x1031
+#define SCISSOR_MAX_XY 0x1032
+#define AREA_STIPPLE_MODE 0x1034
+#define WINDOW_ORIGIN 0x1039
+
#define DY 0x1005
#define TEXTURE_ADDR_MODE 0x1070
@@ -87,16 +91,11 @@
#define LOGICAL_OP_MODE 0x1105
#define STENCIL_MODE 0x1131
-#define READ_MODE 0x1150
#define WRITE_MODE 0x1157
#define WRITE_MASK 0x1158
#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,11 +164,11 @@ typedef struct {
pgx32_frame_t *current;
- int fbfd, fb_width, fb_height, fb_depth, screen_pitch_code;
+ int fbfd, fb_width, fb_height, fb_depth;
uint8_t *vbase;
Display *display;
- int screen, depth, dgavis;
+ int screen, depth;
Visual *visual;
Drawable drawable;
GC gc;
@@ -203,123 +202,88 @@ static void dispose_frame_internals(pgx32_frame_t *frame)
}
/*
- * XINE VIDEO DRIVER FUNCTIONS
+ * Convert yuy2 frame/slice to GFXP internal YUV format
*/
-static void pgx32_frame_proc_frame(vo_frame_t *frame_gen)
+static uint32_t *convert_yuy2(uint32_t *src, int width, int pitch, int height, uint32_t *dst)
{
- pgx32_frame_t *frame = (pgx32_frame_t *)frame_gen;
+ int l, x;
- frame->vo_frame.proc_called = 1;
+ for (l=0; l<height; l++) {
+ for(x=0; x<(width+1)/2; x++) {
+ *(dst++) = (*src >> 16) | ((*src & 0xffff) << 16);
+ src++;
+ }
+ dst += (pitch-width)/2;
+ }
- switch (frame->format) {
- case XINE_IMGFMT_YUY2: {
- int i, x;
- uint32_t *src, *dst, pixel;
+ return dst;
+}
+
+/*
+ * Convert yv12 frame/slice to GFXP internal YUV format
+ */
- src = (uint32_t *)(void *)frame->vo_frame.base[0];
- dst = frame->stripe_dst;
+static uint32_t *convert_yv12(uint16_t *ysrc, uint8_t *usrc, uint8_t *vsrc, int width, int pitch, int height, uint32_t *dst)
+{
+ int l, x, y, u, v;
- for (i=0; i<frame->height; i++) {
- for(x=0; x<frame->vo_frame.pitches[0]/4; x++) {
- pixel = *(src++);
- *(dst++) = (pixel >> 16) | ((pixel & 0xffff) << 16);
- }
- dst += (frame->pitch-frame->width)/2;
- }
+ for (l=0; l<height; l++) {
+ if (l & 1) {
+ usrc -= (width+1)/2;
+ vsrc -= (width+1)/2;
}
- break;
- case XINE_IMGFMT_YV12: {
- int i, x;
- uint16_t *yptr, y;
- uint8_t *uptr, *vptr, u, v;
- uint32_t *dst;
-
- yptr = (uint16_t *)(void *)frame->vo_frame.base[0];
- uptr = frame->vo_frame.base[1];
- vptr = frame->vo_frame.base[2];
- dst = frame->stripe_dst;
-
- for (i=0; i<frame->height; i++) {
- if (i & 1) {
- uptr -= frame->vo_frame.pitches[1];
- vptr -= frame->vo_frame.pitches[2];
- }
-
- for(x=0; x<frame->vo_frame.pitches[0]/2; x++) {
- y = *(yptr++);
- u = *(uptr++);
- v = *(vptr++);
- *(dst++) = ((y & 0x00ff) << 24) | (v << 16) | (y & 0xff00) | u;
- }
- dst += (frame->pitch-frame->width)/2;
- }
+ for (x=0; x<(width+1)/2; x++) {
+ y = *(ysrc++);
+ u = *(usrc++);
+ v = *(vsrc++);
+ *(dst++) = ((y & 0x00ff) << 24) | (v << 16) | (y & 0xff00) | u;
}
- break;
+ dst += (pitch-width)/2;
}
+
+ return dst;
}
-static void pgx32_frame_proc_slice(vo_frame_t *frame_gen, uint8_t **src)
+/*
+ * XINE VIDEO DRIVER FUNCTIONS
+ */
+
+static void pgx32_frame_proc_frame(vo_frame_t *frame_gen)
{
pgx32_frame_t *frame = (pgx32_frame_t *)frame_gen;
frame->vo_frame.proc_called = 1;
switch (frame->format) {
- case XINE_IMGFMT_YUY2: {
- int i, x, len;
- uint32_t *yptr, *dst, pixel;
-
- yptr = (uint32_t *)(void *)src[0];
- dst = frame->stripe_dst;
-
- len = (frame->lines_remaining > 16) ? 16 : frame->lines_remaining;
- frame->lines_remaining -= len;
-
- for (i=0; i<len; i++) {
- for(x=0; x<frame->vo_frame.pitches[0]/4; x++) {
- pixel = *(yptr++);
- *(dst++) = (pixel >> 16) | ((pixel & 0xffff) << 16);
- }
- dst += (frame->pitch-frame->width)/2;
- }
-
- frame->stripe_dst = dst;
- }
+ case XINE_IMGFMT_YUY2:
+ convert_yuy2((uint32_t *)(void *)frame->vo_frame.base[0], frame->width, frame->pitch, frame->height, frame->stripe_dst);
break;
- case XINE_IMGFMT_YV12: {
- int i, x, len;
- uint16_t *yptr, y;
- uint8_t *uptr, *vptr, u, v;
- uint32_t *dst;
+ case XINE_IMGFMT_YV12:
+ convert_yv12((uint16_t *)(void *)frame->vo_frame.base[0], frame->vo_frame.base[1], frame->vo_frame.base[2], frame->width, frame->pitch, frame->height, frame->stripe_dst);
+ break;
+ }
+}
- yptr = (uint16_t *)(void *)src[0];
- uptr = src[1];
- vptr = src[2];
- dst = frame->stripe_dst;
+static void pgx32_frame_proc_slice(vo_frame_t *frame_gen, uint8_t **src)
+{
+ pgx32_frame_t *frame = (pgx32_frame_t *)frame_gen;
+ int slice_height;
- len = (frame->lines_remaining > 16) ? 16 : frame->lines_remaining;
- frame->lines_remaining -= len;
+ frame->vo_frame.proc_called = 1;
- for (i=0; i<len; i++) {
- if (i & 1) {
- uptr -= frame->vo_frame.pitches[1];
- vptr -= frame->vo_frame.pitches[2];
- }
+ slice_height = (frame->lines_remaining > 16) ? 16 : frame->lines_remaining;
+ frame->lines_remaining -= slice_height;
- for(x=0; x<frame->vo_frame.pitches[0]/2; x++) {
- y = *(yptr++);
- u = *(uptr++);
- v = *(vptr++);
- *(dst++) = ((y & 0x00ff) << 24) | (v << 16) | (y & 0xff00) | u;
- }
- dst += (frame->pitch-frame->width)/2;
- }
+ switch (frame->format) {
+ case XINE_IMGFMT_YUY2:
+ frame->stripe_dst = convert_yuy2((uint32_t *)(void *)src[0], frame->width, frame->pitch, slice_height, frame->stripe_dst);
+ break;
- frame->stripe_dst = dst;
- }
+ case XINE_IMGFMT_YV12:
+ frame->stripe_dst = convert_yv12((uint16_t *)(void *)src[0], src[1], src[2], frame->width, frame->pitch, slice_height, frame->stripe_dst);
break;
}
}
@@ -434,7 +398,8 @@ 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;
+
+ short int *cliprects, wx0, wy0, wx1, wy1, cx0, cy0, cx1, cy1;
if ((frame->width != this->vo_scale.delivered_width) ||
(frame->height != this->vo_scale.delivered_height) ||
@@ -464,94 +429,82 @@ 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);
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);
- /* 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)
- */
+ while(le2me_64(vregs[FIFO_SPACE]) < 24) {}
- 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);
- }
+ vregs[RASTERISER_MODE] = 0;
+ vregs[SCISSOR_MODE] = 0;
+ vregs[AREA_STIPPLE_MODE] = 0;
+ vregs[WINDOW_ORIGIN] = 0;
+
+ 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_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[WRITE_MODE] = le2me_64(1);
+ vregs[WRITE_MASK] = le2me_64(0x00ffffff);
+
+ vregs[YUV_MODE] = le2me_64(1);
+
+ wx0 = this->vo_scale.gui_win_x + this->vo_scale.output_xoffset;
+ wy0 = this->vo_scale.gui_win_y + this->vo_scale.output_yoffset;
+ wx1 = wx0 + this->vo_scale.output_width;
+ wy1 = wy0 + this->vo_scale.output_height;
+
+ cliprects = dga_draw_clipinfo(this->dgadraw);
+ while ((cy0 = *cliprects++) != DGA_Y_EOL) {
+ cy1 = *cliprects++;
+ while ((cx0 = *cliprects++) != DGA_X_EOL) {
+ cx1 = *cliprects++;
+
+ if ((cx0 >= wx1) || (cy0 >= wy1)) {
+ continue;
}
- while(le2me_64(vregs[FIFO_SPACE]) < 6) {}
- vregs[SCISSOR_MODE] = 0;
- }
- else {
- vregs[SCISSOR_MODE] = 0;
- while(le2me_64(vregs[FIFO_SPACE]) < 6) {}
+ if ((cx1 <= wx0) || (cy1 <= wy0)) {
+ continue;
+ }
+ cx0 = (cx0 < wx0) ? wx0 : cx0;
+ cy0 = (cy0 < wy0) ? wy0 : cy0;
+ cx1 = (cx1 > wx1) ? wx1 : cx1;
+ cy1 = (cy1 > wy1) ? wy1 : cy1;
+
+ while(le2me_64(vregs[FIFO_SPACE]) < 4) {}
+ vregs[RECT_ORIGIN] = le2me_64(cx0 | (cy0 << 16));
+ vregs[RECT_SIZE] = le2me_64((cx1-cx0) | ((cy1-cy0) << 16));
+ vregs[TEXTURE_BASE_ADDR] = le2me_64(((GFXP_VRAM_MMAPLEN-frame->packedlen) >> 1) + (((cx0-wx0)*frame->width)/this->vo_scale.output_width) + (((cy0-wy0)*frame->height)/this->vo_scale.output_height) * frame->pitch);
vregs[RENDER] = le2me_64(RENDER_BEGIN);
}
+ }
- vregs[TEXTURE_ADDR_MODE] = 0;
- vregs[TEXTURE_READ_MODE] = 0;
- vregs[TEXTURE_COLOUR_MODE] = 0;
- vregs[DITHERING_MODE] = 0;
- vregs[YUV_MODE] = 0;
+ while(le2me_64(vregs[FIFO_SPACE]) < 5) {}
+ 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);
- }
+ DGA_DRAW_UNLOCK(this->dgadraw);
+ XUnlockDisplay(this->display);
if (this->current != NULL) {
this->current->vo_frame.free(&this->current->vo_frame);
@@ -699,12 +652,12 @@ static int pgx32_gui_data_exchange(vo_driver_t *this_gen, int data_type, void *d
XLockDisplay(this->display);
XDgaUnGrabDrawable(this->dgadraw);
XFreeGC(this->display, this->gc);
- 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);
+ XGetWindowAttributes(this->display, this->drawable, &win_attrs);
+ this->depth = win_attrs.depth;
+ this->visual = win_attrs.visual;
XUnlockDisplay(this->display);
}
break;
@@ -785,7 +738,7 @@ static vo_driver_t *pgx32_init_driver(video_driver_class_t *class_gen, const voi
{
pgx32_driver_class_t *class = (pgx32_driver_class_t *)(void *)class_gen;
char *devname;
- int fbfd, i;
+ int fbfd;
struct vis_identifier ident;
struct fbgattr attr;
uint8_t *vbase;
@@ -800,34 +753,36 @@ static vo_driver_t *pgx32_init_driver(video_driver_class_t *class_gen, const voi
class->instance_count++;
pthread_mutex_unlock(&class->mutex);
- devname = class->config->register_string(class->config, "video.pgx32_device", "/dev/fb", "name of pgx32 device", NULL, 10, NULL, NULL);
+ devname = class->config->register_string(class->config, "video.pgx32_device", "/dev/fb", _("path to pgx32 device"), NULL, 10, NULL, NULL);
if ((fbfd = open(devname, O_RDWR)) < 0) {
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx32: Error: can't open framebuffer device '%s'\n", devname);
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx32: Error: can't open framebuffer device '%s'\n"), devname);
return NULL;
}
if (ioctl(fbfd, VIS_GETIDENTIFIER, &ident) < 0) {
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx32: Error: ioctl failed, unable to determine framebuffer type\n");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx32: Error: ioctl failed, bad device\n"));
close(fbfd);
return NULL;
}
if (strcmp("TSIgfxp", ident.name) != 0) {
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx32: Error: '%s' is not a gfxp framebuffer device\n", devname);
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx32: Error: '%s' is not a pgx32 framebuffer device\n"), devname);
close(fbfd);
return NULL;
}
if (ioctl(fbfd, FBIOGATTR, &attr) < 0) {
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx32: Error: ioctl failed, unable to determine framebuffer characteristics\n");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx32: Error: ioctl failed, bad device\n"));
close(fbfd);
return NULL;
}
if ((vbase = mmap(0, GFXP_VRAM_MMAPLEN, PROT_READ | PROT_WRITE, MAP_SHARED, fbfd, 0x04000000)) == MAP_FAILED) {
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx32: Error: unable to memory map framebuffer\n");
return 0;
}
if (mmap(vbase+GFXP_REGSBASE, GFXP_REGS_MMAPLEN, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, fbfd, 0x02000000) == MAP_FAILED) {
+ xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx32: Error: unable to memory map framebuffer\n");
munmap(vbase, GFXP_VRAM_MMAPLEN);
return 0;
}
@@ -865,12 +820,6 @@ static vo_driver_t *pgx32_init_driver(video_driver_class_t *class_gen, const voi
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) {
- this->screen_pitch_code = pitch_code_table[i][1];
- }
- }
-
this->display = ((x11_visual_t *)visual_gen)->display;
this->screen = ((x11_visual_t *)visual_gen)->screen;
this->drawable = ((x11_visual_t *)visual_gen)->d;
diff --git a/src/video_out/video_out_pgx64.c b/src/video_out/video_out_pgx64.c
index a1dade76d..69a552c1b 100644
--- a/src/video_out/video_out_pgx64.c
+++ b/src/video_out/video_out_pgx64.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_pgx64.c,v 1.55 2004/04/16 12:17:03 komadori Exp $
+ * $Id: video_out_pgx64.c,v 1.56 2004/04/25 15:05:31 komadori Exp $
*
* video_out_pgx64.c, Sun PGX64/PGX24 output plugin for xine
*
@@ -41,10 +41,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
-
-#ifdef HAVE_SUNDGA
#include <dga/dga.h>
-#endif
#include "xine_internal.h"
#include "alphablend.h"
@@ -118,19 +115,6 @@ static const int scaler_regs_table[2][3] = {
{SCALER_BUF1_OFFSET, SCALER_BUF1_OFFSET_U, SCALER_BUF1_OFFSET_V}
};
-/* Overlay modes */
-
-#define OVL_MODE_ALPHA_BLEND 0
-#define OVL_MODE_EXCLUSIVE 1
-#define OVL_MODE_CHROMA_KEY 2
-
-static const char *overlay_modes[] = {
- "alpha blend to normal overlay",
- "alpha blend to exclusive overlay",
- "chroma key graphics",
- NULL
-};
-
/* Structures */
struct pgx64_overlay_s {
@@ -175,17 +159,15 @@ typedef struct {
uint8_t *vbase, *buffer_ptrs[2][3];
Display *display;
- int screen, depth, dgavis;
+ int screen, depth;
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;
+ int chromakey_en, chromakey_changed, chromakey_regen_needed;
+ pthread_mutex_t chromakey_mutex;
pgx64_overlay_t *first_overlay;
int multibuf_en, buf_mode, dblbuf_select, delivered_format;
@@ -251,11 +233,11 @@ static void repaint_output_area(pgx64_driver_t *this)
XFlush(this->display);
XUnlockDisplay(this->display);
- pthread_mutex_lock(&this->ovl_mutex);
- if (this->ovl_mode == OVL_MODE_CHROMA_KEY) {
+ pthread_mutex_lock(&this->chromakey_mutex);
+ if (this->chromakey_en) {
draw_overlays(this);
}
- pthread_mutex_unlock(&this->ovl_mutex);
+ pthread_mutex_unlock(&this->chromakey_mutex);
}
/*
@@ -456,10 +438,17 @@ static void pgx64_display_frame(vo_driver_t *this_gen, vo_frame_t *frame_gen)
}
}
+ DGA_DRAW_LOCK(this->dgadraw, -1);
+ this->vo_scale.force_redraw = this->vo_scale.force_redraw || DGA_DRAW_MODIF(this->dgadraw);
+ DGA_DRAW_UNLOCK(this->dgadraw);
+
if (_x_vo_scale_redraw_needed(&this->vo_scale)) {
+ short int *cliprects, wx0, wy0, wx1, wy1, cx0, cy0, cx1, cy1;
+ int dgavis;
+
_x_vo_scale_compute_output_size(&this->vo_scale);
repaint_output_area(this);
- this->ovl_regen_needed = 1;
+ this->chromakey_regen_needed = 1;
vregs[BUS_CNTL] |= le2me_32(BUS_EXT_REG_EN);
vregs[OVERLAY_SCALE_CNTL] = 0;
@@ -482,23 +471,40 @@ 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));
-#ifdef HAVE_SUNDGA
+ wx0 = this->vo_scale.gui_win_x + this->vo_scale.output_xoffset;
+ wy0 = this->vo_scale.gui_win_y + this->vo_scale.output_yoffset;
+ wx1 = wx0 + this->vo_scale.output_width;
+ wy1 = wy0 + this->vo_scale.output_height;
+
DGA_DRAW_LOCK(this->dgadraw, -1);
- this->dgavis = dga_draw_visibility(this->dgadraw);
- DGA_DRAW_UNLOCK(this->dgadraw);
-#endif
+ dgavis = DGA_VIS_FULLY_OBSCURED;
+ cliprects = dga_draw_clipinfo(this->dgadraw);
+ while ((cy0 = *cliprects++) != DGA_Y_EOL) {
+ cy1 = *cliprects++;
+ while ((cx0 = *cliprects++) != DGA_X_EOL) {
+ cx1 = *cliprects++;
+
+ if (((cx0 >= wx0) && (cy0 >= wy0)) || ((cx1 <= wx1) && (cy1 <= wy1))) {
+ dgavis = DGA_VIS_PARTIALLY_OBSCURED;
+ }
+ if ((cx0 <= wx0) && (cy0 <= wy0) && (cx1 >= wx1) && (cy1 >= wy1)) {
+ dgavis = DGA_VIS_UNOBSCURED;
+ }
+ }
+ }
- 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;
+ if (dgavis == DGA_VIS_UNOBSCURED) {
+ 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_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_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);
+ }
+ if (dgavis != DGA_VIS_FULLY_OBSCURED) {
vregs[OVERLAY_SCALE_CNTL] = le2me_32(OVERLAY_SCALE_EN);
}
+ DGA_DRAW_UNLOCK(this->dgadraw);
}
if (this->buf_mode == BUF_MODE_MULTI) {
@@ -595,12 +601,12 @@ static void pgx64_overlay_begin(vo_driver_t *this_gen, vo_frame_t *frame_gen, in
pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen;
/*pgx64_frame_t *frame = (pgx64_frame_t *)frame_gen;*/
- if ((this->ovl_mode == OVL_MODE_CHROMA_KEY) && (changed || this->ovl_regen_needed)) {
+ if ((this->chromakey_en) && (changed || this->chromakey_regen_needed)) {
pgx64_overlay_t *ovl, *next_ovl;
- this->ovl_regen_needed = 0;
- this->ovl_changed = 1;
- pthread_mutex_lock(&this->ovl_mutex);
+ this->chromakey_regen_needed = 0;
+ this->chromakey_changed = 1;
+ pthread_mutex_lock(&this->chromakey_mutex);
XLockDisplay(this->display);
XSetForeground(this->display, this->gc, this->colour_key);
@@ -627,7 +633,7 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen
pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen;
pgx64_frame_t *frame = (pgx64_frame_t *)frame_gen;
- pgx64_overlay_t *ovl, **ovl_ptr;
+ pgx64_overlay_t *ovl, **chromakey_ptr;
int x_scale, y_scale, i, x, y, len, width;
int use_clip_palette, max_palette_colour[2];
unsigned long palette[2][OVL_PALETTE_SIZE];
@@ -744,11 +750,11 @@ static void pgx64_overlay_key_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen
}
XUnlockDisplay(this->display);
- ovl_ptr = &this->first_overlay;
- while ( *ovl_ptr != NULL) {
- ovl_ptr = &( *ovl_ptr)->next;
+ chromakey_ptr = &this->first_overlay;
+ while ( *chromakey_ptr != NULL) {
+ chromakey_ptr = &( *chromakey_ptr)->next;
}
- *ovl_ptr = ovl;
+ *chromakey_ptr = ovl;
}
static void pgx64_overlay_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen, vo_overlay_t *overlay)
@@ -757,7 +763,7 @@ static void pgx64_overlay_blend(vo_driver_t *this_gen, vo_frame_t *frame_gen, vo
pgx64_frame_t *frame = (pgx64_frame_t *)frame_gen;
if (overlay->rle) {
- if (this->ovl_changed) {
+ if (this->chromakey_changed) {
pgx64_overlay_key_blend(this_gen, frame_gen, overlay);
}
else {
@@ -797,10 +803,10 @@ static void pgx64_overlay_end(vo_driver_t *this_gen, vo_frame_t *frame_gen)
pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen;
/*pgx64_frame_t *frame = (pgx64_frame_t *)frame_gen;*/
- if (this->ovl_changed) {
+ if (this->chromakey_changed) {
draw_overlays(this);
- pthread_mutex_unlock(&this->ovl_mutex);
- this->ovl_changed = 0;
+ pthread_mutex_unlock(&this->chromakey_mutex);
+ this->chromakey_changed = 0;
}
}
@@ -915,20 +921,16 @@ static int pgx64_gui_data_exchange(vo_driver_t *this_gen, int data_type, void *d
XWindowAttributes win_attrs;
XLockDisplay(this->display);
-#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;
this->drawable = (Drawable)data;
- this->cmap = XCreateColormap(this->display, this->drawable, this->visual, AllocNone);
- XSetWindowColormap(this->display, this->drawable, this->cmap);
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);
}
break;
@@ -961,15 +963,13 @@ static int pgx64_redraw_needed(vo_driver_t *this_gen)
pgx64_driver_t *this = (pgx64_driver_t *)(void *)this_gen;
int modif = 0;
-#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;
+ this->chromakey_regen_needed = 1;
return 1;
}
@@ -986,9 +986,7 @@ 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);
@@ -1017,7 +1015,7 @@ static void pgx64_config_changed(void *user_data, xine_cfg_entry_t *entry)
pgx64_set_property(this_gen, VO_PROP_SATURATION, entry->num_value);
}
else if (strcmp(entry->key, "video.pgx64_overlay_mode") == 0) {
- this->ovl_mode = entry->num_value;
+ this->chromakey_en = entry->num_value;
}
else if (strcmp(entry->key, "video.pgx64_multibuf_en") == 0) {
this->multibuf_en = entry->num_value;
@@ -1059,20 +1057,20 @@ static vo_driver_t *pgx64_init_driver(video_driver_class_t *class_gen, const voi
class->instance_count++;
pthread_mutex_unlock(&class->mutex);
- devname = class->config->register_string(class->config, "video.pgx64_device", "/dev/fb", "name of pgx64 device", NULL, 10, NULL, NULL);
+ devname = class->config->register_string(class->config, "video.pgx64_device", "/dev/fb", _("path to pgx64/pgx24 device"), NULL, 10, NULL, NULL);
if ((fbfd = open(devname, O_RDWR)) < 0) {
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx64: Error: can't open framebuffer device '%s'\n", devname);
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx64: Error: can't open framebuffer device '%s'\n"), devname);
return NULL;
}
if (ioctl(fbfd, FBIOGATTR, &attr) < 0) {
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx64: Error: ioctl failed, unable to determine framebuffer characteristics\n");
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx64: Error: ioctl failed, bad device\n"));
close(fbfd);
return NULL;
}
if (attr.real_type != 22) {
- xprintf(class->xine, XINE_VERBOSITY_DEBUG, "video_out_pgx64: Error: '%s' is not a mach64 framebuffer device\n", devname);
+ xprintf(class->xine, XINE_VERBOSITY_LOG, _("video_out_pgx64: Error: '%s' is not a pgx64/pgx24 framebuffer device\n"), devname);
close(fbfd);
return NULL;
}
@@ -1124,9 +1122,7 @@ static vo_driver_t *pgx64_init_driver(video_driver_class_t *class_gen, const voi
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;
@@ -1135,13 +1131,13 @@ static vo_driver_t *pgx64_init_driver(video_driver_class_t *class_gen, const voi
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);
- this->saturation = class->config->register_range(this->class->config, "video.pgx64_saturation", 16, 0, 31, "video overlay saturation", NULL, 10, pgx64_config_changed, this);
- this->ovl_mode = class->config->register_enum(this->class->config, "video.pgx64_overlay_mode", 0, (char **)overlay_modes, "video overlay mode", NULL, 10, pgx64_config_changed, this);
- this->multibuf_en = class->config->register_bool(this->class->config, "video.pgx64_multibuf_en", 1, "enable multi-buffering", NULL, 10, pgx64_config_changed, this);
+ 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);
+ this->saturation = class->config->register_range(this->class->config, "video.pgx64_saturation", 16, 0, 31, _("video overlay saturation"), NULL, 10, pgx64_config_changed, this);
+ this->chromakey_en = class->config->register_bool(this->class->config, "video.pgx64_chromakey_en", 0, _("enable chroma keying"), NULL, 10, pgx64_config_changed, this);
+ this->multibuf_en = class->config->register_bool(this->class->config, "video.pgx64_multibuf_en", 1, _("enable multi-buffering"), NULL, 10, pgx64_config_changed, this);
- pthread_mutex_init(&this->ovl_mutex, NULL);
+ pthread_mutex_init(&this->chromakey_mutex, NULL);
return (vo_driver_t *)this;
}
@@ -1165,9 +1161,7 @@ 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;