本文整理汇总了C++中drmModeSetCrtc函数的典型用法代码示例。如果您正苦于以下问题:C++ drmModeSetCrtc函数的具体用法?C++ drmModeSetCrtc怎么用?C++ drmModeSetCrtc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drmModeSetCrtc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: drmkmsSetRegion
static DFBResult
drmkmsSetRegion( CoreLayer *layer,
void *driver_data,
void *layer_data,
void *region_data,
CoreLayerRegionConfig *config,
CoreLayerRegionConfigFlags updated,
CoreSurface *surface,
CorePalette *palette,
CoreSurfaceBufferLock *left_lock,
CoreSurfaceBufferLock *right_lock )
{
int ret;
DRMKMSData *drmkms = driver_data;
DRMKMSDataShared *shared = drmkms->shared;
DRMKMSLayerData *data = layer_data;
D_DEBUG_AT( DRMKMS_Layer, "%s()\n", __FUNCTION__ );
if (!drmkms->resources)
return DFB_OK;
if (updated & (CLRCF_WIDTH | CLRCF_HEIGHT | CLRCF_BUFFERMODE | CLRCF_SOURCE)) {
int i, index = data->layer_index;
for (i=0; i<shared->enabled_crtcs; i++) {
if (shared->mirror_outputs)
index = i;
if (shared->clone_outputs) {
ret = drmModeSetCrtc( drmkms->fd, drmkms->encoder[index]->crtc_id, (u32)(long)left_lock->handle, config->source.x, config->source.y,
shared->cloned_connectors, shared->cloned_count, &shared->mode[index] );
}
else {
ret = drmModeSetCrtc( drmkms->fd, drmkms->encoder[index]->crtc_id, (u32)(long)left_lock->handle, config->source.x, config->source.y,
&drmkms->connector[index]->connector_id, 1, &shared->mode[index] );
}
if (ret) {
D_PERROR( "DirectFB/DRMKMS: drmModeSetCrtc( fd %d, index %d, crtc 0x%x, fb_id 0x%lx, xy %d,%d, cloned %p, count %d ) failed! (%d)\n",
drmkms->fd, index, drmkms->encoder[index]->crtc_id, (long) left_lock->handle, config->source.x, config->source.y,
shared->cloned_connectors, shared->cloned_count, ret );
D_DEBUG_AT( DRMKMS_Mode, " crtc_id: %d connector_id %d, mode %dx%d\n",
drmkms->encoder[index]->crtc_id, drmkms->connector[index]->connector_id,
shared->mode[index].hdisplay, shared->mode[index].vdisplay );
return DFB_FAILURE;
}
if (!shared->mirror_outputs)
break;
}
shared->primary_dimension[data->layer_index] = surface->config.size;
shared->primary_rect = config->source;
shared->primary_fb = (u32)(long)left_lock->handle;
}
return DFB_OK;
}
开发者ID:Distrotech,项目名称:DirectFB,代码行数:59,代码来源:drmkms_layer.c
示例2: 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
示例3: drm_display_set_crtc
/**
* Remember the original CRTC status and set the CRTC
*/
static boolean
drm_display_set_crtc(struct native_display *ndpy, int crtc_idx,
uint32_t buffer_id, uint32_t x, uint32_t y,
uint32_t *connectors, int num_connectors,
drmModeModeInfoPtr mode)
{
struct drm_display *drmdpy = drm_display(ndpy);
struct drm_crtc *drmcrtc = &drmdpy->saved_crtcs[crtc_idx];
uint32_t crtc_id;
int err;
if (drmcrtc->crtc) {
crtc_id = drmcrtc->crtc->crtc_id;
}
else {
int count = 0, i;
/*
* Choose the CRTC once. It could be more dynamic, but let's keep it
* simple for now.
*/
crtc_id = drm_display_choose_crtc(&drmdpy->base,
connectors, num_connectors);
/* save the original CRTC status */
drmcrtc->crtc = drmModeGetCrtc(drmdpy->fd, crtc_id);
if (!drmcrtc->crtc)
return FALSE;
for (i = 0; i < drmdpy->num_connectors; i++) {
struct drm_connector *drmconn = &drmdpy->connectors[i];
drmModeConnectorPtr connector = drmconn->connector;
drmModeEncoderPtr encoder;
encoder = drmModeGetEncoder(drmdpy->fd, connector->encoder_id);
if (encoder) {
if (encoder->crtc_id == crtc_id) {
drmcrtc->connectors[count++] = connector->connector_id;
if (count >= Elements(drmcrtc->connectors))
break;
}
drmModeFreeEncoder(encoder);
}
}
drmcrtc->num_connectors = count;
}
err = drmModeSetCrtc(drmdpy->fd, crtc_id, buffer_id, x, y,
connectors, num_connectors, mode);
if (err) {
drmModeFreeCrtc(drmcrtc->crtc);
drmcrtc->crtc = NULL;
drmcrtc->num_connectors = 0;
return FALSE;
}
return TRUE;
}
开发者ID:nikai3d,项目名称:mesa,代码行数:63,代码来源:modeset.c
示例4: gfx_ctx_drm_egl_destroy_resources
static void gfx_ctx_drm_egl_destroy_resources(gfx_ctx_drm_egl_data_t *drm)
{
if (!drm)
return;
/* Make sure we acknowledge all page-flips. */
if (waiting_for_flip)
wait_flip(true);
if (drm->g_egl_dpy)
{
if (drm->g_egl_ctx)
{
eglMakeCurrent(drm->g_egl_dpy,
EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroyContext(drm->g_egl_dpy, drm->g_egl_ctx);
}
if (drm->g_egl_hw_ctx)
eglDestroyContext(drm->g_egl_dpy, drm->g_egl_hw_ctx);
if (drm->g_egl_surf)
eglDestroySurface(drm->g_egl_dpy, drm->g_egl_surf);
eglTerminate(drm->g_egl_dpy);
}
/* Be as careful as possible in deinit.
* If we screw up, the KMS tty will not restore.
*/
drm->g_egl_ctx = NULL;
drm->g_egl_hw_ctx = NULL;
drm->g_egl_surf = NULL;
drm->g_egl_dpy = NULL;
drm->g_config = 0;
/* Restore original CRTC. */
if (drm->g_orig_crtc)
{
drmModeSetCrtc(drm->g_drm_fd, drm->g_orig_crtc->crtc_id,
drm->g_orig_crtc->buffer_id,
drm->g_orig_crtc->x,
drm->g_orig_crtc->y,
&drm->g_connector_id, 1, &drm->g_orig_crtc->mode);
}
free_drm_resources(drm);
drm->g_drm_mode = NULL;
g_quit = 0;
drm->g_crtc_id = 0;
drm->g_connector_id = 0;
drm->g_fb_width = 0;
drm->g_fb_height = 0;
drm->g_bo = NULL;
drm->g_next_bo = NULL;
}
开发者ID:maddox,项目名称:RetroArch,代码行数:60,代码来源:drm_egl_ctx.c
示例5: crtc_release
static void crtc_release(struct MPGLContext *ctx)
{
struct priv *p = ctx->priv;
if (!p->active)
return;
p->active = false;
// wait for current page flip
while (p->waiting_for_flip) {
int ret = drmHandleEvent(p->kms->fd, &p->ev);
if (ret) {
MP_ERR(ctx->vo, "drmHandleEvent failed: %i\n", ret);
break;
}
}
if (p->old_crtc) {
drmModeSetCrtc(p->kms->fd,
p->old_crtc->crtc_id, p->old_crtc->buffer_id,
p->old_crtc->x, p->old_crtc->y,
&p->kms->connector->connector_id, 1,
&p->old_crtc->mode);
drmModeFreeCrtc(p->old_crtc);
p->old_crtc = NULL;
}
}
开发者ID:qyot27,项目名称:mpv,代码行数:27,代码来源:context_drm_egl.c
示例6: mesaSetRegion
static DFBResult
mesaSetRegion( CoreLayer *layer,
void *driver_data,
void *layer_data,
void *region_data,
CoreLayerRegionConfig *config,
CoreLayerRegionConfigFlags updated,
CoreSurface *surface,
CorePalette *palette,
CoreSurfaceBufferLock *left_lock,
CoreSurfaceBufferLock *right_lock )
{
int ret;
MesaData *mesa = driver_data;
D_DEBUG_AT( Mesa_Layer, "%s()\n", __FUNCTION__ );
ret = drmModeSetCrtc( mesa->fd, mesa->encoder->crtc_id, (u32)(long)left_lock->handle, 0, 0,
&mesa->connector->connector_id, 1, &mesa->mode );
if (ret) {
D_PERROR( "DirectFB/Mesa: drmModeSetCrtc() failed! (%d)\n", ret );
return DFB_FAILURE;
}
return DFB_OK;
}
开发者ID:Distrotech,项目名称:DirectFB,代码行数:26,代码来源:mesa_layer.c
示例7: display_deactivate
static void display_deactivate(struct uterm_display *disp)
{
if (!display_is_online(disp))
return;
if (disp->dumb.saved_crtc) {
if (disp->video->flags & VIDEO_AWAKE) {
drmModeSetCrtc(disp->video->dumb.fd,
disp->dumb.saved_crtc->crtc_id,
disp->dumb.saved_crtc->buffer_id,
disp->dumb.saved_crtc->x,
disp->dumb.saved_crtc->y,
&disp->dumb.conn_id,
1,
&disp->dumb.saved_crtc->mode);
}
drmModeFreeCrtc(disp->dumb.saved_crtc);
disp->dumb.saved_crtc = NULL;
}
destroy_rb(disp, &disp->dumb.rb[1]);
destroy_rb(disp, &disp->dumb.rb[0]);
disp->current_mode = NULL;
disp->flags &= ~(DISPLAY_ONLINE | DISPLAY_VSYNC);
log_info("deactivating display %p", disp);
}
开发者ID:microcai,项目名称:kmscon,代码行数:26,代码来源:uterm_video_dumb.c
示例8: _cogl_winsys_egl_cleanup_context
static void
_cogl_winsys_egl_cleanup_context (CoglDisplay *display)
{
CoglDisplayEGL *egl_display = display->winsys;
CoglDisplayKMS *kms_display = egl_display->platform;
CoglRenderer *renderer = display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys;
CoglRendererKMS *kms_renderer = egl_renderer->platform;
/* Restore the saved CRTC - this failing should not propagate an error */
if (kms_display->saved_crtc)
{
int ret = drmModeSetCrtc (kms_renderer->fd,
kms_display->saved_crtc->crtc_id,
kms_display->saved_crtc->buffer_id,
kms_display->saved_crtc->x,
kms_display->saved_crtc->y,
&kms_display->connector->connector_id, 1,
&kms_display->saved_crtc->mode);
if (ret)
g_critical (G_STRLOC ": Error restoring saved CRTC");
drmModeFreeCrtc (kms_display->saved_crtc);
}
}
开发者ID:collects,项目名称:cogl,代码行数:25,代码来源:cogl-winsys-egl-kms.c
示例9: modeset_cleanup
static void modeset_cleanup(int fd)
{
struct modeset_dev *iter;
while (modeset_list) {
/* remove from global list */
iter = modeset_list;
modeset_list = iter->next;
/* restore saved CRTC configuration */
drmModeSetCrtc(fd,
iter->saved_crtc->crtc_id,
iter->saved_crtc->buffer_id,
iter->saved_crtc->x,
iter->saved_crtc->y,
&iter->conn,
1,
&iter->saved_crtc->mode);
drmModeFreeCrtc(iter->saved_crtc);
/* destroy framebuffers */
modeset_destroy_fb(fd, &iter->bufs[1]);
modeset_destroy_fb(fd, &iter->bufs[0]);
/* free allocated memory */
free(iter);
}
}
开发者ID:AlphaPerfect,项目名称:docs,代码行数:28,代码来源:modeset-double-buffered.c
示例10: drmModeSetCrtc
bool CDRMUtils::RestoreOriginalMode()
{
if(!m_orig_crtc)
{
return false;
}
auto ret = drmModeSetCrtc(m_fd,
m_orig_crtc->crtc_id,
m_orig_crtc->buffer_id,
m_orig_crtc->x,
m_orig_crtc->y,
&m_connector->connector->connector_id,
1,
&m_orig_crtc->mode);
if(ret)
{
CLog::Log(LOGERROR, "CDRMUtils::%s - failed to set original crtc mode", __FUNCTION__);
return false;
}
CLog::Log(LOGDEBUG, "CDRMUtils::%s - set original crtc mode", __FUNCTION__);
drmModeFreeCrtc(m_orig_crtc);
m_orig_crtc = nullptr;
return true;
}
开发者ID:ssfdre38,项目名称:xbmc,代码行数:29,代码来源:DRMUtils.cpp
示例11: ply_renderer_head_set_scan_out_buffer
static bool
ply_renderer_head_set_scan_out_buffer (ply_renderer_backend_t *backend,
ply_renderer_head_t *head,
uint32_t buffer_id)
{
drmModeModeInfo *mode;
uint32_t *connector_ids;
int number_of_connectors;
connector_ids = (uint32_t *) ply_array_get_uint32_elements (head->connector_ids);
number_of_connectors = ply_array_get_size (head->connector_ids);
mode = &head->connector0->modes[head->connector0_mode_index];
ply_trace ("Setting scan out buffer of %ldx%ld head to our buffer",
head->area.width, head->area.height);
/* Tell the controller to use the allocated scan out buffer on each connectors
*/
if (drmModeSetCrtc (backend->device_fd, head->controller_id, buffer_id,
0, 0, connector_ids, number_of_connectors, mode) < 0)
{
ply_trace ("Couldn't set scan out buffer for head with controller id %d",
head->controller_id);
return false;
}
return true;
}
开发者ID:AtsKiYsPoYl,项目名称:plymouth,代码行数:29,代码来源:plugin.c
示例12: drmkmsSetEncoderConfig
static DFBResult
drmkmsSetEncoderConfig( CoreScreen *screen,
void *driver_data,
void *screen_data,
int encoder,
const DFBScreenEncoderConfig *config )
{
int ret = 0;
DRMKMSData *drmkms = driver_data;
DRMKMSDataShared *shared = drmkms->shared;
DFBScreenEncoderFrequency dse_freq;
DFBScreenOutputResolution dso_res;
D_DEBUG_AT( DRMKMS_Screen, "%s()\n", __FUNCTION__ );
if (!(config->flags & (DSECONF_FREQUENCY | DSECONF_RESOLUTION)))
return DFB_INVARG;
drmkms_mode_to_dsor_dsef( &shared->mode[encoder], &dso_res, &dse_freq );
if (config->flags & DSECONF_FREQUENCY) {
D_DEBUG_AT( DRMKMS_Screen, " -> requested frequency change \n" );
dse_freq = config->frequency;
}
if (config->flags & DSECONF_RESOLUTION) {
D_DEBUG_AT( DRMKMS_Screen, " -> requested resolution change \n" );
dso_res = config->resolution;
}
drmModeModeInfo *videomode = drmkms_dsor_freq_to_mode( encoder, dso_res, dse_freq );
if (!videomode)
return DFB_INVARG;
if ((shared->primary_dimension[encoder].w && (shared->primary_dimension[encoder].w < videomode->hdisplay) ) ||
(shared->primary_dimension[encoder].h && (shared->primary_dimension[encoder].h < videomode->vdisplay ))) {
D_DEBUG_AT( DRMKMS_Screen, " -> cannot switch to mode to something that is bigger than the current primary layer\n" );
return DFB_INVARG;
}
if (shared->primary_fb)
ret = drmModeSetCrtc( drmkms->fd, drmkms->encoder[encoder]->crtc_id, shared->primary_fb, shared->primary_rect.x, shared->primary_rect.y,
&drmkms->connector[encoder]->connector_id, 1, videomode );
if (ret) {
D_DEBUG_AT( DRMKMS_Screen, " crtc_id: %d connector_id %d, mode %dx%d\n", drmkms->encoder[encoder]->crtc_id, drmkms->connector[encoder]->connector_id, shared->mode[encoder].hdisplay, shared->mode[encoder].vdisplay );
D_PERROR( "DirectFB/DRMKMS: drmModeSetCrtc() failed! (%d)\n", ret );
return DFB_FAILURE;
}
shared->mode[encoder] = *videomode;
return DFB_OK;
}
开发者ID:folkien,项目名称:directfb,代码行数:59,代码来源:drmkms_screen.c
示例13: gfx_ctx_drm_egl_destroy
static void gfx_ctx_drm_egl_destroy(void *data)
{
(void)data;
// Make sure we acknowledge all page-flips.
if (waiting_for_flip)
wait_flip(true);
if (g_egl_dpy)
{
if (g_egl_ctx)
{
eglMakeCurrent(g_egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroyContext(g_egl_dpy, g_egl_ctx);
}
if (g_egl_hw_ctx)
eglDestroyContext(g_egl_dpy, g_egl_hw_ctx);
if (g_egl_surf)
eglDestroySurface(g_egl_dpy, g_egl_surf);
eglTerminate(g_egl_dpy);
}
// Be as careful as possible in deinit.
// If we screw up, the KMS tty will not restore.
g_egl_ctx = NULL;
g_egl_hw_ctx = NULL;
g_egl_surf = NULL;
g_egl_dpy = NULL;
g_config = 0;
// Restore original CRTC.
if (g_orig_crtc)
{
drmModeSetCrtc(g_drm_fd, g_orig_crtc->crtc_id,
g_orig_crtc->buffer_id,
g_orig_crtc->x,
g_orig_crtc->y,
&g_connector_id, 1, &g_orig_crtc->mode);
}
free_drm_resources();
g_drm_mode = NULL;
g_quit = 0;
g_crtc_id = 0;
g_connector_id = 0;
g_fb_width = 0;
g_fb_height = 0;
g_bo = NULL;
g_next_bo = NULL;
g_inited = false;
}
开发者ID:mprobinson,项目名称:RetroArch,代码行数:58,代码来源:drm_egl_ctx.c
示例14: crtc_commit_legacy
static void crtc_commit_legacy(struct kms_atomic_crtc_state *crtc,
struct kms_atomic_plane_state *plane,
enum kms_atomic_check_relax relax)
{
drmModeObjectPropertiesPtr props;
uint32_t *connectors;
int num_connectors = 0;
int i;
if (!crtc->active) {
do_or_die(drmModeSetCrtc(crtc->state->desc->fd,
crtc->obj, 0, 0, 0, NULL, 0, NULL));
return;
}
connectors = calloc(crtc->state->num_connectors,
sizeof(*connectors));
igt_assert(connectors);
igt_assert_neq_u32(crtc->mode.id, 0);
for (i = 0; i < crtc->state->num_connectors; i++) {
struct kms_atomic_connector_state *connector =
&crtc->state->connectors[i];
if (connector->crtc_id != crtc->obj)
continue;
connectors[num_connectors++] = connector->obj;
}
do_or_die(drmModeSetCrtc(crtc->state->desc->fd, crtc->obj,
plane->fb_id,
plane->src_x >> 16, plane->src_y >> 16,
(num_connectors) ? connectors : NULL,
num_connectors,
crtc->mode.data));
/* When doing a legacy commit, the core may update MODE_ID to be a new
* blob implicitly created by the legacy request. Hence we backfill
* the value in the state object to ensure they match. */
props = drmModeObjectGetProperties(crtc->state->desc->fd, crtc->obj,
DRM_MODE_OBJECT_CRTC);
igt_assert(props);
for (i = 0; i < props->count_props; i++) {
if (props->props[i] !=
crtc->state->desc->props_crtc[CRTC_MODE_ID])
continue;
crtc->mode.id = props->prop_values[i];
break;
}
drmModeFreeObjectProperties(props);
crtc_check_current_state(crtc, plane, relax);
plane_check_current_state(plane, relax);
}
开发者ID:jenkinsci01org,项目名称:igt-doc-test,代码行数:57,代码来源:kms_atomic.c
示例15: crtc_set_mode_major
static Bool
crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
Rotation rotation, int x, int y)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
modesettingPtr ms = modesettingPTR(crtc->scrn);
xf86OutputPtr output = NULL;
struct crtc_private *crtcp = crtc->driver_private;
drmModeCrtcPtr drm_crtc = crtcp->drm_crtc;
drmModeModeInfo drm_mode;
int i, ret;
unsigned int connector_id;
for (i = 0; i < config->num_output; output = NULL, i++) {
output = config->output[i];
if (output->crtc == crtc)
break;
}
if (!output)
return FALSE;
connector_id = xorg_output_get_id(output);
drm_mode.clock = mode->Clock;
drm_mode.hdisplay = mode->HDisplay;
drm_mode.hsync_start = mode->HSyncStart;
drm_mode.hsync_end = mode->HSyncEnd;
drm_mode.htotal = mode->HTotal;
drm_mode.vdisplay = mode->VDisplay;
drm_mode.vsync_start = mode->VSyncStart;
drm_mode.vsync_end = mode->VSyncEnd;
drm_mode.vtotal = mode->VTotal;
drm_mode.flags = mode->Flags;
drm_mode.hskew = mode->HSkew;
drm_mode.vscan = mode->VScan;
drm_mode.vrefresh = mode->VRefresh;
if (!mode->name)
xf86SetModeDefaultName(mode);
strncpy(drm_mode.name, mode->name, DRM_DISPLAY_MODE_LEN - 1);
drm_mode.name[DRM_DISPLAY_MODE_LEN - 1] = '\0';
ret = drmModeSetCrtc(ms->fd, drm_crtc->crtc_id, ms->fb_id, x, y,
&connector_id, 1, &drm_mode);
if (ret)
return FALSE;
crtc->x = x;
crtc->y = y;
crtc->mode = *mode;
crtc->rotation = rotation;
return TRUE;
}
开发者ID:GunioRobot,项目名称:mesa-7.10.2-PS3,代码行数:56,代码来源:xorg_crtc.c
示例16: drm_disable_crtc
static void drm_disable_crtc(int drm_fd, drmModeCrtc *crtc) {
if (crtc) {
drmModeSetCrtc(drm_fd, crtc->crtc_id,
0, // fb_id
0, 0, // x,y
NULL, // connectors
0, // connector_count
NULL); // mode
}
}
开发者ID:CarbonROM,项目名称:android_bootable_recovery,代码行数:10,代码来源:graphics_drm.cpp
示例17: main
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;
}
开发者ID:AlphaPerfect,项目名称:docs,代码行数:55,代码来源:modeset-double-buffered.c
示例18: gbm_surface_lock_front_buffer
void
NativeStateDRM::flip()
{
gbm_bo* next = gbm_surface_lock_front_buffer(surface_);
fb_ = fb_get_from_bo(next);
unsigned int waiting(1);
if (!crtc_set_) {
int status = drmModeSetCrtc(fd_, encoder_->crtc_id, fb_->fb_id, 0, 0,
&connector_->connector_id, 1, mode_);
if (status >= 0) {
crtc_set_ = true;
bo_ = next;
}
else {
Log::error("Failed to set crtc: %d\n", status);
}
return;
}
int status = drmModePageFlip(fd_, encoder_->crtc_id, fb_->fb_id,
DRM_MODE_PAGE_FLIP_EVENT, &waiting);
if (status < 0) {
Log::error("Failed to enqueue page flip: %d\n", status);
return;
}
fd_set fds;
FD_ZERO(&fds);
FD_SET(fd_, &fds);
drmEventContext evCtx;
evCtx.version = DRM_EVENT_CONTEXT_VERSION;
evCtx.page_flip_handler = page_flip_handler;
while (waiting) {
status = select(fd_ + 1, &fds, 0, 0, 0);
if (status < 0) {
// Most of the time, select() will return an error because the
// user pressed Ctrl-C. So, only print out a message in debug
// mode, and just check for the likely condition and release
// the current buffer object before getting out.
Log::debug("Error in select\n");
if (should_quit()) {
gbm_surface_release_buffer(surface_, bo_);
bo_ = next;
}
return;
}
drmHandleEvent(fd_, &evCtx);
}
gbm_surface_release_buffer(surface_, bo_);
bo_ = next;
}
开发者ID:elmarco,项目名称:glmark2,代码行数:54,代码来源:native-state-drm.cpp
示例19: do_set_stereo_mode
static void do_set_stereo_mode(struct connector *c)
{
uint32_t fb_id;
fb_id = igt_create_stereo_fb(drm_fd, &c->mode,
igt_bpp_depth_to_drm_format(bpp, depth),
tiling);
igt_warn_on_f(drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0, &c->id, 1, &c->mode),
"failed to set mode (%dx%[email protected]%dHz): %s\n", width, height, c->mode.vrefresh, strerror(errno));
}
开发者ID:jmb82,项目名称:intel-gpu-tools,代码行数:11,代码来源:testdisplay.c
示例20: drmModeSetCrtc
QKmsScreen::~QKmsScreen()
{
delete m_cursor;
drmModeSetCrtc(m_device->fd(), m_oldCrtc->crtc_id, m_oldCrtc->buffer_id,
m_oldCrtc->x, m_oldCrtc->y,
&m_connectorId, 1, &m_oldCrtc->mode);
drmModeFreeCrtc(m_oldCrtc);
if (m_eglWindowSurface != EGL_NO_SURFACE)
eglDestroySurface(m_device->eglDisplay(), m_eglWindowSurface);
gbm_surface_destroy(m_gbmSurface);
}
开发者ID:CodeDJ,项目名称:qt5-hidpi,代码行数:11,代码来源:qkmsscreen.cpp
注:本文中的drmModeSetCrtc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论