Commit 4edff6c9 authored by Daniel Vetter's avatar Daniel Vetter

libXvMC: move drm_intel_bo to common intel_xvmc_surface

i965 lost the last field in it's private surface struct. Kill it
and any associated headers.
Signed-off-by: Daniel Vetter's avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 9eeabf87
......@@ -406,10 +406,10 @@ static void i915_mc_static_indirect_state_set(XvMCContext * context,
buffer_info->dest_y.dw1.tiled_surface = 0; /* linear */
buffer_info->dest_y.dw1.walk = TILEWALK_XMAJOR;
buffer_info->dest_y.dw1.pitch = (pI915Surface->yStride >> 2); /* in DWords */
buffer_info->dest_y.dw2.base_address = pI915Surface->bo->offset >> 2; /* starting DWORD address */
buffer_info->dest_y.dw2.base_address = pI915Surface->comm.bo->offset >> 2; /* starting DWORD address */
drm_intel_bo_emit_reloc(pI915XvMC->sis_bo,
offsetof(typeof(*buffer_info),dest_y.dw2),
pI915Surface->bo, 0,
pI915Surface->comm.bo, 0,
I915_GEM_DOMAIN_RENDER,
I915_GEM_DOMAIN_RENDER);
......@@ -424,10 +424,10 @@ static void i915_mc_static_indirect_state_set(XvMCContext * context,
buffer_info->dest_u.dw1.walk = TILEWALK_XMAJOR;
buffer_info->dest_u.dw1.pitch = (pI915Surface->uvStride >> 2); /* in DWords */
buffer_info->dest_u.dw2.base_address =
(pI915Surface->bo->offset + UOFFSET(pI915Surface)) >> 2;
(pI915Surface->comm.bo->offset + UOFFSET(pI915Surface)) >> 2;
drm_intel_bo_emit_reloc(pI915XvMC->sis_bo,
offsetof(typeof(*buffer_info),dest_u.dw2),
pI915Surface->bo, UOFFSET(pI915Surface),
pI915Surface->comm.bo, UOFFSET(pI915Surface),
I915_GEM_DOMAIN_RENDER,
I915_GEM_DOMAIN_RENDER);
......@@ -442,10 +442,10 @@ static void i915_mc_static_indirect_state_set(XvMCContext * context,
buffer_info->dest_v.dw1.walk = TILEWALK_XMAJOR;
buffer_info->dest_v.dw1.pitch = (pI915Surface->uvStride >> 2); /* in Dwords */
buffer_info->dest_v.dw2.base_address =
(pI915Surface->bo->offset + VOFFSET(pI915Surface)) >> 2;
(pI915Surface->comm.bo->offset + VOFFSET(pI915Surface)) >> 2;
drm_intel_bo_emit_reloc(pI915XvMC->sis_bo,
offsetof(typeof(*buffer_info),dest_v.dw2),
pI915Surface->bo, VOFFSET(pI915Surface),
pI915Surface->comm.bo, VOFFSET(pI915Surface),
I915_GEM_DOMAIN_RENDER,
I915_GEM_DOMAIN_RENDER);
......@@ -554,10 +554,10 @@ static void i915_mc_map_state_set(XvMCContext * context,
map_state->y_forward.tm2.depth = 0;
map_state->y_forward.tm2.max_lod = 0;
map_state->y_forward.tm2.cube_face = 0;
map_state->y_forward.tm0.base_address = privPast->bo->offset >> 2;
map_state->y_forward.tm0.base_address = privPast->comm.bo->offset >> 2;
drm_intel_bo_emit_reloc(pI915XvMC->msb_bo,
offsetof(typeof(*map_state),y_forward.tm0),
privPast->bo, 0,
privPast->comm.bo, 0,
I915_GEM_DOMAIN_SAMPLER, 0);
map_state->y_forward.tm2.pitch = (privPast->yStride >> 2) - 1; /* in DWords - 1 */
......@@ -574,10 +574,10 @@ static void i915_mc_map_state_set(XvMCContext * context,
map_state->y_backward.tm2.depth = 0;
map_state->y_backward.tm2.max_lod = 0;
map_state->y_backward.tm2.cube_face = 0;
map_state->y_backward.tm0.base_address = privFuture->bo->offset >> 2;
map_state->y_backward.tm0.base_address = privFuture->comm.bo->offset >> 2;
drm_intel_bo_emit_reloc(pI915XvMC->msb_bo,
offsetof(typeof(*map_state),y_backward.tm0),
privFuture->bo, 0,
privFuture->comm.bo, 0,
I915_GEM_DOMAIN_SAMPLER, 0);
map_state->y_backward.tm2.pitch = (privFuture->yStride >> 2) - 1;
......@@ -602,10 +602,10 @@ static void i915_mc_map_state_set(XvMCContext * context,
map_state->u_forward.tm2.max_lod = 0;
map_state->u_forward.tm2.cube_face = 0;
map_state->u_forward.tm0.base_address =
(privPast->bo->offset + UOFFSET(privPast)) >> 2;
(privPast->comm.bo->offset + UOFFSET(privPast)) >> 2;
drm_intel_bo_emit_reloc(pI915XvMC->msb_bo,
offsetof(typeof(*map_state),u_forward.tm0),
privPast->bo, UOFFSET(privPast),
privPast->comm.bo, UOFFSET(privPast),
I915_GEM_DOMAIN_SAMPLER, 0);
map_state->u_forward.tm2.pitch = (privPast->uvStride >> 2) - 1; /* in DWords - 1 */
......@@ -623,10 +623,10 @@ static void i915_mc_map_state_set(XvMCContext * context,
map_state->u_backward.tm2.max_lod = 0;
map_state->u_backward.tm2.cube_face = 0;
map_state->u_backward.tm0.base_address =
(privFuture->bo->offset + UOFFSET(privFuture)) >> 2;
(privFuture->comm.bo->offset + UOFFSET(privFuture)) >> 2;
drm_intel_bo_emit_reloc(pI915XvMC->msb_bo,
offsetof(typeof(*map_state),u_backward.tm0),
privFuture->bo, UOFFSET(privFuture),
privFuture->comm.bo, UOFFSET(privFuture),
I915_GEM_DOMAIN_SAMPLER, 0);
map_state->u_backward.tm2.pitch = (privFuture->uvStride >> 2) - 1;
......@@ -651,10 +651,10 @@ static void i915_mc_map_state_set(XvMCContext * context,
map_state->v_forward.tm2.max_lod = 0;
map_state->v_forward.tm2.cube_face = 0;
map_state->v_forward.tm0.base_address =
(privPast->bo->offset + VOFFSET(privPast)) >> 2;
(privPast->comm.bo->offset + VOFFSET(privPast)) >> 2;
drm_intel_bo_emit_reloc(pI915XvMC->msb_bo,
offsetof(typeof(*map_state),v_forward.tm0),
privPast->bo, VOFFSET(privPast),
privPast->comm.bo, VOFFSET(privPast),
I915_GEM_DOMAIN_SAMPLER, 0);
map_state->v_forward.tm2.pitch = (privPast->uvStride >> 2) - 1; /* in DWords - 1 */
......@@ -672,10 +672,10 @@ static void i915_mc_map_state_set(XvMCContext * context,
map_state->v_backward.tm2.max_lod = 0;
map_state->v_backward.tm2.cube_face = 0;
map_state->v_backward.tm0.base_address =
(privFuture->bo->offset + VOFFSET(privFuture)) >> 2;
(privFuture->comm.bo->offset + VOFFSET(privFuture)) >> 2;
drm_intel_bo_emit_reloc(pI915XvMC->msb_bo,
offsetof(typeof(*map_state),v_backward.tm0),
privFuture->bo, VOFFSET(privFuture),
privFuture->comm.bo, VOFFSET(privFuture),
I915_GEM_DOMAIN_SAMPLER, 0);
map_state->v_backward.tm2.pitch = (privFuture->uvStride >> 2) - 1;
......@@ -999,16 +999,16 @@ static Status i915_xvmc_mc_create_surface(Display * display,
pI915Surface->privContext = pI915XvMC;
pI915Surface->privSubPic = NULL;
pI915Surface->bo = drm_intel_bo_alloc(xvmc_driver->bufmgr,
pI915Surface->comm.bo = drm_intel_bo_alloc(xvmc_driver->bufmgr,
"surface",
SIZE_YUV420(context->width,
context->height),
GTT_PAGE_SIZE);
/* X may still use this buffer when XVMC is already done with it. */
drm_intel_bo_disable_reuse(pI915Surface->bo);
drm_intel_bo_disable_reuse(pI915Surface->comm.bo);
if (!pI915Surface->bo) {
if (!pI915Surface->comm.bo) {
PPTHREAD_MUTEX_UNLOCK();
free(pI915Surface);
return BadAlloc;
......@@ -1036,7 +1036,7 @@ static int i915_xvmc_mc_destroy_surface(Display * display,
if (!(pI915XvMC = pI915Surface->privContext))
return XvMCBadSurface;
drm_intel_bo_unreference(pI915Surface->bo);
drm_intel_bo_unreference(pI915Surface->comm.bo);
free(pI915Surface);
surface->privData = NULL;
......@@ -1316,7 +1316,7 @@ static int i915_xvmc_mc_put_surface(Display * display, XvMCSurface * surface,
PPTHREAD_MUTEX_LOCK();
drm_intel_bo_flink(pI915Surface->bo, gem_handle);
drm_intel_bo_flink(pI915Surface->comm.bo, gem_handle);
PPTHREAD_MUTEX_UNLOCK();
......
......@@ -103,7 +103,6 @@ typedef struct _i915XvMCSurface {
unsigned int uvStride;
unsigned int width; /* Dimensions */
unsigned int height;
drm_intel_bo *bo;
i915XvMCContext *privContext;
i915XvMCSubpicture *privSubPic; /* Subpicture to be blended when
* displaying. NULL if none. */
......
......@@ -24,7 +24,7 @@
* Zou Nan hai <nanhai.zou@intel.com>
*
*/
#include "i965_xvmc.h"
#include "intel_xvmc.h"
#include "i810_reg.h"
#include "brw_defines.h"
#include "brw_structs.h"
......@@ -256,7 +256,7 @@ static Status create_surface(Display * display,
XvMCContext * context, XvMCSurface * surface,
int priv_count, CARD32 * priv_data)
{
struct i965_xvmc_surface *priv_surface = malloc(sizeof(struct i965_xvmc_surface));
struct intel_xvmc_surface *priv_surface = malloc(sizeof(struct intel_xvmc_surface));
if (!priv_surface)
return BadAlloc;
......@@ -273,7 +273,7 @@ static Status create_surface(Display * display,
static Status destroy_surface(Display * display, XvMCSurface * surface)
{
struct i965_xvmc_surface *priv_surface = surface->privData;
struct intel_xvmc_surface *priv_surface = surface->privData;
XSync(display, False);
drm_intel_bo_unreference(priv_surface->bo);
free(priv_surface);
......@@ -722,11 +722,11 @@ static Status render_surface(Display * display,
int i, j;
struct i965_xvmc_context *i965_ctx;
XvMCMacroBlock *mb;
struct i965_xvmc_surface *priv_target_surface =
struct intel_xvmc_surface *priv_target_surface =
target_surface->privData;
struct i965_xvmc_surface *priv_past_surface =
struct intel_xvmc_surface *priv_past_surface =
past_surface ? past_surface->privData : 0;
struct i965_xvmc_surface *priv_future_surface =
struct intel_xvmc_surface *priv_future_surface =
future_surface ? future_surface->privData : 0;
unsigned short *block_ptr;
intel_ctx = intel_xvmc_find_context(context->context_id);
......@@ -884,7 +884,7 @@ static Status put_surface(Display * display, XvMCSurface * surface,
unsigned short destw, unsigned short desth,
int flags, uint32_t *gem_handle)
{
struct i965_xvmc_surface *private_surface = surface->privData;
struct intel_xvmc_surface *private_surface = surface->privData;
drm_intel_bo_flink(private_surface->bo, gem_handle);
......
#include "intel_xvmc.h"
#define I965_MAX_SURFACES 12
struct i965_xvmc_surface {
struct intel_xvmc_surface comm;
dri_bo *bo;
};
......@@ -113,6 +113,7 @@ struct intel_xvmc_surface {
GC gc;
Bool gc_init;
Drawable last_draw;
drm_intel_bo *bo;
uint32_t gem_handle;
};
typedef struct intel_xvmc_surface *intel_xvmc_surface_ptr;
......
......@@ -23,7 +23,7 @@
* Author:
* Zou Nan hai <nanhai.zou@intel.com>
*/
#include "xvmc_vld.h"
#include "intel_xvmc.h"
#include "i830_hwmc.h"
#include "i810_reg.h"
#include "brw_defines.h"
......@@ -325,9 +325,10 @@ struct surface_state_obj {
dri_bo *bo;
};
#define MAX_SURFACES 12
struct binding_table_obj {
dri_bo *bo;
struct surface_state_obj surface_states[I965_MAX_SURFACES];
struct surface_state_obj surface_states[MAX_SURFACES];
};
struct slice_data_obj {
......@@ -364,7 +365,7 @@ static int free_object(struct media_state *s)
for (i = 0; i < MEDIA_KERNEL_NUM; i++)
FREE_ONE_BO(s->vfe_state.interface.kernels[i].bo);
FREE_ONE_BO(s->binding_table.bo);
for (i = 0; i < I965_MAX_SURFACES; i++)
for (i = 0; i < MAX_SURFACES; i++)
FREE_ONE_BO(s->binding_table.surface_states[i].bo);
FREE_ONE_BO(s->slice_data.bo);
FREE_ONE_BO(s->mb_data.bo);
......@@ -376,7 +377,7 @@ static int alloc_object(struct media_state *s)
{
int i;
for (i = 0; i < I965_MAX_SURFACES; i++) {
for (i = 0; i < MAX_SURFACES; i++) {
s->binding_table.surface_states[i].bo =
drm_intel_bo_alloc(xvmc_driver->bufmgr, "surface_state",
sizeof(struct brw_surface_state),
......@@ -461,7 +462,7 @@ static Status interface_descriptor()
desc->desc1.const_urb_entry_read_offset = 0;
desc->desc1.const_urb_entry_read_len = 30;
desc->desc3.binding_table_entry_count = I965_MAX_SURFACES - 1;
desc->desc3.binding_table_entry_count = MAX_SURFACES - 1;
desc->desc3.binding_table_pointer =
media_state.binding_table.bo->offset >> 5;
......@@ -528,18 +529,18 @@ out:
static Status binding_tables()
{
unsigned int table[I965_MAX_SURFACES];
unsigned int table[MAX_SURFACES];
int i;
if (media_state.binding_table.bo)
drm_intel_bo_unreference(media_state.binding_table.bo);
media_state.binding_table.bo =
drm_intel_bo_alloc(xvmc_driver->bufmgr, "binding_table",
I965_MAX_SURFACES * 4, 0x1000);
MAX_SURFACES * 4, 0x1000);
if (!media_state.binding_table.bo)
return BadAlloc;
for (i = 0; i < I965_MAX_SURFACES; i++) {
for (i = 0; i < MAX_SURFACES; i++) {
table[i] =
media_state.binding_table.surface_states[i].bo->offset;
drm_intel_bo_emit_reloc(media_state.binding_table.bo,
......@@ -620,7 +621,7 @@ static Status create_surface(Display * display,
XvMCContext * context, XvMCSurface * surface,
int priv_count, CARD32 * priv_data)
{
struct i965_xvmc_surface *priv_surface = malloc(sizeof(struct i965_xvmc_surface));
struct intel_xvmc_surface *priv_surface = malloc(sizeof(struct intel_xvmc_surface));
if (!priv_surface)
return BadAlloc;
......@@ -637,7 +638,7 @@ static Status create_surface(Display * display,
static Status destroy_surface(Display * display, XvMCSurface * surface)
{
struct i965_xvmc_surface *priv_surface = surface->privData;
struct intel_xvmc_surface *priv_surface = surface->privData;
XSync(display, False);
drm_intel_bo_unreference(priv_surface->bo);
free(priv_surface);
......@@ -754,9 +755,9 @@ static Status setup_media_surface(int index, dri_bo * bo,
return Success;
}
static Status setup_surface(struct i965_xvmc_surface *target,
struct i965_xvmc_surface *past,
struct i965_xvmc_surface *future, int w, int h)
static Status setup_surface(struct intel_xvmc_surface *target,
struct intel_xvmc_surface *past,
struct intel_xvmc_surface *future, int w, int h)
{
Status ret;
ret = setup_media_surface(0, target->bo, 0, w, h, TRUE);
......@@ -810,7 +811,7 @@ static Status begin_surface(Display * display, XvMCContext * context,
const XvMCMpegControl * control)
{
struct i965_xvmc_contex *i965_ctx;
struct i965_xvmc_surface *priv_target, *priv_past, *priv_future;
struct intel_xvmc_surface *priv_target, *priv_past, *priv_future;
intel_xvmc_context_ptr intel_ctx;
Status ret;
......@@ -1052,7 +1053,7 @@ static Status put_surface(Display * display, XvMCSurface * surface,
unsigned short destw, unsigned short desth,
int flags, uint32_t *gem_handle)
{
struct i965_xvmc_surface *private_surface = surface->privData;
struct intel_xvmc_surface *private_surface = surface->privData;
drm_intel_bo_flink(private_surface->bo, gem_handle);
return Success;
......@@ -1070,7 +1071,7 @@ static Status render_surface(Display * display,
XvMCMacroBlockArray * macroblock_array,
XvMCBlockArray * blocks)
{
struct i965_xvmc_surface *priv_target, *priv_past, *priv_future;
struct intel_xvmc_surface *priv_target, *priv_past, *priv_future;
intel_xvmc_context_ptr intel_ctx;
XvMCMacroBlock *mb;
Status ret;
......
#include "i965_xvmc.h"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment