summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 64e4e38)
raw | patch | inline | side by side (parent: 64e4e38)
author | Karthik Ramanan <a0393906@ti.com> | |
Fri, 13 Jun 2014 08:40:28 +0000 (14:10 +0530) | ||
committer | Karthik Ramanan <a0393906@ti.com> | |
Wed, 18 Jun 2014 12:25:26 +0000 (17:55 +0530) |
This patch adds support for a new demo, which is to render video
on the face of the kmscube.
Usage:
viddec3test <video_file> --kmscube --connector <connector id>
There are other options that are are supported, please refer to
viddec3test --help for further details
The main additions in this patch are:
* Added support for allocation of the buffers via DRM
* Added support for the allocated buffers
* Added support for specifying the connector ID on the command line
Signed-off-by: Karthik Ramanan <a0393906@ti.com>
on the face of the kmscube.
Usage:
viddec3test <video_file> --kmscube --connector <connector id>
There are other options that are are supported, please refer to
viddec3test --help for further details
The main additions in this patch are:
* Added support for allocation of the buffers via DRM
* Added support for the allocated buffers
* Added support for specifying the connector ID on the command line
Signed-off-by: Karthik Ramanan <a0393906@ti.com>
util/display-kmscube.c | patch | blob | history |
diff --git a/util/display-kmscube.c b/util/display-kmscube.c
index 97aac4d955d0782977cd81cf4672fd44dc6827c4..5c3b187137fbd240a928f1490da460733640436d 100644 (file)
--- a/util/display-kmscube.c
+++ b/util/display-kmscube.c
uint32_t connector_id;
drmModePlaneRes *plane_resources;
} drm;
+
+ //user specified connector id
+ uint32_t user_connector_id;
};
/* All our buffers are only vid buffers, and they all have an EGLImage. */
/* find a connected connector: */
for (i = 0; i < resources->count_connectors; i++) {
connector = drmModeGetConnector(disp_kmsc->base.fd, resources->connectors[i]);
- if (connector->connection == DRM_MODE_CONNECTED) {
+ if (connector->connection == DRM_MODE_CONNECTED && \
+ connector->connector_id == disp_kmsc->user_connector_id) {
/* it's connected, let's use this! */
break;
}
disp_kmsc->drm.crtc_id = encoder->crtc_id;
disp_kmsc->drm.connector_id = connector->connector_id;
+ printf("Chosen Connector ID = %d\n", disp_kmsc->drm.connector_id);
return 0;
}
buf->fourcc = fourcc;
buf->width = w;
buf->height = h;
- buf->multiplanar = false;
+ buf->multiplanar = true;
buf->nbo = 1;
&bo_handles[0], &buf->pitches[0]);
break;
case FOURCC('N','V','1','2'):
- buf->nbo = 1;
- buf->bo[0] = alloc_bo(disp, 8, buf->width, (buf->height + buf->height/2),
- &bo_handles[0], &buf->pitches[0]);
- break;
+ if (disp->multiplanar) {
+ buf->nbo = 2;
+ buf->bo[0] = alloc_bo(disp, 8, buf->width, buf->height,
+ &bo_handles[0], &buf->pitches[0]);
+ buf->fd[0] = omap_bo_dmabuf(buf->bo[0]);
+ buf->bo[1] = alloc_bo(disp, 16, buf->width/2, buf->height/2,
+ &bo_handles[1], &buf->pitches[1]);
+ buf->fd[1] = omap_bo_dmabuf(buf->bo[1]);
+ } else {
+ buf->nbo = 1;
+ buf->bo[0] = alloc_bo(disp, 8, buf->width, buf->height * 3 / 2,
+ &bo_handles[0], &buf->pitches[0]);
+ buf->fd[0] = omap_bo_dmabuf(buf->bo[0]);
+ bo_handles[1] = bo_handles[0];
+ buf->pitches[1] = buf->pitches[0];
+ offsets[1] = buf->width * buf->height;
+ buf->multiplanar = false;
+ }
+ break;
case FOURCC('I','4','2','0'):
buf->nbo = 1;
buf->bo[0] = alloc_bo(disp, 8, buf->width, (buf->height + buf->height/2),
}
}
+ disp->buf = bufs;
return bufs;
fail:
return NULL;
}
+
+static void
+free_buffers(struct display *disp, uint32_t n)
+{
+ uint32_t i;
+ for (i = 0; i < n; i++) {
+ if (disp->buf[i]) {
+ close(disp->buf[i]->fd[0]);
+ omap_bo_del(disp->buf[i]->bo[0]);
+ if(disp->multiplanar){
+ close(disp->buf[i]->fd[1]);
+ omap_bo_del(disp->buf[i]->bo[1]);
+ }
+ }
+ }
+ free(disp->buf);
+}
+
+
static struct buffer **
get_buffers(struct display *disp, uint32_t n)
{
MSG("\t--distance <float>\tset cube distance (default 8.0)");
MSG("\t--fov <float>\tset field of vision (default 45.0)");
MSG("\t--kmscube\tEnable display kmscube (default: disabled)");
+ MSG("\t--connector <connector_id>\tset the connector ID (default: LCD)");
}
struct display *
struct gbm_bo *bo;
struct drm_fb *fb;
int ret, i, enabled = 0;
- float fov = 45, distance = 8;
+ float fov = 45, distance = 8, connector_id = 4;
/* note: set args to NULL after we've parsed them so other modules know
* that it is already parsed (since the arg parsing is decentralized)
ERROR("invalid arg: %s", argv[i]);
goto fail;
}
+ } else if (!strcmp("--connector", argv[i])) {
+ argv[i++] = NULL;
+ if (sscanf(argv[i], "%f", &connector_id) != 1) {
+ ERROR("invalid arg: %s", argv[i]);
+ goto fail;
+ }
} else if (!strcmp("--kmscube", argv[i])) {
enabled = 1;
} else {
}
disp_kmsc->gl.distance = distance;
disp_kmsc->gl.fov = fov;
+ disp_kmsc->user_connector_id = connector_id;
disp = &disp_kmsc->base;
disp->fd = drmOpen("omapdrm", NULL);
disp->post_buffer = post_buffer;
disp->post_vid_buffer = post_vid_buffer;
disp->close = close_kmscube;
+ disp->disp_free_buf = free_buffers;
+
if (init_drm(disp_kmsc)) {
ERROR("couldn't init drm");