<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-11-27 14:43 GMT+01:00 Marek Olšák <span dir="ltr"><<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On Mon, Nov 27, 2017 at 12:54 PM, Nicolai Hähnle <<a href="mailto:nhaehnle@gmail.com">nhaehnle@gmail.com</a>> wrote:<br>
> On 23.11.2017 20:35, Marek Olšák wrote:<br>
>><br>
>> From: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br>
>><br>
>> The next commit will reduce the size even more.<br>
>><br>
>> v2: typecast to uint64_t manually<br>
>> ---<br>
>>   src/amd/common/ac_surface.c                        |  2 +-<br>
>>   src/amd/common/ac_surface.h                        |  3 ++-<br>
>>   src/amd/vulkan/radv_image.c                        |  8 ++++----<br>
>>   src/gallium/drivers/r600/<wbr>evergreen_state.c         |  8 ++++----<br>
>>   src/gallium/drivers/r600/r600_<wbr>state.c              |  8 ++++----<br>
>>   src/gallium/drivers/r600/r600_<wbr>texture.c            | 14 +++++++-------<br>
>>   src/gallium/drivers/r600/<wbr>radeon_uvd.c              |  2 +-<br>
>>   src/gallium/drivers/radeon/<wbr>r600_texture.c          | 10 +++++-----<br>
>>   src/gallium/drivers/radeon/<wbr>radeon_uvd.c            |  2 +-<br>
>>   src/gallium/drivers/radeonsi/<wbr>cik_sdma.c            |  4 ++--<br>
>>   src/gallium/drivers/radeonsi/<wbr>si_dma.c              |  8 ++++----<br>
>>   src/gallium/winsys/radeon/drm/<wbr>radeon_drm_surface.c |  4 ++--<br>
>>   12 files changed, 37 insertions(+), 36 deletions(-)<br>
>><br>
>> diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c<br>
>> index f7600a3..2b6c3fb 100644<br>
>> --- a/src/amd/common/ac_surface.c<br>
>> +++ b/src/amd/common/ac_surface.c<br>
>> @@ -297,21 +297,21 @@ static int gfx6_compute_level(ADDR_HANDLE addrlib,<br>
>>         ret = AddrComputeSurfaceInfo(<wbr>addrlib,<br>
>>                                      AddrSurfInfoIn,<br>
>>                                      AddrSurfInfoOut);<br>
>>         if (ret != ADDR_OK) {<br>
>>                 return ret;<br>
>>         }<br>
>>         surf_level = is_stencil ? &surf->u.legacy.stencil_level[<wbr>level] :<br>
>> &surf->u.legacy.level[level];<br>
>>         surf_level->offset = align64(surf->surf_size,<br>
>> AddrSurfInfoOut->baseAlign);<br>
>> -       surf_level->slice_size = AddrSurfInfoOut->sliceSize;<br>
>> +       surf_level->slice_size_dw = AddrSurfInfoOut->sliceSize / 4;<br>
>>         surf_level->nblk_x = AddrSurfInfoOut->pitch;<br>
>>         surf_level->nblk_y = AddrSurfInfoOut->height;<br>
>>         switch (AddrSurfInfoOut->tileMode) {<br>
>>         case ADDR_TM_LINEAR_ALIGNED:<br>
>>                 surf_level->mode = RADEON_SURF_MODE_LINEAR_<wbr>ALIGNED;<br>
>>                 break;<br>
>>         case ADDR_TM_1D_TILED_THIN1:<br>
>>                 surf_level->mode = RADEON_SURF_MODE_1D;<br>
>>                 break;<br>
>> diff --git a/src/amd/common/ac_surface.h b/src/amd/common/ac_surface.h<br>
>> index 1dc95cd..a50aec2 100644<br>
>> --- a/src/amd/common/ac_surface.h<br>
>> +++ b/src/amd/common/ac_surface.h<br>
>> @@ -64,21 +64,22 @@ enum radeon_micro_mode {<br>
>>   /* bits 19 and 20 are reserved for libdrm_radeon, don't use them */<br>
>>   #define RADEON_SURF_FMASK                       (1 << 21)<br>
>>   #define RADEON_SURF_DISABLE_DCC                 (1 << 22)<br>
>>   #define RADEON_SURF_TC_COMPATIBLE_<wbr>HTILE         (1 << 23)<br>
>>   #define RADEON_SURF_IMPORTED                    (1 << 24)<br>
>>   #define RADEON_SURF_OPTIMIZE_FOR_SPACE          (1 << 25)<br>
>>   #define RADEON_SURF_SHAREABLE                   (1 << 26)<br>
>>     struct legacy_surf_level {<br>
>>       uint64_t                    offset;<br>
>> -    uint64_t                    slice_size;<br>
>> +    /* Declare 32 bits of uint64_t, so that multiplication results in 64<br>
>> bits. */<br>
>> +    uint32_t                    slice_size_dw; /* in dwords; max = 4GB /<br>
>> 4. */<br>
><br>
><br>
> The comment is outdated now.<br>
><br>
><br>
>>       uint32_t                    dcc_offset; /* relative offset within<br>
>> DCC mip tree */<br>
>>       uint32_t                    dcc_fast_clear_size;<br>
>>       uint16_t                    nblk_x;<br>
>>       uint16_t                    nblk_y;<br>
>>       enum radeon_surf_mode       mode;<br>
>>   };<br>
>>     struct legacy_surf_layout {<br>
>>       unsigned                    bankw:4;  /* max 8 */<br>
>>       unsigned                    bankh:4;  /* max 8 */<br>
><br>
> [snip]<br>
>><br>
>> diff --git a/src/gallium/drivers/r600/<wbr>r600_texture.c<br>
>> b/src/gallium/drivers/r600/<wbr>r600_texture.c<br>
>> index f7c9b63..cc15e53 100644<br>
>> --- a/src/gallium/drivers/r600/<wbr>r600_texture.c<br>
>> +++ b/src/gallium/drivers/r600/<wbr>r600_texture.c<br>
>> @@ -171,29 +171,29 @@ static void r600_copy_from_staging_<wbr>texture(struct<br>
>> pipe_context *ctx, struct r600<br>
>>   }<br>
>>     static unsigned r600_texture_get_offset(struct r600_common_screen<br>
>> *rscreen,<br>
>>                                         struct r600_texture *rtex,<br>
>> unsigned level,<br>
>>                                         const struct pipe_box *box,<br>
>>                                         unsigned *stride,<br>
>>                                         unsigned *layer_stride)<br>
>>   {<br>
>>         *stride = rtex->surface.u.legacy.level[<wbr>level].nblk_x *<br>
>>                 rtex->surface.bpe;<br>
>> -       *layer_stride = rtex->surface.u.legacy.level[<wbr>level].slice_size;<br>
>> +       *layer_stride = rtex->surface.u.legacy.level[<wbr>level].slice_size_dw<br>
>> * 4;<br>
><br>
><br>
> Missing cast, and this was potentially broken anyway... an assert would be<br>
> nice (same for radeonsi).<br>
><br>
> In general, the casts are systematically missing in r600. Even if there's<br>
> some reason why r600 can never reach 4GB (though I don't see why right now),<br>
> it'd be nice to do the cast for consistency, if code is every moved across<br>
> drivers.<br>
<br>
</div></div>r600 can have at most 2GB of VRAM (Cayman). Let's say it also has 4GB<br>
of GTT. You can't really allocate 4GB of GTT, because there is not<br>
enough contiguous space (or free space even).<br></blockquote><div><br></div><div>What about workstation GPUs [1]? According to the wikipedia article, some had at least 4GB of VRAM (FirePro 3D V9800 and FireStream 9370).</div><div><br></div><div>[1] <a href="https://en.wikipedia.org/wiki/List_of_AMD_graphics_processing_units#Workstation_GPUs">https://en.wikipedia.org/wiki/List_of_AMD_graphics_processing_units#Workstation_GPUs</a></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Since this is surface.u.legacy (GFX 6-8), radeonsi using this code can<br>
have at most 8GB of VRAM (Hawaii and Polaris10). No other GFX 6-8 chip<br>
has or will have so much memory.<br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
Marek</font></span> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-HOEnZb"><font color="#888888">
</font></span><div class="gmail-HOEnZb"><div class="gmail-h5">______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div></div>