bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SVGA console


From: Marco Gerards
Subject: Re: SVGA console
Date: 27 Aug 2003 20:52:42 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Hi,

"Peter 'p2' De Schrijver" <p2@mind.be> writes:

> struct syncinfo {
>       enum { SPLIT_SYNC, CSYNC, SYNC_ON_COLOR } type;
>       union {
>               struct {
>                       polarity hsync_pol;
>                       polarity vsync_pol;
>               } split_sync;
>               struct {
>                       polarity csync_pol;
>               } csync;
>               struct {
>                       polarity pol;
>                       enum {RED, GREEN, BLUE} color;
>               } sync_on_color;
>       } sync_parameters;
> };
> 
> typedef unsigned int display_flags;
> 
> #define DISPLAY_FLAGS_LACE    (1<<0)
> #define DISPLAY_FLAGS_EXTSYNC         (1<<1)
> #define DISPLAY_FLAGS_DOUBLE  (1<<2)

Ah, thanks. I've updated the interfaces to use this. I've changed it a
bit and added some comments, can you have a look at the new interfaces
if this update was sane?
 
[...]

> I wuould rather have :
> error_t (*set_horiz_timings) (unsigned xres, unsigned left, unsigned
> right, unsigned hslen);
> 
> /* set number of visible horizontal pixels to xres,
>    set number of left margin pixels to left,
>    set number of right margin pixels to right,
>    set horizontal sync pulse width to hslen */

Yes, that is much better. I will update the interfaces soon. I haven't
done this because it requires that all modelines will be updated (yes,
I'm lazy :)).

[...]

> error_t (*set_syncinfo) (struct syncinfo *si);
> 
> error_t (*get_syncinfo) (struct syncinfo *si);
> 
> error_t (*set_options) (display_flags flags);
> 
> error_t (*get_options) (display_flags *flags);

I've added these too. Thanks.

Thanks,
Marco


The new interfaces:

/* video-driver.h - Video driver interfaces.
   Copyright (C) 2003 Free Software Foundation, Inc.
   Written by Marco Gerards.

   This file is part of the GNU Hurd.

   The GNU Hurd is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2, or (at
   your option) any later version.

   The GNU Hurd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA. */

/* The powermodes that can be used to configure the power state of the
   monitor.  */

#ifndef _VIDEO_DRIVER_H_
#define _VIDEO_DRIVER_H_ 1

/* DPMS powermodes.  */
enum powermode
  {
    /* Normal operation.  */
    PM_ON,
    PM_STANDBY,
    PM_SUSPEND,
    /* Turn the screen off.  */
    PM_OFF
  };

typedef enum powermode powermode_t;

/* Use polarity to use for syncing.  */
typedef enum polarity
  {
    POLARITY_LOW,
    POLARITY_HIGH
  } polarity_t;

/* The kind of sync signal that should be used.  */
typedef struct syncinfo
{
  enum
    {
      /* The videocard use the HSYNC and VSYNC lines to inform the
         monitor of the sync.  */
      SPLIT_SYNC,
      /* The monitor uses only one line for both HSYNC and VSYNC.  */
      CSYNC,
      /* The monitor uses no seperate line for the sync; it uses one
         of the color lines instead.  */
      SYNC_ON_COLOR
    } type;
  union
  {
    struct 
    {
      polarity_t hsync_pol;
      polarity_t vsync_pol;
    } split_sync;
    struct
    {
      polarity_t csync_pol;
    } csync;
    struct
    {
      polarity_t pol;
      /* The color line that is used for syncing.  */
      enum 
        {
          RED,
          GREEN, 
          BLUE
        } color;
    } sync_on_color;
  } sync_parameters;
} syncinfo_t;

typedef unsigned int display_flags_t;

/* Use interlacing.  */
#define DISPLAY_FLAGS_LACE      (1 << 0);
/* Use a pixelclock from an external source (genlock?)  */
#define DISPLAY_FLAGS_EXTSYNC   (1 << 1);
/* Use doublescan.  Every line is shown twice, used for low resolution
   modes.  */
#define DISPLAY_FLAGS_DOUBLE    (1 << 2);

/* Information and interfaces for a video driver.  */
struct video_driver
{
  /* Name of driver name.  */
  const char *driver_name;

  /* Name of videocard or videochipset.  This information is available
     after initialisation with init.  It can be set to NULL when it is
     not relevant.  */
  char *card_sub_name;

  /* Maximum allowed values.  XXX: Are more maximum values
     required?  */
  int max_hdisplay_end;
  int max_hsync_start;
  int max_hblank_start;
  int max_htotal;
  int max_vdisplay_end;
  int max_vsync_start;
  int max_vblank_start;
  int max_vtotal;

  /* Initialise video driver.  If the hardware is not available or
     usable ENODEV is returned.  */
  error_t (*init) (void);

  /* Deinitialize the driver.  */
  error_t (*fini) (void);

  /* Set the last visible pixel on the display to END.  Set the first
     pixel of the horizontal retrace to SYNC_START and its last pixel
     to SYNC_END.  Set the last pixel of the screen to TOTAL, after
     this the new line will begin.  END, SYNC_START, SYNC_END and
     TOTAL must be multiples of 8.  Return EOVERFLOW when the hardware
     can't setup the hardware registers without overflowing them, in
     that case the videomode is not available.  */
  error_t (*set_horiz_timings) (int xres, int sync_start, int sync_end,
                                int total);

  /* Return in END the last visible pixel on the screen, in SYNC_START
     the pixel on which the horizontal retrace starts, in SYNC_END the
     pixel on which the horizontal retrace ends and in TOTAL the last
     pixel of the screen.  Never return values that are not usable
     with set_horiz_timings.  */
  error_t (*get_horiz_timings) (int *xres, int *sync_start, int *sync_end,
                                int *total);

  /* Set the last visible scanline on the display to END.  Set the
     first scanline of the horizontal retrace to SYNC_START and its
     last scanline to SYNC_END.  Set the last scanline of the screen
     to TOTAL, after this the new vertical period will begin.  Return
     EOVERFLOW when the hardware can't setup the hardware registers
     without overflowing them, in that case the videomode is not
     available.  */
  error_t (*set_vert_timings) (int yres, int sync_start, int sync_end,
                               int total);

  /* Return in END the last visible scanline on the screen, in
     SYNC_START the scanline on which the horizontal retrace starts,
     in SYNC_END the scanline on which the horizontal retrace ends and
     in TOTAL the last scanline of the screen.  Never return values
     that are not usable with set_vert_timings.  */
  error_t (*get_vert_timings) (int *yres, int *sync_start, int *sync_end,
                               int *total);

  /* Set the timer to FREQUENCY Khz, the frequency used by the
     hardware may be DEVIATION Hhz more or less than FREQUENCY.  If
     the pixelclock cannot be set to FREQUENCY with the deviation
     DEVIATION return EINVAL.  */
  error_t (*set_pixclock) (long frequency, int deviation);

  /* Test if there is a pixelclock with FREQUENCY Khz available, the
     frequency used by the hardware may be DEVIATION Khz more or less
     than FREQUENCY.  Return 1 if a clock is available, return 0
     otherwise.  */
  int (*test_pixclock) (long frequency, int deviation);

  /* Set the powermode of the monitor connected to this card to
     POWERMODE.  If this mode is not supported, return EINVAL.  */
  error_t (*set_powermode) (powermode_t powermode);

  /* Get the current powermode, it is guaranteed that the returned
     powermode is setable with set_powermode.  */
  powermode_t (*get_powermode) (void);

  /* Set the kind of syncronisation used to SI.  */
  error_t (*set_syncinfo) (syncinfo_t *si);

  /* Get the kind of syncronisation that is used.  Return the
     information in *SI.  SI should have been allocated by the
     caller.  */
  error_t (*get_syncinfo) (syncinfo_t *si);

  /* Use the options in FLAGS for producing display output.  */
  error_t (*set_options) (display_flags_t flags);

  /* Get the currently used options and return them in FLAGS.  */
  error_t (*get_options) (display_flags_t *flags);
};

typedef struct video_driver *video_driver_t;


/* Available video drivers.  */

/* The video driver that is used.  This is one of the drivers
   below.  */
video_driver_t video_driver;

/* The VGA driver.  It only supports the minimal VGA hardware, a 25
   and 28 Mhz clock.  This driver is also used by other drivers for
   SVGA cards.  */
extern const video_driver_t video_driver_vga;

/* The driver for S3 videochips.  Only the S3 Trio is currently
   supported, this chipset has a programmable clock.  */
extern const video_driver_t video_driver_s3;

#endif  /* _VIDEO_DRIVER_H_ */





reply via email to

[Prev in Thread] Current Thread [Next in Thread]