Ejemplo n.º 1
0
static void mainmenu_draw(menu_t *menu) {
  modeset_draw(menu);

  /* draw the two video mode lines */
  osd_gotoxy(menu->xpos + menu->xsize - 20, menu->ypos + menu->ysize - 3);
  osd_puts("Input : ");
  print_resolution();
  osd_gotoxy(menu->xpos + menu->xsize - 20, menu->ypos + menu->ysize - 2);

  uint32_t outputlines = video_out_lines[current_videomode];
  bool interlaced = false;

  if (current_videomode <= VIDMODE_576i &&
      (video_settings[current_videomode] & VIDEOIF_SET_LD_ENABLE))
    outputlines *= 2;

  if (outputlines & 1) {
    outputlines *= 2;
    interlaced   = true;
  }

  printf("Output: 720x%3d%c%d",
         outputlines & ~3,
         interlaced  ? 'i' : 'p',
         (current_videomode & 1) ? 50 : 60);
}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
	int ret, fd;
	const char *card;
	struct modeset_dev *iter;
	struct modeset_buf *buf;

	/* check which DRM device to open */
	if (argc > 1)
		card = argv[1];
	else
		card = "/dev/dri/card0";

	fprintf(stderr, "using card '%s'\n", card);

	/* open the DRM device */
	ret = modeset_open(&fd, card);
	if (ret)
		goto out_return;

	/* prepare all connectors and CRTCs */
	ret = modeset_prepare(fd);
	if (ret)
		goto out_close;

	/* perform actual modesetting on each found connector+CRTC */
	for (iter = modeset_list; iter; iter = iter->next) {
		iter->saved_crtc = drmModeGetCrtc(fd, iter->crtc);
		buf = &iter->bufs[iter->front_buf];
		ret = drmModeSetCrtc(fd, iter->crtc, buf->fb, 0, 0,
				     &iter->conn, 1, &iter->mode);
		if (ret)
			fprintf(stderr, "cannot set CRTC for connector %u (%d): %m\n",
				iter->conn, errno);
	}

	/* draw some colors for 5seconds */
	modeset_draw(fd);

	/* cleanup everything */
	modeset_cleanup(fd);

	ret = 0;

out_close:
	close(fd);
out_return:
	if (ret) {
		errno = -ret;
		fprintf(stderr, "modeset failed with error %d: %m\n", errno);
	} else {
		fprintf(stderr, "exiting\n");
	}
	return ret;
}
Ejemplo n.º 3
0
static void modeset_render(Modeset *m, grdev_display *d) {
        const grdev_display_target *t;

        m->r = next_color(&m->r_up, m->r, 4);
        m->g = next_color(&m->g_up, m->g, 3);
        m->b = next_color(&m->b_up, m->b, 2);

        GRDEV_DISPLAY_FOREACH_TARGET(d, t) {
                modeset_draw(m, t);
                grdev_display_flip_target(d, t);
        }