mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
gallium: Reorg texture usage flags
Introduce a new shared usage and rename primary to scanout. The display target usage is more of a windows concept and doesn't mean the same thing as shared. Display target means that the surface should be presentable, for softpipe this means that it should be backed by a hardware buffer.
This commit is contained in:
parent
b2e94d05c9
commit
3f37f23d17
13 changed files with 35 additions and 26 deletions
|
|
@ -219,12 +219,12 @@ i915_miptree_layout_2d(struct i915_texture *tex)
|
|||
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->width0);
|
||||
|
||||
/* used for scanouts that need special layouts */
|
||||
if (pt->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
|
||||
if (pt->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT)
|
||||
if (i915_scanout_layout(tex))
|
||||
return;
|
||||
|
||||
/* for shared buffers we use something very like scanout */
|
||||
if (pt->tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET)
|
||||
/* shared buffers needs to be compatible with X servers */
|
||||
if (pt->tex_usage & PIPE_TEXTURE_USAGE_SHARED)
|
||||
if (i915_display_target_layout(tex))
|
||||
return;
|
||||
|
||||
|
|
@ -369,12 +369,12 @@ i945_miptree_layout_2d(struct i915_texture *tex)
|
|||
unsigned nblocksy = util_format_get_nblocksy(pt->format, pt->height0);
|
||||
|
||||
/* used for scanouts that need special layouts */
|
||||
if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY)
|
||||
if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_SCANOUT)
|
||||
if (i915_scanout_layout(tex))
|
||||
return;
|
||||
|
||||
/* for shared buffers we use some very like scanout */
|
||||
if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET)
|
||||
/* shared buffers needs to be compatible with X servers */
|
||||
if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_SHARED)
|
||||
if (i915_display_target_layout(tex))
|
||||
return;
|
||||
|
||||
|
|
@ -642,7 +642,7 @@ i915_texture_create(struct pipe_screen *screen,
|
|||
|
||||
|
||||
/* for scanouts and cursors, cursors arn't scanouts */
|
||||
if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width0 != 64)
|
||||
if (templat->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT && templat->width0 != 64)
|
||||
buf_usage = INTEL_NEW_SCANOUT;
|
||||
else
|
||||
buf_usage = INTEL_NEW_TEXTURE;
|
||||
|
|
|
|||
|
|
@ -231,8 +231,8 @@ static struct pipe_texture *brw_texture_create( struct pipe_screen *screen,
|
|||
goto fail;
|
||||
|
||||
|
||||
if (templ->tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
|
||||
PIPE_TEXTURE_USAGE_PRIMARY)) {
|
||||
if (templ->tex_usage & (PIPE_TEXTURE_USAGE_SCANOUT |
|
||||
PIPE_TEXTURE_USAGE_SHARED)) {
|
||||
buffer_type = BRW_BUFFER_TYPE_SCANOUT;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -125,7 +125,8 @@ llvmpipe_texture_create(struct pipe_screen *_screen,
|
|||
lpt->base.screen = &screen->base;
|
||||
|
||||
if (lpt->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
|
||||
PIPE_TEXTURE_USAGE_PRIMARY)) {
|
||||
PIPE_TEXTURE_USAGE_SCANOUT |
|
||||
PIPE_TEXTURE_USAGE_SHARED)) {
|
||||
if (!llvmpipe_displaytarget_layout(screen, lpt))
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,14 +231,16 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
|
|||
/* Check colorbuffer format support. */
|
||||
if ((usage & (PIPE_TEXTURE_USAGE_RENDER_TARGET |
|
||||
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
|
||||
PIPE_TEXTURE_USAGE_PRIMARY)) &&
|
||||
PIPE_TEXTURE_USAGE_SCANOUT |
|
||||
PIPE_TEXTURE_USAGE_SHARED)) &&
|
||||
/* 2101010 cannot be rendered to on non-r5xx. */
|
||||
(is_r500 || !is_color2101010) &&
|
||||
r300_is_colorbuffer_format_supported(format)) {
|
||||
retval |= usage &
|
||||
(PIPE_TEXTURE_USAGE_RENDER_TARGET |
|
||||
PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
|
||||
PIPE_TEXTURE_USAGE_PRIMARY);
|
||||
PIPE_TEXTURE_USAGE_SCANOUT |
|
||||
PIPE_TEXTURE_USAGE_SHARED);
|
||||
}
|
||||
|
||||
/* Check depth-stencil format support. */
|
||||
|
|
|
|||
|
|
@ -123,7 +123,8 @@ softpipe_texture_create(struct pipe_screen *screen,
|
|||
util_is_power_of_two(template->depth0));
|
||||
|
||||
if (spt->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
|
||||
PIPE_TEXTURE_USAGE_PRIMARY)) {
|
||||
PIPE_TEXTURE_USAGE_SCANOUT |
|
||||
PIPE_TEXTURE_USAGE_SHARED)) {
|
||||
if (!softpipe_displaytarget_layout(screen, spt))
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,7 +315,11 @@ svga_texture_create(struct pipe_screen *screen,
|
|||
tex->key.cachable = 0;
|
||||
}
|
||||
|
||||
if(templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) {
|
||||
if(templat->tex_usage & PIPE_TEXTURE_USAGE_SHARED) {
|
||||
tex->key.cachable = 0;
|
||||
}
|
||||
|
||||
if(templat->tex_usage & PIPE_TEXTURE_USAGE_SCANOUT) {
|
||||
tex->key.flags |= SVGA3D_SURFACE_HINT_SCANOUT;
|
||||
tex->key.cachable = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,11 +176,12 @@ enum pipe_texture_target {
|
|||
#define PIPE_TEX_COMPARE_R_TO_TEXTURE 1
|
||||
|
||||
#define PIPE_TEXTURE_USAGE_RENDER_TARGET 0x1
|
||||
#define PIPE_TEXTURE_USAGE_DISPLAY_TARGET 0x2 /* ie a backbuffer */
|
||||
#define PIPE_TEXTURE_USAGE_PRIMARY 0x4 /* ie a frontbuffer */
|
||||
#define PIPE_TEXTURE_USAGE_DISPLAY_TARGET 0x2 /* windows presentable buffer, ie a backbuffer */
|
||||
#define PIPE_TEXTURE_USAGE_SCANOUT 0x4 /* ie a frontbuffer */
|
||||
#define PIPE_TEXTURE_USAGE_DEPTH_STENCIL 0x8
|
||||
#define PIPE_TEXTURE_USAGE_SAMPLER 0x10
|
||||
#define PIPE_TEXTURE_USAGE_DYNAMIC 0x20
|
||||
#define PIPE_TEXTURE_USAGE_SHARED 0x40
|
||||
/** Pipe driver custom usage flags should be greater or equal to this value */
|
||||
#define PIPE_TEXTURE_USAGE_CUSTOM (1 << 16)
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ kms_surface_validate(struct native_surface *nsurf, uint attachment_mask,
|
|||
templ.format = ksurf->color_format;
|
||||
templ.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET;
|
||||
if (ksurf->type == KMS_SURFACE_TYPE_SCANOUT)
|
||||
templ.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
|
||||
templ.tex_usage |= PIPE_TEXTURE_SCANOUT;
|
||||
}
|
||||
|
||||
/* create textures */
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
|
|||
|
||||
memset(&templat, 0, sizeof(templat));
|
||||
templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
|
||||
templat.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
|
||||
templat.tex_usage |= PIPE_TEXTURE_USAGE_SCANOUT;
|
||||
templat.target = PIPE_TEXTURE_2D;
|
||||
templat.last_level = 0;
|
||||
templat.depth0 = 1;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
|
|||
template.depth0 = 1;
|
||||
template.last_level = 0;
|
||||
template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL |
|
||||
PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
|
||||
PIPE_TEXTURE_USAGE_SHARED;
|
||||
tex = ms->screen->texture_create(ms->screen, &template);
|
||||
pipe_texture_reference(&exa_priv->depth_stencil_tex, tex);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -789,7 +789,7 @@ xorg_exa_set_displayed_usage(PixmapPtr pPixmap)
|
|||
return 0;
|
||||
}
|
||||
|
||||
priv->flags |= PIPE_TEXTURE_USAGE_PRIMARY;
|
||||
priv->flags |= PIPE_TEXTURE_USAGE_SCANOUT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -805,7 +805,7 @@ xorg_exa_set_shared_usage(PixmapPtr pPixmap)
|
|||
return 0;
|
||||
}
|
||||
|
||||
priv->flags |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
|
||||
priv->flags |= PIPE_TEXTURE_USAGE_SHARED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -943,7 +943,7 @@ xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex)
|
|||
{
|
||||
struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap);
|
||||
|
||||
int mask = PIPE_TEXTURE_USAGE_PRIMARY | PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
|
||||
int mask = PIPE_TEXTURE_USAGE_SHARED | PIPE_TEXTURE_USAGE_SCANOUT;
|
||||
|
||||
if (!priv)
|
||||
return FALSE;
|
||||
|
|
@ -976,8 +976,8 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
|
|||
template.depth0 = 1;
|
||||
template.last_level = 0;
|
||||
template.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET;
|
||||
template.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY;
|
||||
template.tex_usage |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
|
||||
template.tex_usage |= PIPE_TEXTURE_USAGE_SCANOUT;
|
||||
template.tex_usage |= PIPE_TEXTURE_USAGE_SHARED;
|
||||
|
||||
return exa->scrn->texture_create(exa->scrn, &template);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, u
|
|||
template.width0 = width;
|
||||
template.height0 = height;
|
||||
template.depth0 = 1;
|
||||
template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET;
|
||||
template.tex_usage = PIPE_TEXTURE_USAGE_SHARED;
|
||||
|
||||
tex = vpipe->screen->texture_create(vpipe->screen, &template);
|
||||
if (!tex)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ dri_surface_from_handle(struct drm_api *api, struct pipe_screen *pscreen,
|
|||
struct pipe_texture tmpl;
|
||||
|
||||
memset(&tmpl, 0, sizeof(tmpl));
|
||||
tmpl.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY;
|
||||
tmpl.tex_usage = PIPE_TEXTURE_USAGE_SCANOUT;
|
||||
tmpl.target = PIPE_TEXTURE_2D;
|
||||
tmpl.last_level = 0;
|
||||
tmpl.depth0 = 1;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue