bring back mistakenly deleted radeon_buffer.h plus some moregallium-resources
@@ -44,7 +44,7 @@ static unsigned r300_buffer_is_referenced(struct pipe_context *context, | |||
if (r300_buffer_is_user_buffer(buf)) | |||
return PIPE_UNREFERENCED; | |||
if (r300->rws->is_resource_referenced(r300->rws, rbuf->buf)) | |||
if (r300->rws->is_buffer_referenced(r300->rws, rbuf->buf)) | |||
return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; | |||
return PIPE_UNREFERENCED; | |||
@@ -293,7 +293,7 @@ struct u_resource_vtbl r300_buffer_vtbl = | |||
{ | |||
u_default_resource_get_handle, /* get_handle */ | |||
r300_buffer_destroy, /* resource_destroy */ | |||
r300_buffer_is_referenced, /* is_resource_referenced */ | |||
r300_buffer_is_referenced, /* is_buffer_referenced */ | |||
u_default_get_transfer, /* get_transfer */ | |||
u_default_transfer_destroy, /* transfer_destroy */ | |||
r300_buffer_transfer_map, /* transfer_map */ |
@@ -770,7 +770,7 @@ static unsigned r300_texture_is_referenced(struct pipe_context *context, | |||
struct r300_context *r300 = r300_context(context); | |||
struct r300_texture *rtex = (struct r300_texture *)texture; | |||
if (r300->rws->is_resource_referenced(r300->rws, rtex->buffer)) | |||
if (r300->rws->is_buffer_referenced(r300->rws, rtex->buffer)) | |||
return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; | |||
return PIPE_UNREFERENCED; |
@@ -159,7 +159,7 @@ struct r300_winsys_screen { | |||
unsigned stride, | |||
struct winsys_handle *whandle); | |||
boolean (*is_resource_referenced)(struct r300_winsys_screen *winsys, | |||
boolean (*is_buffer_referenced)(struct r300_winsys_screen *winsys, | |||
struct r300_winsys_buffer *buffer); | |||
@@ -0,0 +1,86 @@ | |||
/* | |||
* Copyright © 2008 Jérôme Glisse | |||
* All Rights Reserved. | |||
* | |||
* Permission is hereby granted, free of charge, to any person obtaining | |||
* a copy of this software and associated documentation files (the | |||
* "Software"), to deal in the Software without restriction, including | |||
* without limitation the rights to use, copy, modify, merge, publish, | |||
* distribute, sub license, and/or sell copies of the Software, and to | |||
* permit persons to whom the Software is furnished to do so, subject to | |||
* the following conditions: | |||
* | |||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | |||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |||
* NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS | |||
* AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | |||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | |||
* USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
* | |||
* The above copyright notice and this permission notice (including the | |||
* next paragraph) shall be included in all copies or substantial portions | |||
* of the Software. | |||
*/ | |||
/* | |||
* Authors: | |||
* Jérôme Glisse <glisse@freedesktop.org> | |||
*/ | |||
#ifndef RADEON_BUFFER_H | |||
#define RADEON_BUFFER_H | |||
#include <stdio.h> | |||
#include "pipe/p_defines.h" | |||
#include "util/u_inlines.h" | |||
#include "pipebuffer/pb_buffer.h" | |||
#include "pipebuffer/pb_bufmgr.h" | |||
#include "radeon_bo.h" | |||
#include "radeon_cs.h" | |||
#include "radeon_winsys.h" | |||
#define RADEON_MAX_BOS 24 | |||
static INLINE struct pb_buffer * | |||
radeon_pb_buffer(struct r300_winsys_buffer *buffer) | |||
{ | |||
return (struct pb_buffer *)buffer; | |||
} | |||
static INLINE struct r300_winsys_buffer * | |||
radeon_libdrm_winsys_buffer(struct pb_buffer *buffer) | |||
{ | |||
return (struct r300_winsys_buffer *)buffer; | |||
} | |||
struct pb_manager * | |||
radeon_drm_bufmgr_create(struct radeon_libdrm_winsys *rws); | |||
boolean radeon_drm_bufmgr_add_buffer(struct pb_buffer *_buf, | |||
uint32_t rd, uint32_t wd); | |||
void radeon_drm_bufmgr_write_reloc(struct pb_buffer *_buf, | |||
uint32_t rd, uint32_t wd, | |||
uint32_t flags); | |||
struct pb_buffer *radeon_drm_bufmgr_create_buffer_from_handle(struct pb_manager *_mgr, | |||
uint32_t handle); | |||
void radeon_drm_bufmgr_set_tiling(struct pb_buffer *_buf, | |||
enum r300_buffer_tiling microtiled, | |||
enum r300_buffer_tiling macrotiled, | |||
uint32_t pitch); | |||
void radeon_drm_bufmgr_flush_maps(struct pb_manager *_mgr); | |||
boolean radeon_drm_bufmgr_get_handle(struct pb_buffer *_buf, | |||
struct winsys_handle *whandle); | |||
boolean radeon_drm_bufmgr_is_buffer_referenced(struct pb_buffer *_buf); | |||
#endif |
@@ -31,6 +31,7 @@ | |||
#include "radeon_drm.h" | |||
#include "radeon_r300.h" | |||
#include "radeon_buffer.h" | |||
#include "r300_winsys.h" | |||
#include "trace/tr_drm.h" |
@@ -3,6 +3,7 @@ | |||
#include "radeon_drm.h" | |||
#include "radeon_bo_gem.h" | |||
#include "radeon_cs_gem.h" | |||
#include "radeon_buffer.h" | |||
#include "util/u_inlines.h" | |||
#include "util/u_memory.h" | |||
@@ -71,7 +72,7 @@ radeon_drm_buffer_map(struct pb_buffer *_buf, | |||
struct radeon_drm_buffer *buf = radeon_drm_buffer(_buf); | |||
int write; | |||
if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) { | |||
if (flags & PIPE_TRANSFER_DONTBLOCK) { | |||
if ((_buf->base.usage & PIPE_BUFFER_USAGE_VERTEX) || | |||
(_buf->base.usage & PIPE_BUFFER_USAGE_INDEX)) | |||
if (radeon_bo_is_referenced_by_cs(buf->bo, buf->mgr->rws->cs)) | |||
@@ -81,7 +82,7 @@ radeon_drm_buffer_map(struct pb_buffer *_buf, | |||
if (buf->bo->ptr != NULL) | |||
return buf->bo->ptr; | |||
if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) { | |||
if (flags & PIPE_TRANSFER_DONTBLOCK) { | |||
uint32_t domain; | |||
if (radeon_bo_is_busy(buf->bo, &domain)) | |||
return NULL; |
@@ -21,6 +21,7 @@ | |||
* USE OR OTHER DEALINGS IN THE SOFTWARE. */ | |||
#include "radeon_r300.h" | |||
#include "radeon_buffer.h" | |||
#include "radeon_bo_gem.h" | |||
#include "radeon_cs_gem.h" |