Просмотр исходного кода

st/dri: update for pipe_resources

gallium-resources
Keith Whitwell 16 лет назад
Родитель
Сommit
eb39977fe7

+ 9
- 9
src/gallium/state_trackers/dri/dri1.c Просмотреть файл

} }


static struct pipe_surface * static struct pipe_surface *
dri1_get_pipe_surface(struct dri_drawable *drawable, struct pipe_texture *ptex)
dri1_get_pipe_surface(struct dri_drawable *drawable, struct pipe_resource *ptex)
{ {
struct pipe_screen *pipe_screen = dri_screen(drawable->sPriv)->pipe_screen; struct pipe_screen *pipe_screen = dri_screen(drawable->sPriv)->pipe_screen;
struct pipe_surface *psurf = drawable->dri1_surface; struct pipe_surface *psurf = drawable->dri1_surface;


static void static void
dri1_present_texture_locked(__DRIdrawable * dPriv, dri1_present_texture_locked(__DRIdrawable * dPriv,
struct pipe_texture *ptex,
struct pipe_resource *ptex,
const struct drm_clip_rect *sub_box, const struct drm_clip_rect *sub_box,
struct pipe_fence_handle **fence) struct pipe_fence_handle **fence)
{ {


static void static void
dri1_copy_to_front(struct dri_context *ctx, dri1_copy_to_front(struct dri_context *ctx,
struct pipe_texture *ptex,
struct pipe_resource *ptex,
__DRIdrawable * dPriv, __DRIdrawable * dPriv,
const struct drm_clip_rect *sub_box, const struct drm_clip_rect *sub_box,
struct pipe_fence_handle **fence) struct pipe_fence_handle **fence)


void void
dri1_flush_frontbuffer(struct dri_drawable *drawable, dri1_flush_frontbuffer(struct dri_drawable *drawable,
struct pipe_texture *ptex)
struct pipe_resource *ptex)
{ {
struct st_api *stapi = dri_get_st_api(); struct st_api *stapi = dri_get_st_api();
struct dri_screen *screen = dri_screen(drawable->sPriv); struct dri_screen *screen = dri_screen(drawable->sPriv);
struct dri_screen *screen = dri_screen(draw->sPriv); struct dri_screen *screen = dri_screen(draw->sPriv);
struct pipe_screen *pipe_screen = screen->pipe_screen; struct pipe_screen *pipe_screen = screen->pipe_screen;
struct pipe_fence_handle *fence; struct pipe_fence_handle *fence;
struct pipe_texture *ptex;
struct pipe_resource *ptex;


assert(__dri1_api_hooks != NULL); assert(__dri1_api_hooks != NULL);


struct drm_clip_rect sub_bbox; struct drm_clip_rect sub_bbox;
struct dri_drawable *draw = dri_drawable(dPriv); struct dri_drawable *draw = dri_drawable(dPriv);
struct pipe_fence_handle *dummy_fence; struct pipe_fence_handle *dummy_fence;
struct pipe_texture *ptex;
struct pipe_resource *ptex;


assert(__dri1_api_hooks != NULL); assert(__dri1_api_hooks != NULL);


unsigned mask) unsigned mask)
{ {
struct dri_screen *screen = dri_screen(drawable->sPriv); struct dri_screen *screen = dri_screen(drawable->sPriv);
struct pipe_texture templ;
struct pipe_resource templ;
int i; int i;


/* remove outdated textures */ /* remove outdated textures */
if (drawable->old_w != width || drawable->old_h != height) { if (drawable->old_w != width || drawable->old_h != height) {
for (i = 0; i < ST_ATTACHMENT_COUNT; i++) for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
pipe_texture_reference(&drawable->textures[i], NULL);
pipe_resource_reference(&drawable->textures[i], NULL);
} }


memset(&templ, 0, sizeof(templ)); memset(&templ, 0, sizeof(templ));
templ.tex_usage = tex_usage; templ.tex_usage = tex_usage;


drawable->textures[i] = drawable->textures[i] =
screen->pipe_screen->texture_create(screen->pipe_screen, &templ);
screen->pipe_screen->resource_create(screen->pipe_screen, &templ);
} }
} }



+ 1
- 1
src/gallium/state_trackers/dri/dri1.h Просмотреть файл



void void
dri1_flush_frontbuffer(struct dri_drawable *drawable, dri1_flush_frontbuffer(struct dri_drawable *drawable,
struct pipe_texture *ptex);
struct pipe_resource *ptex);


void void
dri1_allocate_textures(struct dri_drawable *drawable, dri1_allocate_textures(struct dri_drawable *drawable,

+ 2
- 2
src/gallium/state_trackers/dri/dri_drawable.c Просмотреть файл

{ {
struct dri_context *ctx = dri_context(pDRICtx); struct dri_context *ctx = dri_context(pDRICtx);
struct dri_drawable *drawable = dri_drawable(dPriv); struct dri_drawable *drawable = dri_drawable(dPriv);
struct pipe_texture *pt =
struct pipe_resource *pt =
dri_get_st_framebuffer_texture(drawable->stfb, ST_ATTACHMENT_FRONT_LEFT); dri_get_st_framebuffer_texture(drawable->stfb, ST_ATTACHMENT_FRONT_LEFT);


if (pt) { if (pt) {


pipe_surface_reference(&drawable->dri1_surface, NULL); pipe_surface_reference(&drawable->dri1_surface, NULL);
for (i = 0; i < ST_ATTACHMENT_COUNT; i++) for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
pipe_texture_reference(&drawable->textures[i], NULL);
pipe_resource_reference(&drawable->textures[i], NULL);


dri_destroy_st_framebuffer(drawable->stfb); dri_destroy_st_framebuffer(drawable->stfb);



+ 1
- 1
src/gallium/state_trackers/dri/dri_drawable.h Просмотреть файл

unsigned old_w; unsigned old_w;
unsigned old_h; unsigned old_h;


struct pipe_texture *textures[ST_ATTACHMENT_COUNT];
struct pipe_resource *textures[ST_ATTACHMENT_COUNT];
unsigned int texture_mask, texture_stamp; unsigned int texture_mask, texture_stamp;


struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX]; struct pipe_fence_handle *swap_fences[DRI_SWAP_FENCES_MAX];

+ 7
- 7
src/gallium/state_trackers/dri/dri_st_api.c Просмотреть файл

{ {
struct dri_screen *screen = dri_screen(drawable->sPriv); struct dri_screen *screen = dri_screen(drawable->sPriv);
__DRIdrawable *dri_drawable = drawable->dPriv; __DRIdrawable *dri_drawable = drawable->dPriv;
struct pipe_texture templ;
struct pipe_resource templ;
struct winsys_handle whandle; struct winsys_handle whandle;
boolean have_depth = FALSE; boolean have_depth = FALSE;
unsigned i; unsigned i;
return; return;


for (i = 0; i < ST_ATTACHMENT_COUNT; i++) for (i = 0; i < ST_ATTACHMENT_COUNT; i++)
pipe_texture_reference(&drawable->textures[i], NULL);
pipe_resource_reference(&drawable->textures[i], NULL);


memset(&templ, 0, sizeof(templ)); memset(&templ, 0, sizeof(templ));
templ.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET; templ.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
whandle.stride = buf->pitch; whandle.stride = buf->pitch;
drawable->textures[statt] = drawable->textures[statt] =
screen->pipe_screen->texture_from_handle(screen->pipe_screen,
screen->pipe_screen->resource_from_handle(screen->pipe_screen,
&templ, &whandle); &templ, &whandle);
} }


dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi, dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
const enum st_attachment_type *statts, const enum st_attachment_type *statts,
unsigned count, unsigned count,
struct pipe_texture **out)
struct pipe_resource **out)
{ {
struct dri_drawable *drawable = struct dri_drawable *drawable =
(struct dri_drawable *) stfbi->st_manager_private; (struct dri_drawable *) stfbi->st_manager_private;


for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
out[i] = NULL; out[i] = NULL;
pipe_texture_reference(&out[i], drawable->textures[statts[i]]);
pipe_resource_reference(&out[i], drawable->textures[statts[i]]);
} }


return TRUE; return TRUE;
drawable->sPriv->dri2.loader; drawable->sPriv->dri2.loader;


if (__dri1_api_hooks) { if (__dri1_api_hooks) {
struct pipe_texture *ptex = drawable->textures[statt];
struct pipe_resource *ptex = drawable->textures[statt];
if (ptex) if (ptex)
dri1_flush_frontbuffer(drawable, ptex); dri1_flush_frontbuffer(drawable, ptex);
return TRUE; return TRUE;
* Return the texture at an attachment. Allocate the texture if it does not * Return the texture at an attachment. Allocate the texture if it does not
* exist. * exist.
*/ */
struct pipe_texture *
struct pipe_resource *
dri_get_st_framebuffer_texture(struct st_framebuffer_iface *stfbi, dri_get_st_framebuffer_texture(struct st_framebuffer_iface *stfbi,
enum st_attachment_type statt) enum st_attachment_type statt)
{ {

+ 1
- 1
src/gallium/state_trackers/dri/dri_st_api.h Просмотреть файл

void void
dri_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi); dri_destroy_st_framebuffer(struct st_framebuffer_iface *stfbi);


struct pipe_texture *
struct pipe_resource *
dri_get_st_framebuffer_texture(struct st_framebuffer_iface *stfbi, dri_get_st_framebuffer_texture(struct st_framebuffer_iface *stfbi,
enum st_attachment_type statt); enum st_attachment_type statt);



Загрузка…
Отмена
Сохранить