コード例 #1
0
ファイル: evdi_lib.c プロジェクト: ajbogh/evdi
bool evdi_request_update(evdi_handle handle, int bufferId)
{
  evdi_frame_buffer_node* front_buffer = NULL;

  assert(handle);
  
  front_buffer = findBuffer(handle, bufferId);
  if (!front_buffer) {
    printf("[libevdi] Buffer %d is not registered! Ignoring update request.\n", bufferId);
    return false;
  }

  if (front_buffer->isInvalidated) {
    printf("[libevdi] Buffer %d was invalidated due to mode change! Ignoring update request.\n", bufferId);
    return false;
  }

  handle->bufferToUpdate = bufferId;

  {
    struct drm_evdi_request_update cmd;
    const int requestResult = do_ioctl(handle->fd, DRM_IOCTL_EVDI_REQUEST_UPDATE, &cmd, "request_update");
    const bool grabImmediately = requestResult == 1;
    
    return grabImmediately;
  }
}
コード例 #2
0
ファイル: evdi_lib.c プロジェクト: ajbogh/evdi
void evdi_register_buffer(evdi_handle handle, evdi_buffer buffer)
{
  assert(handle);
  assert(!findBuffer(handle, buffer.id));

  addFrameBuffer(handle, &buffer);
}
コード例 #3
0
ファイル: pl-util.c プロジェクト: eazar001/swipl-devel
const char *
atom_summary(atom_t name, unsigned int maxlen)
{ PL_chars_t txt;
  Buffer b;
  size_t i;

  if ( !get_atom_text(name, &txt) )
    return NULL;

  if ( txt.encoding == ENC_ISO_LATIN_1 && txt.length < maxlen )
  { const unsigned char *s = (const unsigned char*) txt.text.t;
    const unsigned char *e = &s[txt.length];

    for( ; s<e; s++ )
    { if ( *s >= 0x80 )
	break;
    }
    if ( s == e )
      return txt.text.t;
  }

  b = findBuffer(BUF_RING);
  for(i=0; i<txt.length; i++)
  { char buf[6];
    char *e;

    e = utf8_put_char(buf, fetch_text(&txt, i));
    addMultipleBuffer(b, buf, e-buf, char);
    if ( i == maxlen - 6 )
    { addMultipleBuffer(b, "...", 3, char);
      i = txt.length - 4;
      maxlen = 0;			/* make sure not to trap again */
    }
  }
コード例 #4
0
ファイル: dwiobuff.c プロジェクト: Azarien/open-watcom-v2
static DWIOBUFF *findReWrBuffer(// FIND BUFFER FOR RE-WRITE
    DISK_ADDR block )           // - disk block
{
    DWIOBUFF *ctl;
    ctl = findBuffer( block );
    ctl->writing = true;
    return ctl;
}
コード例 #5
0
ファイル: dwiobuff.c プロジェクト: Azarien/open-watcom-v2
static DWIOBUFF *findRdBuffer(  // FIND A BUFFER FOR READING
    DISK_ADDR block )           // - disk block
{
    DWIOBUFF *ctl;
    ctl = findBuffer( block );
    ++ctl->reading;
    ctl->current_offset = 0;
    return ctl;
}
コード例 #6
0
ファイル: evdi_lib.c プロジェクト: ajbogh/evdi
void evdi_unregister_buffer(evdi_handle handle, int bufferId)
{
  evdi_buffer* bufferToRemove = NULL;
  assert(handle);

  bufferToRemove = &findBuffer(handle, bufferId)->frame_buffer;
  assert(bufferToRemove);

  removeFrameBuffer(handle, &bufferId);
}
コード例 #7
0
ファイル: collector.cpp プロジェクト: Gael-de-Sailly/minetest
void MeshCollector::append(const TileLayer &layer, const video::S3DVertex *vertices,
		u32 numVertices, const u16 *indices, u32 numIndices, u8 layernum,
		bool use_scale)
{
	PreMeshBuffer &p = findBuffer(layer, layernum, numVertices);

	f32 scale = 1.0f;
	if (use_scale)
		scale = 1.0f / layer.scale;

	u32 vertex_count = p.vertices.size();
	for (u32 i = 0; i < numVertices; i++)
		p.vertices.emplace_back(vertices[i].Pos, vertices[i].Normal,
				vertices[i].Color, scale * vertices[i].TCoords);

	for (u32 i = 0; i < numIndices; i++)
		p.indices.push_back(indices[i] + vertex_count);
}
コード例 #8
0
ファイル: evdi_lib.c プロジェクト: ajbogh/evdi
void evdi_grab_pixels(evdi_handle handle, evdi_rect *rects, int *num_rects)
{
  struct drm_clip_rect kernelDirts[MAX_DIRTS] = {};
  evdi_frame_buffer_node* destinationNode = NULL;
  evdi_buffer* destinationBuffer = NULL;

  destinationNode = findBuffer(handle, handle->bufferToUpdate);
  assert(destinationNode);

  if (destinationNode->isInvalidated) {
    printf("[libevdi] Buffer was invalidated due to mode change. Not grabbing.\n");
    return;
  }

  destinationBuffer = &destinationNode->frame_buffer;

  struct drm_evdi_grabpix grab = {
    EVDI_GRABPIX_MODE_DIRTY,
    destinationBuffer->width,
    destinationBuffer->height,
    destinationBuffer->stride,
    destinationBuffer->buffer,
    MAX_DIRTS,
    kernelDirts
  };

  if (do_ioctl(handle->fd, DRM_IOCTL_EVDI_GRABPIX, &grab, "grabpix") == 0) {
    // Buffer was filled by ioctl, now we only have to fill the dirty rects
    int r = 0;

    for (; r < grab.num_rects; ++r) {
      rects[r].x1 = kernelDirts[r].x1;
      rects[r].y1 = kernelDirts[r].y1;
      rects[r].x2 = kernelDirts[r].x2;
      rects[r].y2 = kernelDirts[r].y2;
    }

    *num_rects = grab.num_rects;
  } else {
    printf("[libevdi] Grabbing pixels for buffer %d failed. Should be ignored if caused by change of mode in kernel.\n", destinationBuffer->id);
  }
}
コード例 #9
0
void DepthBufferList::saveBuffer(uint32_t _address)
{
	if (!config.frameBufferEmulation.enable)
		return;

	FrameBuffer * pFrameBuffer = frameBufferList().findBuffer(_address);
	if (pFrameBuffer != NULL)
		pFrameBuffer->m_isDepthBuffer = true;

	if (m_pCurrent == NULL || m_pCurrent->m_address != _address)
		m_pCurrent = findBuffer(_address);

	if (m_pCurrent != NULL && pFrameBuffer != NULL && m_pCurrent->m_width != pFrameBuffer->m_width) {
		removeBuffer(_address);
		m_pCurrent = NULL;
	}

	if (m_pCurrent == NULL) {
		m_list.emplace_front();
		DepthBuffer & buffer = m_list.front();

		buffer.m_address = _address;
		buffer.m_width = pFrameBuffer != NULL ? pFrameBuffer->m_width : VI.width;

		buffer.initDepthBufferTexture(pFrameBuffer);

		m_pCurrent = &buffer;
	}

	frameBufferList().attachDepthBuffer();

#ifdef DEBUG
		DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "DepthBuffer_SetBuffer( 0x%08X ); color buffer is 0x%08X\n",
			address, ( pFrameBuffer != NULL &&  pFrameBuffer->m_FBO > 0) ?  pFrameBuffer->m_startAddress : 0
		);
#endif

}