mirror of
https://github.com/mpv-player/mpv
synced 2025-01-20 21:07:29 +01:00
upgraded to newest vidix interface. in eq: return if g200 moved to the beginning of seteq
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4327 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
1b66c9ef9c
commit
c5c4f37195
@ -10,8 +10,10 @@
|
|||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
* fix doublebuffering for vidix
|
* fix doublebuffering for vidix
|
||||||
* fix pci_config_read for option word (memory size detection)
|
* fix memory size detection (current reading pci userconfig isn't
|
||||||
|
working as requested - returns the max avail. ram on arch?)
|
||||||
* fix/complete brightness/contrast handling (Nick)
|
* fix/complete brightness/contrast handling (Nick)
|
||||||
|
MGA users: please test this! (#define MGA_EQUALIZER)
|
||||||
* translate all non-english comments to english
|
* translate all non-english comments to english
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -38,6 +40,7 @@
|
|||||||
// Set this value, if autodetection fails! (video ram size in megabytes)
|
// Set this value, if autodetection fails! (video ram size in megabytes)
|
||||||
// #define MGA_MEMORY_SIZE 16
|
// #define MGA_MEMORY_SIZE 16
|
||||||
|
|
||||||
|
/* No irq support in userspace implemented yet, do not enable this! */
|
||||||
/* disable irq */
|
/* disable irq */
|
||||||
#undef MGA_ALLOW_IRQ
|
#undef MGA_ALLOW_IRQ
|
||||||
|
|
||||||
@ -47,6 +50,8 @@
|
|||||||
|
|
||||||
#undef MGA_PCICONFIG_MEMDETECT
|
#undef MGA_PCICONFIG_MEMDETECT
|
||||||
|
|
||||||
|
#define MGA_DEFAULT_FRAMES 1
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -54,8 +59,6 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
|
||||||
//#include "../../libvo/fastmemcpy.h"
|
|
||||||
|
|
||||||
#include "../vidix.h"
|
#include "../vidix.h"
|
||||||
#include "../fourcc.h"
|
#include "../fourcc.h"
|
||||||
#include "../../libdha/libdha.h"
|
#include "../../libdha/libdha.h"
|
||||||
@ -82,10 +85,10 @@ static int probed = 0;
|
|||||||
static pciinfo_t pci_info;
|
static pciinfo_t pci_info;
|
||||||
|
|
||||||
/* internal booleans */
|
/* internal booleans */
|
||||||
static uint32_t mga_vid_in_use = 0;
|
static int mga_vid_in_use = 0;
|
||||||
static uint32_t is_g400 = 0;
|
static int is_g400 = 0;
|
||||||
static uint32_t vid_src_ready = 0;
|
static int vid_src_ready = 0;
|
||||||
static uint32_t vid_overlay_on = 0;
|
static int vid_overlay_on = 0;
|
||||||
|
|
||||||
/* mapped physical addresses */
|
/* mapped physical addresses */
|
||||||
static uint8_t *mga_mmio_base = 0;
|
static uint8_t *mga_mmio_base = 0;
|
||||||
@ -111,6 +114,7 @@ static int mga_next_frame = 0;
|
|||||||
static vidix_capability_t mga_cap =
|
static vidix_capability_t mga_cap =
|
||||||
{
|
{
|
||||||
"Matrox MGA G200/G400 YUV Video",
|
"Matrox MGA G200/G400 YUV Video",
|
||||||
|
"Aaron Holtzman, Arpad Gereoffy, Alex Beregszaszi, Nick Kurshev",
|
||||||
TYPE_OUTPUT,
|
TYPE_OUTPUT,
|
||||||
{ 0, 0, 0, 0 },
|
{ 0, 0, 0, 0 },
|
||||||
1600, /* 2048x2048 is supported if Pontscho is right */
|
1600, /* 2048x2048 is supported if Pontscho is right */
|
||||||
@ -124,7 +128,7 @@ static vidix_capability_t mga_cap =
|
|||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
VENDOR_MATROX,
|
VENDOR_MATROX,
|
||||||
0,
|
-1, /* will be set in vixProbe */
|
||||||
{ 0, 0, 0, 0}
|
{ 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -714,8 +718,9 @@ int vixConfigPlayback(vidix_playback_t *config)
|
|||||||
|
|
||||||
if ((config->num_frames < 1) || (config->num_frames > 4))
|
if ((config->num_frames < 1) || (config->num_frames > 4))
|
||||||
{
|
{
|
||||||
printf("[mga] illegal num_frames: %d, setting to 1\n", config->num_frames);
|
printf("[mga] illegal num_frames: %d, setting to %d\n",
|
||||||
config->num_frames = 1;
|
config->num_frames, MGA_DEFAULT_FRAMES);
|
||||||
|
config->num_frames = MGA_DEFAULT_FRAMES;
|
||||||
// return(EINVAL);
|
// return(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -734,15 +739,13 @@ int vixConfigPlayback(vidix_playback_t *config)
|
|||||||
|
|
||||||
if ((sw < 4) || (sh < 4) || (dw < 4) || (dh < 4))
|
if ((sw < 4) || (sh < 4) || (dw < 4) || (dh < 4))
|
||||||
{
|
{
|
||||||
printf("[mga] Invalid src/dest dimenstions\n");
|
printf("[mga] Invalid src/dest dimensions\n");
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//FIXME check that window is valid and inside desktop
|
//FIXME check that window is valid and inside desktop
|
||||||
|
|
||||||
// printf("[mga] vcount = %d\n", readl(mga_mmio_base + VCOUNT));
|
// printf("[mga] vcount = %d\n", readl(mga_mmio_base + VCOUNT));
|
||||||
printf("[mga] mga_mmio_base = %p\n",mga_mmio_base);
|
|
||||||
printf("[mga] mga_mem_base = %08x\n",mga_mem_base);
|
|
||||||
|
|
||||||
config->offsets[0] = 0;
|
config->offsets[0] = 0;
|
||||||
config->offsets[1] = config->frame_size;
|
config->offsets[1] = config->frame_size;
|
||||||
@ -764,6 +767,9 @@ int vixConfigPlayback(vidix_playback_t *config)
|
|||||||
case IMGFMT_UYVY:
|
case IMGFMT_UYVY:
|
||||||
config->frame_size = ((sw + 31) & ~31) * sh * 2;
|
config->frame_size = ((sw + 31) & ~31) * sh * 2;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
printf("[mga] Unsupported pixel format: %x\n", config->fourcc);
|
||||||
|
return(ENOTSUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// config->frame_size = config->src.h*config->src.w+(config->src.w*config->src.h)/2;
|
// config->frame_size = config->src.h*config->src.w+(config->src.w*config->src.h)/2;
|
||||||
@ -784,6 +790,9 @@ int vixConfigPlayback(vidix_playback_t *config)
|
|||||||
|
|
||||||
config->dga_addr = mga_mem_base + mga_src_base;
|
config->dga_addr = mga_mem_base + mga_src_base;
|
||||||
|
|
||||||
|
/* for G200 set Interleaved UV planes */
|
||||||
|
if (!is_g400)
|
||||||
|
config->flags = VID_PLAY_INTERLEAVED_UV | INTERLEAVING_UV;
|
||||||
|
|
||||||
//Setup the BES registers for a three plane 4:2:0 video source
|
//Setup the BES registers for a three plane 4:2:0 video source
|
||||||
|
|
||||||
@ -841,9 +850,6 @@ int vixConfigPlayback(vidix_playback_t *config)
|
|||||||
regs.besglobctl = 1<<6; // UYVY format selected
|
regs.besglobctl = 1<<6; // UYVY format selected
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
printf("[mga] Unsupported pixel format: %x\n", config->fourcc);
|
|
||||||
return(ENOTSUP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1096,10 +1102,6 @@ switch(config->fourcc){
|
|||||||
+ (0<<28) // static subpicture key
|
+ (0<<28) // static subpicture key
|
||||||
*/ ;
|
*/ ;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
|
||||||
printf("[mga] Unsupported pixel format: %x\n",config->fourcc);
|
|
||||||
return(ENOTSUP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cregs.c2hparam=((hdispend - 8) << 16) | (htotal - 8);
|
cregs.c2hparam=((hdispend - 8) << 16) | (htotal - 8);
|
||||||
@ -1449,9 +1451,20 @@ int vixPlaybackSetEq( const vidix_video_eq_t * eq)
|
|||||||
{
|
{
|
||||||
uint32_t beslumactl;
|
uint32_t beslumactl;
|
||||||
int brightness,contrast;
|
int brightness,contrast;
|
||||||
|
|
||||||
|
/* contrast and brightness control isn't supported with G200,
|
||||||
|
don't enable c/b control and set values, just return error -- alex */
|
||||||
|
if (!is_g400)
|
||||||
|
{
|
||||||
|
if (mga_verbose > 1)
|
||||||
|
printf("[mga] equalizer isn't supported with G200\n");
|
||||||
|
return ENOSYS;
|
||||||
|
}
|
||||||
|
|
||||||
if(eq->cap & VEQ_CAP_BRIGHTNESS) equal.brightness = eq->brightness;
|
if(eq->cap & VEQ_CAP_BRIGHTNESS) equal.brightness = eq->brightness;
|
||||||
if(eq->cap & VEQ_CAP_CONTRAST) equal.contrast = eq->contrast;
|
if(eq->cap & VEQ_CAP_CONTRAST) equal.contrast = eq->contrast;
|
||||||
equal.flags = eq->flags;
|
equal.flags = eq->flags;
|
||||||
|
|
||||||
//Enable contrast and brightness control
|
//Enable contrast and brightness control
|
||||||
writel(readl(mga_mmio_base + BESGLOBCTL) & ~((1<<5) + (1<<7)),mga_mmio_base + BESGLOBCTL);
|
writel(readl(mga_mmio_base + BESGLOBCTL) & ~((1<<5) + (1<<7)),mga_mmio_base + BESGLOBCTL);
|
||||||
brightness = (equal.brightness * 128) / 1000;
|
brightness = (equal.brightness * 128) / 1000;
|
||||||
@ -1462,11 +1475,7 @@ int vixPlaybackSetEq( const vidix_video_eq_t * eq)
|
|||||||
if(contrast > 255) contrast = 255;
|
if(contrast > 255) contrast = 255;
|
||||||
beslumactl = ((brightness & 0xff) << 16) | (contrast & 0xff);
|
beslumactl = ((brightness & 0xff) << 16) | (contrast & 0xff);
|
||||||
|
|
||||||
if (is_g400)
|
writel(beslumactl,mga_mmio_base + BESLUMACTL);
|
||||||
writel(beslumactl,mga_mmio_base + BESLUMACTL);
|
|
||||||
else
|
|
||||||
if (mga_verbose > 1)
|
|
||||||
printf("[mga] equalizer isn't supported with G200\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user