diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2014-11-07 16:38:14 +0100 |
---|---|---|
committer | Philipp Zabel <p.zabel@pengutronix.de> | 2014-11-07 16:41:42 +0100 |
commit | 083c42eb4af8f9b79fdeeef9d6e4c41cc44bcd9c (patch) | |
tree | b60abea4203adacfadddd1f786a0cda2742d60b6 | |
parent | 1f05c49af92693032541bde7e953c810b32d6c22 (diff) | |
download | kmsfbwrap-083c42eb4af8f9b79fdeeef9d6e4c41cc44bcd9c.tar.gz kmsfbwrap-083c42eb4af8f9b79fdeeef9d6e4c41cc44bcd9c.tar.xz |
kmsfb-manage: add frame rate selection support
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
-rw-r--r-- | src/kmsfb-manage.c | 17 | ||||
-rw-r--r-- | src/kmsfb.h | 1 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/kmsfb-manage.c b/src/kmsfb-manage.c index 49d90e2..5fbe05d 100644 --- a/src/kmsfb-manage.c +++ b/src/kmsfb-manage.c @@ -140,6 +140,8 @@ static int kms_data_val_set(struct kms_data *kd, const char *key, const char *va kd->ypos = strtoul(value, NULL, 0); else if (!strcmp(key, "alpha")) kd->alpha = strtoul(value, NULL, 0); + else if (!strcmp(key, "fps")) + kd->fps = strtoul(value, NULL, 0); else return -EINVAL; return 0; @@ -225,13 +227,14 @@ static struct drm_mode_get_encoder *drm_find_encoder(struct drm_resource *res, u } static struct drm_mode_modeinfo *drm_find_mode(struct drm_connector *con, - int xres, int yres) + int xres, int yres, int fps) { int i; for (i = 0; i < con->num_modes; i++) { struct drm_mode_modeinfo *mode = &con->modes[i]; - if (mode->hdisplay == xres && mode->vdisplay == yres) + if (mode->hdisplay == xres && mode->vdisplay == yres && + (!fps || mode->vrefresh == fps)) return mode; } @@ -884,9 +887,14 @@ static int create_window(struct drm_resource *res, const char *in) con = drm_find_connector(res, kd.connector); if (!con) return -EINVAL; - mode = drm_find_mode(con, kd.xres, kd.yres); + mode = drm_find_mode(con, kd.xres, kd.yres, kd.fps); if (!mode) { - printf("could not find mode %dx%d\n", kd.xres, kd.yres); + if (kd.fps) { + printf("could not find mode %dx%d@%d\n", + kd.xres, kd.yres, kd.fps); + } else { + printf("could not find mode %dx%d\n", kd.xres, kd.yres); + } return -EINVAL; } @@ -1190,6 +1198,7 @@ static void usage(const char *prgname) " connector, encoder, crtc [required]: chain of DRM object IDs onto which the window should be bound\n" " xres, yres [optional]: resolution of the window (default: full resolution of referenced FB)\n" " xofs, yofs [optional]: offset in pixels into the FB\n" + " fps [optional]: select a frame rate in Hz\n" "-o <ovldesc> create a DRM window into a framebuffer using a partial overlay plane\n" " recognized variables for <ovldesc:\n" " fbid [required]: ID of the FB created with -f\n" diff --git a/src/kmsfb.h b/src/kmsfb.h index 21bdd21..a7b45ea 100644 --- a/src/kmsfb.h +++ b/src/kmsfb.h @@ -91,6 +91,7 @@ struct kms_data { char file[MAX_FILENAME]; int vsync; int alpha; + int fps; }; struct splash { |