2 * Copyright 2010 Jerome Glisse <glisse@freedesktop.org>
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
28 #include <pipe/p_screen.h>
29 #include <util/u_format.h>
30 #include <util/u_math.h>
31 #include <util/u_inlines.h>
32 #include <util/u_memory.h>
33 #include "state_tracker/drm_driver.h"
34 #include "r600_pipe.h"
35 #include "r600_resource.h"
36 #include "r600_state_inlines.h"
39 extern struct u_resource_vtbl r600_texture_vtbl
;
41 /* Copy from a tiled texture to a detiled one. */
42 static void r600_copy_from_tiled_texture(struct pipe_context
*ctx
, struct r600_transfer
*rtransfer
)
44 struct pipe_transfer
*transfer
= (struct pipe_transfer
*)rtransfer
;
45 struct pipe_resource
*texture
= transfer
->resource
;
46 struct pipe_subresource subdst
;
50 ctx
->resource_copy_region(ctx
, rtransfer
->linear_texture
,
51 subdst
, 0, 0, 0, texture
, transfer
->sr
,
52 transfer
->box
.x
, transfer
->box
.y
, transfer
->box
.z
,
53 transfer
->box
.width
, transfer
->box
.height
);
57 /* Copy from a detiled texture to a tiled one. */
58 static void r600_copy_into_tiled_texture(struct pipe_context
*ctx
, struct r600_transfer
*rtransfer
)
60 struct pipe_transfer
*transfer
= (struct pipe_transfer
*)rtransfer
;
61 struct pipe_resource
*texture
= transfer
->resource
;
62 struct pipe_subresource subsrc
;
66 ctx
->resource_copy_region(ctx
, texture
, transfer
->sr
,
67 transfer
->box
.x
, transfer
->box
.y
, transfer
->box
.z
,
68 rtransfer
->linear_texture
, subsrc
,
70 transfer
->box
.width
, transfer
->box
.height
);
72 ctx
->flush(ctx
, 0, NULL
);
75 static unsigned long r600_texture_get_offset(struct r600_resource_texture
*rtex
,
76 unsigned level
, unsigned zslice
,
79 unsigned long offset
= rtex
->offset
[level
];
81 switch (rtex
->resource
.base
.b
.target
) {
84 return offset
+ zslice
* rtex
->layer_size
[level
];
85 case PIPE_TEXTURE_CUBE
:
87 return offset
+ face
* rtex
->layer_size
[level
];
89 assert(zslice
== 0 && face
== 0);
94 static unsigned r600_texture_get_stride(struct pipe_screen
*screen
,
95 struct r600_resource_texture
*rtex
,
98 struct pipe_resource
*ptex
= &rtex
->resource
.base
.b
;
99 struct radeon
*radeon
= (struct radeon
*)screen
->winsys
;
100 enum chip_class chipc
= r600_get_family_class(radeon
);
101 unsigned width
, stride
;
103 if (rtex
->pitch_override
)
104 return rtex
->pitch_override
;
106 width
= u_minify(ptex
->width0
, level
);
108 stride
= util_format_get_stride(ptex
->format
, align(width
, 64));
109 if (chipc
== EVERGREEN
)
110 stride
= align(stride
, 512);
112 stride
= align(stride
, 256);
116 static unsigned r600_texture_get_nblocksy(struct pipe_screen
*screen
,
117 struct r600_resource_texture
*rtex
,
120 struct pipe_resource
*ptex
= &rtex
->resource
.base
.b
;
123 height
= u_minify(ptex
->height0
, level
);
124 height
= util_next_power_of_two(height
);
125 return util_format_get_nblocksy(ptex
->format
, height
);
128 static void r600_setup_miptree(struct pipe_screen
*screen
,
129 struct r600_resource_texture
*rtex
)
131 struct pipe_resource
*ptex
= &rtex
->resource
.base
.b
;
132 struct radeon
*radeon
= (struct radeon
*)screen
->winsys
;
133 enum chip_class chipc
= r600_get_family_class(radeon
);
134 unsigned long pitch
, size
, layer_size
, i
, offset
;
137 rtex
->bpt
= util_format_get_blocksize(ptex
->format
);
138 for (i
= 0, offset
= 0; i
<= ptex
->last_level
; i
++) {
139 pitch
= r600_texture_get_stride(screen
, rtex
, i
);
140 nblocksy
= r600_texture_get_nblocksy(screen
, rtex
, i
);
142 layer_size
= pitch
* nblocksy
;
144 if (ptex
->target
== PIPE_TEXTURE_CUBE
) {
146 size
= layer_size
* 8;
148 size
= layer_size
* 6;
151 size
= layer_size
* u_minify(ptex
->depth0
, i
);
152 rtex
->offset
[i
] = offset
;
153 rtex
->layer_size
[i
] = layer_size
;
154 rtex
->pitch
[i
] = pitch
;
160 static struct r600_resource_texture
*
161 r600_texture_create_object(struct pipe_screen
*screen
,
162 const struct pipe_resource
*base
,
164 unsigned pitch_in_bytes_override
,
165 unsigned max_buffer_size
,
168 struct r600_resource_texture
*rtex
;
169 struct r600_resource
*resource
;
170 struct radeon
*radeon
= (struct radeon
*)screen
->winsys
;
172 rtex
= CALLOC_STRUCT(r600_resource_texture
);
176 resource
= &rtex
->resource
;
177 resource
->base
.b
= *base
;
178 resource
->base
.vtbl
= &r600_texture_vtbl
;
179 pipe_reference_init(&resource
->base
.b
.reference
, 1);
180 resource
->base
.b
.screen
= screen
;
182 resource
->domain
= r600_domain_from_usage(resource
->base
.b
.bind
);
183 rtex
->pitch_override
= pitch_in_bytes_override
;
184 rtex
->array_mode
= array_mode
;
186 r600_setup_miptree(screen
, rtex
);
188 resource
->size
= rtex
->size
;
191 resource
->bo
= r600_bo(radeon
, rtex
->size
, 4096, 0);
200 struct pipe_resource
*r600_texture_create(struct pipe_screen
*screen
,
201 const struct pipe_resource
*templ
)
203 unsigned array_mode
= 0;
205 return (struct pipe_resource
*)r600_texture_create_object(screen
, templ
, array_mode
,
210 static void r600_texture_destroy(struct pipe_screen
*screen
,
211 struct pipe_resource
*ptex
)
213 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)ptex
;
214 struct r600_resource
*resource
= &rtex
->resource
;
215 struct radeon
*radeon
= (struct radeon
*)screen
->winsys
;
217 if (rtex
->flushed_depth_texture
)
218 pipe_resource_reference((struct pipe_resource
**)&rtex
->flushed_depth_texture
, NULL
);
221 r600_bo_reference(radeon
, &resource
->bo
, NULL
);
226 static struct pipe_surface
*r600_get_tex_surface(struct pipe_screen
*screen
,
227 struct pipe_resource
*texture
,
228 unsigned face
, unsigned level
,
229 unsigned zslice
, unsigned flags
)
231 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)texture
;
232 struct pipe_surface
*surface
= CALLOC_STRUCT(pipe_surface
);
233 unsigned long offset
;
237 offset
= r600_texture_get_offset(rtex
, level
, zslice
, face
);
238 pipe_reference_init(&surface
->reference
, 1);
239 pipe_resource_reference(&surface
->texture
, texture
);
240 surface
->format
= texture
->format
;
241 surface
->width
= u_minify(texture
->width0
, level
);
242 surface
->height
= u_minify(texture
->height0
, level
);
243 surface
->offset
= offset
;
244 surface
->usage
= flags
;
245 surface
->zslice
= zslice
;
246 surface
->texture
= texture
;
247 surface
->face
= face
;
248 surface
->level
= level
;
252 static void r600_tex_surface_destroy(struct pipe_surface
*surface
)
254 pipe_resource_reference(&surface
->texture
, NULL
);
259 struct pipe_resource
*r600_texture_from_handle(struct pipe_screen
*screen
,
260 const struct pipe_resource
*templ
,
261 struct winsys_handle
*whandle
)
263 struct radeon
*rw
= (struct radeon
*)screen
->winsys
;
264 struct r600_bo
*bo
= NULL
;
266 /* Support only 2D textures without mipmaps */
267 if ((templ
->target
!= PIPE_TEXTURE_2D
&& templ
->target
!= PIPE_TEXTURE_RECT
) ||
268 templ
->depth0
!= 1 || templ
->last_level
!= 0)
271 bo
= r600_bo_handle(rw
, whandle
->handle
);
276 return (struct pipe_resource
*)r600_texture_create_object(screen
, templ
, 0,
282 static unsigned int r600_texture_is_referenced(struct pipe_context
*context
,
283 struct pipe_resource
*texture
,
284 unsigned face
, unsigned level
)
287 return PIPE_REFERENCED_FOR_READ
| PIPE_REFERENCED_FOR_WRITE
;
290 int (*r600_blit_uncompress_depth_ptr
)(struct pipe_context
*ctx
, struct r600_resource_texture
*texture
);
292 int r600_texture_depth_flush(struct pipe_context
*ctx
,
293 struct pipe_resource
*texture
)
295 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)texture
;
296 struct pipe_resource resource
;
298 if (rtex
->flushed_depth_texture
)
301 resource
.target
= PIPE_TEXTURE_2D
;
302 resource
.format
= texture
->format
;
303 resource
.width0
= texture
->width0
;
304 resource
.height0
= texture
->height0
;
306 resource
.last_level
= 0;
307 resource
.nr_samples
= 0;
308 resource
.usage
= PIPE_USAGE_DYNAMIC
;
312 resource
.bind
|= PIPE_BIND_RENDER_TARGET
;
314 rtex
->flushed_depth_texture
= (struct r600_resource_texture
*)ctx
->screen
->resource_create(ctx
->screen
, &resource
);
315 if (rtex
->flushed_depth_texture
== NULL
) {
316 R600_ERR("failed to create temporary texture to hold untiled copy\n");
321 r600_blit_uncompress_depth_ptr(ctx
, rtex
);
325 struct pipe_transfer
* r600_texture_get_transfer(struct pipe_context
*ctx
,
326 struct pipe_resource
*texture
,
327 struct pipe_subresource sr
,
329 const struct pipe_box
*box
)
331 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)texture
;
332 struct pipe_resource resource
;
333 struct r600_transfer
*trans
;
336 trans
= CALLOC_STRUCT(r600_transfer
);
339 pipe_resource_reference(&trans
->transfer
.resource
, texture
);
340 trans
->transfer
.sr
= sr
;
341 trans
->transfer
.usage
= usage
;
342 trans
->transfer
.box
= *box
;
343 trans
->transfer
.stride
= rtex
->pitch
[sr
.level
];
344 trans
->offset
= r600_texture_get_offset(rtex
, sr
.level
, box
->z
, sr
.face
);
346 r
= r600_texture_depth_flush(ctx
, texture
);
348 R600_ERR("failed to create temporary texture to hold untiled copy\n");
349 pipe_resource_reference(&trans
->transfer
.resource
, NULL
);
353 } else if (rtex
->tiled
) {
354 resource
.target
= PIPE_TEXTURE_2D
;
355 resource
.format
= texture
->format
;
356 resource
.width0
= box
->width
;
357 resource
.height0
= box
->height
;
359 resource
.last_level
= 0;
360 resource
.nr_samples
= 0;
361 resource
.usage
= PIPE_USAGE_DYNAMIC
;
364 /* For texture reading, the temporary (detiled) texture is used as
365 * a render target when blitting from a tiled texture. */
366 if (usage
& PIPE_TRANSFER_READ
) {
367 resource
.bind
|= PIPE_BIND_RENDER_TARGET
;
369 /* For texture writing, the temporary texture is used as a sampler
370 * when blitting into a tiled texture. */
371 if (usage
& PIPE_TRANSFER_WRITE
) {
372 resource
.bind
|= PIPE_BIND_SAMPLER_VIEW
;
374 /* Create the temporary texture. */
375 trans
->linear_texture
= ctx
->screen
->resource_create(ctx
->screen
, &resource
);
376 if (trans
->linear_texture
== NULL
) {
377 R600_ERR("failed to create temporary texture to hold untiled copy\n");
378 pipe_resource_reference(&trans
->transfer
.resource
, NULL
);
382 if (usage
& PIPE_TRANSFER_READ
) {
383 /* We cannot map a tiled texture directly because the data is
384 * in a different order, therefore we do detiling using a blit. */
385 r600_copy_from_tiled_texture(ctx
, trans
);
386 /* Always referenced in the blit. */
387 ctx
->flush(ctx
, 0, NULL
);
390 return &trans
->transfer
;
393 void r600_texture_transfer_destroy(struct pipe_context
*ctx
,
394 struct pipe_transfer
*transfer
)
396 struct r600_transfer
*rtransfer
= (struct r600_transfer
*)transfer
;
397 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)transfer
->resource
;
399 if (rtransfer
->linear_texture
) {
400 if (transfer
->usage
& PIPE_TRANSFER_WRITE
) {
401 r600_copy_into_tiled_texture(ctx
, rtransfer
);
403 pipe_resource_reference(&rtransfer
->linear_texture
, NULL
);
405 if (rtex
->flushed_depth_texture
) {
406 pipe_resource_reference((struct pipe_resource
**)&rtex
->flushed_depth_texture
, NULL
);
408 pipe_resource_reference(&transfer
->resource
, NULL
);
412 void* r600_texture_transfer_map(struct pipe_context
*ctx
,
413 struct pipe_transfer
* transfer
)
415 struct r600_transfer
*rtransfer
= (struct r600_transfer
*)transfer
;
417 enum pipe_format format
= transfer
->resource
->format
;
418 struct radeon
*radeon
= (struct radeon
*)ctx
->screen
->winsys
;
419 unsigned long offset
= 0;
422 if (rtransfer
->linear_texture
) {
423 bo
= ((struct r600_resource
*)rtransfer
->linear_texture
)->bo
;
425 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)transfer
->resource
;
427 if (rtex
->flushed_depth_texture
)
428 bo
= ((struct r600_resource
*)rtex
->flushed_depth_texture
)->bo
;
430 bo
= ((struct r600_resource
*)transfer
->resource
)->bo
;
432 offset
= rtransfer
->offset
+
433 transfer
->box
.y
/ util_format_get_blockheight(format
) * transfer
->stride
+
434 transfer
->box
.x
/ util_format_get_blockwidth(format
) * util_format_get_blocksize(format
);
436 map
= r600_bo_map(radeon
, bo
, 0, ctx
);
444 void r600_texture_transfer_unmap(struct pipe_context
*ctx
,
445 struct pipe_transfer
* transfer
)
447 struct r600_transfer
*rtransfer
= (struct r600_transfer
*)transfer
;
448 struct radeon
*radeon
= (struct radeon
*)ctx
->screen
->winsys
;
451 if (rtransfer
->linear_texture
) {
452 bo
= ((struct r600_resource
*)rtransfer
->linear_texture
)->bo
;
454 struct r600_resource_texture
*rtex
= (struct r600_resource_texture
*)transfer
->resource
;
456 if (rtex
->flushed_depth_texture
) {
457 bo
= ((struct r600_resource
*)rtex
->flushed_depth_texture
)->bo
;
459 bo
= ((struct r600_resource
*)transfer
->resource
)->bo
;
462 r600_bo_unmap(radeon
, bo
);
465 struct u_resource_vtbl r600_texture_vtbl
=
467 u_default_resource_get_handle
, /* get_handle */
468 r600_texture_destroy
, /* resource_destroy */
469 r600_texture_is_referenced
, /* is_resource_referenced */
470 r600_texture_get_transfer
, /* get_transfer */
471 r600_texture_transfer_destroy
, /* transfer_destroy */
472 r600_texture_transfer_map
, /* transfer_map */
473 u_default_transfer_flush_region
,/* transfer_flush_region */
474 r600_texture_transfer_unmap
, /* transfer_unmap */
475 u_default_transfer_inline_write
/* transfer_inline_write */
478 void r600_init_screen_texture_functions(struct pipe_screen
*screen
)
480 screen
->get_tex_surface
= r600_get_tex_surface
;
481 screen
->tex_surface_destroy
= r600_tex_surface_destroy
;
484 static unsigned r600_get_swizzle_combined(const unsigned char *swizzle_format
,
485 const unsigned char *swizzle_view
)
488 unsigned char swizzle
[4];
490 const uint32_t swizzle_shift
[4] = {
493 const uint32_t swizzle_bit
[4] = {
498 /* Combine two sets of swizzles. */
499 for (i
= 0; i
< 4; i
++) {
500 swizzle
[i
] = swizzle_view
[i
] <= UTIL_FORMAT_SWIZZLE_W
?
501 swizzle_format
[swizzle_view
[i
]] : swizzle_view
[i
];
504 memcpy(swizzle
, swizzle_format
, 4);
508 for (i
= 0; i
< 4; i
++) {
509 switch (swizzle
[i
]) {
510 case UTIL_FORMAT_SWIZZLE_Y
:
511 result
|= swizzle_bit
[1] << swizzle_shift
[i
];
513 case UTIL_FORMAT_SWIZZLE_Z
:
514 result
|= swizzle_bit
[2] << swizzle_shift
[i
];
516 case UTIL_FORMAT_SWIZZLE_W
:
517 result
|= swizzle_bit
[3] << swizzle_shift
[i
];
519 case UTIL_FORMAT_SWIZZLE_0
:
520 result
|= V_038010_SQ_SEL_0
<< swizzle_shift
[i
];
522 case UTIL_FORMAT_SWIZZLE_1
:
523 result
|= V_038010_SQ_SEL_1
<< swizzle_shift
[i
];
525 default: /* UTIL_FORMAT_SWIZZLE_X */
526 result
|= swizzle_bit
[0] << swizzle_shift
[i
];
532 /* texture format translate */
533 uint32_t r600_translate_texformat(enum pipe_format format
,
534 const unsigned char *swizzle_view
,
535 uint32_t *word4_p
, uint32_t *yuv_format_p
)
537 uint32_t result
= 0, word4
= 0, yuv_format
= 0;
538 const struct util_format_description
*desc
;
539 boolean uniform
= TRUE
;
541 const uint32_t sign_bit
[4] = {
542 S_038010_FORMAT_COMP_X(V_038010_SQ_FORMAT_COMP_SIGNED
),
543 S_038010_FORMAT_COMP_Y(V_038010_SQ_FORMAT_COMP_SIGNED
),
544 S_038010_FORMAT_COMP_Z(V_038010_SQ_FORMAT_COMP_SIGNED
),
545 S_038010_FORMAT_COMP_W(V_038010_SQ_FORMAT_COMP_SIGNED
)
547 desc
= util_format_description(format
);
549 word4
|= r600_get_swizzle_combined(desc
->swizzle
, swizzle_view
);
551 /* Colorspace (return non-RGB formats directly). */
552 switch (desc
->colorspace
) {
553 /* Depth stencil formats */
554 case UTIL_FORMAT_COLORSPACE_ZS
:
556 case PIPE_FORMAT_Z16_UNORM
:
557 result
= V_0280A0_COLOR_16
;
559 case PIPE_FORMAT_X24S8_USCALED
:
560 word4
|= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT
);
561 case PIPE_FORMAT_Z24X8_UNORM
:
562 case PIPE_FORMAT_Z24_UNORM_S8_USCALED
:
563 result
= V_0280A0_COLOR_8_24
;
565 case PIPE_FORMAT_S8X24_USCALED
:
566 word4
|= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT
);
567 case PIPE_FORMAT_X8Z24_UNORM
:
568 case PIPE_FORMAT_S8_USCALED_Z24_UNORM
:
569 result
= V_0280A0_COLOR_24_8
;
571 case PIPE_FORMAT_S8_USCALED
:
572 result
= V_0280A0_COLOR_8
;
573 word4
|= S_038010_NUM_FORMAT_ALL(V_038010_SQ_NUM_FORMAT_INT
);
579 case UTIL_FORMAT_COLORSPACE_YUV
:
580 yuv_format
|= (1 << 30);
582 case PIPE_FORMAT_UYVY
:
583 case PIPE_FORMAT_YUYV
:
587 goto out_unknown
; /* TODO */
589 case UTIL_FORMAT_COLORSPACE_SRGB
:
590 word4
|= S_038010_FORCE_DEGAMMA(1);
591 if (format
== PIPE_FORMAT_L8A8_SRGB
|| format
== PIPE_FORMAT_L8_SRGB
)
592 goto out_unknown
; /* fails for some reason - TODO */
599 /* S3TC formats. TODO */
600 if (desc
->layout
== UTIL_FORMAT_LAYOUT_S3TC
) {
605 for (i
= 0; i
< desc
->nr_channels
; i
++) {
606 if (desc
->channel
[i
].type
== UTIL_FORMAT_TYPE_SIGNED
) {
607 word4
|= sign_bit
[i
];
611 /* R8G8Bx_SNORM - TODO CxV8U8 */
615 /* See whether the components are of the same size. */
616 for (i
= 1; i
< desc
->nr_channels
; i
++) {
617 uniform
= uniform
&& desc
->channel
[0].size
== desc
->channel
[i
].size
;
620 /* Non-uniform formats. */
622 switch(desc
->nr_channels
) {
624 if (desc
->channel
[0].size
== 5 &&
625 desc
->channel
[1].size
== 6 &&
626 desc
->channel
[2].size
== 5) {
627 result
= V_0280A0_COLOR_5_6_5
;
632 if (desc
->channel
[0].size
== 5 &&
633 desc
->channel
[1].size
== 5 &&
634 desc
->channel
[2].size
== 5 &&
635 desc
->channel
[3].size
== 1) {
636 result
= V_0280A0_COLOR_1_5_5_5
;
639 if (desc
->channel
[0].size
== 10 &&
640 desc
->channel
[1].size
== 10 &&
641 desc
->channel
[2].size
== 10 &&
642 desc
->channel
[3].size
== 2) {
643 result
= V_0280A0_COLOR_10_10_10_2
;
651 /* Find the first non-VOID channel. */
652 for (i
= 0; i
< 4; i
++) {
653 if (desc
->channel
[i
].type
!= UTIL_FORMAT_TYPE_VOID
) {
661 /* uniform formats */
662 switch (desc
->channel
[i
].type
) {
663 case UTIL_FORMAT_TYPE_UNSIGNED
:
664 case UTIL_FORMAT_TYPE_SIGNED
:
665 if (!desc
->channel
[i
].normalized
&&
666 desc
->colorspace
!= UTIL_FORMAT_COLORSPACE_SRGB
) {
670 switch (desc
->channel
[i
].size
) {
672 switch (desc
->nr_channels
) {
674 result
= V_0280A0_COLOR_4_4
;
677 result
= V_0280A0_COLOR_4_4_4_4
;
682 switch (desc
->nr_channels
) {
684 result
= V_0280A0_COLOR_8
;
687 result
= V_0280A0_COLOR_8_8
;
690 result
= V_0280A0_COLOR_8_8_8_8
;
695 switch (desc
->nr_channels
) {
697 result
= V_0280A0_COLOR_16
;
700 result
= V_0280A0_COLOR_16_16
;
703 result
= V_0280A0_COLOR_16_16_16_16
;
709 case UTIL_FORMAT_TYPE_FLOAT
:
710 switch (desc
->channel
[i
].size
) {
712 switch (desc
->nr_channels
) {
714 result
= V_0280A0_COLOR_16_FLOAT
;
717 result
= V_0280A0_COLOR_16_16_FLOAT
;
720 result
= V_0280A0_COLOR_16_16_16_16_FLOAT
;
725 switch (desc
->nr_channels
) {
727 result
= V_0280A0_COLOR_32_FLOAT
;
730 result
= V_0280A0_COLOR_32_32_FLOAT
;
733 result
= V_0280A0_COLOR_32_32_32_32_FLOAT
;
743 *yuv_format_p
= yuv_format
;
746 // R600_ERR("Unable to handle texformat %d %s\n", format, util_format_name(format));