* Authors:
* Jérôme Glisse <jglisse@redhat.com>
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdbool.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/mman.h>
#include <sys/ioctl.h>
#include "drm.h"
+#include "libdrm.h"
#include "xf86drm.h"
#include "radeon_drm.h"
#include "radeon_surface.h"
CHIP_KAVERI,
CHIP_KABINI,
CHIP_HAWAII,
+ CHIP_MULLINS,
CHIP_LAST,
};
surf_minify(surf, surf->level+i, surf->bpe, i, xalign, yalign, zalign, offset);
/* level0 and first mipmap need to have alignment */
offset = surf->bo_size;
- if ((i == 0)) {
+ if (i == 0) {
offset = ALIGN(offset, surf->bo_alignment);
}
}
surf_minify(surf, surf->level+i, surf->bpe, i, xalign, yalign, zalign, offset);
/* level0 and first mipmap need to have alignment */
offset = surf->bo_size;
- if ((i == 0)) {
+ if (i == 0) {
offset = ALIGN(offset, surf->bo_alignment);
}
}
surf_minify(surf, surf->level+i, surf->bpe, i, xalign, yalign, zalign, offset);
/* level0 and first mipmap need to have alignment */
offset = surf->bo_size;
- if ((i == 0)) {
+ if (i == 0) {
offset = ALIGN(offset, surf->bo_alignment);
}
}
}
/* level0 and first mipmap need to have alignment */
offset = surf->bo_size;
- if ((i == 0)) {
+ if (i == 0) {
offset = ALIGN(offset, surf->bo_alignment);
}
}
surf_minify(surf, level+i, bpe, i, xalign, yalign, zalign, offset);
/* level0 and first mipmap need to have alignment */
offset = surf->bo_size;
- if ((i == 0)) {
+ if (i == 0) {
offset = ALIGN(offset, surf->bo_alignment);
}
}
tileb = tilew * tileh * bpe * surf->nsamples;
/* slices per tile */
slice_pt = 1;
- if (tileb > tile_split) {
+ if (tileb > tile_split && tile_split) {
slice_pt = tileb / tile_split;
}
tileb = tileb / slice_pt;
}
/* level0 and first mipmap need to have alignment */
offset = surf->bo_size;
- if ((i == 0)) {
+ if (i == 0) {
offset = ALIGN(offset, surf->bo_alignment);
}
}
/* default value */
surf->mtilea = 1;
surf->bankw = 1;
- surf->bankw = 1;
+ surf->bankh = 1;
surf->tile_split = 64;
surf->stencil_tile_split = 64;
}
si_surf_minify(surf, surf->level+i, surf->bpe, i, xalign, yalign, zalign, slice_align, offset);
/* level0 and first mipmap need to have alignment */
offset = surf->bo_size;
- if ((i == 0)) {
+ if (i == 0) {
offset = ALIGN(offset, surf->bo_alignment);
}
if (surf->flags & RADEON_SURF_HAS_TILE_MODE_INDEX) {
si_surf_minify(surf, level+i, bpe, i, xalign, yalign, zalign, slice_align, offset);
/* level0 and first mipmap need to have alignment */
offset = surf->bo_size;
- if ((i == 0)) {
+ if (i == 0) {
offset = ALIGN(offset, alignment);
}
if (surf->flags & RADEON_SURF_HAS_TILE_MODE_INDEX) {
tileb = tilew * tileh * bpe * surf->nsamples;
/* slices per tile */
slice_pt = 1;
- if (tileb > tile_split) {
+ if (tileb > tile_split && tile_split) {
slice_pt = tileb / tile_split;
}
tileb = tileb / slice_pt;
}
/* level0 and first mipmap need to have alignment */
aligned_offset = offset = surf->bo_size;
- if ((i == 0)) {
+ if (i == 0) {
aligned_offset = ALIGN(aligned_offset, surf->bo_alignment);
}
if (surf->flags & RADEON_SURF_HAS_TILE_MODE_INDEX) {
sample_split = 1;
break;
case CIK__SAMPLE_SPLIT__2:
- sample_split = 1;
+ sample_split = 2;
break;
case CIK__SAMPLE_SPLIT__4:
sample_split = 4;
/* default value */
surf->mtilea = 1;
surf->bankw = 1;
- surf->bankw = 1;
+ surf->bankh = 1;
surf->tile_split = 64;
surf->stencil_tile_split = 64;
}
/* slices per tile */
slice_pt = 1;
- if (tileb > tile_split) {
+ if (tileb > tile_split && tile_split) {
slice_pt = tileb / tile_split;
tileb = tileb / slice_pt;
}
/* ===========================================================================
* public API
*/
-struct radeon_surface_manager *radeon_surface_manager_new(int fd)
+drm_public struct radeon_surface_manager *
+radeon_surface_manager_new(int fd)
{
struct radeon_surface_manager *surf_man;
return NULL;
}
-void radeon_surface_manager_free(struct radeon_surface_manager *surf_man)
+drm_public void
+radeon_surface_manager_free(struct radeon_surface_manager *surf_man)
{
free(surf_man);
}
return 0;
}
-int radeon_surface_init(struct radeon_surface_manager *surf_man,
- struct radeon_surface *surf)
+drm_public int
+radeon_surface_init(struct radeon_surface_manager *surf_man,
+ struct radeon_surface *surf)
{
unsigned mode, type;
int r;
return surf_man->surface_init(surf_man, surf);
}
-int radeon_surface_best(struct radeon_surface_manager *surf_man,
- struct radeon_surface *surf)
+drm_public int
+radeon_surface_best(struct radeon_surface_manager *surf_man,
+ struct radeon_surface *surf)
{
unsigned mode, type;
int r;