Codebase list kmscube / 4d322e9
drm-atomic: Fix the slashes, dammit Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Ben Widawsky 7 years ago
1 changed file(s) with 21 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
366366 drm.connector = calloc(1, sizeof(*drm.connector));
367367
368368 #define get_resource(type, Type, id) do { \
369 drm.type->type = drmModeGet##Type(drm.fd, id); \
370 if (!drm.type->type) { \
371 printf("could not get %s %i: %s\n", \
372 #type, id, strerror(errno)); \
373 return NULL; \
374 } \
369 drm.type->type = drmModeGet##Type(drm.fd, id); \
370 if (!drm.type->type) { \
371 printf("could not get %s %i: %s\n", \
372 #type, id, strerror(errno)); \
373 return NULL; \
374 } \
375375 } while (0)
376376
377377 get_resource(plane, Plane, plane_id);
378378 get_resource(crtc, Crtc, drm.crtc_id);
379379 get_resource(connector, Connector, drm.connector_id);
380380
381 #define get_properties(type, TYPE, id) do { \
382 uint32_t i; \
383 drm.type->props = drmModeObjectGetProperties(drm.fd, \
384 id, DRM_MODE_OBJECT_##TYPE); \
385 if (!drm.type->props) { \
386 printf("could not get %s %u properties: %s\n", \
387 #type, id, strerror(errno)); \
388 return NULL; \
389 } \
390 drm.type->props_info = calloc(drm.type->props->count_props, \
391 sizeof(drm.type->props_info)); \
392 for (i = 0; i < drm.type->props->count_props; i++) { \
393 drm.type->props_info[i] = drmModeGetProperty(drm.fd,\
394 drm.type->props->props[i]); \
395 } \
381 #define get_properties(type, TYPE, id) do { \
382 uint32_t i; \
383 drm.type->props = drmModeObjectGetProperties(drm.fd, \
384 id, DRM_MODE_OBJECT_##TYPE); \
385 if (!drm.type->props) { \
386 printf("could not get %s %u properties: %s\n", \
387 #type, id, strerror(errno)); \
388 return NULL; \
389 } \
390 drm.type->props_info = calloc(drm.type->props->count_props, \
391 sizeof(drm.type->props_info)); \
392 for (i = 0; i < drm.type->props->count_props; i++) { \
393 drm.type->props_info[i] = drmModeGetProperty(drm.fd, \
394 drm.type->props->props[i]); \
395 } \
396396 } while (0)
397
398397
399398 get_properties(plane, PLANE, plane_id);
400399 get_properties(crtc, CRTC, drm.crtc_id);