ecore_drm_device_close(Ecore_Drm_Device *dev)
{
/* check for valid device */
- if (!dev) return EINA_FALSE;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
/* delete udev watch */
if (dev->watch) eeze_udev_watch_del(dev->watch);
EAPI int
ecore_drm_device_fd_get(Ecore_Drm_Device *dev)
{
- if (!dev) return -1;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(dev, -1);
return dev->drm.fd;
}
ecore_drm_device_window_set(Ecore_Drm_Device *dev, unsigned int window)
{
/* check for valid device */
- if ((!dev) || (dev->drm.fd < 0)) return;
+ EINA_SAFETY_ON_TRUE_RETURN((!dev) || (dev->drm.fd < 0));
dev->window = window;
}
ecore_drm_device_name_get(Ecore_Drm_Device *dev)
{
/* check for valid device */
- if ((!dev) || (dev->drm.fd < 0)) return NULL;
+ EINA_SAFETY_ON_TRUE_RETURN_VAL((!dev) || (dev->drm.fd < 0), NULL);
return dev->drm.name;
}
if (y) *y = 0;
/* check for valid device */
- if ((!dev) || (dev->drm.fd < 0)) return;
+ EINA_SAFETY_ON_TRUE_RETURN((!dev) || (dev->drm.fd < 0));
EINA_LIST_FOREACH(dev->seats, l, seat)
{
Eina_List *l;
EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL((x < 0) || (y < 0), NULL);
EINA_LIST_FOREACH(dev->outputs, l, output)
{
const char *vals;
enum libinput_config_status status;
- if ((w == 0) || (h == 0)) return;
+ EINA_SAFETY_ON_NULL_RETURN(edev);
+ EINA_SAFETY_ON_TRUE_RETURN((w == 0) || (h == 0));
if ((!libinput_device_config_calibration_has_matrix(edev->device)) ||
(libinput_device_config_calibration_get_default_matrix(edev->device, cal) != 0))
struct drm_mode_destroy_dumb darg;
struct drm_mode_map_dumb marg;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(dev, NULL);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL((width < 1) || (height < 1), NULL);
if (!(fb = calloc(1, sizeof(Ecore_Drm_Fb)))) return NULL;
memset(&carg, 0, sizeof(struct drm_mode_create_dumb));
ecore_drm_fb_dirty(Ecore_Drm_Fb *fb, Eina_Rectangle *rects, unsigned int count)
{
EINA_SAFETY_ON_NULL_RETURN(fb);
+ EINA_SAFETY_ON_NULL_RETURN(rects);
+ EINA_SAFETY_ON_TRUE_RETURN(!count);
#ifdef DRM_MODE_FEATURE_DIRTYFB
drmModeClip *clip;
Ecore_Drm_Seat *seat;
Ecore_Drm_Evdev *edev;
+ EINA_SAFETY_ON_NULL_RETURN(dev);
EINA_LIST_FREE(dev->seats, seat)
{
EINA_LIST_FREE(seat->devices, edev)
EAPI Eina_Bool
ecore_drm_launcher_connect(Ecore_Drm_Device *dev)
{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
/* try to connect to logind */
if (!(logind = _ecore_drm_logind_connect(dev)))
{
EAPI void
ecore_drm_launcher_disconnect(Ecore_Drm_Device *dev)
{
+ EINA_SAFETY_ON_NULL_RETURN(dev);
if (dev->tty.switch_hdlr) ecore_event_handler_del(dev->tty.switch_hdlr);
dev->tty.switch_hdlr = NULL;
int i = 0, x = 0, y = 0;
EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
+ EINA_SAFETY_ON_TRUE_RETURN_VAL(dev->drm.fd < 0, EINA_FALSE);
/* DBG("Create outputs for %d", dev->drm.fd); */
EAPI void
ecore_drm_output_cursor_size_set(Ecore_Drm_Output *output, int handle, int w, int h)
{
- if (!output) return;
+ EINA_SAFETY_ON_NULL_RETURN(output);
drmModeSetCursor(output->dev->drm.fd, output->crtc_id, handle, w, h);
}
int x = 0, y = 0;
EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(output->dev, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(output->current_mode, EINA_FALSE);
- if (!(dev = output->dev)) return EINA_FALSE;
+ dev = output->dev;
output->enabled = EINA_TRUE;
if (!dev->current)
EAPI void
ecore_drm_output_fb_release(Ecore_Drm_Output *output, Ecore_Drm_Fb *fb)
{
+ EINA_SAFETY_ON_NULL_RETURN(output);
+ EINA_SAFETY_ON_NULL_RETURN(fb);
_ecore_drm_output_fb_release(output, fb);
}
int ret = 0;
EINA_SAFETY_ON_NULL_RETURN(output);
+ EINA_SAFETY_ON_NULL_RETURN(output->dev);
EINA_SAFETY_ON_TRUE_RETURN(output->pending_destroy);
- if (!(dev = output->dev)) return;
+ dev = output->dev;
/* DBG("Output Repaint: %d %d", output->crtc_id, output->conn_id); */
if (w) *w = 0;
if (h) *h = 0;
- if (!dev) return;
+ EINA_SAFETY_ON_NULL_RETURN(dev);
if (!(fb = drmModeGetFB(dev->drm.fd, output))) return;
if (w) *w = fb->width;
if (y) *y = 0;
if (w) *w = 0;
if (h) *h = 0;
- if (!dev) return;
+ EINA_SAFETY_ON_NULL_RETURN(dev);
EINA_LIST_FOREACH(dev->outputs, l, output)
{
ecore_drm_output_dpms_set(Ecore_Drm_Output *output, int level)
{
EINA_SAFETY_ON_NULL_RETURN(output);
+ EINA_SAFETY_ON_NULL_RETURN(output->dev);
EINA_SAFETY_ON_NULL_RETURN(output->dpms);
drmModeConnectorSetProperty(output->dev->drm.fd, output->conn_id,
ecore_drm_output_gamma_set(Ecore_Drm_Output *output, uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b)
{
EINA_SAFETY_ON_NULL_RETURN(output);
+ EINA_SAFETY_ON_NULL_RETURN(output->dev);
EINA_SAFETY_ON_NULL_RETURN(output->crtc);
if (output->gamma != size) return;
unsigned int id = 0;
EINA_SAFETY_ON_NULL_RETURN_VAL(output, 0);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(output->dev, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(output->crtc, 0);
if (!(crtc = drmModeGetCrtc(output->dev->drm.fd, output->crtc_id)))
unsigned int i = 0;
/* check for valid device */
- if ((!dev) || (dev->drm.fd < 0)) return EINA_FALSE;
+ EINA_SAFETY_ON_TRUE_RETURN_VAL((!dev) || (dev->drm.fd < 0), EINA_FALSE);
/* get plane resources */
if (!(res = drmModeGetPlaneResources(dev->drm.fd))) return EINA_FALSE;
Ecore_Drm_Sprite *sprite;
/* check for valid device */
- if (!dev) return;
+ EINA_SAFETY_ON_NULL_RETURN(dev);
EINA_LIST_FREE(dev->sprites, sprite)
{
EAPI void
ecore_drm_sprites_fb_set(Ecore_Drm_Sprite *sprite, int fb_id, int flags)
{
- if ((!sprite) || (!sprite->output)) return;
+ EINA_SAFETY_ON_TRUE_RETURN((!sprite) || (!sprite->output));
if (fb_id)
{
Ecore_Drm_Device *dev;
unsigned int c = 0;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(output, EINA_FALSE);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(output->dev, EINA_FALSE);
dev = output->dev;
for (c = 0; c < dev->crtc_count; c++)
char tty[32] = "<stdin>";
/* check for valid device */
- if ((!dev) || (!dev->drm.name)) return EINA_FALSE;
+ EINA_SAFETY_ON_TRUE_RETURN_VAL((!dev) || (!dev->drm.name), EINA_FALSE);
/* assign default tty fd of -1 */
dev->tty.fd = -1;
ecore_drm_tty_close(Ecore_Drm_Device *dev)
{
/* check for valid device */
- if ((!dev) || (!dev->drm.name)) return EINA_FALSE;
+ EINA_SAFETY_ON_TRUE_RETURN_VAL((!dev) || (!dev->drm.name), EINA_FALSE);
_ecore_drm_tty_restore(dev);
ecore_drm_tty_release(Ecore_Drm_Device *dev)
{
/* check for valid device */
- if ((!dev) || (!dev->drm.name) || (dev->tty.fd < 0)) return EINA_FALSE;
+ EINA_SAFETY_ON_TRUE_RETURN_VAL((!dev) || (!dev->drm.name) || (dev->tty.fd < 0), EINA_FALSE);
/* send ioctl for vt release */
if (ioctl(dev->tty.fd, VT_RELDISP, 1) < 0)
ecore_drm_tty_acquire(Ecore_Drm_Device *dev)
{
/* check for valid device */
- if ((!dev) || (!dev->drm.name) || (dev->tty.fd < 0)) return EINA_FALSE;
+ EINA_SAFETY_ON_TRUE_RETURN_VAL((!dev) || (!dev->drm.name) || (dev->tty.fd < 0), EINA_FALSE);
/* send ioctl for vt acquire */
if (ioctl(dev->tty.fd, VT_RELDISP, VT_ACKACQ) < 0)
ecore_drm_tty_get(Ecore_Drm_Device *dev)
{
/* check for valid device */
- if ((!dev) || (!dev->drm.name) || (dev->tty.fd < 0)) return -1;
+ EINA_SAFETY_ON_TRUE_RETURN_VAL((!dev) || (!dev->drm.name) || (dev->tty.fd < 0), -1);
return dev->tty.fd;
}