struct kgem_bo *sna_static_stream_fini(struct sna *sna, struct sna_static_stream *stream) { struct kgem_bo *bo; DBG(("uploaded %d bytes of static state\n", stream->used)); if (DEBUG_DUMP) { int fd = open("/tmp1/1/static.bin", O_CREAT|O_WRONLY); if (fd != -1) { write(fd, stream->data, stream->used); close(fd); } else { printf("SNA: failed to write static stream\n"); asm volatile("int3"); } } bo = kgem_create_linear(&sna->kgem, stream->used, 0); if (bo && !kgem_bo_write(&sna->kgem, bo, stream->data, stream->used)) { kgem_bo_destroy(&sna->kgem, bo); return NULL; } free(stream->data); return bo; }
struct kgem_bo * sna_video_buffer(struct sna_video *video, struct sna_video_frame *frame) { /* Free the current buffer if we're going to have to reallocate */ if (video->buf && __kgem_bo_size(video->buf) < frame->size) sna_video_free_buffers(video); if (video->buf && video->buf->scanout) { if (frame->width != video->width || frame->height != video->height || frame->id != video->format) sna_video_free_buffers(video); } if (video->buf == NULL) { if (video->tiled) { video->buf = kgem_create_2d(&video->sna->kgem, frame->width, frame->height, 32, I915_TILING_X, CREATE_EXACT); } else { video->buf = kgem_create_linear(&video->sna->kgem, frame->size, CREATE_GTT_MAP); } } video->width = frame->width; video->height = frame->height; video->format = frame->id; return video->buf; }
struct kgem_bo * sna_video_buffer(struct sna *sna, struct sna_video *video, struct sna_video_frame *frame) { /* Free the current buffer if we're going to have to reallocate */ if (video->buf && __kgem_bo_size(video->buf) < frame->size) sna_video_free_buffers(sna, video); if (video->buf == NULL) video->buf = kgem_create_linear(&sna->kgem, frame->size, CREATE_GTT_MAP); return video->buf; }
struct kgem_bo *sna_static_stream_fini(struct sna *sna, struct sna_static_stream *stream) { struct kgem_bo *bo; DBG(("uploaded %d bytes of static state\n", stream->used)); bo = kgem_create_linear(&sna->kgem, stream->used, 0); if (bo && !kgem_bo_write(&sna->kgem, bo, stream->data, stream->used)) { kgem_bo_destroy(&sna->kgem, bo); return NULL; } free(stream->data); return bo; }
struct kgem_bo * sna_video_buffer(struct sna *sna, struct sna_video *video, struct sna_video_frame *frame) { /* Free the current buffer if we're going to have to reallocate */ if (video->buf && __kgem_bo_size(video->buf) < frame->size) sna_video_free_buffers(sna, video); if (video->buf == NULL) { if (video->tiled) { video->buf = kgem_create_2d(&sna->kgem, frame->width, frame->height, 32, I915_TILING_X, CREATE_EXACT); } else { video->buf = kgem_create_linear(&sna->kgem, frame->size, CREATE_GTT_MAP); } } return video->buf; }