本文整理汇总了C++中drmModeFreeConnector函数的典型用法代码示例。如果您正苦于以下问题:C++ drmModeFreeConnector函数的具体用法?C++ drmModeFreeConnector怎么用?C++ drmModeFreeConnector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drmModeFreeConnector函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: drm_get_connector
bool drm_get_connector(int fd)
{
unsigned i;
unsigned monitor_index = 0;
settings_t *settings = config_get_ptr();
unsigned monitor = MAX(settings->video.monitor_index, 1);
/* Enumerate all connectors. */
RARCH_LOG("[DRM]: Found %d connectors.\n", g_drm_resources->count_connectors);
for (i = 0; (int)i < g_drm_resources->count_connectors; i++)
{
drmModeConnectorPtr conn = drmModeGetConnector(
fd, g_drm_resources->connectors[i]);
if (conn)
{
bool connected = conn->connection == DRM_MODE_CONNECTED;
RARCH_LOG("[DRM]: Connector %d connected: %s\n", i, connected ? "yes" : "no");
RARCH_LOG("[DRM]: Connector %d has %d modes.\n", i, conn->count_modes);
if (connected && conn->count_modes > 0)
{
monitor_index++;
RARCH_LOG("[DRM]: Connector %d assigned to monitor index: #%u.\n", i, monitor_index);
}
drmModeFreeConnector(conn);
}
}
monitor_index = 0;
for (i = 0; (int)i < g_drm_resources->count_connectors; i++)
{
g_drm_connector = drmModeGetConnector(fd,
g_drm_resources->connectors[i]);
if (!g_drm_connector)
continue;
if (g_drm_connector->connection == DRM_MODE_CONNECTED
&& g_drm_connector->count_modes > 0)
{
monitor_index++;
if (monitor_index == monitor)
break;
}
drmModeFreeConnector(g_drm_connector);
g_drm_connector = NULL;
}
if (!g_drm_connector)
{
RARCH_WARN("[DRM]: Couldn't get device connector.\n");
return false;
}
return true;
}
开发者ID:Ezio-PS,项目名称:RetroArch,代码行数:58,代码来源:drm_common.c
示例2: swc_drm_create_screens
bool swc_drm_create_screens(struct wl_list * screens)
{
drmModeRes * resources;
drmModeConnector * connector;
uint32_t index;
struct swc_output * output;
uint32_t taken_crtcs = 0;
if (!(resources = drmModeGetResources(swc.drm->fd)))
{
ERROR("Could not get DRM resources\n");
return false;
}
for (index = 0; index < resources->count_connectors;
++index, drmModeFreeConnector(connector))
{
connector = drmModeGetConnector(swc.drm->fd,
resources->connectors[index]);
if (connector->connection == DRM_MODE_CONNECTED)
{
uint32_t crtc_index;
uint32_t id;
if (!find_available_crtc(resources, connector, taken_crtcs,
&crtc_index))
{
WARNING("Could not find CRTC for connector %u\n", index);
continue;
}
if (!find_available_id(&id))
{
WARNING("No more available output IDs\n");
drmModeFreeConnector(connector);
break;
}
if (!(output = swc_output_new(connector)))
continue;
output->screen = screen_new(resources->crtcs[crtc_index], output);
output->screen->id = id;
taken_crtcs |= 1 << crtc_index;
drm.taken_ids |= 1 << id;
wl_list_insert(screens, &output->screen->link);
}
}
drmModeFreeResources(resources);
return true;
}
开发者ID:ibab,项目名称:swc,代码行数:56,代码来源:drm.c
示例3: modeset_prepare
static int modeset_prepare(int fd)
{
drmModeRes *res;
drmModeConnector *conn;
unsigned int i;
struct modeset_dev *dev;
int ret;
/* retrieve resources */
res = drmModeGetResources(fd);
if (!res) {
fprintf(stderr, "cannot retrieve DRM resources (%d): %m\n",
errno);
return -errno;
}
/* iterate all connectors */
for (i = 0; i < res->count_connectors; ++i) {
/* get information for each connector */
conn = drmModeGetConnector(fd, res->connectors[i]);
if (!conn) {
fprintf(stderr, "cannot retrieve DRM connector %u:%u (%d): %m\n",
i, res->connectors[i], errno);
continue;
}
/* create a device structure */
dev = malloc(sizeof(*dev));
memset(dev, 0, sizeof(*dev));
dev->conn = conn->connector_id;
/* call helper function to prepare this connector */
ret = modeset_setup_dev(fd, res, conn, dev);
if (ret) {
if (ret != -ENOENT) {
errno = -ret;
fprintf(stderr, "cannot setup device for connector %u:%u (%d): %m\n",
i, res->connectors[i], errno);
}
free(dev);
drmModeFreeConnector(conn);
continue;
}
/* free connector data and link device into global list */
drmModeFreeConnector(conn);
dev->next = modeset_list;
modeset_list = dev;
}
/* free resources again */
drmModeFreeResources(res);
return 0;
}
开发者ID:AlphaPerfect,项目名称:docs,代码行数:54,代码来源:modeset-double-buffered.c
示例4: stereo_prepare_dev
static struct gbm_dev *
stereo_prepare_dev(int fd, const struct gbm_options *options)
{
drmModeRes *res;
drmModeConnector *conn;
struct gbm_dev *dev;
int ret;
/* retrieve resources */
res = drmModeGetResources(fd);
if (!res) {
fprintf(stderr, "cannot retrieve DRM resources (%d): %m\n",
errno);
goto error;
}
conn = get_connector(fd, res, options);
if (!conn)
goto error_resources;
/* create a device structure */
dev = xmalloc(sizeof(*dev));
memset(dev, 0, sizeof(*dev));
dev->conn = conn->connector_id;
dev->fd = fd;
/* call helper function to prepare this connector */
ret = stereo_setup_dev(res, conn, options, dev);
if (ret) {
if (ret != -ENOENT) {
errno = -ret;
fprintf(stderr,
"cannot setup device for connector "
"%u:%u (%d): %m\n",
0, res->connectors[0], errno);
}
goto error_dev;
}
drmModeFreeConnector(conn);
drmModeFreeResources(res);
return dev;
error_dev:
free(dev);
drmModeFreeConnector(conn);
error_resources:
drmModeFreeResources(res);
error:
return NULL;
}
开发者ID:bpeel,项目名称:stereo-cube,代码行数:52,代码来源:gbm-winsys.c
示例5: drm_init
bool drm_init()
{
union drm_psb_extension_arg video_getparam_arg;
const char video_getparam_ext[] = "lnc_video_getparam";
memset(&gDrmCxt,0,sizeof(drmContext));
gDrmCxt.hdmiConnector = NULL;
gDrmCxt.drmFD = open(DRM_DEVICE_NAME, O_RDWR, 0);
if (gDrmCxt.drmFD <= 0) {
LOGE("%s: Failed to open %s", __func__, DRM_DEVICE_NAME);
return false;
}
strncpy(video_getparam_arg.extension,
video_getparam_ext, sizeof(video_getparam_arg.extension));
int ret = drmCommandWriteRead(gDrmCxt.drmFD, DRM_PSB_EXTENSION,
&video_getparam_arg, sizeof(video_getparam_arg));
if (ret != 0) {
LOGE("Failed to get ioctl offset.");
drm_cleanup();
return false;
}
gDrmCxt.ioctlOffset = video_getparam_arg.rep.driver_ioctl_offset;
drmModeConnectorPtr connector = getConnector(gDrmCxt.drmFD, DRM_MODE_CONNECTOR_DVID);
gDrmCxt.hdmiSupported = (connector != NULL);
if (connector) {
drmModeFreeConnector(connector);
connector = NULL;
}
return true;
}
开发者ID:bju2000,项目名称:android_hardware_intel,代码行数:32,代码来源:drm_hdmi.cpp
示例6: drmmode_output_detect
static xf86OutputStatus
drmmode_output_detect(xf86OutputPtr output)
{
/* go to the hw and retrieve a new output struct */
drmmode_output_private_ptr drmmode_output = output->driver_private;
drmmode_ptr drmmode = drmmode_output->drmmode;
xf86OutputStatus status;
drmModeFreeConnector(drmmode_output->mode_output);
drmmode_output->mode_output =
drmModeGetConnector(drmmode->fd, drmmode_output->output_id);
switch (drmmode_output->mode_output->connection) {
case DRM_MODE_CONNECTED:
status = XF86OutputStatusConnected;
break;
case DRM_MODE_DISCONNECTED:
status = XF86OutputStatusDisconnected;
break;
default:
case DRM_MODE_UNKNOWNCONNECTION:
status = XF86OutputStatusUnknown;
break;
}
return status;
}
开发者ID:adegroote,项目名称:netbsd-drmgem,代码行数:26,代码来源:drmmode_display.c
示例7: get_connector
static drmModeConnector *
get_connector(int fd, drmModeRes *res,
const struct gbm_options *options)
{
drmModeConnector *conn;
int i;
for (i = 0; i < res->count_connectors; i++) {
conn = drmModeGetConnector(fd, res->connectors[i]);
if (conn == NULL) {
fprintf(stderr,
"cannot retrieve DRM connector "
"%u:%u (%d): %m\n",
i, res->connectors[i], errno);
return NULL;
}
if (options->connector == -1 ||
conn->connector_id == options->connector)
return conn;
drmModeFreeConnector(conn);
}
fprintf(stderr,
"couldn't find connector with id %i\n",
options->connector);
return NULL;
}
开发者ID:bpeel,项目名称:stereo-cube,代码行数:30,代码来源:gbm-winsys.c
示例8: getConnector
static drmModeConnector* getConnector(int fd, uint32_t connector_type)
{
LOGV("Entering %s, %d", __func__, connector_type);
drmModeRes *resources = drmModeGetResources(fd);
drmModeConnector *connector = NULL;
int i;
if (resources == NULL || resources->connectors == NULL) {
LOGE("%s: drmModeGetResources failed.", __func__);
return NULL;
}
for (i = 0; i < resources->count_connectors; i++) {
connector = drmModeGetConnector(fd, resources->connectors[i]);
if (connector == NULL)
continue;
if (connector->connector_type == connector_type)
break;
drmModeFreeConnector(connector);
connector = NULL;
}
drmModeFreeResources(resources);
if (connector == NULL) {
LOGE("%s: Failed to get conector", __func__);
}
LOGV("Leaving %s, %d", __func__, connector_type);
return connector;
}
开发者ID:bju2000,项目名称:android_hardware_intel,代码行数:28,代码来源:drm_hdmi.cpp
示例9: drmOpen
bool CDRMUtils::OpenDrm()
{
std::vector<const char*>modules =
{
"i915",
"amdgpu",
"radeon",
"nouveau",
"vmwgfx",
"msm",
"imx-drm",
"rockchip",
"vc4",
"virtio_gpu",
"sun4i-drm",
};
for(int i = 0; i < 10; ++i)
{
std::string device = "/dev/dri/card";
device.append(std::to_string(i));
for (auto module : modules)
{
m_fd = drmOpen(module, device.c_str());
if (m_fd >= 0)
{
if(!GetResources())
{
continue;
}
if(!GetConnector())
{
continue;
}
drmModeFreeResources(m_drm_resources);
m_drm_resources = nullptr;
drmModeFreeConnector(m_connector->connector);
m_connector->connector = nullptr;
drmModeFreeObjectProperties(m_connector->props);
m_connector->props = nullptr;
drmModeFreeProperty(*m_connector->props_info);
*m_connector->props_info = nullptr;
CLog::Log(LOGDEBUG, "CDRMUtils::%s - opened device: %s using module: %s", __FUNCTION__, device.c_str(), module);
return true;
}
drmClose(m_fd);
m_fd = -1;
}
}
return false;
}
开发者ID:ssfdre38,项目名称:xbmc,代码行数:60,代码来源:DRMUtils.cpp
示例10: free_drm_resources
static void free_drm_resources(void)
{
if (g_gbm_surface)
gbm_surface_destroy(g_gbm_surface);
if (g_gbm_dev)
gbm_device_destroy(g_gbm_dev);
if (g_encoder)
drmModeFreeEncoder(g_encoder);
if (g_connector)
drmModeFreeConnector(g_connector);
if (g_resources)
drmModeFreeResources(g_resources);
if (g_orig_crtc)
drmModeFreeCrtc(g_orig_crtc);
if (g_drm_fd >= 0)
close(g_drm_fd);
g_gbm_surface = NULL;
g_gbm_dev = NULL;
g_encoder = NULL;
g_connector = NULL;
g_resources = NULL;
g_orig_crtc = NULL;
g_drm_fd = -1;
}
开发者ID:mprobinson,项目名称:RetroArch,代码行数:31,代码来源:drm_egl_ctx.c
示例11: memset
void Drm::resetOutput(int index)
{
DrmOutput *output = &mOutputs[index];
output->connected = false;
memset(&output->mode, 0, sizeof(drmModeModeInfo));
if (output->connector) {
drmModeFreeConnector(output->connector);
output->connector = 0;
}
if (output->encoder) {
drmModeFreeEncoder(output->encoder);
output->encoder = 0;
}
if (output->crtc) {
drmModeFreeCrtc(output->crtc);
output->crtc = 0;
}
if (output->fbId) {
drmModeRmFB(mDrmFd, output->fbId);
output->fbId = 0;
}
if (output->fbHandle) {
Hwcomposer::getInstance().getBufferManager()->freeFrameBuffer(output->fbHandle);
output->fbHandle = 0;
}
}
开发者ID:OMNI-Zenfone-2,项目名称:hwcomposer,代码行数:28,代码来源:Drm.cpp
示例12: free_drm_resources
static void free_drm_resources(gfx_ctx_drm_egl_data_t *drm)
{
if (!drm)
return;
if (drm->g_gbm_surface)
gbm_surface_destroy(drm->g_gbm_surface);
if (drm->g_gbm_dev)
gbm_device_destroy(drm->g_gbm_dev);
if (drm->g_encoder)
drmModeFreeEncoder(drm->g_encoder);
if (drm->g_connector)
drmModeFreeConnector(drm->g_connector);
if (drm->g_resources)
drmModeFreeResources(drm->g_resources);
if (drm->g_orig_crtc)
drmModeFreeCrtc(drm->g_orig_crtc);
if (drm->g_drm_fd >= 0)
close(drm->g_drm_fd);
drm->g_gbm_surface = NULL;
drm->g_gbm_dev = NULL;
drm->g_encoder = NULL;
drm->g_connector = NULL;
drm->g_resources = NULL;
drm->g_orig_crtc = NULL;
drm->g_drm_fd = -1;
}
开发者ID:maddox,项目名称:RetroArch,代码行数:34,代码来源:drm_egl_ctx.c
示例13: output_detect
static xf86OutputStatus
output_detect(xf86OutputPtr output)
{
modesettingPtr ms = modesettingPTR(output->scrn);
struct output_private *priv = output->driver_private;
drmModeConnectorPtr drm_connector;
xf86OutputStatus status;
drm_connector = drmModeGetConnector(ms->fd, priv->drm_connector->connector_id);
if (drm_connector) {
drmModeFreeConnector(priv->drm_connector);
priv->drm_connector = drm_connector;
} else {
drm_connector = priv->drm_connector;
}
switch (drm_connector->connection) {
case DRM_MODE_CONNECTED:
status = XF86OutputStatusConnected;
break;
case DRM_MODE_DISCONNECTED:
status = XF86OutputStatusDisconnected;
break;
default:
status = XF86OutputStatusUnknown;
}
return status;
}
开发者ID:CSRedRat,项目名称:mesa-1,代码行数:29,代码来源:xorg_output.c
示例14: drm_terminate
EGLBoolean
drm_terminate(_EGLDriver *drv, _EGLDisplay *dpy)
{
struct drm_device *dev = lookup_drm_device(dpy);
struct drm_screen *screen;
int i = 0;
_eglReleaseDisplayResources(drv, dpy);
_eglCleanupDisplay(dpy);
drmFreeVersion(dev->version);
for (i = 0; i < dev->count_screens; i++) {
screen = dev->screens[i];
if (screen->shown)
drm_takedown_shown_screen(dpy, screen);
drmModeFreeProperty(screen->dpms);
drmModeFreeConnector(screen->connector);
_eglDestroyScreen(&screen->base);
dev->screens[i] = NULL;
}
dev->screen->destroy(dev->screen);
dev->winsys = NULL;
drmClose(dev->drmFD);
dev->api->destroy(dev->api);
free(dev);
dpy->DriverData = NULL;
return EGL_TRUE;
}
开发者ID:MttDs,项目名称:new-rexeno-tindpe,代码行数:35,代码来源:egl_tracker.c
示例15: output_free
static void
output_free (int fd, CoglOutputKMS *output)
{
if (output->modes)
g_free (output->modes);
if (output->encoder)
drmModeFreeEncoder (output->encoder);
if (output->connector)
{
if (output->saved_crtc)
{
int ret = drmModeSetCrtc (fd,
output->saved_crtc->crtc_id,
output->saved_crtc->buffer_id,
output->saved_crtc->x,
output->saved_crtc->y,
&output->connector->connector_id, 1,
&output->saved_crtc->mode);
if (ret)
g_warning (G_STRLOC ": Error restoring saved CRTC");
}
drmModeFreeConnector (output->connector);
}
g_slice_free (CoglOutputKMS, output);
}
开发者ID:djdeath,项目名称:cogl-android,代码行数:28,代码来源:cogl-winsys-egl-kms.c
示例16: connector_check_current_state
/* XXX: Checking this repeatedly actually hangs the GPU. I have literally no
* idea why. */
static void
connector_check_current_state(struct kms_atomic_connector_state *connector)
{
struct kms_atomic_connector_state connector_kernel;
drmModeConnectorPtr legacy;
uint32_t crtc_id;
legacy = drmModeGetConnectorCurrent(connector->state->desc->fd,
connector->obj);
igt_assert(legacy);
if (legacy->encoder_id) {
drmModeEncoderPtr legacy_enc;
legacy_enc = drmModeGetEncoder(connector->state->desc->fd,
legacy->encoder_id);
igt_assert(legacy_enc);
crtc_id = legacy_enc->crtc_id;
drmModeFreeEncoder(legacy_enc);
} else {
crtc_id = 0;
}
igt_assert_eq_u32(crtc_id, connector->crtc_id);
memcpy(&connector_kernel, connector, sizeof(connector_kernel));
connector_get_current_state(&connector_kernel);
do_or_die(memcmp(&connector_kernel, connector,
sizeof(connector_kernel)));
drmModeFreeConnector(legacy);
}
开发者ID:jenkinsci01org,项目名称:igt-doc-test,代码行数:35,代码来源:kms_atomic.c
示例17: drm_mipi_setMode
bool drm_mipi_setMode(int mode)
{
drmModeConnector *connector = getConnector(gDrmCxt.drmFD, DRM_MODE_CONNECTOR_MIPI);
if (connector == NULL)
return false;
int i = 0;
drmModePropertyPtr props = NULL;
// Set MIPI On/Off
for (i = 0; i < connector->count_props; i++) {
props = drmModeGetProperty(gDrmCxt.drmFD, connector->props[i]);
if (!props) continue;
if (props->name != NULL &&
!strncmp(props->name, "DPMS", sizeof("DPMS"))) {
LOGV("%s: %s %u", __func__,
(mode == DRM_MIPI_ON) ? "On" : "Off",
connector->connector_id);
drmModeConnectorSetProperty(gDrmCxt.drmFD,
connector->connector_id,
props->prop_id,
(mode == DRM_MIPI_ON)
? DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF);
drmModeFreeProperty(props);
break;
}
drmModeFreeProperty(props);
}
drmModeFreeConnector(connector);
return true;
}
开发者ID:bju2000,项目名称:android_hardware_intel,代码行数:33,代码来源:drm_hdmi.cpp
示例18: drmModeGetConnector
bool CDRMUtils::GetConnector()
{
for(auto i = 0; i < m_drm_resources->count_connectors; i++)
{
m_connector->connector = drmModeGetConnector(m_fd,
m_drm_resources->connectors[i]);
if(m_connector->connector->connection == DRM_MODE_CONNECTED)
{
CLog::Log(LOGDEBUG, "CDRMUtils::%s - found connector: %d", __FUNCTION__,
m_connector->connector->connector_id);
break;
}
drmModeFreeConnector(m_connector->connector);
m_connector->connector = nullptr;
}
if(!m_connector->connector)
{
CLog::Log(LOGERROR, "CDRMUtils::%s - could not get connector: %s", __FUNCTION__, strerror(errno));
return false;
}
if (!GetProperties(m_fd, m_connector->connector->connector_id, DRM_MODE_OBJECT_CONNECTOR, m_connector))
{
CLog::Log(LOGERROR, "CDRMUtils::%s - could not get connector %u properties: %s", __FUNCTION__, m_connector->connector->connector_id, strerror(errno));
return false;
}
return true;
}
开发者ID:Arcko,项目名称:xbmc,代码行数:30,代码来源:DRMUtils.cpp
示例19: printConnectors
static void printConnectors(int fd, uint32_t* ids, uint32_t count) {
drmModeConnector *conn;
int i;
for (i = 0; i < count; i++) {
conn = drmModeGetConnector(fd, ids[i]);
if (!conn) {
fprintf(stdout, " Connector %u: cannot retrieve (%d): %m\n\n", ids[i], errno);
continue;
}
fprintf(stdout, " Connector %u:\n", conn->connector_id);
fprintf(stdout, " Type: %s\n", getConnectorType(conn->connector_type));
fprintf(stdout, " Dimensions: %umm x %umm\n", conn->mmWidth, conn->mmHeight);
fprintf(stdout, " SubPixel: %s\n", getConnectorSubPixel(conn->subpixel));
fprintf(stdout, " Connection: %s\n", getConnectorConnection(conn->connection));
fprintf(stdout, " Encoders: %d: %s\n", conn->count_encoders, getList32(conn->encoders, conn->count_encoders));
fprintf(stdout, " Properties: %d:\n", conn->count_props);
printProperties(fd, conn->props, conn->prop_values, conn->count_props);
fprintf(stdout, " Modes: %d:\n", conn->count_modes);
printModes(conn->modes, conn->count_modes);
fprintf(stdout, "\n");
drmModeFreeConnector(conn);
}
}
开发者ID:fritschy,项目名称:drm-utils,代码行数:27,代码来源:drm-info.c
示例20: ply_renderer_head_free
static void
ply_renderer_head_free (ply_renderer_head_t *head)
{
ply_trace ("freeing %ldx%ld renderer head", head->area.width, head->area.height);
ply_pixel_buffer_free (head->pixel_buffer);
drmModeFreeConnector (head->connector);
free (head);
}
开发者ID:pkt,项目名称:pkt-plymouth,代码行数:8,代码来源:plugin.c
注:本文中的drmModeFreeConnector函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论