From: Marek Olšák <marek.ol...@amd.com> Some other changes needed here. --- src/gallium/auxiliary/rbug/rbug_texture.c | 4 ++-- src/gallium/auxiliary/rbug/rbug_texture.h | 4 ++-- src/gallium/auxiliary/vl/vl_video_buffer.h | 2 +- src/gallium/drivers/rbug/rbug_core.c | 2 +- src/gallium/include/pipe/p_state.h | 10 +++++----- src/gallium/state_trackers/vdpau/surface.c | 8 +++++--- src/mesa/state_tracker/st_cb_texture.c | 15 ++++++++++----- src/mesa/state_tracker/st_texture.c | 17 +++++++++-------- src/mesa/state_tracker/st_texture.h | 14 +++++++------- 9 files changed, 42 insertions(+), 34 deletions(-)
diff --git a/src/gallium/auxiliary/rbug/rbug_texture.c b/src/gallium/auxiliary/rbug/rbug_texture.c index ca05147..3ee5e14 100644 --- a/src/gallium/auxiliary/rbug/rbug_texture.c +++ b/src/gallium/auxiliary/rbug/rbug_texture.c @@ -276,23 +276,23 @@ int rbug_send_texture_list_reply(struct rbug_connection *__con, FREE(__data); return __ret; } int rbug_send_texture_info_reply(struct rbug_connection *__con, uint32_t serial, uint32_t target, uint32_t format, uint32_t *width, uint32_t width_len, - uint32_t *height, + uint16_t *height, uint32_t height_len, - uint32_t *depth, + uint16_t *depth, uint32_t depth_len, uint32_t blockw, uint32_t blockh, uint32_t blocksize, uint32_t last_level, uint32_t nr_samples, uint32_t tex_usage, uint32_t *__serial) { uint32_t __len = 0; diff --git a/src/gallium/auxiliary/rbug/rbug_texture.h b/src/gallium/auxiliary/rbug/rbug_texture.h index 59c9140..269e596 100644 --- a/src/gallium/auxiliary/rbug/rbug_texture.h +++ b/src/gallium/auxiliary/rbug/rbug_texture.h @@ -159,23 +159,23 @@ int rbug_send_texture_list_reply(struct rbug_connection *__con, rbug_texture_t *textures, uint32_t textures_len, uint32_t *__serial); int rbug_send_texture_info_reply(struct rbug_connection *__con, uint32_t serial, uint32_t target, uint32_t format, uint32_t *width, uint32_t width_len, - uint32_t *height, + uint16_t *height, uint32_t height_len, - uint32_t *depth, + uint16_t *depth, uint32_t depth_len, uint32_t blockw, uint32_t blockh, uint32_t blocksize, uint32_t last_level, uint32_t nr_samples, uint32_t tex_usage, uint32_t *__serial); int rbug_send_texture_read_reply(struct rbug_connection *__con, diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.h b/src/gallium/auxiliary/vl/vl_video_buffer.h index 8a1c077..1dc47c8 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.h +++ b/src/gallium/auxiliary/vl/vl_video_buffer.h @@ -42,21 +42,21 @@ struct vl_video_buffer { struct pipe_video_buffer base; unsigned num_planes; struct pipe_resource *resources[VL_NUM_COMPONENTS]; struct pipe_sampler_view *sampler_view_planes[VL_NUM_COMPONENTS]; struct pipe_sampler_view *sampler_view_components[VL_NUM_COMPONENTS]; struct pipe_surface *surfaces[VL_MAX_SURFACES]; }; static inline void -vl_video_buffer_adjust_size(unsigned *width, unsigned *height, unsigned plane, +vl_video_buffer_adjust_size(unsigned *width, uint16_t *height, unsigned plane, enum pipe_video_chroma_format chroma_format, bool interlaced) { if (interlaced) { *height /= 2; } if (plane > 0) { if (chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) { *width /= 2; *height /= 2; diff --git a/src/gallium/drivers/rbug/rbug_core.c b/src/gallium/drivers/rbug/rbug_core.c index 64c2d63..82bcef8 100644 --- a/src/gallium/drivers/rbug/rbug_core.c +++ b/src/gallium/drivers/rbug/rbug_core.c @@ -198,21 +198,21 @@ rbug_texture_list(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_ } static int rbug_texture_info(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_t serial) { struct rbug_screen *rb_screen = tr_rbug->rb_screen; struct rbug_resource *tr_tex = NULL; struct rbug_proto_texture_info *gpti = (struct rbug_proto_texture_info *)header; struct rbug_list *ptr; struct pipe_resource *t; - unsigned num_layers; + uint16_t num_layers; mtx_lock(&rb_screen->list_mutex); foreach(ptr, &rb_screen->resources) { tr_tex = container_of(ptr, struct rbug_resource, list); if (gpti->texture == VOID2U64(tr_tex)) break; tr_tex = NULL; } if (!tr_tex) { diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 6a147ef..ae7f1c3 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -487,28 +487,28 @@ struct pipe_box }; /** * A memory object/resource such as a vertex buffer or texture. */ struct pipe_resource { struct pipe_reference reference; struct pipe_screen *screen; /**< screen that this texture belongs to */ - enum pipe_texture_target target; /**< PIPE_TEXTURE_x */ - enum pipe_format format; /**< PIPE_FORMAT_x */ unsigned width0; - unsigned height0; - unsigned depth0; - unsigned array_size; + uint16_t height0; + uint16_t depth0; + uint16_t array_size; + enum pipe_format format:16; /**< PIPE_FORMAT_x */ + enum pipe_texture_target target:8; /**< PIPE_TEXTURE_x */ unsigned last_level:8; /**< Index of last mipmap level present/defined */ unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */ unsigned usage:8; /**< PIPE_USAGE_x (not a bitmask) */ unsigned bind; /**< bitmask of PIPE_BIND_x */ unsigned flags; /**< bitmask of PIPE_RESOURCE_FLAG_x */ /** * For planar images, ie. YUV EGLImage external, etc, pointer to the * next plane. diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c index 884ae30..0e679d7 100644 --- a/src/gallium/state_trackers/vdpau/surface.c +++ b/src/gallium/state_trackers/vdpau/surface.c @@ -173,21 +173,21 @@ vlVdpVideoSurfaceGetParameters(VdpVideoSurface surface, *width = p_surf->templat.width; *height = p_surf->templat.height; *chroma_type = PipeToChroma(p_surf->templat.chroma_format); } return VDP_STATUS_OK; } static void vlVdpVideoSurfaceSize(vlVdpSurface *p_surf, int component, - unsigned *width, unsigned *height) + unsigned *width, uint16_t *height) { *width = p_surf->templat.width; *height = p_surf->templat.height; vl_video_buffer_adjust_size(width, height, component, p_surf->templat.chroma_format, p_surf->templat.interlaced); } /** @@ -239,21 +239,22 @@ vlVdpVideoSurfaceGetBitsYCbCr(VdpVideoSurface surface, } mtx_lock(&vlsurface->device->mutex); sampler_views = vlsurface->video_buffer->get_sampler_view_planes(vlsurface->video_buffer); if (!sampler_views) { mtx_unlock(&vlsurface->device->mutex); return VDP_STATUS_RESOURCES; } for (i = 0; i < 3; ++i) { - unsigned width, height; + unsigned width; + uint16_t height; struct pipe_sampler_view *sv = sampler_views[i]; if (!sv) continue; vlVdpVideoSurfaceSize(vlsurface, i, &width, &height); for (j = 0; j < sv->texture->array_size; ++j) { struct pipe_box box = { 0, 0, j, width, height, 1 }; @@ -371,21 +372,22 @@ vlVdpVideoSurfacePutBitsYCbCr(VdpVideoSurface surface, return VDP_STATUS_NO_IMPLEMENTATION; } sampler_views = p_surf->video_buffer->get_sampler_view_planes(p_surf->video_buffer); if (!sampler_views) { mtx_unlock(&p_surf->device->mutex); return VDP_STATUS_RESOURCES; } for (i = 0; i < 3; ++i) { - unsigned width, height; + unsigned width; + uint16_t height; struct pipe_sampler_view *sv = sampler_views[i]; struct pipe_resource *tex; if (!sv || !source_pitches[i]) continue; tex = sv->texture; vlVdpVideoSurfaceSize(p_surf, i, &width, &height); for (j = 0; j < tex->array_size; ++j) { struct pipe_box dst_box = { 0, 0, j, diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 1b486d7..99c59f7 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -490,21 +490,22 @@ allocate_full_mipmap(const struct st_texture_object *stObj, * \return GL_TRUE for success, GL_FALSE if out of memory. */ static GLboolean guess_and_alloc_texture(struct st_context *st, struct st_texture_object *stObj, const struct st_texture_image *stImage) { const struct gl_texture_image *firstImage; GLuint lastLevel, width, height, depth; GLuint bindings; - GLuint ptWidth, ptHeight, ptDepth, ptLayers; + unsigned ptWidth; + uint16_t ptHeight, ptDepth, ptLayers; enum pipe_format fmt; bool guessed_box = false; DBG("%s\n", __func__); assert(!stObj->pt); /* If a base level image with compatible size exists, use that as our guess. */ firstImage = _mesa_base_tex_image(&stObj->base); @@ -642,21 +643,22 @@ st_AllocTextureImageBuffer(struct gl_context *ctx, else { /* Create a new, temporary texture/resource/buffer to hold this * one texture image. Note that when we later access this image * (either for mapping or copying) we'll want to always specify * mipmap level=0, even if the image represents some other mipmap * level. */ enum pipe_format format = st_mesa_format_to_pipe_format(st, texImage->TexFormat); GLuint bindings = default_bindings(st, format); - GLuint ptWidth, ptHeight, ptDepth, ptLayers; + unsigned ptWidth; + uint16_t ptHeight, ptDepth, ptLayers; st_gl_texture_dims_to_pipe_dims(stObj->base.Target, width, height, depth, &ptWidth, &ptHeight, &ptDepth, &ptLayers); stImage->pt = st_texture_create(st, gl_target_to_pipe(stObj->base.Target), format, 0, /* lastLevel */ ptWidth, @@ -2436,21 +2438,22 @@ st_finalize_texture(struct gl_context *ctx, struct pipe_context *pipe, struct gl_texture_object *tObj, GLuint cubeMapFace) { struct st_context *st = st_context(ctx); struct st_texture_object *stObj = st_texture_object(tObj); const GLuint nr_faces = _mesa_num_tex_faces(stObj->base.Target); GLuint face; const struct st_texture_image *firstImage; enum pipe_format firstImageFormat; - GLuint ptWidth, ptHeight, ptDepth, ptLayers, ptNumSamples; + unsigned ptWidth; + uint16_t ptHeight, ptDepth, ptLayers, ptNumSamples; if (tObj->Immutable) return GL_TRUE; if (_mesa_is_texture_complete(tObj, &tObj->Sampler)) { /* The texture is complete and we know exactly how many mipmap levels * are present/needed. This is conditional because we may be called * from the st_generate_mipmap() function when the texture object is * incomplete. In that case, we'll have set stObj->lastLevel before * we get here. @@ -2498,21 +2501,22 @@ st_finalize_texture(struct gl_context *ctx, if (stObj->surface_based) { return GL_TRUE; } /* Find gallium format for the Mesa texture */ firstImageFormat = st_mesa_format_to_pipe_format(st, firstImage->base.TexFormat); /* Find size of level=0 Gallium mipmap image, plus number of texture layers */ { - GLuint width, height, depth; + unsigned width; + uint16_t height, depth; st_gl_texture_dims_to_pipe_dims(stObj->base.Target, firstImage->base.Width2, firstImage->base.Height2, firstImage->base.Depth2, &width, &height, &depth, &ptLayers); /* If we previously allocated a pipe texture and its sizes are * compatible, use them. */ @@ -2639,21 +2643,22 @@ static GLboolean st_AllocTextureStorage(struct gl_context *ctx, struct gl_texture_object *texObj, GLsizei levels, GLsizei width, GLsizei height, GLsizei depth) { const GLuint numFaces = _mesa_num_tex_faces(texObj->Target); struct gl_texture_image *texImage = texObj->Image[0][0]; struct st_context *st = st_context(ctx); struct st_texture_object *stObj = st_texture_object(texObj); struct pipe_screen *screen = st->pipe->screen; - GLuint ptWidth, ptHeight, ptDepth, ptLayers, bindings; + unsigned ptWidth, bindings; + uint16_t ptHeight, ptDepth, ptLayers; enum pipe_format fmt; GLint level; GLuint num_samples = texImage->NumSamples; assert(levels > 0); stObj->lastLevel = levels - 1; fmt = st_mesa_format_to_pipe_format(st, texImage->TexFormat); diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 7b72ffd..2e9856d 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -104,27 +104,27 @@ st_texture_create(struct st_context *st, /** * In OpenGL the number of 1D array texture layers is the "height" and * the number of 2D array texture layers is the "depth". In Gallium the * number of layers in an array texture is a separate 'array_size' field. * This function converts dimensions from the former to the later. */ void st_gl_texture_dims_to_pipe_dims(GLenum texture, - GLuint widthIn, - GLuint heightIn, - GLuint depthIn, - GLuint *widthOut, - GLuint *heightOut, - GLuint *depthOut, - GLuint *layersOut) + unsigned widthIn, + uint16_t heightIn, + uint16_t depthIn, + unsigned *widthOut, + uint16_t *heightOut, + uint16_t *depthOut, + uint16_t *layersOut) { switch (texture) { case GL_TEXTURE_1D: case GL_PROXY_TEXTURE_1D: assert(heightIn == 1); assert(depthIn == 1); *widthOut = widthIn; *heightOut = 1; *depthOut = 1; *layersOut = 1; @@ -195,21 +195,22 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture, /** * Check if a texture image can be pulled into a unified mipmap texture. */ GLboolean st_texture_match_image(struct st_context *st, const struct pipe_resource *pt, const struct gl_texture_image *image) { - GLuint ptWidth, ptHeight, ptDepth, ptLayers; + unsigned ptWidth; + uint16_t ptHeight, ptDepth, ptLayers; /* Images with borders are never pulled into mipmap textures. */ if (image->Border) return GL_FALSE; /* Check if this image's format matches the established texture's format. */ if (st_mesa_format_to_pipe_format(st, image->TexFormat) != pt->format) return GL_FALSE; diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h index 0ce7989..f797445 100644 --- a/src/mesa/state_tracker/st_texture.h +++ b/src/mesa/state_tracker/st_texture.h @@ -195,27 +195,27 @@ st_texture_create(struct st_context *st, GLuint width0, GLuint height0, GLuint depth0, GLuint layers, GLuint nr_samples, GLuint tex_usage ); extern void st_gl_texture_dims_to_pipe_dims(GLenum texture, - GLuint widthIn, - GLuint heightIn, - GLuint depthIn, - GLuint *widthOut, - GLuint *heightOut, - GLuint *depthOut, - GLuint *layersOut); + unsigned widthIn, + uint16_t heightIn, + uint16_t depthIn, + unsigned *widthOut, + uint16_t *heightOut, + uint16_t *depthOut, + uint16_t *layersOut); /* Check if an image fits into an existing texture object. */ extern GLboolean st_texture_match_image(struct st_context *st, const struct pipe_resource *pt, const struct gl_texture_image *image); /* Return a pointer to an image within a texture. Return image stride as * well. -- 2.7.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev