#include "asahi/lib/agx_formats.h"
#include "asahi/lib/decode.h"
#include "drm-uapi/drm_fourcc.h"
-#include "frontend/sw_winsys.h"
#include "frontend/winsys_handle.h"
#include "gallium/auxiliary/renderonly/renderonly.h"
#include "gallium/auxiliary/util/u_debug_cb.h"
pipe_reference_init(&nresource->base.reference, 1);
- struct sw_winsys *winsys = ((struct agx_screen *)screen)->winsys;
-
ail_make_miptree(&nresource->layout);
if (templ->target == PIPE_BUFFER) {
util_range_init(&nresource->valid_buffer_range);
}
- if (winsys && templ->bind & PIPE_BIND_DISPLAY_TARGET) {
- unsigned width = templ->width0;
- unsigned height = templ->height0;
-
- if (nresource->layout.tiling == AIL_TILING_TWIDDLED) {
- width = ALIGN_POT(width, 64);
- height = ALIGN_POT(height, 64);
- }
-
- nresource->dt = winsys->displaytarget_create(
- winsys, templ->bind, templ->format, width, height, 64,
- NULL /*map_front_private*/, &nresource->dt_stride);
-
- if (nresource->layout.tiling == AIL_TILING_LINEAR)
- nresource->layout.linear_stride_B = nresource->dt_stride;
-
- if (nresource->dt == NULL) {
- FREE(nresource);
- return NULL;
- }
- }
-
/* Guess a label based on the bind */
unsigned bind = templ->bind;
if (prsrc->target == PIPE_BUFFER)
util_range_destroy(&rsrc->valid_buffer_range);
- if (rsrc->dt) {
- /* display target */
- struct sw_winsys *winsys = agx_screen->winsys;
- winsys->displaytarget_destroy(winsys, rsrc->dt);
- }
-
if (rsrc->scanout)
renderonly_scanout_destroy(rsrc->scanout, agx_screen->dev.ro);
return pctx;
}
-static void
-agx_flush_frontbuffer(struct pipe_screen *_screen, struct pipe_context *pctx,
- struct pipe_resource *prsrc, unsigned level,
- unsigned layer, void *context_private,
- struct pipe_box *box)
-{
- struct agx_resource *rsrc = (struct agx_resource *)prsrc;
- struct agx_screen *agx_screen = (struct agx_screen *)_screen;
- struct sw_winsys *winsys = agx_screen->winsys;
-
- /* Dump the framebuffer */
- assert(rsrc->dt);
- void *map = winsys->displaytarget_map(winsys, rsrc->dt, PIPE_USAGE_DEFAULT);
- assert(map != NULL);
-
- if (rsrc->modifier == DRM_FORMAT_MOD_APPLE_TWIDDLED) {
- ail_detile(rsrc->bo->ptr.cpu, map, &rsrc->layout, 0, rsrc->dt_stride, 0,
- 0, rsrc->base.width0, rsrc->base.height0);
- } else {
- assert(rsrc->modifier == DRM_FORMAT_MOD_LINEAR);
- memcpy(map, rsrc->bo->ptr.cpu, rsrc->dt_stride * rsrc->base.height0);
- }
-
- winsys->displaytarget_display(winsys, rsrc->dt, context_private, box);
-}
-
static const char *
agx_get_vendor(struct pipe_screen *pscreen)
{
}
struct pipe_screen *
-agx_screen_create(int fd, struct renderonly *ro, struct sw_winsys *winsys)
+agx_screen_create(int fd, struct renderonly *ro)
{
struct agx_screen *agx_screen;
struct pipe_screen *screen;
return NULL;
screen = &agx_screen->pscreen;
- agx_screen->winsys = winsys;
/* Set debug before opening */
agx_screen->dev.debug =
screen->resource_get_handle = agx_resource_get_handle;
screen->resource_get_param = agx_resource_get_param;
screen->resource_create_with_modifiers = agx_resource_create_with_modifiers;
- screen->flush_frontbuffer = agx_flush_frontbuffer;
screen->get_timestamp = u_default_get_timestamp;
screen->fence_reference = agx_fence_reference;
screen->fence_finish = agx_fence_finish;