Esempio n. 1
0
int evdi_handle_damage(struct evdi_framebuffer *fb,
                       int x,
                       int y,
                       int width,
                       int height)
{
  struct drm_device *dev = fb->base.dev;
  struct evdi_device *evdi = dev->dev_private;

  EVDI_CHECKPT();

  if (!fb->obj->vmapping) {
    if (evdi_gem_vmap(fb->obj) == -ENOMEM) {
      DRM_ERROR("failed to vmap fb\n");
      return 0;
    }
    if (!fb->obj->vmapping) {
      DRM_ERROR("failed to vmapping\n");
      return 0;
    }
  }

  {
    const int line_offset = fb->base.pitches[0] * y;
    const int byte_offset = line_offset + (x * 4); //RG24
    const char* pix = (char*)fb->obj->vmapping + byte_offset;

    EVDI_VERBOSE("%p %d,%d-%dx%d %02x%02x%02x%02x%02x%02x%02x%02x\n",
               fb, x, y, width, height,
               ((int)(pix[0])&0xff),
               ((int)(pix[1])&0xff),
               ((int)(pix[2])&0xff),
               ((int)(pix[3])&0xff),
               ((int)(pix[4])&0xff),
               ((int)(pix[5])&0xff),
               ((int)(pix[6])&0xff),
               ((int)(pix[7])&0xff));
  }

  {
    struct drm_clip_rect rect = { x, y, x + width, y + height };
    evdi_painter_mark_dirty(evdi, fb, &rect);
  }

  return 0;
}
Esempio n. 2
0
int evdi_handle_damage(struct evdi_framebuffer *fb,
		       int x, int y, int width, int height)
{
	const struct drm_clip_rect dirty_rect = { x, y, x + width, y + height };
	const struct drm_clip_rect rect =
		evdi_framebuffer_sanitize_rect(fb, &dirty_rect);
	struct drm_device *dev = fb->base.dev;
	struct evdi_device *evdi = dev->dev_private;

	EVDI_CHECKPT();

	if (!fb->active)
		return 0;
	evdi_set_new_scanout_buffer(evdi, fb);
	evdi_flip_scanout_buffer(evdi);
	evdi_painter_mark_dirty(evdi, &rect);

	return 0;
}